-
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
Target vector update refactoring #262
Conversation
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.
Nice exending the use of network listener. Just a couple of comments
} | ||
|
||
public double[] toArray() { | ||
if (status == Status.VALID) { |
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.
Just being meticulous, but as you're always returning this.array
, I'd maybe add an updateArray
method, and call createArray
in case of a vector invalid.
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.
Yes, done.
@@ -102,7 +102,7 @@ public DcLoadFlowResult run(Reporter reporter) { | |||
|
|||
equationSystem.updateEquations(x); | |||
|
|||
this.targetVector = equationSystem.createTargetVector(); | |||
this.targetVector = TargetVector.createArray(network, equationSystem); |
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.
Shouldn't we do something similar for DC, later maybe? Indeed, I think that the target vector update could be used for sensitivity analyses, where we could avoid to create the vector several times. Not sure the gain is interesting though.
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.
Maybe it could be interesting but not as much as for AC power flow because for DC power we have just either one or two iteration depending on stack distribution activated or not. For AC power we have often a lot of iterations and number of target vector updates, that is why it is in this case very interesting to automate the update. So yes let's see that later.
@@ -283,7 +297,14 @@ public double getLoadTargetQ() { | |||
|
|||
@Override | |||
public void setLoadTargetQ(double loadTargetQ) { | |||
this.loadTargetQ = loadTargetQ * PerUnit.SB; | |||
double newLoadTargetQ = loadTargetQ * PerUnit.SB; | |||
if (newLoadTargetQ != this.loadTargetQ) { |
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.
I realized this old/new test is only there because of restoring all bus states instead of only those which have changed, maybe I should have a look there if there's something to do. and if it's worth it.
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.
Indeed we could probably check if restoration is relevant on BusState/BranchState side but in any case I think it is safer to add this guard here.
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@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 ? If so, link to this issue using
'#XXX'
and skip the restWhat kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
What is the current behavior? (You can also link to an open issue here)
What is the new behavior (if this is a feature change)?
Does this PR introduce a breaking change or deprecate an API? If yes, check the following:
Other information:
(if any of the questions/checkboxes don't apply, please delete them entirely)