Skip to content

Commit

Permalink
Add substation creation with voltage level creation (#17)
Browse files Browse the repository at this point in the history
Signed-off-by: Rehili Ghazwa <[email protected]>
  • Loading branch information
ghazwarhili authored Jan 16, 2025
1 parent 9ba9250 commit a7554a2
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,14 +361,19 @@ public void createSubstation(SubstationCreationInfos substationCreationInfos,
public void createVoltageLevel(VoltageLevelCreationInfos voltageLevelCreationInfos,
ReportNode subReportNode, Network network) {
String substationId = voltageLevelCreationInfos.getSubstationId();
if (voltageLevelCreationInfos.getSubstationCreation() != null) {
createSubstation(voltageLevelCreationInfos.getSubstationCreation(), subReportNode, network);
SubstationCreationInfos substationCreation = voltageLevelCreationInfos.getSubstationCreation();
Substation substation;
if (substationCreation != null) {
substationId = substationCreation.getEquipmentId();
createSubstation(substationCreation, subReportNode, network);
substation = network.getSubstation(substationId);
PropertiesUtils.applyProperties(substation, subReportNode, substationCreation.getProperties(), "SubstationProperties");
} else {
substation = network.getSubstation(substationId);
}
Substation substation = network.getSubstation(substationId);
if (substation == null) {
throw new NetworkModificationException(SUBSTATION_NOT_FOUND, substationId);
}

VoltageLevel voltageLevel = substation.newVoltageLevel()
.setId(voltageLevelCreationInfos.getEquipmentId())
.setName(voltageLevelCreationInfos.getEquipmentName())
Expand Down

0 comments on commit a7554a2

Please sign in to comment.