|
8 | 8 |
|
9 | 9 | import com.powsybl.balances_adjustment.balance_computation.*; |
10 | 10 | import com.powsybl.balances_adjustment.util.CountryAreaFactory; |
11 | | -import com.powsybl.balances_adjustment.util.Reports; |
12 | 11 | import com.powsybl.commons.report.ReportNode; |
13 | 12 | import com.powsybl.commons.report.TypedValue; |
14 | 13 | import com.powsybl.computation.ComputationManager; |
@@ -60,6 +59,7 @@ public String getName() { |
60 | 59 | private BalanceComputationParameters createBalanceComputationParameters(ReportNode reportNode) { |
61 | 60 | BalanceComputationParameters parameters = BalanceComputationParameters.load(); |
62 | 61 | parameters.getScalingParameters().setPriority(ScalingParameters.Priority.RESPECT_OF_VOLUME_ASKED); |
| 62 | + parameters.setWithLoadFlow(balancesAdjustmentModificationInfos.isWithLoadFlow()); |
63 | 63 |
|
64 | 64 | if (!balancesAdjustmentModificationInfos.isWithLoadFlow()) { |
65 | 65 | return parameters; |
@@ -137,34 +137,14 @@ public void apply(Network network, |
137 | 137 |
|
138 | 138 | BalanceComputationParameters parameters = createBalanceComputationParameters(reportNode); |
139 | 139 |
|
140 | | - if (balancesAdjustmentModificationInfos.isWithLoadFlow()) { |
141 | | - applyWithLoadFlow(network, computationManager, reportNode, parameters); |
142 | | - } else { |
143 | | - applyWithoutLoadFlow(network, reportNode, parameters); |
144 | | - } |
145 | | - } |
146 | | - |
147 | | - private void applyWithLoadFlow(Network network, ComputationManager computationManager, |
148 | | - ReportNode reportNode, BalanceComputationParameters parameters) { |
149 | 140 | List<BalanceComputationArea> areas = createBalanceComputationAreas(network, reportNode); |
150 | 141 |
|
151 | 142 | BalanceComputation balanceComputation = new BalanceComputationFactoryImpl() |
152 | | - .create(areas, LoadFlow.find(), computationManager); |
| 143 | + .create(areas, LoadFlow.find(), computationManager); |
153 | 144 |
|
154 | 145 | balanceComputation |
155 | | - .run(network, network.getVariantManager().getWorkingVariantId(), parameters, reportNode) |
156 | | - .join(); |
157 | | - } |
158 | | - |
159 | | - private void applyWithoutLoadFlow(Network network, ReportNode reportNode, BalanceComputationParameters parameters) { |
160 | | - balancesAdjustmentModificationInfos.getAreas().forEach(area -> { |
161 | | - CountryArea countryArea = new CountryArea(network, area.getCountries()); |
162 | | - double offset = area.getNetPosition() - countryArea.getNetPosition(); |
163 | | - Scalable scalable = createScalable(area, network, reportNode); |
164 | | - double done = scalable.scale(network, offset, parameters.getScalingParameters()); |
165 | | - Reports.reportAreaScaling(reportNode, area.getName(), offset, done); |
166 | | - LOGGER.info("Scaling for area {}: offset={}, done={}", area.getName(), offset, done); |
167 | | - }); |
| 146 | + .run(network, network.getVariantManager().getWorkingVariantId(), parameters, reportNode) |
| 147 | + .join(); |
168 | 148 | } |
169 | 149 |
|
170 | 150 | private List<BalanceComputationArea> createBalanceComputationAreas(Network network, ReportNode reportNode) { |
|
0 commit comments