@@ -104,12 +104,17 @@ public void align(Network referenceNetwork, Network marketBasedNetwork) {
104104 }
105105
106106 private static void shiftNetwork (Network marketBasedNetwork , Map <String , Double > reducedSplittingFactors , ZonalData <Scalable > zonalScalable , ExchangeAndNetPosition marketBasedExchangeAndNetPosition , ExchangeAndNetPosition referenceExchangeAndNetPosition ) throws GlskLimitationException , ShiftingException {
107- // shift target value: Italian import = opposite to the Italian NP in the reference network
108- // ntc: ntc in the market based network
109107 Map <String , Double > ntcs = updateMarketBasedNtcs (marketBasedExchangeAndNetPosition );
110108 ShiftDispatcher shiftDispatcher = new CseD2ccShiftDispatcherTmp (LOGGER , reducedSplittingFactors , ntcs );
111109 LinearScaler linearScaler = new LinearScaler (zonalScalable , shiftDispatcher );
112- linearScaler .shiftNetwork (-referenceExchangeAndNetPosition .getNetPosition (IT ), marketBasedNetwork );
110+ double deltaOfItalianNetPosition = referenceExchangeAndNetPosition .getNetPosition (IT ) - marketBasedExchangeAndNetPosition .getNetPosition (IT );
111+ double deltaOfItalianImport = -deltaOfItalianNetPosition ;
112+ // In Italy North Shift Dispatcher, the actual shifted value is decreased by the initial NTC (probably due to
113+ // a bug masked by the fact that initial network have been previously shifted to these NTCs). We have
114+ // to increase the shift asked to bypass this issue. If solved, we would only have to put target italian import,
115+ // i.e. the opposite of reference file net position.
116+ double actualNetPositionShift = deltaOfItalianImport + ntcs .values ().stream ().mapToDouble (Double ::doubleValue ).sum ();
117+ linearScaler .shiftNetwork (actualNetPositionShift , marketBasedNetwork );
113118 }
114119
115120 ExchangeAndNetPosition computeExchangeAndNetPosition (Network network ) {
@@ -120,7 +125,7 @@ ExchangeAndNetPosition computeExchangeAndNetPosition(Network network) {
120125 private static Map <String , Double > updateMarketBasedNtcs (ExchangeAndNetPositionInterface marketBasedExchangeAndNetPosition ) {
121126 return Map .of (
122127 new CountryEICode (FR ).getCode (), marketBasedExchangeAndNetPosition .getNetPosition (FR ),
123- new CountryEICode (CH ).getCode (), marketBasedExchangeAndNetPosition .getNetPosition (CH ) + marketBasedExchangeAndNetPosition . getNetPosition ( DE ) ,
128+ new CountryEICode (CH ).getCode (), marketBasedExchangeAndNetPosition .getNetPosition (CH ),
124129 new CountryEICode (AT ).getCode (), marketBasedExchangeAndNetPosition .getNetPosition (AT ),
125130 new CountryEICode (SI ).getCode (), marketBasedExchangeAndNetPosition .getNetPosition (SI )
126131 );
0 commit comments