@@ -147,30 +147,35 @@ public void apply(LoadFlowParameters.BalanceType balanceType) {
147
147
shunt .setG (shunt .getG () - e .getValue ().getG ());
148
148
shunt .setB (shunt .getB () - e .getValue ().getB ());
149
149
}
150
- processPowerShifts (balanceType , true );
150
+ processLostPowerChanges (balanceType , true );
151
151
}
152
152
153
- public void processPowerShifts (LoadFlowParameters .BalanceType balanceType , boolean updateAc ) {
154
- processLostLoads (balanceType , updateAc );
155
- processLostGenerators (updateAc );
153
+ /**
154
+ * Process the power shifts due to the loss of loads, generators, and HVDCs.
155
+ * @param balanceType the property defining how to manage active distribution.
156
+ * @param updateAcParameters a boolean to indicate if voltage/reactive dependent parameters should be updated or not.
157
+ */
158
+ public void processLostPowerChanges (LoadFlowParameters .BalanceType balanceType , boolean updateAcParameters ) {
159
+ processLostLoads (balanceType , updateAcParameters );
160
+ processLostGenerators (updateAcParameters );
156
161
processHvdcsWithoutPower ();
157
162
}
158
163
159
- private void processLostLoads (LoadFlowParameters .BalanceType balanceType , boolean updateAc ) {
164
+ private void processLostLoads (LoadFlowParameters .BalanceType balanceType , boolean updateAcParameters ) {
160
165
for (var e : lostLoads .entrySet ()) {
161
166
LfLoad load = e .getKey ();
162
167
LfLostLoad lostLoad = e .getValue ();
163
168
PowerShift shift = lostLoad .getPowerShift ();
164
169
load .setTargetP (load .getTargetP () - getUpdatedLoadP0 (load , balanceType , shift .getActive (), shift .getVariableActive (), lostLoad .getNotParticipatingLoadP0 ()));
165
- if (updateAc ) {
170
+ if (updateAcParameters ) {
166
171
load .setTargetQ (load .getTargetQ () - shift .getReactive ());
167
172
}
168
173
load .setAbsVariableTargetP (load .getAbsVariableTargetP () - Math .abs (shift .getVariableActive ()));
169
174
lostLoad .getOriginalIds ().forEach (loadId -> load .setOriginalLoadDisabled (loadId , true ));
170
175
}
171
176
}
172
177
173
- private void processLostGenerators (boolean updateAc ) {
178
+ private void processLostGenerators (boolean updateAcParameters ) {
174
179
Set <LfBus > generatorBuses = new HashSet <>();
175
180
for (LfGenerator generator : lostGenerators ) {
176
181
generator .setTargetP (0 );
@@ -179,7 +184,7 @@ private void processLostGenerators(boolean updateAc) {
179
184
generatorBuses .add (bus );
180
185
generator .setParticipating (false );
181
186
generator .setDisabled (true );
182
- if (updateAc ) {
187
+ if (updateAcParameters ) {
183
188
if (generator .getGeneratorControlType () != LfGenerator .GeneratorControlType .OFF ) {
184
189
generator .setGeneratorControlType (LfGenerator .GeneratorControlType .OFF );
185
190
bus .getGeneratorVoltageControl ().ifPresent (GeneratorVoltageControl ::updateReactiveKeys );
@@ -196,7 +201,7 @@ private void processLostGenerators(boolean updateAc) {
196
201
}
197
202
}
198
203
}
199
- if (updateAc ) {
204
+ if (updateAcParameters ) {
200
205
for (LfBus bus : generatorBuses ) {
201
206
if (bus .getGenerators ().stream ().noneMatch (gen -> gen .getGeneratorControlType () == LfGenerator .GeneratorControlType .VOLTAGE )) {
202
207
bus .setGeneratorVoltageControlEnabled (false );
0 commit comments