1010import com .powsybl .commons .reporter .Reporter ;
1111import com .powsybl .commons .reporter .TypedValue ;
1212import com .powsybl .iidm .modification .scalable .Scalable ;
13+ import com .powsybl .iidm .modification .scalable .ScalingParameters ;
1314import com .powsybl .iidm .network .Generator ;
1415import com .powsybl .iidm .network .Network ;
1516import org .gridsuite .modification .server .VariationType ;
@@ -49,7 +50,7 @@ protected void applyStackingUpVariation(Network network,
4950 sum .set (network .getGenerator (equipment .getId ()).getTargetP () + sum .get ());
5051 return getScalable (equipment .getId ());
5152 }).toArray (Scalable []::new ));
52- scale (network , subReporter , generatorScalingVariation , sum , stackingUpScalable );
53+ scale (network , subReporter , generatorScalingVariation , sum , stackingUpScalable , new ScalingParameters () );
5354 }
5455
5556 @ Override
@@ -69,7 +70,7 @@ protected void applyVentilationVariation(Network network,
6970 percentages .add ((float ) ((equipment .getDistributionKey () / distributionKeys ) * 100 ));
7071 });
7172 Scalable ventilationScalable = Scalable .proportional (percentages , scalables );
72- scale (network , subReporter , generatorScalingVariation , sum , ventilationScalable );
73+ scale (network , subReporter , generatorScalingVariation , sum , ventilationScalable , new ScalingParameters (). setIterative ( true ) );
7374 }
7475 }
7576
@@ -94,7 +95,7 @@ protected void applyRegularDistributionVariation(Network network,
9495
9596 List <Float > percentages = new ArrayList <>(Collections .nCopies (scalables .size (), (float ) (100.0 / scalables .size ())));
9697 Scalable regularDistributionScalable = Scalable .proportional (percentages , scalables );
97- scale (network , subReporter , generatorScalingVariation , sum , regularDistributionScalable );
98+ scale (network , subReporter , generatorScalingVariation , sum , regularDistributionScalable , new ScalingParameters (). setIterative ( true ) );
9899 }
99100
100101 @ Override
@@ -120,7 +121,7 @@ protected void applyProportionalToPmaxVariation(Network network,
120121
121122 setScalablePercentage (maxPSum , maxPMap , percentages , scalables );
122123 Scalable proportionalToPmaxScalable = Scalable .proportional (percentages , scalables );
123- scale (network , subReporter , generatorScalingVariation , targetPSum , proportionalToPmaxScalable );
124+ scale (network , subReporter , generatorScalingVariation , targetPSum , proportionalToPmaxScalable , new ScalingParameters (). setIterative ( true ) );
124125 }
125126
126127 @ Override
@@ -144,7 +145,7 @@ protected void applyProportionalVariation(Network network,
144145 // we calculate percentage of each target P value relative to the sum of target P
145146 setScalablePercentage (sum , targetPMap , percentages , scalables );
146147 Scalable proportionalScalable = Scalable .proportional (percentages , scalables );
147- scale (network , subReporter , generatorScalingVariation , sum , proportionalScalable );
148+ scale (network , subReporter , generatorScalingVariation , sum , proportionalScalable , new ScalingParameters (). setIterative ( true ) );
148149 }
149150
150151 private void setScalablePercentage (AtomicReference <Double > sum ,
@@ -157,9 +158,9 @@ private void setScalablePercentage(AtomicReference<Double> sum,
157158 });
158159 }
159160
160- private void scale (Network network , Reporter subReporter , ScalingVariationInfos scalingVariationInfos , AtomicReference <Double > sum , Scalable scalable ) {
161+ private void scale (Network network , Reporter subReporter , ScalingVariationInfos scalingVariationInfos , AtomicReference <Double > sum , Scalable scalable , ScalingParameters scalingParameters ) {
161162 double asked = getAsked (scalingVariationInfos , sum );
162- double done = scalable .scale (network , asked );
163+ double done = scalable .scale (network , asked , scalingParameters );
163164 createReport (subReporter ,
164165 "scalingApplied" ,
165166 String .format ("successfully scaled for mode %s with variation value asked is %s. variation done is %s" , scalingVariationInfos .getVariationMode (), asked , done ),
0 commit comments