Skip to content

Commit

Permalink
Replace rao network elementary actions by core remedial actions: fix …
Browse files Browse the repository at this point in the history
…cse <- incorrect?

Signed-off-by: Pauline Jean-Marie <[email protected]>
  • Loading branch information
Pauline Jean-Marie committed Apr 23, 2024
1 parent 711b41a commit af0a91b
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
*/
package com.powsybl.openrao.data.craccreation.creator.cse.remedialaction;

import com.powsybl.iidm.network.Connectable;
import com.powsybl.iidm.network.Country;
import com.powsybl.iidm.network.IdentifiableType;
import com.powsybl.iidm.network.Network;
import com.powsybl.openrao.commons.OpenRaoException;
import com.powsybl.openrao.data.cracapi.Crac;
Expand All @@ -25,6 +27,7 @@
import com.powsybl.openrao.data.craccreation.creator.cse.parameters.BusBarChangeSwitches;
import com.powsybl.openrao.data.craccreation.creator.cse.parameters.CseCracCreationParameters;
import com.powsybl.openrao.data.craccreation.creator.cse.xsd.*;
import com.powsybl.openrao.data.craccreation.util.OpenRaoImportException;
import com.powsybl.openrao.data.craccreation.util.ucte.UcteNetworkAnalyzer;
import com.powsybl.openrao.data.craccreation.util.ucte.UctePstHelper;
import com.powsybl.openrao.data.craccreation.util.ucte.UcteTopologicalElementHelper;
Expand Down Expand Up @@ -110,6 +113,10 @@ private void importTopologicalAction(TRemedialAction tRemedialAction) {
cseCracCreationContext.addRemedialActionCreationContext(CseRemedialActionCreationContext.notImported(tRemedialAction, ImportStatus.ELEMENT_NOT_FOUND_IN_NETWORK, branchHelper.getInvalidReason()));
return;
}
// TODO: to erase if always true:
if (!(network.getIdentifiable(branchHelper.getIdInNetwork()) instanceof Connectable<?>)) {
throw new OpenRaoImportException(ImportStatus.INCONSISTENCY_IN_DATA, "CSE topological action " + createdRAId + " should be on connectable, not on " + network.getIdentifiable(branchHelper.getIdInNetwork()).getType());
}
networkActionAdder.newTerminalsConnectionAction()
.withNetworkElement(branchHelper.getIdInNetwork())
.withActionType(convertActionType(tBranch.getStatus()))
Expand Down Expand Up @@ -152,6 +159,10 @@ private void importInjectionAction(TRemedialAction tRemedialAction) {
}
}
try {
// TODO: to erase if always true:
if (network.getIdentifiable(generatorHelper.getGeneratorId()).getType() != IdentifiableType.GENERATOR) {
throw new OpenRaoImportException(ImportStatus.INCONSISTENCY_IN_DATA, "CSE injection action " + createdRAId + " should be on generator, not on " + network.getIdentifiable(generatorHelper.getGeneratorId()).getType());
}
networkActionAdder.newGeneratorAction()
.withNetworkElement(generatorHelper.getGeneratorId())
.withActivePowerValue(tNode.getValue().getV())
Expand Down

0 comments on commit af0a91b

Please sign in to comment.