2121
2222import static com .powsybl .openloadflow .util .LoadFlowAssert .*;
2323import static org .junit .jupiter .api .Assertions .assertTrue ;
24+ import static org .junit .jupiter .api .Assertions .assertFalse ;
2425
2526/**
2627 * @author Denis Bonnand {@literal <denis.bonnand at supergrid-institute.com>}
@@ -30,14 +31,156 @@ public class AcDcLoadFlowTest {
3031 Network network ;
3132
3233 @ Test
33- void testNetworkFactory () {
34+ void testVscAsymmetricalMonopole () {
3435 network = DcDetailedNetworkFactory .createVscAsymmetricalMonopole ();
3536 LoadFlow .Runner loadFlowRunner = new LoadFlow .Runner (new OpenLoadFlowProvider (new DenseMatrixFactory ()));
36- LoadFlowParameters parameters = new LoadFlowParameters ();
37+ //TODO: adapt slack distribution for AC subnetworks
38+ //for now, we just deactivate slack distribution for AC DC load flow
39+ LoadFlowParameters parameters = new LoadFlowParameters ().setDistributedSlack (false );
3740 OpenLoadFlowParameters .create (parameters )
3841 .setAcDcNetwork (true );
3942 LoadFlowResult result = loadFlowRunner .run (network , parameters );
4043 assertTrue (result .isFullyConverged ());
44+
45+ Bus busGb150 = network .getBusBreakerView ().getBus ("BUSDC-GB-xNodeDc1gb-150" );
46+ assertVoltageEquals (149.776011 , busGb150 );
47+ assertAngleEquals (-2.550141 , busGb150 );
48+
49+ Bus busFr150 = network .getBusBreakerView ().getBus ("BUSDC-FR-xNodeDc1fr-150" );
50+ assertVoltageEquals (149.819131 , busFr150 );
51+ assertAngleEquals (2.543088 , busFr150 );
52+
53+ Bus busGb400 = network .getBusBreakerView ().getBus ("BUSDC-GB-xNodeDc1gb-400" );
54+ assertVoltageEquals (400.155070 , busGb400 );
55+ assertAngleEquals (-0.000000 , busGb400 );
56+
57+ Bus busFr400 = network .getBusBreakerView ().getBus ("BUSDC-FR-xNodeDc1fr-400" );
58+ assertVoltageEquals (399.556099 , busFr400 );
59+ assertAngleEquals (-0.000000 , busFr400 );
60+
61+ Bus busFr = network .getBusBreakerView ().getBus ("BUS-FR" );
62+ assertVoltageEquals (400.000000 , busFr );
63+ assertAngleEquals (0.427977 , busFr );
64+
65+ Bus busGb = network .getBusBreakerView ().getBus ("BUS-GB" );
66+ assertVoltageEquals (400.000000 , busGb );
67+ assertAngleEquals (-0.431794 , busGb );
68+
69+ DcNode dcNodeGbNeg = network .getDcNode ("dcNodeGbNeg" );
70+ assertVoltageEquals (0.000000 , dcNodeGbNeg );
71+
72+ DcNode dcNodeGbPos = network .getDcNode ("dcNodeGbPos" );
73+ assertVoltageEquals (-501.992063 , dcNodeGbPos );
74+
75+ DcNode dcNodeFrNeg = network .getDcNode ("dcNodeFrNeg" );
76+ assertVoltageEquals (0.000000 , dcNodeFrNeg );
77+
78+ DcNode dcNodeFrPos = network .getDcNode ("dcNodeFrPos" );
79+ assertVoltageEquals (-500.000000 , dcNodeFrPos );
80+
81+ Generator genFr = network .getGenerator ("GEN-FR" );
82+ assertActivePowerEquals (-2000.000000 , genFr .getTerminal ());
83+ assertReactivePowerEquals (-10.336457 , genFr .getTerminal ());
84+
85+ Generator genGb = network .getGenerator ("GEN-GB" );
86+ assertActivePowerEquals (-2000.000000 , genGb .getTerminal ());
87+ assertReactivePowerEquals (-10.419567 , genGb .getTerminal ());
88+
89+ VoltageSourceConverter vscFr = network .getVoltageSourceConverter ("VscFr" );
90+ assertActivePowerEquals (199.206337 , vscFr .getTerminal1 ());
91+ assertReactivePowerEquals (0.000000 , vscFr .getTerminal1 ());
92+ assertDcPowerEquals (-0.000000 , vscFr .getDcTerminal1 ());
93+ assertDcPowerEquals (-199.206337 , vscFr .getDcTerminal2 ());
94+
95+ VoltageSourceConverter vscGb = network .getVoltageSourceConverter ("VscGb" );
96+ assertActivePowerEquals (-200.000000 , vscGb .getTerminal1 ());
97+ assertReactivePowerEquals (0.000000 , vscGb .getTerminal1 ());
98+ assertDcPowerEquals (0.000000 , vscGb .getDcTerminal1 ());
99+ assertDcPowerEquals (200.000000 , vscGb .getDcTerminal2 ());
100+
101+ DcLine dcLinePos = network .getDcLine ("dcLinePos" );
102+ assertDcPowerEquals (199.206337 , dcLinePos .getDcTerminal1 ());
103+ assertDcPowerEquals (-200.000000 , dcLinePos .getDcTerminal2 ());
104+ }
105+
106+ @ Test
107+ void testVscSymmetricalMonopole () {
108+ network = DcDetailedNetworkFactory .createVscSymmetricalMonopole ();
109+ LoadFlowParameters parameters = new LoadFlowParameters ().setDistributedSlack (false );
110+ OpenLoadFlowParameters .create (parameters )
111+ .setAcDcNetwork (true );
112+ //FIXME : loadflow on this network does not converge with DenseMatrixFactory
113+ LoadFlow .Runner loadFlowRunner = new LoadFlow .Runner (new OpenLoadFlowProvider (new DenseMatrixFactory ()));
114+ LoadFlowResult result = loadFlowRunner .run (network , parameters );
115+ assertFalse (result .isFullyConverged ());
116+
117+ loadFlowRunner = new LoadFlow .Runner (new OpenLoadFlowProvider ());
118+ result = loadFlowRunner .run (network , parameters );
119+ assertTrue (result .isFullyConverged ());
120+
121+ Bus busGb150 = network .getBusBreakerView ().getBus ("BUSDC-GB-xNodeDc1gb-150" );
122+ assertVoltageEquals (149.776011 , busGb150 );
123+ assertAngleEquals (-2.550141 , busGb150 );
124+
125+ Bus busFr150 = network .getBusBreakerView ().getBus ("BUSDC-FR-xNodeDc1fr-150" );
126+ assertVoltageEquals (149.820194 , busFr150 );
127+ assertAngleEquals (2.533076 , busFr150 );
128+
129+ Bus busGb400 = network .getBusBreakerView ().getBus ("BUSDC-GB-xNodeDc1gb-400" );
130+ assertVoltageEquals (400.155070 , busGb400 );
131+ assertAngleEquals (0.000000 , busGb400 );
132+
133+ Bus busFr400 = network .getBusBreakerView ().getBus ("BUSDC-FR-xNodeDc1fr-400" );
134+ assertVoltageEquals (399.557158 , busFr400 );
135+ assertAngleEquals (0.000000 , busFr400 );
136+
137+ Bus busFr = network .getBusBreakerView ().getBus ("BUS-FR" );
138+ assertVoltageEquals (400.000000 , busFr );
139+ assertAngleEquals (0.427991 , busFr );
140+
141+ Bus busGb = network .getBusBreakerView ().getBus ("BUS-GB" );
142+ assertVoltageEquals (400.000000 , busGb );
143+ assertAngleEquals (-0.431794 , busGb );
144+
145+ DcNode dcNodeGbNeg = network .getDcNode ("dcNodeGbNeg" );
146+ assertVoltageEquals (243.330843 , dcNodeGbNeg );
147+
148+ DcNode dcNodeGbPos = network .getDcNode ("dcNodeGbPos" );
149+ assertVoltageEquals (-260.637659 , dcNodeGbPos );
150+
151+ DcNode dcNodeFrNeg = network .getDcNode ("dcNodeFrNeg" );
152+ assertVoltageEquals (241.346592 , dcNodeFrNeg );
153+
154+ DcNode dcNodeFrPos = network .getDcNode ("dcNodeFrPos" );
155+ assertVoltageEquals (-258.653408 , dcNodeFrPos );
156+
157+ Generator genFr = network .getGenerator ("GEN-FR" );
158+ assertActivePowerEquals (-2000.000000 , genFr .getTerminal ());
159+ assertReactivePowerEquals (-10.265940 , genFr .getTerminal ());
160+
161+ Generator genGb = network .getGenerator ("GEN-GB" );
162+ assertActivePowerEquals (-2000.000000 , genGb .getTerminal ());
163+ assertReactivePowerEquals (-10.419567 , genGb .getTerminal ());
164+
165+ VoltageSourceConverter vscFr = network .getVoltageSourceConverter ("VscFr" );
166+ assertActivePowerEquals (198.425099 , vscFr .getTerminal1 ());
167+ assertReactivePowerEquals (0.000000 , vscFr .getTerminal1 ());
168+ assertDcPowerEquals (-95.778443 , vscFr .getDcTerminal1 ());
169+ assertDcPowerEquals (-102.646656 , vscFr .getDcTerminal2 ());
170+
171+ VoltageSourceConverter vscGb = network .getVoltageSourceConverter ("VscGb" );
172+ assertActivePowerEquals (-200.000000 , vscGb .getTerminal1 ());
173+ assertReactivePowerEquals (0.000000 , vscGb .getTerminal1 ());
174+ assertDcPowerEquals (96.565893 , vscGb .getDcTerminal1 ());
175+ assertDcPowerEquals (103.434107 , vscGb .getDcTerminal2 ());
176+
177+ DcLine dcLineNeg = network .getDcLine ("dcLineNeg" );
178+ assertDcPowerEquals (95.778443 , dcLineNeg .getDcTerminal1 ());
179+ assertDcPowerEquals (-96.565893 , dcLineNeg .getDcTerminal2 ());
180+
181+ DcLine dcLinePos = network .getDcLine ("dcLinePos" );
182+ assertDcPowerEquals (102.646656 , dcLinePos .getDcTerminal1 ());
183+ assertDcPowerEquals (-103.434107 , dcLinePos .getDcTerminal2 ());
41184 }
42185
43186 @ Test
0 commit comments