-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discrete control optional #319
Conversation
308216f
to
92ff1f7
Compare
80f12a6
to
e93032e
Compare
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
e93032e
to
6e8e01a
Compare
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
@@ -35,11 +37,12 @@ public OuterLoopStatus check(OuterLoopContext context, Reporter reporter) { | |||
|
|||
if (context.getIteration() == 0) { | |||
for (LfBus bus : context.getNetwork().getBuses()) { | |||
if (bus.isDiscreteVoltageControlled()) { | |||
Optional<DiscreteVoltageControl> dvc = bus.getDiscreteVoltageControl().filter(dvc0 -> bus.isDiscreteVoltageControlled()); | |||
if (dvc.isPresent()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you hare change for a more explicit name such as voltageControl
because you use it during several lines? And keep dvc
for the filter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in fact I changed the code to have something similar to PhaseControlOuterLoop
, which is clearer at the cost of creating a list of enabled voltage controls.
EquationTerm vTerm = EquationTerm.createVariableTerm(bus, VariableType.BUS_V, variableSet, bus.getV().eval()); | ||
equationSystem.createEquation(bus.getNum(), EquationType.BUS_V).addTerm(vTerm); | ||
bus.setV(vTerm); | ||
bus.getDiscreteVoltageControl() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You impress me here!
return bus.getDiscreteVoltageControl().filter(dvc -> bus.isDiscreteVoltageControlled()) | ||
.map(DiscreteVoltageControl::getTargetValue) | ||
.orElse(getVoltageControlledTargetValue(bus) | ||
.orElse(Double.NaN)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation issue here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but it's a bit unclear, so I changed it to
.orElse(
getVoltageControlledTargetValue(bus).orElse(Double.NaN)
);
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Kudos, SonarCloud Quality Gate passed! |
Please check if the PR fulfills these requirements (please use
'[x]'
to check the checkboxes, or submit the PR and then click the checkboxes)Does this PR already have an issue describing the problem ?
No
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Refactor
What is the current behavior? (You can also link to an open issue here)
LfBus::getDiscreteVoltageControl
andLfBranch::getDiscreteVoltageControl
returnnull
if no controlWhat is the new behavior (if this is a feature change)?
the
getDiscreteVoltageControl
return anOptional<DiscreteVoltageControl>
Does this PR introduce a breaking change or deprecate an API?
No
Other information:
Done to have something similar to VoltageControl