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 P/Q targets of converter stations in optimization #94

Open
wants to merge 13 commits into
base: generators-6-points-diagram
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion docs/optimizer/inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
## Network data

Files with the prefix `ampl_` contain the data and the parameters of the network on which the reactive OPF is executed.
These files are obtained by using the [PowSyBl AMPL export](inv:powsyblcore:*:*:#grid_exchange_formats/ampl/export), which is the default version.
[V2 of the extended version of PowSyBl AMPL export](https://github.com/powsybl/powsybl-core/blob/main/ampl-converter/src/main/java/com/powsybl/ampl/converter/version/ExtendedAmplExporterV2.java), which is the default version.

Note that from release `0.10.0` of OpenReac, the active target of VSC and LCC converter stations is calculated using HVDC line active set point
and the converter mode, both specified in `ampl_network_hvdc.txt`. The losses related to rectifier/inverter conversion, and HVDC line **are ignored**.

## Configuration of the run

Expand Down
4 changes: 2 additions & 2 deletions open-reac/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
<description>OpenReac optimizer</description>

<properties>
<powsybl-core.version>6.5.1</powsybl-core.version>
<powsybl-open-loadflow.version>1.13.2</powsybl-open-loadflow.version>
<powsybl-core.version>6.6.0</powsybl-core.version>
<powsybl-open-loadflow.version>1.14.1</powsybl-open-loadflow.version>
</properties>

<developers>
Expand Down
6 changes: 3 additions & 3 deletions open-reac/src/main/resources/openreac/acopf.mod
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ sum{(qq,k,n) in BRANCHCC} base100MVA * V[k] * Red_Tran_Act_Dir[qq,k,n]
# Loads
+ sum{(c,k) in LOADCC} load_PFix[1,c,k] # Fixed value
# VSC converters
+ sum{(v,k) in VSCCONVON} vscconv_P0[1,v,k] # Fixed value
+ sum{(v,k) in VSCCONVON} vscconv_targetP[v] # Fixed value
# LCC converters
+ sum{(l,k) in LCCCONVON} lccconv_P0[1,l,k] # Fixed value
+ sum{(l,k) in LCCCONVON} lccconv_targetP[l] # Fixed value
= 0; # No slack variables for active power. If data are really too bad, may not converge.


Expand Down Expand Up @@ -220,7 +220,7 @@ sum{(qq,k,n) in BRANCHCC} base100MVA * V[k] * Red_Tran_Rea_Dir[qq,k,n]
# VSC converters
- sum{(v,k) in VSCCONVON} vscconv_qvar[v,k]
# LCC converters
+ sum{(l,k) in LCCCONVON} lccconv_Q0[1,l,k] # Fixed value
+ sum{(l,k) in LCCCONVON} lccconv_q0[1,l,k] # Fixed value
# Slack variables
+ if k in BUSCC_SLACK then
(- base100MVA * V[k]^2 * slack1_shunt_B[k] # Homogeneous to a generation of reactive power (condensator)
Expand Down
41 changes: 36 additions & 5 deletions open-reac/src/main/resources/openreac/commons.mod
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,56 @@ set BATTERYCC := setof {(1,b,n) in BATTERY : n in BUSCC} (b,n);
# Warning: units with Ptarget=0 are considered as out of order
set UNITON := {(g,n) in UNITCC : abs(unit_Pc[1,g,n]) >= Pnull};

# Active and reactive targets of converter stations
# Warning: the losses are ignored
set LCCCONV_NUM := setof{(t,lcc,bus) in LCCCONV}lcc;
set VSCCONV_NUM := setof{(t,vsc,bus) in VSCCONV}vsc;
param lccconv_targetP {LCCCONV_NUM};
param vscconv_targetP {VSCCONV_NUM};
for {(1,h) in HVDC} {
# case of VSC converter stations
if (hvdc_type[1,h] == 1) then {
if (hvdc_convertersMode[1,h] == "SIDE_1_RECTIFIER_SIDE_2_INVERTER") then {
let vscconv_targetP[hvdc_conv1[1,h]] := hvdc_targetP[1,h];
let vscconv_targetP[hvdc_conv2[1,h]] := -hvdc_targetP[1,h];
} else {
let vscconv_targetP[hvdc_conv1[1,h]] := -hvdc_targetP[1,h];
let vscconv_targetP[hvdc_conv2[1,h]] := hvdc_targetP[1,h];
}
}
# case of LCC converter stations
if (hvdc_type[1,h] == 2) then {
if (hvdc_convertersMode[1,h] == "SIDE_1_RECTIFIER_SIDE_2_INVERTER") then {
let lccconv_targetP[hvdc_conv1[1,h]] := hvdc_targetP[1,h];
let lccconv_targetP[hvdc_conv2[1,h]] := -hvdc_targetP[1,h];
} else {
let lccconv_targetP[hvdc_conv1[1,h]] := -hvdc_targetP[1,h];
let lccconv_targetP[hvdc_conv2[1,h]] := hvdc_targetP[1,h];
}
}
}
check {lcc in LCCCONV_NUM}: lccconv_targetP[lcc] != NaN;
check {vsc in VSCCONV_NUM}: vscconv_targetP[vsc] != NaN;

#
# VSC converter stations
#
set VSCCONVON := setof{(t,v,n) in VSCCONV:
n in BUSCC
and abs(vscconv_P0[t,v,n] ) <= PQmax
and abs(vscconv_targetP[v]) <= PQmax
and abs(vscconv_Pmin[t,v,n]) <= PQmax
and abs(vscconv_Pmax[t,v,n]) <= PQmax
and vscconv_P0[t,v,n] >= vscconv_Pmin[t,v,n]
and vscconv_P0[t,v,n] <= vscconv_Pmax[t,v,n]
and vscconv_targetP[v] >= vscconv_Pmin[t,v,n]
and vscconv_targetP[v] <= vscconv_Pmax[t,v,n]
} (v,n);

#
# LCC converter stations
#
set LCCCONVON := setof{(t,l,n) in LCCCONV:
n in BUSCC
and abs(lccconv_P0[1,l,n]) <= PQmax
and abs(lccconv_Q0[1,l,n]) <= PQmax
and abs(lccconv_targetP[l]) <= PQmax
and abs(lccconv_q0[1,l,n]) <= PQmax
} (l,n);


Expand Down
6 changes: 3 additions & 3 deletions open-reac/src/main/resources/openreac/connected_component.run
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,16 @@ if 1 in LOG_INFO then {
let temp1 := sum{(c,n) in LOADCC} load_PFix[1,c,n];
let temp2 := sum{(g,n) in UNITON} unit_Pc[1,g,n];
let temp2 := temp2 + sum{(b,n) in BATTERYCC} battery_p0[1,b,n];
let temp3 := (sum{(vscconv,n) in VSCCONVON} vscconv_P0[1,vscconv,n])+(sum{(l,k) in LCCCONVON} lccconv_P0[1,l,k]);
let temp3 := (sum{(vscconv,n) in VSCCONVON} vscconv_targetP[vscconv])+(sum{(l,k) in LCCCONVON} lccconv_targetP[l]);
let global_initial_losses_ratio := (temp2-temp1-temp3)/(temp1+temp3);

printf{LOG_INFO} "HVDC injections (homogeneous to loads):\n";
for {(v,n) in VSCCONVON}
printf{LOG_INFO} "VSC converter %Q in %Q: P0=%.1fMW is fixed, Q is variable\n",
vscconv_id[1,v,n],substation_id[1,bus_substation[1,n]],vscconv_P0[1,v,n];
vscconv_id[1,v,n],substation_id[1,bus_substation[1,n]],vscconv_targetP[v];
for {(l,n) in LCCCONVON}
printf{LOG_INFO} "LCC converter %Q in %Q: P0=%.1fMW is fixed, Q0=%.1fMvar is fixed\n",
lccconv_id[1,l,n],substation_id[1,bus_substation[1,n]],lccconv_P0[1,l,n],lccconv_Q0[1,l,n];
lccconv_id[1,l,n],substation_id[1,bus_substation[1,n]],lccconv_targetP[l],lccconv_q0[1,l,n];
printf{LOG_INFO} "Sum of HVDC conv. H: %.0f MW\n", temp3;
printf{LOG_INFO} "Sum of loads C: %.0f MW\n", temp1;
printf{LOG_INFO} "Sum of generations P: %.0f MW\n", temp2;
Expand Down
4 changes: 2 additions & 2 deletions open-reac/src/main/resources/openreac/dcopf.mod
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ subject to ctr_balance{PROBLEM_DCOPF, n in BUSCC}:
+ sum{(c,n) in LOADCC} load_PFix[1,c,n]
+ sum{(qq,n,m) in BRANCHCC} activeflow[qq,n,m] # active power flow outgoing on branch qq at bus n
- sum{(qq,m,n) in BRANCHCC} activeflow[qq,m,n] # active power flow entering in bus n on branch qq
+ sum{(vscconv,n) in VSCCONVON} vscconv_P0[1,vscconv,n]
+ sum{(l,n) in LCCCONVON} lccconv_P0[1,l,n]
+ sum{(vscconv,n) in VSCCONVON} vscconv_targetP[vscconv]
+ sum{(l,n) in LCCCONVON} lccconv_targetP[l]
=
balance_pos[n] - balance_neg[n];

Expand Down
2 changes: 1 addition & 1 deletion open-reac/src/main/resources/openreac/dcopf.run
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ for {(g,n) in UNITON : abs(P_dcopf[g,n]-unit_Pc[1,g,n]) >= temp2*0.99}
let temp1 := sum{(c,n) in LOADCC} load_PFix[1,c,n];
let temp2 := sum{(g,n) in UNITON} P_dcopf[g,n];
let temp2 := temp2 + sum{(b,n) in BATTERYCC} battery_p0[1,b,n];
let temp3 := (sum{(vscconv,n) in VSCCONVON} vscconv_P0[1,vscconv,n])+(sum{(l,k) in LCCCONVON} lccconv_P0[1,l,k]);
let temp3 := (sum{(vscconv,n) in VSCCONVON} vscconv_targetP[vscconv])+(sum{(l,k) in LCCCONVON} lccconv_targetP[l]);
printf{LOG_INFO} "Sum of HVDC conv. H: %.0f MW\n", temp3;
printf{LOG_INFO} "Sum of loads C: %.0f MW\n", temp1;
printf{LOG_INFO} "Sum of generations P: %.0f MW\n", temp2;
Expand Down
5 changes: 5 additions & 0 deletions open-reac/src/main/resources/openreac/iidm_importer.mod
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ param unit_Qp {UNIT};
param unit_vregul {UNIT} symbolic; # Does unit do voltage regulation, or PQ bus?
param unit_vregul_bus {UNIT} integer; # Bus regulated by unit, if it does voltage regulation
param unit_Vc {UNIT}; # Voltage set point (in case of voltage regulation)
param unit_condenser {UNIT} symbolic; # Is unit a condenser
param unit_Pc {UNIT}; # Active power set point
param unit_Qc {UNIT}; # Rective power set point (in case no voltage regulation)
param unit_fault {UNIT};
Expand Down Expand Up @@ -417,6 +418,7 @@ check {(t,cs,n) in VSCCONV}: vscconv_qP[t,cs,n] <= vscconv_QP[t,cs,n];
set LCCCONV dimen 3; # [variant, num, bus]
param lccconv_possiblebus {LCCCONV} integer;
param lccconv_substation {LCCCONV} integer;
param lccconv_q0 {LCCCONV}; # Load target q of lcc converter station
param lccconv_loss_factor {LCCCONV};
param lccconv_power_factor{LCCCONV};
param lccconv_fault {LCCCONV};
Expand All @@ -440,7 +442,10 @@ param hvdc_conv2 {HVDC} integer;
param hvdc_r {HVDC};
param hvdc_Vnom {HVDC};
param hvdc_convertersMode {HVDC} symbolic;
param hvdc_ac_emul {HVDC} symbolic; # Is the line emulating in AC
param hvdc_targetP {HVDC};
param hvdc_p0 {HVDC}; # Active power offset of ac emulation
param hvdc_k {HVDC};
param hvdc_Pmax {HVDC};
param hvdc_fault {HVDC};
param hvdc_curative {HVDC};
Expand Down
14 changes: 7 additions & 7 deletions open-reac/src/main/resources/openreac/reactiveopf.dat
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ param: SUBSTATIONS: substation_horizon substation_fodist substation_Vnomi substa
param: BUS: bus_substation bus_CC bus_SC bus_V0 bus_angl0 bus_injA bus_injR bus_slack bus_fault bus_curative bus_id := include ampl_network_buses.txt;

# ampl_network_generators.txt
#"variant" "num" "bus" "con. bus" "substation" "minP (MW)" "maxP (MW)" "minQmaxP (MVar)" "minQ0 (MVar)" "minQminP (MVar)" "maxQmaxP (MVar)" "maxQ0 (MVar)" "maxQminP (MVar)" "v regul." "v regul. bus" "targetV (pu)" "targetP (MW)" "targetQ (MVar)" "fault" "curative" "id" "description" "P (MW)" "Q (MVar)"
param: UNIT: unit_potentialbus unit_substation unit_Pmin unit_Pmax unit_qP unit_qp0 unit_qp unit_QP unit_Qp0 unit_Qp unit_vregul unit_vregul_bus unit_Vc unit_Pc unit_Qc unit_fault unit_curative unit_id unit_name unit_P0 unit_Q0 := include ampl_network_generators.txt;
#"variant" "num" "bus" "con. bus" "substation" "minP (MW)" "maxP (MW)" "minQmaxP (MVar)" "minQ0 (MVar)" "minQminP (MVar)" "maxQmaxP (MVar)" "maxQ0 (MVar)" "maxQminP (MVar)" "v regul." "v regul. bus" "targetV (pu)" "condenser" "targetP (MW)" "targetQ (MVar)" "fault" "curative" "id" "description" "P (MW)" "Q (MVar)"
param: UNIT: unit_potentialbus unit_substation unit_Pmin unit_Pmax unit_qP unit_qp0 unit_qp unit_QP unit_Qp0 unit_Qp unit_vregul unit_vregul_bus unit_Vc unit_condenser unit_Pc unit_Qc unit_fault unit_curative unit_id unit_name unit_P0 unit_Q0 := include ampl_network_generators.txt;

# ampl_network_loads.txt
#"variant" "num" "bus" "substation" "p (MW)" "q (MVar)" "fault" "curative" "id" "description" "p (MW)" "q (MVar)"
Expand All @@ -41,7 +41,7 @@ param: SHUNT: shunt_possiblebus shunt_substation shunt_valmin shunt_valmax shunt
param: SVC: svc_possiblebus svc_substation svc_bmin svc_bmax svc_vregul svc_vregul_bus svc_targetV svc_targetQ svc_fault svc_curative svc_id svc_description svc_P0 svc_Q0 := include ampl_network_static_var_compensators.txt;

# ampl_network_batteries.txt
#"variant" "num" "bus" "con. bus" "substation" "p0 (MW)" "q0 (MW)" "minP (MW)" "maxP (MW)" "minQmaxP (MVar)" "minQ0 (MVar)" "minQminP (MVar)" "maxQmaxP (MVar)" "maxQ0 (MVar)" "maxQminP (MVar)" "fault" "curative" "id" "description" "P (MW)" "Q (MVar)"
#"variant" "num" "bus" "con. bus" "substation" "p0 (MW)" "q0 (MVar)" "minP (MW)" "maxP (MW)" "minQmaxP (MVar)" "minQ0 (MVar)" "minQminP (MVar)" "maxQmaxP (MVar)" "maxQ0 (MVar)" "maxQminP (MVar)" "fault" "curative" "id" "description" "P (MW)" "Q (MVar)"
param: BATTERY: battery_possiblebus battery_substation battery_p0 battery_q0 battery_Pmin battery_Pmax battery_qP battery_qp0 battery_qp battery_QP battery_Qp0 battery_Qp battery_fault battery_curative battery_id battery_name battery_P0 battery_Q0 := include ampl_network_batteries.txt;

# ampl_network_tct.txt
Expand All @@ -62,13 +62,13 @@ param: DEPH: deph_tap0 deph_table deph_fault deph_curative deph_id := include am
param: VSCCONV: vscconv_possiblebus vscconv_substation vscconv_Pmin vscconv_Pmax vscconv_qP vscconv_qp0 vscconv_qp vscconv_QP vscconv_Qp0 vscconv_Qp vscconv_vregul vscconv_targetV vscconv_targetQ vscconv_lossFactor vscconv_fault vscconv_curative vscconv_id vscconv_description vscconv_P0 vscconv_Q0 := include ampl_network_vsc_converter_stations.txt;

# ampl_network_lcc_converter_stations.txt
#"variant" "num" "bus" "con. bus" "substation" "lossFactor (%PDC)" "powerFactor" "fault" "curative" "id" "description" "P (MW)" "Q (MVar)"
param: LCCCONV: lccconv_possiblebus lccconv_substation lccconv_loss_factor lccconv_power_factor lccconv_fault lccconv_curative lccconv_id lccconv_description lccconv_P0 lccconv_Q0 := include ampl_network_lcc_converter_stations.txt;
#"variant" "num" "bus" "con. bus" "substation" "q0 (MVar)" "lossFactor (%PDC)" "powerFactor" "fault" "curative" "id" "description" "P (MW)" "Q (MVar)"
param: LCCCONV: lccconv_possiblebus lccconv_substation lccconv_q0 lccconv_loss_factor lccconv_power_factor lccconv_fault lccconv_curative lccconv_id lccconv_description lccconv_P0 lccconv_Q0 := include ampl_network_lcc_converter_stations.txt;

#ampl_network_hvdc.txt
#"variant" "num" "type" "converterStation1" "converterStation2" "r (ohm)" "nomV (KV)" "convertersMode" "targetP (MW)" "maxP (MW)" "fault" "curative" "id" "description"
#"variant" "num" "type" "converterStation1" "converterStation2" "r (ohm)" "nomV (KV)" "convertersMode" "ac emul." "targetP (MW)" "P offset (MW)" "k (MW/rad)" "maxP (MW)" "fault" "curative" "id" "description"
#ampl_network_hvdc.txt
param: HVDC: hvdc_type hvdc_conv1 hvdc_conv2 hvdc_r hvdc_Vnom hvdc_convertersMode hvdc_targetP hvdc_Pmax hvdc_fault hvdc_curative hvdc_id hvdc_description := include ampl_network_hvdc.txt;
param: HVDC: hvdc_type hvdc_conv1 hvdc_conv2 hvdc_r hvdc_Vnom hvdc_convertersMode hvdc_ac_emul hvdc_targetP hvdc_p0 hvdc_k hvdc_Pmax hvdc_fault hvdc_curative hvdc_id hvdc_description := include ampl_network_hvdc.txt;

# ampl_network_branches.txt
#"variant" "num" "bus1" "bus2" "3wt num" "sub.1" "sub.2" "r (pu)" "x (pu)" "g1 (pu)" "g2 (pu)" "b1 (pu)" "b2 (pu)" "cst ratio (pu)" "ratio tc" "phase tc" "p1 (MW)" "p2 (MW)" "q1 (MVar)" "q2 (MVar)" "patl1 (A)" "patl2 (A)" "merged" "fault" "curative" "id" "description"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ printf{(v,n) in VSCCONVON} "%i;%i;%i;%Q;%.3f;%.1f;%.1f;%.1f;\n",
vscconv_vregul[1,v,n],
V[n],
vscconv_qvar[v,n],
vscconv_P0[1,v,n],
vscconv_targetP[v],
vscconv_qvar[v,n]
> (fileOut);
close (fileOut);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ void testOnlyGenerator() throws IOException {
@Test
void testHvdc() throws IOException {
Network network = HvdcNetworkFactory.createNetworkWithGenerators2();
network.getVscConverterStation("cs3").getTerminal().setP(0.0);
network.getVscConverterStation("cs4").getTerminal().setP(0.0);
OpenReacParameters parameters = new OpenReacParameters();
parameters.addConstantQGenerators(List.of("g1", "g2", "g5", "g6"));
testAllModifAndLoadFlow(network, "optimization/loadflow/openreac-output-vsc", parameters, ReportNode.NO_OP);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/**
* Copyright (c) 2024, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* SPDX-License-Identifier: MPL-2.0
*/
package com.powsybl.openreac.optimization;

import com.powsybl.commons.report.ReportNode;
import com.powsybl.iidm.network.HvdcLine;
import com.powsybl.iidm.network.Network;
import com.powsybl.openreac.network.HvdcNetworkFactory;
import com.powsybl.openreac.parameters.input.OpenReacParameters;
import com.powsybl.openreac.parameters.output.OpenReacResult;
import com.powsybl.openreac.parameters.output.OpenReacStatus;
import org.junit.jupiter.api.Test;

import java.io.IOException;

import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* Test OpenReac optimization with HVDC lines.
*
* @author Pierre ARVY {@literal <pierre.arvy at artelys.com>}
*/
class OpenReacOptimizationHvdcTest extends AbstractOpenReacRunnerTest {

@Test
void testLccExcludedFromOptimization() throws IOException {
Network network = HvdcNetworkFactory.createLcc();
OpenReacParameters parameters = new OpenReacParameters();
network.getLccConverterStation("cs2")
.getHvdcLine()
// put active set point > PQmax to remove LCC converter station from optimization
.setActivePowerSetpoint(parameters.getPQMax() + 1)
// modify max P to avoid check failure before optimization
.setMaxP(Double.MAX_VALUE);
OpenReacResult result = runOpenReac(network, "optimization/hvdc/lcc-excluded", true);

assertEquals(OpenReacStatus.OK, result.getStatus());
assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_lcc_converter_in_data_file")));
// verify no lcc is considered in optimization
assertEquals(0, Integer.parseInt(result.getIndicators().get("nb_lcc_converter_up_and_running")));
}

@Test
void testVscExcludedFromOptimization() throws IOException {
Network network = HvdcNetworkFactory.createVsc();
OpenReacParameters parameters = new OpenReacParameters();
network.getVscConverterStation("cs2")
.getHvdcLine()
// put active set point > PQmax to remove VSC converter station from optimization
.setActivePowerSetpoint(parameters.getPQMax() + 1)
// modify max P to avoid check failure before optimization
.setMaxP(parameters.getPQMax() + 2);
OpenReacResult result = runOpenReac(network, "optimization/hvdc/vsc-excluded", true);

assertEquals(OpenReacStatus.OK, result.getStatus());
assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_vsc_converter_in_data_file")));
// verify no vsc is considered in optimization
assertEquals(0, Integer.parseInt(result.getIndicators().get("nb_vsc_converter_up_and_running")));
}

@Test
void testVscExcludedFromOptimization2() throws IOException {
Network network = HvdcNetworkFactory.createVsc();
OpenReacParameters parameters = new OpenReacParameters();
network.getVscConverterStation("cs2")
.getHvdcLine()
// put max P > PQmax to remove vsc from optimization
.setMaxP(parameters.getPQMax() + 1);
OpenReacResult result = runOpenReac(network, "optimization/hvdc/vsc-excluded2", true);

assertEquals(OpenReacStatus.OK, result.getStatus());
assertEquals(2, Integer.parseInt(result.getIndicators().get("nb_vsc_converter_in_data_file")));
// verify no vsc is considered in optimization
assertEquals(0, Integer.parseInt(result.getIndicators().get("nb_vsc_converter_up_and_running")));
}

@Test
void testVscActiveSetPointSignInOptimization() throws IOException {
Network network = HvdcNetworkFactory.createVsc();
network.getHvdcLine("hvdc23")
.setActivePowerSetpoint(20)
.setConvertersMode(HvdcLine.ConvertersMode.SIDE_1_RECTIFIER_SIDE_2_INVERTER);
testAllModifAndLoadFlow(network, "optimization/hvdc/vsc-in-optimization/rectifier", new OpenReacParameters(), ReportNode.NO_OP);

network.getHvdcLine("hvdc23")
.setActivePowerSetpoint(2)
.setConvertersMode(HvdcLine.ConvertersMode.SIDE_1_INVERTER_SIDE_2_RECTIFIER);
testAllModifAndLoadFlow(network, "optimization/hvdc/vsc-in-optimization/inverter", new OpenReacParameters(), ReportNode.NO_OP);

}

@Test
void testLccActiveSetPointSignInOptimization() throws IOException {
Network network = HvdcNetworkFactory.createLcc();
network.getHvdcLine("hvdc23")
.setActivePowerSetpoint(20)
.setConvertersMode(HvdcLine.ConvertersMode.SIDE_1_RECTIFIER_SIDE_2_INVERTER);
testAllModifAndLoadFlow(network, "optimization/hvdc/lcc-in-optimization/rectifier", new OpenReacParameters(), ReportNode.NO_OP);

network.getHvdcLine("hvdc23")
.setActivePowerSetpoint(51)
.setConvertersMode(HvdcLine.ConvertersMode.SIDE_1_INVERTER_SIDE_2_RECTIFIER);
testAllModifAndLoadFlow(network, "optimization/hvdc/lcc-in-optimization/inverter", new OpenReacParameters(), ReportNode.NO_OP);
}
}
Loading
Loading