-
Notifications
You must be signed in to change notification settings - Fork 0
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
check null values for droop and P0 #512
check null values for droop and P0 #512
Conversation
…ol in vsc modification Signed-off-by: Etienne LESOT <[email protected]>
…werControl Signed-off-by: Etienne LESOT <[email protected]>
Signed-off-by: Etienne LESOT <[email protected]>
Signed-off-by: Etienne LESOT <[email protected]>
src/main/java/org/gridsuite/modification/server/modifications/VscModification.java
Outdated
Show resolved
Hide resolved
src/main/java/org/gridsuite/modification/server/modifications/VscModification.java
Outdated
Show resolved
Hide resolved
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 may be wrong, you can ask to a PO but I think that you should check the hvcdc values as well, not juste the network modification values. Explication :
HVDC creation :
A you can see I have a k and P0 value but disables angle droop.
Now modifciation of this HVDC :
As you can see I activate angle droop but didn't change the values. And they are still there.
The result is a failure even if there are all the required values :
boolean isEnabledAngleDroopActivePowerControl = modificationInfos.getAngleDroopActivePowerControl() != null | ||
&& modificationInfos.getAngleDroopActivePowerControl().getValue(); | ||
if (isEnabledAngleDroopActivePowerControl) { |
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 think all of this may be included directly inside checkDroopModification.
Why would you do half of the checking inside the function and the other half outside of 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.
YES
In the new commit 315a18b, the extension is in one of two cases: In addition, when applying the modification, if the extension not yet existed, we should check whether the power control is activated before creating a new extension, see https://github.com/gridsuite/network-modification-server/pull/512/files#diff-73327289c738f5205af82fc66dfecb066c50a235fdc0ae36feda05cbed59d8a4R255 In creation, the same rule 2 is used, see f3f5a71 |
return modificationInfos.getAngleDroopActivePowerControl() != null && | ||
modificationInfos.getAngleDroopActivePowerControl() && |
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
return modificationInfos.getAngleDroopActivePowerControl() != null && | |
modificationInfos.getAngleDroopActivePowerControl() && | |
return Boolean.TRUE.equals(modificationInfos.getAngleDroopActivePowerControl())) && |
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.
DONE
private void checkDroop() { | ||
// extension is not enabled => ignore check inside fields | ||
if (modificationInfos.getAngleDroopActivePowerControl() == null || !modificationInfos.getAngleDroopActivePowerControl()) { | ||
return; |
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.
It may be good to send an error if (modificationInfos.getDroop() != null || modificationInfos.getP0() != null) { (because the network modification has weird ignored values). But not sure that it is required, see with a P0.
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.
These modification infos will be ignored if the control is not activated (i.e. no extension created). We can show a warning but not here because the implementation of check method is for a blocking issue, in other word we throw an exception that automatically captured and then created an error report.
For the simplicity, I do not implement a warning when do not create an extension while Droop or P0 is provided.
However, I modified the check as yours above comment:
// extension is not enabled => ignore check inside fields
if (!Boolean.TRUE.equals(modificationInfos.getAngleDroopActivePowerControl())) {
return;
}
|
||
checkDroopModification(); | ||
private void checkDroopModification(HvdcLine hvdcLine) { | ||
// the extension has already existed |
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.
// the extension has already existed | |
// the extension already exists |
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.
DONE
// the extension has not yet existed and the modification want to enable the extension => | ||
// should verify whether all fields have been filled | ||
boolean isEnabledAngleDroopActivePowerControl = modificationInfos.getAngleDroopActivePowerControl() != null | ||
&& modificationInfos.getAngleDroopActivePowerControl().getValue(); |
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.
// the extension has not yet existed and the modification want to enable the extension => | |
// should verify whether all fields have been filled | |
boolean isEnabledAngleDroopActivePowerControl = modificationInfos.getAngleDroopActivePowerControl() != null | |
&& modificationInfos.getAngleDroopActivePowerControl().getValue(); | |
// the extension doesn't exist yet and the modification wants to enable the extension => | |
// should verify whether all fields have been filled | |
boolean isEnabledAngleDroopActivePowerControl = Boolean.TRUE.equals(modificationInfos.getAngleDroopActivePowerControl())); |
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.
modificationInfos.getAngleDroopActivePowerControl() is an AttributeModification and not a Boolean, so based on yours comment, I have changed to:
boolean isEnabledAngleDroopActivePowerControl = modificationInfos.getAngleDroopActivePowerControl() != null
&& Boolean.TRUE.equals(modificationInfos.getAngleDroopActivePowerControl().getValue());
DONE
public static final String DROOP_FIELD = "Droop"; | ||
public static final String DROOP_AND_P0_FIELD = "Droop and P0"; | ||
public static final String P0_FIELD = "P0"; | ||
public static final String ACTIVE_POWER_CONTROL_EXTENSION_CREATE_ERROR_MESSAGE = "Both %s are required when angle droop active power control is activated to modify the equipment with id=%s"; |
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.
ACTIVE_POWER_CONTROL_EXTENSION_MODIFY_ERROR_MESSAGE
variable name doesn't really fit (this is a modification).
It is also identical to the other ACTIVE_POWER_CONTROL_EXTENSION_MODIFY_ERROR_MESSAGE in the creation file so it may use it instead of cerating a new one.
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!
I have removed the last part of message in modification which contains the id of equipment, I think we do not need the id at this level because the report of the whole modification contains already the id.
Now we can share the message between creation and modification.
public static final String DROOP_ACTIVE_POWER_CONTROL_P0_DROOP_REQUIRED_ERROR_MSG = "Both Droop and P0 are required when angle droop active power control is activated";
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.
DONE
Quality Gate passedIssues Measures |
check null values for droop and P0 for hvdcAngleDroopActivePowerControl in vsc modification