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 AC voltage sensitivities #539

Merged
merged 6 commits into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -994,4 +994,27 @@ void testContingencyOnHvdcVsc2() {
assertEquals(result2.getBranchFlow1FunctionReferenceValue(null, "l25"), result.getBranchFlow1FunctionReferenceValue("hvdc34", "l25"), LoadFlowAssert.DELTA_POWER);
assertEquals(result2.getBranchFlow1FunctionReferenceValue(null, "l56"), result.getBranchFlow1FunctionReferenceValue("hvdc34", "l56"), LoadFlowAssert.DELTA_POWER);
}

@Test
void testVoltageSensitivityConnectivityLoss() {
Network network = ConnectedComponentNetworkFactory.createTwoComponentWithGeneratorOnOneSide();

SensitivityAnalysisParameters sensiParameters = createParameters(false, "b1_vl_0", true);
sensiParameters.getLoadFlowParameters().setBalanceType(LoadFlowParameters.BalanceType.PROPORTIONAL_TO_GENERATION_P_MAX);

List<Contingency> contingencies = List.of(new Contingency("l34", new BranchContingency("l34")), new Contingency("l13+l23", new BranchContingency("l13"), new BranchContingency("l23")));

List<SensitivityFactor> factors = List.of(createBusVoltagePerTargetV("b4", "g3", "l34"), createBusVoltagePerTargetV("b1", "g3", "l13+l23"), createBusVoltagePerTargetV("b4", "g3", "l13+l23"));

SensitivityAnalysisResult result = sensiRunner.run(network, factors, contingencies, Collections.emptyList(), sensiParameters);

assertEquals(3, result.getValues().size());

assertEquals(0.0, result.getBusVoltageSensitivityValue("l34", "g3", "b4"));
assertEquals(Double.NaN, result.getBusVoltageFunctionReferenceValue("l34", "b4"));
assertEquals(0.0, result.getBusVoltageSensitivityValue("l13+l23", "g3", "b1"));
assertEquals(0.9798, result.getBusVoltageFunctionReferenceValue("l13+l23", "b1"), LoadFlowAssert.DELTA_V);
assertEquals(Double.NaN, result.getBusVoltageSensitivityValue("l13+l23", "g3", "b4"));
assertEquals(Double.NaN, result.getBusVoltageFunctionReferenceValue("l13+l23", "b4"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1045,4 +1045,26 @@ void lineWithDifferentNominalVoltageTest() {
assertEquals(602.302, network.getTwoWindingsTransformer("NHV2_NLOAD").getTerminal1().getP(), LoadFlowAssert.DELTA_POWER);
assertEquals(-601.430, network.getTwoWindingsTransformer("NHV2_NLOAD").getTerminal2().getP(), LoadFlowAssert.DELTA_POWER);
}

@Test
void testWithPvPqSwitch() {
SensitivityAnalysisParameters sensiParameters = createParameters(false, "b1_vl_0", false);
sensiParameters.getLoadFlowParameters().setBalanceType(LoadFlowParameters.BalanceType.PROPORTIONAL_TO_GENERATION_P_MAX);

// this network has no G or B, so we should be very close to DC results
Network network = FourBusNetworkFactory.createBaseNetwork();
network.getLoad("d2").setQ0(0.4);
network.getLoad("d3").setQ0(1.6);
network.getGenerator("g4").newMinMaxReactiveLimits().setMinQ(-0.5).setMaxQ(0.5).add();

runLf(network, sensiParameters.getLoadFlowParameters());

List<SensitivityFactor> factors = List.of(createBusVoltagePerTargetV("b3", "g4"));

SensitivityAnalysisResult result = sensiRunner.run(network, factors, Collections.emptyList(), Collections.emptyList(), sensiParameters);

assertEquals(1, result.getValues().size());

assertEquals(0.0, result.getBusVoltageSensitivityValue("g4", "b3"));
}
}