Skip to content

Commit

Permalink
Merge branch 'master' into upgrade_dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
kahyami committed Nov 23, 2023
2 parents 3b41a6f + 3ac8466 commit 93019a0
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2023, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package com.farao_community.farao.cse.export_runner.app.configurations;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
* @author Amira Kahya {@literal <amira.kahya at rte-france.com>}
*/
@Configuration
public class MendrisioConfiguration {
@Value("${cse-cc-runner.mendrisio.mendrisio-pst-id}")
private String mendrisioPstId;
@Value("${cse-cc-runner.mendrisio.mendrisio-node-id}")
private String mendrisioNodeId;

public String getMendrisioPstId() {
return mendrisioPstId;
}

public String getMendrisioNodeId() {
return mendrisioNodeId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,17 @@ public class CseExportRunner {
private final TtcRaoService ttcRaoService;
private final Logger businessLogger;
private final ProcessConfiguration processConfiguration;
private final MerchantLineService merchantLineService;

public CseExportRunner(FileImporter fileImporter, FileExporter fileExporter, PiSaService pisaService, RaoRunnerService raoRunnerService, TtcRaoService ttcRaoService, Logger businessLogger, ProcessConfiguration processConfiguration) {
public CseExportRunner(FileImporter fileImporter, FileExporter fileExporter, PiSaService pisaService, RaoRunnerService raoRunnerService, TtcRaoService ttcRaoService, Logger businessLogger, ProcessConfiguration processConfiguration, MerchantLineService merchantLineService) {
this.fileImporter = fileImporter;
this.fileExporter = fileExporter;
this.pisaService = pisaService;
this.raoRunnerService = raoRunnerService;
this.ttcRaoService = ttcRaoService;
this.businessLogger = businessLogger;
this.processConfiguration = processConfiguration;
this.merchantLineService = merchantLineService;
}

public CseExportResponse run(CseExportRequest cseExportRequest) {
Expand All @@ -68,6 +70,7 @@ public CseExportResponse run(CseExportRequest cseExportRequest) {

// Import and pre-treatment on Network
Network network = fileImporter.importNetwork(cseExportRequest.getCgmUrl());
merchantLineService.setTransformerInActivePowerRegulation(network);
pisaService.alignGenerators(network);

// Create CRAC creation context
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2023, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package com.farao_community.farao.cse.export_runner.app.services;

import com.farao_community.farao.cse.export_runner.app.configurations.MendrisioConfiguration;
import com.farao_community.farao.cse.network_processing.ucte_pst_change.UctePstProcessor;
import com.powsybl.iidm.network.Network;
import org.springframework.stereotype.Service;

/**
* @author Amira Kahya {@literal <amira.kahya at rte-france.com>}
*/
@Service
public class MerchantLineService {

private final UctePstProcessor uctePstProcessor;

public MerchantLineService(MendrisioConfiguration mendrisioConfiguration) {

this.uctePstProcessor = new UctePstProcessor(
mendrisioConfiguration.getMendrisioPstId(),
mendrisioConfiguration.getMendrisioNodeId());
}

public void setTransformerInActivePowerRegulation(Network network) {
uctePstProcessor.setTransformerInActivePowerRegulation(network);

}
}
3 changes: 3 additions & 0 deletions cse-cc-export-runner-app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ cse-cc-runner:
ttc-rao: TTC_RAO
xnodes:
file-path: /home/farao/xnodes/xnodes.xml
mendrisio:
mendrisio-pst-id: SMENDR3T SMENDR32 1
mendrisio-node-id: SMENDR3T
pisa:
link1:
node-fr: FFG.IL12
Expand Down
3 changes: 3 additions & 0 deletions cse-cc-export-runner-app/src/test/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ cse-cc-runner:
ttc-rao: TTC_RAO
xnodes:
file-path: xnodes/cvg_xnodes_20200714.xml
mendrisio:
mendrisio-pst-id: SMENDR3T SMENDR32 1
mendrisio-node-id: SMENDR3T
pisa:
link1:
node-fr: FFG.IL12
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ private void setTransformerInActivePowerRegulation(TwoWindingsTransformer transf
}
}

public void setTransformerInActivePowerRegulation(Network network) {
TwoWindingsTransformer transformer = network.getTwoWindingsTransformer(pstId);
PhaseTapChanger phaseTapChanger = getPhaseTapChanger(transformer);
setTransformerInActivePowerRegulation(transformer, phaseTapChanger);
}

private PhaseTapChanger getPhaseTapChanger(TwoWindingsTransformer transformer) {
if (transformer == null) {
throw new UctePstException(String.format(
Expand Down

0 comments on commit 93019a0

Please sign in to comment.