Skip to content

Commit

Permalink
Revert "Introduction of non linear shunt compensators (#1202)"
Browse files Browse the repository at this point in the history
This reverts commit 7e9d21f.

Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>

# Conflicts:
#	iidm/iidm-tck/src/test/java/com/powsybl/iidm/network/tck/AbstractShuntCompensatorTest.java
  • Loading branch information
miovd committed Apr 20, 2020
1 parent 0b8b3a8 commit f60b5da
Show file tree
Hide file tree
Showing 43 changed files with 302 additions and 1,552 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
package com.powsybl.ampl.converter;

import com.powsybl.commons.PowsyblException;
import com.powsybl.commons.datasource.ReadOnlyDataSource;
import com.powsybl.commons.util.StringToIntMapper;
import com.powsybl.iidm.network.*;
Expand Down Expand Up @@ -278,9 +277,6 @@ private Void readShunt(String[] tokens) {
throw new AmplException("Invalid shunt compensator id '" + id + "'");
}

if (ShuntCompensatorModelType.NON_LINEAR.equals(sc.getModelType())) {
throw new PowsyblException("non linear shunt not supported yet");
}
sc.setCurrentSectionCount(Math.max(0, Math.min(sc.getMaximumSectionCount(), sections)));
Terminal t = sc.getTerminal();
t.setQ(q);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.util.Objects;
import java.util.Set;

