Skip to content

Commit

Permalink
fixes coupling names when noswitch is true
Browse files Browse the repository at this point in the history
  • Loading branch information
CBiasuzzi committed Jan 23, 2018
1 parent a02d593 commit d1e5b2b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public final class EurostagDictionary {

private final EurostagEchExportConfig config;

public static final String ACNODE_PREFIX = "ACNODE_ID_";

public static EurostagDictionary create(Network network, BranchParallelIndexes parallelIndexes, EurostagEchExportConfig config, EurostagFakeNodes fakeNodes) {
EurostagDictionary dictionary = new EurostagDictionary(config);

Expand Down Expand Up @@ -99,6 +101,13 @@ public static EurostagDictionary create(Network network, BranchParallelIndexes p
parallelIndexes.getParallelIndex(twt.getId())).toString());
}

for (VscConverterStation vscCc : Identifiables.sort(network.getVscConverterStations())) {
Esg8charName acNode = new Esg8charName(dictionary.getEsgId(ConnectionBus.fromTerminal(vscCc.getTerminal(), config, fakeNodes).getId()));
if (!dictionary.iidmIdExists(ACNODE_PREFIX + vscCc.getId())) {
dictionary.add(ACNODE_PREFIX + vscCc.getId(), ACNODE_PREFIX + vscCc.getId() + "_" + acNode.toString());
}
}

for (ThreeWindingsTransformer twt : Identifiables.sort(network.getThreeWindingsTransformers())) {
throw new AssertionError("TODO");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,11 @@ protected boolean isPMode(HvdcConverterStation vscConv, HvdcLine hvdcLine) {
Objects.requireNonNull(hvdcLine);
HvdcConverterStation side1Conv = hvdcLine.getConverterStation1();
HvdcConverterStation side2Conv = hvdcLine.getConverterStation2();
if ((hvdcLine.getConvertersMode().equals(HvdcLine.ConvertersMode.SIDE_1_RECTIFIER_SIDE_2_INVERTER))
if ((hvdcLine.getConvertersMode().equals(HvdcLine.ConvertersMode.SIDE_1_INVERTER_SIDE_2_RECTIFIER))
&& (vscConv.getId().equals(side1Conv.getId()))) {
return true;
}
if ((hvdcLine.getConvertersMode().equals(HvdcLine.ConvertersMode.SIDE_1_INVERTER_SIDE_2_RECTIFIER))
if ((hvdcLine.getConvertersMode().equals(HvdcLine.ConvertersMode.SIDE_1_RECTIFIER_SIDE_2_INVERTER))
&& (vscConv.getId().equals(side2Conv.getId()))) {
return true;
}
Expand All @@ -591,7 +591,12 @@ protected EsgACDCVscConverter createACDCVscConverter(VscConverterStation vscConv
Esg8charName znamsvc = new Esg8charName(dictionary.getEsgId(vscConv.getId())); // converter station ID
Esg8charName dcNode1 = new Esg8charName(getDCNodeName(vscConv.getId(), 5, dcNodesEsgNames)); // sending DC node name
Esg8charName dcNode2 = new Esg8charName("GROUND"); // receiving DC node name; is it always GROUND?
Esg8charName acNode = new Esg8charName(dictionary.getEsgId(ConnectionBus.fromTerminal(vscConv.getTerminal(), config, fakeNodes).getId())); // AC node name
String acNodeIdKey = EurostagDictionary.ACNODE_PREFIX + vscConv.getId();
Esg8charName acNode = dictionary.iidmIdExists(acNodeIdKey) ? new Esg8charName(dictionary.getEsgId(acNodeIdKey).substring(acNodeIdKey.length() + 1))
: null;
if (acNode == null) {
throw new RuntimeException("VSCConverter " + vscConv.getId() + " : acNode mapping not found");
}
EsgACDCVscConverter.ConverterState xstate = EsgACDCVscConverter.ConverterState.ON; // converter state ' ' ON; 'S' OFF
EsgACDCVscConverter.DCControlMode xregl = isPmode ? EsgACDCVscConverter.DCControlMode.AC_ACTIVE_POWER : EsgACDCVscConverter.DCControlMode.DC_VOLTAGE; // DC control mode 'P' AC_ACTIVE_POWER; 'V' DC_VOLTAGE
//AC control mode assumed to be "AC reactive power"(Q)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1650,15 +1650,17 @@ public void dumpData(Internal inst, SimulatorInst simInst, DDBManager ddbmanager
zm.put("coupling.par2", "M " + machineName);
} else if (par2.startsWith("N")) {
//set par2 to the other converter AC node eurostag name (connected bus)
//AC node name assumed to be mapped in iidm2eurostagId
//"ACNODE_ID_"+vscConv.getId()+"_"+ACNODENAME
VscConverterStation vscConv = network.getVscConverterStation(eqCimId2);
Bus conBus = vscConv.getTerminal().getBusBreakerView().getConnectableBus();
if (conBus == null) {
conBus = vscConv.getTerminal().getBusView().getConnectableBus();
}
if (conBus != null) {
zm.put("coupling.par2", "N " + iidm2eurostagId.get(conBus.getId()));
String acNodePrefix = "ACNODE_ID_";
String acNodeIdKey = acNodePrefix + vscConv.getId();
String acNode = iidm2eurostagId.containsKey(acNodeIdKey) ? iidm2eurostagId.get(acNodeIdKey).substring(acNodeIdKey.length() + 1) : null;
if (acNode != null) {
zm.put("coupling.par2", "N " + acNode);
} else {
throw new RuntimeException("VSCConverter " + vscConv.getId() + " : acNode mapping not found");
}

}
log.debug("Converter id: {}, machine name: {} fixed macrobloc data: {}", eq.getCimId(), machineName, zm);
} else {
Expand Down

0 comments on commit d1e5b2b

Please sign in to comment.