Skip to content
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

Merged
merged 18 commits into from
Aug 26, 2024

Conversation

EtienneLt
Copy link
Contributor

check null values for droop and P0 for hvdcAngleDroopActivePowerControl in vsc modification

@EtienneLt EtienneLt self-assigned this Aug 6, 2024
@EtienneLt EtienneLt requested a review from thangqp August 8, 2024 07:45
@thangqp thangqp self-assigned this Aug 20, 2024
Copy link
Contributor

@Mathieu-Deharbe Mathieu-Deharbe left a 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 :
image

A you can see I have a k and P0 value but disables angle droop.

Now modifciation of this HVDC :

image

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 :

image

Comment on lines 65 to 67
boolean isEnabledAngleDroopActivePowerControl = modificationInfos.getAngleDroopActivePowerControl() != null
&& modificationInfos.getAngleDroopActivePowerControl().getValue();
if (isEnabledAngleDroopActivePowerControl) {
Copy link
Contributor

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 ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YES

@thangqp
Copy link
Contributor

thangqp commented Aug 22, 2024

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 : image

A you can see I have a k and P0 value but disables angle droop.

Now modifciation of this HVDC :

image

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 :

image

In the new commit 315a18b, the extension is in one of two cases:
1/ If already existed, P0 is required if Droop is filled (keep the same behaviour as before)
2/ If not yet existed, in case of activating power control, both P0 and Droop are required, otherwise the check is ignored

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

Comment on lines 138 to 139
return modificationInfos.getAngleDroopActivePowerControl() != null &&
modificationInfos.getAngleDroopActivePowerControl() &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe

Suggested change
return modificationInfos.getAngleDroopActivePowerControl() != null &&
modificationInfos.getAngleDroopActivePowerControl() &&
return Boolean.TRUE.equals(modificationInfos.getAngleDroopActivePowerControl())) &&

Copy link
Contributor

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;
Copy link
Contributor

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.

Copy link
Contributor

@thangqp thangqp Aug 26, 2024

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// the extension has already existed
// the extension already exists

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DONE

Comment on lines 80 to 83
// 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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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()));

Copy link
Contributor

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";
Copy link
Contributor

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.

Copy link
Contributor

@thangqp thangqp Aug 26, 2024

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";

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DONE

Copy link

@thangqp thangqp merged commit 4d9293c into main Aug 26, 2024
3 checks passed
@thangqp thangqp deleted the check-null-values-for-hvdcAngleDroopActivePowerControl branch August 26, 2024 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants