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

Fix disabled voltage control equations #772

Merged
merged 4 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ static <T extends LfElement> void updateRemoteVoltageControlEquations(VoltageCon
.setActive(false);
equationSystem.getEquation(controllerElement.getNum(), ctrlEqType)
.orElseThrow()
.setActive(false);
.setActive(!controllerElement.isDisabled());
Copy link
Member

Choose a reason for hiding this comment

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

There is something, I don't understand: vl.isDisabled() check that controlled bus and ALL controller buses are disabled, so this should be always false and equivalent to actual code.

Copy link
Member

Choose a reason for hiding this comment

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

Understood, check should not be done on voltage control but just the controlled bus.
I pushed a fix.

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure of your fix. Or it works because in case of all controllers disabled we go to the last else?

Copy link
Member

Choose a reason for hiding this comment

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

It works because it does not check merged voltage control

}
} else {
if (voltageControl.isHidden()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -981,4 +981,22 @@ public static Network createWithStaticVarCompensator() {
.add();
return network;
}

public static Network createWithSimpleRemoteControl() {
Network network = Network.create("remoteControl", "code");
Bus b1 = createBus(network, "b1");
Bus b2 = createBus(network, "b2");
Bus b3 = createBus(network, "b3");
Bus b4 = createBus(network, "b4");
createGenerator(b2, "g2", 2, 1);
createGenerator(b3, "g3", 2, 1);
createGenerator(b4, "g4", 2, 1);
createLoad(b3, "l3", 5, 1);
createLoad(b1, "l1", 1, 1);
createLine(network, b1, b2, "l12", 0.0);
createLine(network, b2, b4, "l24", 0.01);
createLine(network, b4, b3, "l43", 0.01);
createLine(network, b3, b1, "l31", 0.0);
return network;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1850,4 +1850,17 @@ void testLoadContingencyNoImpact() {
result = runSecurityAnalysis(network, contingencies);
assertEquals(2, result.getPostContingencyResults().size());
}

@Test
void testWithVoltageRemoteControl() {
Network network = VoltageControlNetworkFactory.createWithSimpleRemoteControl();
network.getGenerator("g4").setRegulatingTerminal(network.getLoad("l1").getTerminal()); // remote control.
List<Contingency> contingencies = List.of(new Contingency("contingency",
List.of(new BranchContingency("l12"), new BranchContingency("l31"))));
LoadFlowParameters lfParameters = new LoadFlowParameters();
setSlackBusId(lfParameters, "b4_vl");
SecurityAnalysisParameters securityAnalysisParameters = new SecurityAnalysisParameters();
securityAnalysisParameters.setLoadFlowParameters(lfParameters);
SecurityAnalysisResult result = runSecurityAnalysis(network, contingencies, Collections.emptyList(), securityAnalysisParameters);
}
}