Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5d0af01
Add FastCSV dependency to pom.xml for CSV processing
rolnico Oct 9, 2025
28d9bd4
Refactor PSSE model to replace Univocity with FastCSV for CSV processing
rolnico Oct 20, 2025
de89791
Fix CaseIdentificationData parsing for legacy text where titles are o…
rolnico Oct 20, 2025
5c2ebda
Refactor PSSE model to replace NamedCsvRecord with CsvRecord and adju…
rolnico Oct 21, 2025
080ef45
Refactor PSSE Transformer model to introduce dedicated classes for tr…
rolnico Oct 21, 2025
57faba0
Refactor PSSE codebase to introduce internal classes for transformers…
rolnico Oct 22, 2025
0995804
Refactor PSSE model to improve parsing utilities, enhance JSON and CS…
rolnico Oct 22, 2025
b62b2ef
Introduce delimiter and quote detection logic in `Context`, add unit …
rolnico Oct 23, 2025
75a2082
Refactor TransformerImpedances and PsseTransformer to improve parsing…
rolnico Oct 23, 2025
0a0b46c
Refactor PSSE model to enhance CSV and JSON processing, improve I/O h…
rolnico Oct 23, 2025
ba4378e
Refactor `PsseTransformer` to streamline winding-related parsing logi…
rolnico Oct 23, 2025
581e665
Refactor PSSE model to enhance impedance correction handling, improve…
rolnico Oct 23, 2025
8427d74
Refactor PSSE model to introduce internal classes for substations, im…
rolnico Oct 23, 2025
18378e0
Remove unused `CsvWriter` import and extra blank space
rolnico Oct 23, 2025
b5d6c0a
Refactor PSSE model to handle optional headers more gracefully, impro…
rolnico Oct 23, 2025
9f0ca76
Add FastCSV to PSS/E pom.xml
rolnico Nov 4, 2025
4d44cac
Fix detection of fields number
rolnico Nov 4, 2025
15ea757
fix issues
rolnico Nov 14, 2025
4c6fe6b
Fix issues
rolnico Nov 14, 2025
b743b4f
remove unused parameter
rolnico Nov 14, 2025
343fd94
fix issues
rolnico Nov 14, 2025
412dcaa
Merge branch 'main' into nro/replace_univocity-parsers_psse
rolnico Nov 19, 2025
89c530a
Merge branch 'main' into nro/replace_univocity-parsers_psse
rolnico Nov 21, 2025
660a3a3
Merge branch 'main' into nro/replace_univocity-parsers_psse
zamarrenolm Dec 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
<commonsmath3.version>3.6.1</commonsmath3.version>
<commonstext.version>1.13.1</commonstext.version>
<ejml.version>0.44.0</ejml.version>
<fastcsv.version>4.0.0</fastcsv.version>
<!-- findbugs cannot be updated until graphviz is updated/replaced since findbugs groupdId changed -->
<findbugs-annotations.version>3.0.1</findbugs-annotations.version>
<findbugs-jsr305.version>3.0.2</findbugs-jsr305.version>
Expand Down Expand Up @@ -745,6 +746,11 @@
<artifactId>commons-io</artifactId>
<version>${commonsio.version}</version>
</dependency>
<dependency>
<groupId>de.siegmar</groupId>
<artifactId>fastcsv</artifactId>
<version>${fastcsv.version}</version>
</dependency>
<dependency>
<groupId>gov.nist.math</groupId>
<artifactId>jama</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.powsybl.iidm.network.util.Networks;
import com.powsybl.psse.model.PsseException;
import com.powsybl.psse.model.pf.*;
import com.powsybl.psse.model.pf.internal.PsseSubstationSwitchingDevice;
import org.apache.commons.math3.complex.Complex;

import com.powsybl.iidm.network.util.ContainersMapping;
Expand Down Expand Up @@ -191,7 +192,7 @@ static String getVscConverterId(Network network, PsseVoltageSourceConverterDcTra
return Identifiables.getUniqueId("VscConverter-" + converter.getIbus() + "-" + psseVscDcTransmissionLine.getName(), id -> network.getVscConverterStation(id) != null);
}

static String getSwitchId(String voltageLevelId, PsseSubstation.PsseSubstationSwitchingDevice switchingDevice) {
static String getSwitchId(String voltageLevelId, PsseSubstationSwitchingDevice switchingDevice) {
return voltageLevelId + "-Sw-" + switchingDevice.getNi() + "-" + switchingDevice.getNj() + "-" + switchingDevice.getCkt();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
package com.powsybl.psse.converter;

import com.powsybl.psse.model.pf.*;
import com.powsybl.psse.model.pf.PsseSubstation.PsseSubstationNode;
import com.powsybl.psse.model.PsseVersion;
import com.powsybl.psse.model.pf.internal.PsseSubstationNode;
import org.jgrapht.Graph;
import org.jgrapht.alg.connectivity.ConnectivityInspector;
import org.jgrapht.alg.util.Pair;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.powsybl.psse.model.PsseException;
import com.powsybl.psse.model.PsseVersion;
import com.powsybl.psse.model.pf.*;
import com.powsybl.psse.model.pf.internal.TransformerImpedances;
import org.apache.commons.math3.complex.Complex;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -1163,7 +1164,7 @@ private static PsseTransformer createDefaultTransformer() {
}

private static void createDefaultTransformerImpedances(PsseTransformer psseTransformer) {
psseTransformer.setImpedances(new PsseTransformer.TransformerImpedances());
psseTransformer.setImpedances(new TransformerImpedances());
psseTransformer.setR12(0.0);
psseTransformer.setX12(0.0);
psseTransformer.setSbase12(0.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
import com.powsybl.psse.model.pf.PsseBus;
import com.powsybl.psse.model.pf.PssePowerFlowModel;
import com.powsybl.psse.model.pf.PsseSubstation;
import com.powsybl.psse.model.pf.PsseSubstation.PsseSubstationNode;
import com.powsybl.psse.model.pf.PsseSubstation.PsseSubstationSwitchingDevice;
import com.powsybl.psse.model.pf.PsseSubstation.PsseSubstationEquipmentTerminal;
import com.powsybl.psse.model.pf.internal.PsseSubstationNode;
import com.powsybl.psse.model.pf.internal.PsseSubstationSwitchingDevice;
import com.powsybl.psse.model.pf.internal.PsseSubstationEquipmentTerminal;
import com.powsybl.psse.model.pf.internal.PsseSubstationRecord;
import org.jgrapht.Graph;
import org.jgrapht.alg.connectivity.ConnectivityInspector;
import org.jgrapht.alg.util.Pair;
Expand Down Expand Up @@ -468,9 +469,9 @@ static void createSubstations(PssePowerFlowModel psseModel, ContextExport contex
List<PsseSubstation> psseSubstations = new ArrayList<>();

contextExport.getFullExport().getSortedPsseSubstationIds().forEach(psseSubstationId -> {
List<PsseSubstation.PsseSubstationNode> nodes = new ArrayList<>();
List<PsseSubstation.PsseSubstationSwitchingDevice> switchingDevices = new ArrayList<>();
List<PsseSubstation.PsseSubstationEquipmentTerminal> equipmentTerminals = new ArrayList<>();
List<PsseSubstationNode> nodes = new ArrayList<>();
List<PsseSubstationSwitchingDevice> switchingDevices = new ArrayList<>();
List<PsseSubstationEquipmentTerminal> equipmentTerminals = new ArrayList<>();

contextExport.getFullExport().getVoltageLevelSet(psseSubstationId).forEach(voltageLevel -> {
nodes.addAll(createPsseSubstationNodes(voltageLevel, contextExport));
Expand All @@ -479,24 +480,24 @@ static void createSubstations(PssePowerFlowModel psseModel, ContextExport contex
});

PsseSubstation psseSubstation = new PsseSubstation(createPsseSubstationSubstationRecord(psseSubstationId, contextExport),
nodes.stream().sorted(Comparator.comparingInt(PsseSubstation.PsseSubstationNode::getNi)).toList(),
switchingDevices.stream().sorted(Comparator.comparingInt(PsseSubstation.PsseSubstationSwitchingDevice::getNi)
.thenComparingInt(PsseSubstation.PsseSubstationSwitchingDevice::getNj)
.thenComparing(PsseSubstation.PsseSubstationSwitchingDevice::getCkt)).toList(),
equipmentTerminals.stream().sorted(Comparator.comparingInt(PsseSubstation.PsseSubstationEquipmentTerminal::getI)
.thenComparingInt(PsseSubstation.PsseSubstationEquipmentTerminal::getNi)
.thenComparingInt(PsseSubstation.PsseSubstationEquipmentTerminal::getJ)
.thenComparingInt(PsseSubstation.PsseSubstationEquipmentTerminal::getK)
.thenComparing(PsseSubstation.PsseSubstationEquipmentTerminal::getId)
.thenComparing(PsseSubstation.PsseSubstationEquipmentTerminal::getType)).toList());
nodes.stream().sorted(Comparator.comparingInt(PsseSubstationNode::getNi)).toList(),
switchingDevices.stream().sorted(Comparator.comparingInt(PsseSubstationSwitchingDevice::getNi)
.thenComparingInt(PsseSubstationSwitchingDevice::getNj)
.thenComparing(PsseSubstationSwitchingDevice::getCkt)).toList(),
equipmentTerminals.stream().sorted(Comparator.comparingInt(PsseSubstationEquipmentTerminal::getI)
.thenComparingInt(PsseSubstationEquipmentTerminal::getNi)
.thenComparingInt(PsseSubstationEquipmentTerminal::getJ)
.thenComparingInt(PsseSubstationEquipmentTerminal::getK)
.thenComparing(PsseSubstationEquipmentTerminal::getId)
.thenComparing(PsseSubstationEquipmentTerminal::getType)).toList());
psseSubstations.add(psseSubstation);
});

psseModel.addSubstations(psseSubstations);
}

private static PsseSubstation.PsseSubstationRecord createPsseSubstationSubstationRecord(String psseSubstationId, ContextExport contextExport) {
PsseSubstation.PsseSubstationRecord substationRecord = new PsseSubstation.PsseSubstationRecord();
private static PsseSubstationRecord createPsseSubstationSubstationRecord(String psseSubstationId, ContextExport contextExport) {
PsseSubstationRecord substationRecord = new PsseSubstationRecord();
substationRecord.setIs(contextExport.getFullExport().getNewPsseSubstationIs());
substationRecord.setName(psseSubstationId);
substationRecord.setLati(0.0);
Expand All @@ -505,16 +506,16 @@ private static PsseSubstation.PsseSubstationRecord createPsseSubstationSubstatio
return substationRecord;
}

private static List<PsseSubstation.PsseSubstationNode> createPsseSubstationNodes(VoltageLevel voltageLevel, ContextExport contextExport) {
List<PsseSubstation.PsseSubstationNode> nodes = new ArrayList<>();
private static List<PsseSubstationNode> createPsseSubstationNodes(VoltageLevel voltageLevel, ContextExport contextExport) {
List<PsseSubstationNode> nodes = new ArrayList<>();

for (int node : voltageLevel.getNodeBreakerView().getNodes()) {
contextExport.getFullExport().getBusI(voltageLevel, node).ifPresent(busI -> {
int ni = contextExport.getFullExport().getPsseNode(voltageLevel, node).orElseThrow();
Bus voltageBusView = contextExport.getFullExport().getVoltageBus(voltageLevel, node).orElse(null);
boolean isDeEnergized = contextExport.getFullExport().isDeEnergized(voltageLevel, node);

PsseSubstation.PsseSubstationNode psseNode = new PsseSubstationNode();
PsseSubstationNode psseNode = new PsseSubstationNode();
psseNode.setNi(ni);
psseNode.setName(getNodeId(voltageLevel, node));
psseNode.setI(busI);
Expand All @@ -530,12 +531,12 @@ private static List<PsseSubstation.PsseSubstationNode> createPsseSubstationNodes
}

// ckt must be unique inside the voltageLevel
private static List<PsseSubstation.PsseSubstationSwitchingDevice> createPsseSubstationSwitchingDevices(VoltageLevel voltageLevel, ContextExport contextExport) {
List<PsseSubstation.PsseSubstationSwitchingDevice> switchingDevices = new ArrayList<>();
private static List<PsseSubstationSwitchingDevice> createPsseSubstationSwitchingDevices(VoltageLevel voltageLevel, ContextExport contextExport) {
List<PsseSubstationSwitchingDevice> switchingDevices = new ArrayList<>();
voltageLevel.getSwitches().forEach(sw -> {
int ni = contextExport.getFullExport().getPsseNode(voltageLevel, sw.getVoltageLevel().getNodeBreakerView().getNode1(sw.getId())).orElseThrow();
int nj = contextExport.getFullExport().getPsseNode(voltageLevel, sw.getVoltageLevel().getNodeBreakerView().getNode2(sw.getId())).orElseThrow();
PsseSubstation.PsseSubstationSwitchingDevice switchingDevice = new PsseSubstationSwitchingDevice();
PsseSubstationSwitchingDevice switchingDevice = new PsseSubstationSwitchingDevice();
switchingDevice.setNi(ni);
switchingDevice.setNj(nj);
switchingDevice.setCkt(contextExport.getFullExport().getEquipmentCkt(voltageLevel, sw.getId(), ni, nj));
Expand All @@ -560,8 +561,8 @@ private static int getSwitchingDeviceType(Switch sw) {
};
}

private static List<PsseSubstation.PsseSubstationEquipmentTerminal> createPsseSubstationEquipmentTerminals(VoltageLevel voltageLevel, ContextExport contextExport) {
List<PsseSubstation.PsseSubstationEquipmentTerminal> equipmentTerminals = new ArrayList<>();
private static List<PsseSubstationEquipmentTerminal> createPsseSubstationEquipmentTerminals(VoltageLevel voltageLevel, ContextExport contextExport) {
List<PsseSubstationEquipmentTerminal> equipmentTerminals = new ArrayList<>();

getEquipmentListToBeExported(voltageLevel).forEach(equipmentId -> {
Identifiable<?> identifiable = getIdentifiable(voltageLevel, equipmentId);
Expand All @@ -572,7 +573,7 @@ private static List<PsseSubstation.PsseSubstationEquipmentTerminal> createPsseSu
List<Integer> otherBuses = getTwoOtherBusesPreservingOrder(identifiable, terminals, nodeBusR, contextExport);
String ckt = contextExport.getFullExport().getEquipmentCkt(equipmentId, type, nodeBusR.busI(), otherBuses.get(0), otherBuses.get(1));

PsseSubstation.PsseSubstationEquipmentTerminal equipmentTerminal = new PsseSubstationEquipmentTerminal();
PsseSubstationEquipmentTerminal equipmentTerminal = new PsseSubstationEquipmentTerminal();
equipmentTerminal.setNi(nodeBusR.psseNode);
equipmentTerminal.setType(type);
equipmentTerminal.setId(getEquipmentTerminalId(type, identifiable, ckt));
Expand Down
4 changes: 2 additions & 2 deletions psse/psse-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.univocity</groupId>
<artifactId>univocity-parsers</artifactId>
<groupId>de.siegmar</groupId>
<artifactId>fastcsv</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
Loading