Skip to content

Commit

Permalink
svc binit computation: fixes NPE and value computation when the svc b…
Browse files Browse the repository at this point in the history
…us is not connected
  • Loading branch information
CBiasuzzi committed Jan 8, 2018
1 parent 01a1ef1 commit 9338710
Showing 1 changed file with 12 additions and 2 deletions.
Expand Up @@ -496,9 +496,19 @@ private void createStaticVarCompensators(EsgNetwork esgNetwork) {
Esg8charName znamsvc = new Esg8charName(dictionary.getEsgId(svc.getId()));
EsgConnectionStatus xsvcst = bus.isConnected() ? EsgConnectionStatus.CONNECTED : EsgConnectionStatus.NOT_CONNECTED;
Esg8charName znodsvc = new Esg8charName(dictionary.getEsgId(bus.getId()));
float factor = (float) Math.pow(svc.getTerminal().getVoltageLevel().getNominalV(), 2);
float vlNomVoltage = svc.getTerminal().getVoltageLevel().getNominalV();
float factor = (float) Math.pow(vlNomVoltage, 2);
float bmin = (!config.isSvcAsFixedInjectionInLF()) ? svc.getBmin() * factor : -9999999; // [Mvar]
float binit = (!config.isSvcAsFixedInjectionInLF()) ? svc.getReactivePowerSetPoint() : -svc.getTerminal().getQ() * (float) Math.pow(svc.getTerminal().getVoltageLevel().getNominalV() / EchUtil.getBus(svc.getTerminal(), config).getV(), 2); // [Mvar]
float binit; // [Mvar]
if (!config.isSvcAsFixedInjectionInLF()) {
binit = svc.getReactivePowerSetPoint();
} else {
binit = -svc.getTerminal().getQ();
Bus svcBus = EchUtil.getBus(svc.getTerminal(), config);
if ((svcBus != null) && (Math.abs(svcBus.getV()) > 0.0f)) {
binit = binit * (float) Math.pow(vlNomVoltage / svcBus.getV(), 2);
}
}
float bmax = (!config.isSvcAsFixedInjectionInLF()) ? svc.getBmax() * factor : 9999999; // [Mvar]
EsgRegulatingMode xregsvc = ((svc.getRegulationMode() == StaticVarCompensator.RegulationMode.VOLTAGE) && (!config.isSvcAsFixedInjectionInLF())) ? EsgRegulatingMode.REGULATING : EsgRegulatingMode.NOT_REGULATING;
float vregsvc = svc.getVoltageSetPoint();
Expand Down

0 comments on commit 9338710

Please sign in to comment.