Skip to content

Commit

Permalink
First working version.
Browse files Browse the repository at this point in the history
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
  • Loading branch information
annetill committed Mar 11, 2022
1 parent 924119f commit bec9403
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public abstract class AbstractHvdcAcEmulationFlowEquationTerm extends AbstractNa

protected LfHvdc hvdc;

protected final double lossFactor1;

protected final double lossFactor2;

protected AbstractHvdcAcEmulationFlowEquationTerm(LfHvdc hvdc, LfBus bus1, LfBus bus2, VariableSet<AcVariableType> variableSet) {
ph1Var = variableSet.getVariable(bus1.getNum(), AcVariableType.BUS_PHI);
ph2Var = variableSet.getVariable(bus2.getNum(), AcVariableType.BUS_PHI);
Expand All @@ -45,6 +49,8 @@ protected AbstractHvdcAcEmulationFlowEquationTerm(LfHvdc hvdc, LfBus bus1, LfBus
this.hvdc = hvdc;
k = hvdc.getDroop() * 180 / Math.PI;
p0 = hvdc.getP0();
lossFactor1 = hvdc.getConverterStation1().getLossFactor() / 100;
lossFactor2 = hvdc.getConverterStation2().getLossFactor() / 100;
}

protected double ph1() {
Expand All @@ -63,6 +69,10 @@ protected double v2() {
return stateVector.get(v2Var.getRow());
}

protected double getLossMultiplier() {
return (1 - lossFactor1) * (1 - lossFactor2);
}

@Override
public List<Variable<AcVariableType>> getVariables() {
return variables;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@
*/
public class HvdcAcEmulationSide1ActiveFlowEquationTerm extends AbstractHvdcAcEmulationFlowEquationTerm {

private double sign;

private double multiplier;

public HvdcAcEmulationSide1ActiveFlowEquationTerm(LfHvdc hvdc, LfBus bus1, LfBus bus2, VariableSet<AcVariableType> variableSet) {
super(hvdc, bus1, bus2, variableSet);
sign = hvdc.getConverterStation1().isRectifier() ? 1 : -1;
multiplier = 1 + sign * hvdc.getConverterStation1().getLossFactor() / 100;
}

private double p1() {
return multiplier * (p0 + k * (ph1() - ph2()));
return (isController() ? 1 : getLossMultiplier()) * (p0 + k * (ph1() - ph2()));
}

private boolean isController() {
return (ph1() - ph2()) >= 0 ? true : false;
}

private double dp1dv1() {
Expand All @@ -41,7 +39,7 @@ private double dp1dv2() {
}

private double dp1dph1() {
return multiplier * k;
return (isController() ? 1 : getLossMultiplier()) * k;
}

private double dp1dph2() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@
*/
public class HvdcAcEmulationSide2ActiveFlowEquationTerm extends AbstractHvdcAcEmulationFlowEquationTerm {

private double sign;

private double multiplier;

public HvdcAcEmulationSide2ActiveFlowEquationTerm(LfHvdc hvdc, LfBus bus1, LfBus bus2, VariableSet<AcVariableType> variableSet) {
super(hvdc, bus1, bus2, variableSet);
sign = hvdc.getConverterStation2().isRectifier() ? 1 : -1;
multiplier = 1 + sign * hvdc.getConverterStation2().getLossFactor() / 100;
}

private double p2() {
return -multiplier * (p0 + k * (ph1() - ph2()));
return -(isController() ? 1 : getLossMultiplier()) * (p0 + k * (ph1() - ph2()));
}

private boolean isController() {
return (ph1() - ph2()) < 0 ? true : false;
}

private double dp1dv1() {
Expand All @@ -41,7 +39,7 @@ private double dp1dv2() {
}

private double dp1dph1() {
return -multiplier * k;
return -(isController() ? 1 : getLossMultiplier()) * k;
}

private double dp1dph2() {
Expand Down

0 comments on commit bec9403

Please sign in to comment.