Skip to content

Commit

Permalink
Add HVDC case for Zone Raw Graph
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas ADAM <tadam@silicom.fr>
  • Loading branch information
tadam50 committed Aug 2, 2023
1 parent 795816d commit 95c1fc2
Show file tree
Hide file tree
Showing 13 changed files with 6,167 additions and 1,528 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
*/
package com.powsybl.sld.builders;

import com.powsybl.iidm.network.HvdcConverterStation;
import com.powsybl.sld.model.coordinate.Direction;
import com.powsybl.sld.model.graphs.BaseGraph;
import com.powsybl.sld.model.graphs.NodeFactory;
import com.powsybl.sld.model.nodes.FeederNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -67,6 +69,62 @@ public Map<VoltageLevelRawBuilder, FeederNode> createLine(String id, VoltageLeve
return createLine(id, List.of(vl1, vl2), List.of(0, 0), Stream.of((Direction) null, null).toList());
}

@Override
public Map<VoltageLevelRawBuilder, FeederNode> createHdvcLine(String id,
HvdcConverterStation.HvdcType type,
List<VoltageLevelRawBuilder> vls,
List<Integer> orders,
List<Direction> directions) {
checkInputParameters(2, vls, orders, directions);

VoltageLevelRawBuilder vl1 = vls.get(0);
VoltageLevelRawBuilder vl2 = vls.get(1);
int order1 = orders.get(0);
int order2 = orders.get(1);
Direction direction1 = directions.get(0);
Direction direction2 = directions.get(1);
Map<VoltageLevelRawBuilder, FeederNode> feederLineNodes = new HashMap<>();

FeederNode feederLccNode1;
FeederNode feederLccNode2;
switch (type) {
case LCC: {
feederLccNode1 = NodeFactory.createLccConverterStation(vl1.getGraph(), id + "_" + ONE, id, id, ONE, vl2.getVoltageLevelInfos());
feederLccNode2 = NodeFactory.createLccConverterStation(vl2.getGraph(), id + "_" + TWO, id, id, TWO, vl1.getVoltageLevelInfos());
break;
}
case VSC: {
feederLccNode1 = NodeFactory.createVscConverterStation(vl1.getGraph(), id + "_" + ONE, id, id, ONE, vl2.getVoltageLevelInfos());
feederLccNode2 = NodeFactory.createVscConverterStation(vl2.getGraph(), id + "_" + TWO, id, id, TWO, vl1.getVoltageLevelInfos());
break;
}
default: {
throw new AssertionError();
}
}
feederLccNode1.setLabel(id);
feederLccNode1.setOrder(order1);
feederLccNode1.setDirection(direction1 == null ? Direction.UNDEFINED : direction1);
feederLccNode2.setLabel(id);
feederLccNode2.setOrder(order2);
feederLccNode2.setDirection(direction1 == null ? Direction.UNDEFINED : direction2);

feederLineNodes.put(vl1, feederLccNode1);
feederLineNodes.put(vl2, feederLccNode2);

if (containsVoltageLevelRawBuilders(vl1, vl2)) {
// All VoltageLevel must be in the same Substation or the same Zone
getGraph().addLineEdge(id, feederLccNode1, feederLccNode2);
}

return feederLineNodes;
}

@Override
public Map<VoltageLevelRawBuilder, FeederNode> createHdvcLine(String id, HvdcConverterStation.HvdcType type, VoltageLevelRawBuilder vl1, VoltageLevelRawBuilder vl2) {
return createHdvcLine(id, type, List.of(vl1, vl2), List.of(0, 0), Stream.of((Direction) null, null).toList());
}

