Skip to content

Commit

Permalink
fixes eurostag shunt impedances
Browse files Browse the repository at this point in the history
  • Loading branch information
CBiasuzzi committed Jun 8, 2018
1 parent c3ee48e commit 0641065
Showing 1 changed file with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,16 @@ private EsgDetailedTwoWindingTransformer.Tap createTap(TwoWindingsTransformer tw
}


private void createAdditionalBank(EsgNetwork esgNetwork, TwoWindingsTransformer twt, Terminal terminal, String nodeName, Set<String> additionalBanksIds) {
float rcapba = twt.getB() * (float) Math.pow(terminal.getVoltageLevel().getNominalV(), 2) / (config.isSpecificCompatibility() ? 2 : 1);
float plosba = twt.getG() * (float) Math.pow(terminal.getVoltageLevel().getNominalV(), 2) / (config.isSpecificCompatibility() ? 2 : 1);
private void createAdditionalBank(EsgNetwork esgNetwork, TwoWindingsTransformer twt, String nodeName, Set<String> additionalBanksIds, boolean isSide2) {
float v2 = (float) Math.pow(twt.getTerminal2().getVoltageLevel().getNominalV(), 2);
float rcapba = 0.0f;
if (-twt.getB() < 0 || isSide2) {
rcapba = twt.getB() * v2 / (config.isSpecificCompatibility() ? 2 : 1);
}
float plosba = 0.0f;
if (twt.getG() < 0 || isSide2) {
plosba = 1000 * twt.getG() * v2 / (config.isSpecificCompatibility() ? 2 : 1);
}
if ((Math.abs(plosba) > G_EPSILON) || (Math.abs(rcapba) > B_EPSILON)) {
//simple new bank naming: 4 first letters of the node name, 7th letter of the node name, 'C', 2 digits order code
String nnodeName = Strings.padEnd(nodeName, 8, ' ');
Expand All @@ -324,7 +331,7 @@ private void createAdditionalBank(EsgNetwork esgNetwork, TwoWindingsTransformer
newBankName = newBankNamePrefix + newCounter;
}
additionalBanksIds.add(newBankName);
LOGGER.info("create additional bank with id: {} at node: {}, for twt: {} ( B={}, G={} ); rcapba={}, plosba={}", newBankName, nodeName, twt, twt.getB(), twt.getG(), rcapba, plosba);
LOGGER.info("create additional bank with id: {} at node: {}, for twt: {} ( B={}, G={} ); rcapba={}, plosba={}, isSide2: {}", newBankName, nodeName, twt, twt.getB(), twt.getG(), rcapba, plosba, isSide2);
esgNetwork.addCapacitorsOrReactorBanks(new EsgCapacitorOrReactorBank(new Esg8charName(newBankName), new Esg8charName(nodeName), 1, plosba, rcapba, 1, EsgCapacitorOrReactorBank.RegulatingMode.NOT_REGULATING));
}
}
Expand Down Expand Up @@ -522,12 +529,11 @@ private void createTransformers(EsgNetwork esgNetwork, EsgGeneralParameters para
float pregmax = Float.NaN; //...?

//handling of the cases where cmagn should be negative and where pfer should be negative
if ((-twt.getB() < 0) || (twt.getG() < 0)) {
createAdditionalBank(esgNetwork, twt, twt.getTerminal1(), dictionary.getEsgId(bus1.getId()), additionalBanksIds);
}

if (config.isSpecificCompatibility()) {
createAdditionalBank(esgNetwork, twt, twt.getTerminal2(), dictionary.getEsgId(bus2.getId()), additionalBanksIds);
if ((-twt.getB() < 0) || (twt.getG() < 0) || (config.isSpecificCompatibility())) {
createAdditionalBank(esgNetwork, twt, dictionary.getEsgId(bus1.getId()), additionalBanksIds, false);
if (config.isSpecificCompatibility()) {
createAdditionalBank(esgNetwork, twt, dictionary.getEsgId(bus2.getId()), additionalBanksIds, true);
}
}

EsgDetailedTwoWindingTransformer esgTransfo = new EsgDetailedTwoWindingTransformer(
Expand Down Expand Up @@ -652,8 +658,8 @@ private void createBanks(EsgNetwork esgNetwork) {

//...number of steps in service
int ieleba = bus.isConnected() ? sc.getCurrentSectionCount() : 0; // not really correct, because it can be connected with zero section, EUROSTAG should be modified...
float plosba = 0.f; // no active lost in the iidm shunt compensator
float vnom = sc.getTerminal().getVoltageLevel().getNominalV();
float plosba = 1000 * vnom * vnom * 0.f; // no active lost in the iidm shunt compensator. Expressed in kw
float rcapba = vnom * vnom * sc.getbPerSection();
int imaxba = sc.getMaximumSectionCount();
EsgCapacitorOrReactorBank.RegulatingMode xregba = EsgCapacitorOrReactorBank.RegulatingMode.NOT_REGULATING;
Expand Down

0 comments on commit 0641065

Please sign in to comment.