Skip to content

Commit

Permalink
move participationFactor into AbstractLfGenerator
Browse files Browse the repository at this point in the history
Signed-off-by: Caio Luke <caio.luke@artelys.com>
  • Loading branch information
Caio Luke committed Jan 23, 2023
1 parent c269335 commit 99d0354
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ default double getDroop() {
return 0;
}

void setParticipationFactor(double participationFactor);

default double getParticipationFactor() {
return 0.0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public abstract class AbstractLfGenerator extends AbstractPropertyBag implements

private static final double POWER_EPSILON_SI = 1e-4;

private double participationFactor = 0.0;

protected static final double DEFAULT_DROOP = 4; // why not

protected final LfNetwork network;
Expand Down Expand Up @@ -302,6 +304,16 @@ public void setParticipating(boolean participating) {
// nothing to do
}

@Override
public void setParticipationFactor(double participationFactor) {
this.participationFactor = participationFactor;
}

@Override
public double getParticipationFactor() {
return participationFactor;
}

protected boolean checkActivePowerControl(double targetP, double minP, double maxP, double participationFactor,
LfNetworkParameters parameters, LfNetworkLoadingReport report) {
boolean participating = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ public final class LfBatteryImpl extends AbstractLfGenerator {

private double droop;

private double participationFactor;

private LfBatteryImpl(Battery battery, LfNetwork network, LfNetworkParameters parameters, LfNetworkLoadingReport report) {
super(network, battery.getTargetP());
this.batteryRef = new Ref<>(battery);
Expand All @@ -41,10 +39,10 @@ private LfBatteryImpl(Battery battery, LfNetwork network, LfNetworkParameters pa
if (activePowerControl.getDroop() != 0) {
droop = activePowerControl.getDroop();
}
participationFactor = activePowerControl.getParticipationFactor();
this.setParticipationFactor(activePowerControl.getParticipationFactor());
}

if (!checkActivePowerControl(battery.getTargetP(), battery.getMinP(), battery.getMaxP(), participationFactor, parameters, report)) {
if (!checkActivePowerControl(battery.getTargetP(), battery.getMinP(), battery.getMaxP(), this.getParticipationFactor(), parameters, report)) {
participating = false;
}
}
Expand Down Expand Up @@ -101,11 +99,6 @@ public double getDroop() {
return droop;
}

@Override
public double getParticipationFactor() {
return participationFactor;
}

@Override
public void updateState() {
var battery = getBattery();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ public final class LfGeneratorImpl extends AbstractLfGenerator {

private double droop;

private double participationFactor;

private LfGeneratorImpl(Generator generator, LfNetwork network, LfNetworkParameters parameters, LfNetworkLoadingReport report) {
super(network, generator.getTargetP());
this.generatorRef = new Ref<>(generator);
Expand All @@ -45,10 +43,10 @@ private LfGeneratorImpl(Generator generator, LfNetwork network, LfNetworkParamet
if (withDroop) {
droop = activePowerControl.getDroop();
}
participationFactor = activePowerControl.getParticipationFactor();
this.setParticipationFactor(activePowerControl.getParticipationFactor());
}

if (!checkActivePowerControl(generator.getTargetP(), generator.getMinP(), generator.getMaxP(), participationFactor, parameters, report)) {
if (!checkActivePowerControl(generator.getTargetP(), generator.getMinP(), generator.getMaxP(), this.getParticipationFactor(), parameters, report)) {
participating = false;
}

Expand Down Expand Up @@ -130,11 +128,6 @@ public double getDroop() {
return droop;
}

@Override
public double getParticipationFactor() {
return participationFactor;
}

@Override
public void updateState() {
var generator = getGenerator();
Expand Down

0 comments on commit 99d0354

Please sign in to comment.