protected void checkInputParameters(int expectedSize,
List<VoltageLevelRawBuilder> vls,
List<Integer> orders,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
package com.powsybl.sld.builders;

import com.powsybl.iidm.network.HvdcConverterStation;
import com.powsybl.sld.model.coordinate.Direction;
import com.powsybl.sld.model.nodes.FeederNode;

Expand All @@ -24,4 +25,14 @@ Map<VoltageLevelRawBuilder, FeederNode> createLine(String id,

Map<VoltageLevelRawBuilder, FeederNode> createLine(String id,
VoltageLevelRawBuilder vl1, VoltageLevelRawBuilder vl2);

Map<VoltageLevelRawBuilder, FeederNode> createHdvcLine(String id,
HvdcConverterStation.HvdcType type,
List<VoltageLevelRawBuilder> vls,
List<Integer> orders,
List<Direction> directions);

Map<VoltageLevelRawBuilder, FeederNode> createHdvcLine(String id,
HvdcConverterStation.HvdcType type,
VoltageLevelRawBuilder vl1, VoltageLevelRawBuilder vl2);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
package com.powsybl.sld.raw;

import com.powsybl.iidm.network.HvdcConverterStation;
import com.powsybl.sld.builders.RawGraphBuilder;
import com.powsybl.sld.builders.SubstationRawBuilder;
import com.powsybl.sld.builders.VoltageLevelRawBuilder;
Expand Down Expand Up @@ -292,6 +293,42 @@ public static void createRawBuilderWithTwoSubstations(RawGraphBuilder rawGraphBu
vlsubst2.connectNode(dline212, bline212);
vlsubst2.connectNode(bline212, line1.get(vlsubst2));

/*
// - a HVDC line (LCC) between the two substations
//
*/
SwitchNode dHvdclcc112 = vlb1.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dhvdc_lcc11_2", false, false);
SwitchNode bHvdclcc112 = vlb1.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "bhvdc_lcc11_2", false, false);

SwitchNode dHvdclcc212 = vlsubst2.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dhvdc_lcc21_2", false, false);
SwitchNode bHvdclcc212 = vlsubst2.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "bhvdc_lcc21_2", false, false);
Map<VoltageLevelRawBuilder, FeederNode> hvdclcc =
((parentGraph != null) ? parentGraph : ssb1).createHdvcLine("hvdc_lcc", HvdcConverterStation.HvdcType.LCC, vlb1, vlsubst2);
vlb1.connectNode(bbs1, dHvdclcc112);
vlb1.connectNode(dHvdclcc112, bHvdclcc112);
vlb1.connectNode(bHvdclcc112, hvdclcc.get(vlb1));
vlsubst2.connectNode(bbs12, dHvdclcc212);
vlsubst2.connectNode(dHvdclcc212, bHvdclcc212);
vlsubst2.connectNode(bHvdclcc212, hvdclcc.get(vlsubst2));

/*
// - a HVDC line (VSC) between the two substations
//
*/
SwitchNode dHvdcvsc112 = vlb1.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dhvdc_vsc11_2", false, false);
SwitchNode bHvdcvsc112 = vlb1.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "bhvdc_vsc11_2", false, false);

SwitchNode dHvdcvsc212 = vlsubst2.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dhvdc_vsc21_2", false, false);
SwitchNode bHvdcvsc212 = vlsubst2.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "bhvdc_vsc21_2", false, false);
Map<VoltageLevelRawBuilder, FeederNode> hvdcvsc =
((parentGraph != null) ? parentGraph : ssb1).createHdvcLine("hvdc_vsc", HvdcConverterStation.HvdcType.VSC, vlb1, vlsubst2);
vlb1.connectNode(bbs1, dHvdcvsc112);
vlb1.connectNode(dHvdcvsc112, bHvdcvsc112);
vlb1.connectNode(bHvdcvsc112, hvdcvsc.get(vlb1));
vlsubst2.connectNode(bbs12, dHvdcvsc212);
vlsubst2.connectNode(dHvdcvsc212, bHvdcvsc212);
vlsubst2.connectNode(bHvdcvsc212, hvdcvsc.get(vlsubst2));

if (append2wt) {
/*
// - a two windings transformers between the two substations
Expand Down
Loading

0 comments on commit 95c1fc2

Please sign in to comment.