import com.powsybl.commons.PowsyblException;
import com.powsybl.iidm.network.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -1311,9 +1310,6 @@ private void writeShunts(AmplExportContext context) throws IOException {
new Column("sections count"))) {
List<String> skipped = new ArrayList<>();
for (ShuntCompensator sc : network.getShuntCompensators()) {
if (ShuntCompensatorModelType.NON_LINEAR.equals(sc.getModelType())) {
throw new PowsyblException("Non linear shunt compensator not yet supported");
}
Terminal t = sc.getTerminal();
Bus bus = AmplUtil.getBus(t);
String busId = null;
Expand All @@ -1340,7 +1336,7 @@ private void writeShunts(AmplExportContext context) throws IOException {
double vb = t.getVoltageLevel().getNominalV();
double zb = vb * vb / AmplConstants.SB;
double b1 = 0;
double b2 = sc.getModel(ShuntCompensatorLinearModel.class).getbPerSection() * sc.getMaximumSectionCount() * zb;
double b2 = sc.getbPerSection() * sc.getMaximumSectionCount() * zb;
double minB = Math.min(b1, b2);
double maxB = Math.max(b1, b2);
double b = sc.getCurrentB() * zb;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,9 @@ private static Network microBE(String modelId) {
.setName("BE_S2")
.setConnectableBus(busBrussels380.getId())
.setBus(busBrussels380.getId())
.setbPerSection(3.46e-4)
.setMaximumSectionCount(1)
.setCurrentSectionCount(1)
.newLinearModel()
.setbPerSection(3.46e-4)
.setMaximumSectionCount(1)
.add()
.add();
shBrussels380.getTerminal().setQ(-59.058144);
DanglingLine be3 = vlBrussels380.newDanglingLine()
Expand Down Expand Up @@ -270,11 +268,9 @@ private static Network microBE(String modelId) {
.setName("BE_S1")
.setConnectableBus(busBrussels110.getId())
.setBus(busBrussels110.getId())
.setbPerSection(0.024793)
.setMaximumSectionCount(1)
.setCurrentSectionCount(1)
.newLinearModel()
.setbPerSection(0.024793)
.setMaximumSectionCount(1)
.add()
.add();
shBrussels110.getTerminal().setQ(-330.75);
Bus busBrussels21 = vlBrussels21.getBusBreakerView().newBus()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ public EquivalentShuntConversion(PropertyBag p, Context context) {
@Override
public void convert() {
ShuntCompensatorAdder adder = voltageLevel().newShuntCompensator()
.setCurrentSectionCount(terminalConnected() ? 1 : 0)
.newLinearModel()
.setbPerSection(p.asDouble("b"))
.setMaximumSectionCount(1)
.add();
.setbPerSection(p.asDouble("b"))
.setMaximumSectionCount(1)
.setCurrentSectionCount(terminalConnected() ? 1 : 0);
identify(adder);
connect(adder);
adder.add();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,8 @@ public void convert() {

ShuntCompensatorAdder adder = voltageLevel().newShuntCompensator()
.setCurrentSectionCount(sections)
.newLinearModel()
.setbPerSection(bPerSection)
.setMaximumSectionCount(maximumSections)
.add();
.setbPerSection(bPerSection)
.setMaximumSectionCount(maximumSections);
identify(adder);
connect(adder);
ShuntCompensator shunt = adder.add();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public void microBEEquivalentShunt() {
ShuntCompensator shunt = network.getShuntCompensator("_d771118f-36e9-4115-a128-cc3d9ce3e3da");
assertNotNull(shunt);
assertEquals(1, shunt.getMaximumSectionCount());
assertEquals(0.0012, shunt.getModel(ShuntCompensatorLinearModel.class).getbPerSection(), 0.0);
assertEquals(0.0012, shunt.getbPerSection(), 0.0);
assertEquals(1, shunt.getCurrentSectionCount());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,31 @@
import java.util.stream.Stream;

import com.powsybl.cgmes.model.CgmesNames;
import com.powsybl.iidm.network.*;
import com.powsybl.iidm.network.Bus;
import com.powsybl.iidm.network.CurrentLimits;
import com.powsybl.iidm.network.DanglingLine;
import com.powsybl.iidm.network.Generator;
import com.powsybl.iidm.network.Identifiable;
import com.powsybl.iidm.network.Line;
import com.powsybl.iidm.network.Load;
import com.powsybl.iidm.network.MinMaxReactiveLimits;
import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.PhaseTapChanger;
import com.powsybl.iidm.network.PhaseTapChangerStep;
import com.powsybl.iidm.network.RatioTapChanger;
import com.powsybl.iidm.network.RatioTapChangerStep;
import com.powsybl.iidm.network.ReactiveCapabilityCurve;
import com.powsybl.iidm.network.ReactiveCapabilityCurve.Point;
import com.powsybl.iidm.network.ReactiveLimits;
import com.powsybl.iidm.network.ShuntCompensator;
import com.powsybl.iidm.network.StaticVarCompensator;
import com.powsybl.iidm.network.Substation;
import com.powsybl.iidm.network.Switch;
import com.powsybl.iidm.network.TapChanger;
import com.powsybl.iidm.network.TapChangerStep;
import com.powsybl.iidm.network.ThreeWindingsTransformer;
import com.powsybl.iidm.network.TwoWindingsTransformer;
import com.powsybl.iidm.network.VoltageLevel;
import com.powsybl.iidm.network.extensions.CoordinatedReactiveControl;
import com.powsybl.iidm.network.extensions.TwoWindingsTransformerPhaseAngleClock;
import com.powsybl.iidm.network.extensions.ThreeWindingsTransformerPhaseAngleClock;
Expand Down Expand Up @@ -210,8 +233,8 @@ private void compareShunts(ShuntCompensator expected, ShuntCompensator actual) {
expected.getMaximumSectionCount(),
actual.getMaximumSectionCount());
compare("bPerSection",
expected.getModel(ShuntCompensatorLinearModel.class).getbPerSection(),
actual.getModel(ShuntCompensatorLinearModel.class).getbPerSection());
expected.getbPerSection(),
actual.getbPerSection());
compare("voltageRegulationOn",
expected.isVoltageRegulatorOn(),
actual.isVoltageRegulatorOn());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@
*/
package com.powsybl.cgmes.conversion.test.update;

import com.powsybl.iidm.network.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.powsybl.cgmes.conversion.update.elements16.GeneratorToSynchronousMachine;
import com.powsybl.cgmes.conversion.update.elements16.TwoWindingsTransformerToPowerTransformer;
import com.powsybl.iidm.network.Generator;
import com.powsybl.iidm.network.Line;
import com.powsybl.iidm.network.Load;
import com.powsybl.iidm.network.MinMaxReactiveLimits;
import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.ReactiveLimitsKind;
import com.powsybl.iidm.network.ShuntCompensator;
import com.powsybl.iidm.network.TwoWindingsTransformer;
import com.powsybl.iidm.network.VoltageLevel;

/**
* @author Luma Zamarreño <zamarrenolm at aia.es>
Expand Down Expand Up @@ -83,8 +91,8 @@ public static void modifyEquipmentCharacteristics(Network network) {

if (network.getShuntCompensatorCount() > 0) {
ShuntCompensator sh = network.getShuntCompensators().iterator().next();
sh.getModel(ShuntCompensatorLinearModel.class).setbPerSection(sh.getModel(ShuntCompensatorLinearModel.class).getbPerSection() + 0.2);
sh.getModel(ShuntCompensatorLinearModel.class).setMaximumSectionCount(sh.getMaximumSectionCount() + 5);
sh.setbPerSection(sh.getbPerSection() + 0.2);
sh.setMaximumSectionCount(sh.getMaximumSectionCount() + 5);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,9 @@ private static void createShuntCompensator(IeeeCdfBus ieeeCdfBus, PerUnitContext
.setId(busId + "-SH")
.setConnectableBus(busId)
.setBus(busId)
.setbPerSection(ieeeCdfBus.getShuntSusceptance() / zb)
.setCurrentSectionCount(1)
.newLinearModel()
.setMaximumSectionCount(1)
.setbPerSection(ieeeCdfBus.getShuntSusceptance() / zb)
.add()
.setMaximumSectionCount(1)
.add();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@
*/
public interface ShuntCompensator extends Injection<ShuntCompensator> {

/**
* Get the maximum section count.
*/
int getMaximumSectionCount();

/**
* Set the maximum number of section.
*
* @param maximumSectionCount the maximum number of section
* @return the shunt compensator to chain method calls.
*/
ShuntCompensator setMaximumSectionCount(int maximumSectionCount);

/**
* Get the current section count.
* <p>
Expand All @@ -27,11 +40,6 @@ public interface ShuntCompensator extends Injection<ShuntCompensator> {
*/
int getCurrentSectionCount();

/**
* Get the maximum number of sections.
*/
int getMaximumSectionCount();

/**
* Change the number of section.
*
Expand All @@ -45,32 +53,35 @@ public interface ShuntCompensator extends Injection<ShuntCompensator> {
ShuntCompensator setCurrentSectionCount(int currentSectionCount);

/**
* Get the susceptance for the current section count.
* <p>
* Depends on the working variant.
* @see VariantManager
* Get the susceptance per section in S.
*/
double getCurrentB();
double getbPerSection();

/**
* Get the conductance for the current section count.
* <p>
* Depends on the working variant.
* @see VariantManager
* Set the susceptance per section in S.
*
* @param bPerSection the susceptance per section
* @return the shunt compensator to chain method calls.
*/
double getCurrentG();
ShuntCompensator setbPerSection(double bPerSection);

/**
* Get the model type of the shunt compensator (linear or non-linear)
* Get the susceptance for the maximum section count.
*
* @deprecated Use {@link #getbPerSection()} * {@link #getMaximumSectionCount()} instead.
*/
ShuntCompensatorModelType getModelType();
@Deprecated
default double getMaximumB() {
return getbPerSection() * getMaximumSectionCount();
}

/**
* Get the shunt model.
* Get the susceptance for the current section counts.
* <p>
* Depends on the working variant.
* @see VariantManager
*/
ShuntCompensatorModel getModel();

<M extends ShuntCompensatorModel> M getModel(Class<M> modelType);
double getCurrentB();

/**
* Get the terminal used for regulation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
*/
public interface ShuntCompensatorAdder extends InjectionAdder<ShuntCompensatorAdder> {

ShuntCompensatorLinearModelAdder newLinearModel();
ShuntCompensatorAdder setbPerSection(double bPerSection);

ShuntCompensatorNonLinearModelAdder newNonLinearModel();
ShuntCompensatorAdder setMaximumSectionCount(int maximumSectionCount);

ShuntCompensatorAdder setCurrentSectionCount(int currentSectionCount);

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit f60b5da

Please sign in to comment.