Skip to content

Commit

Permalink
Remove final state option from DynawoSimulationParameters (#386)
Browse files Browse the repository at this point in the history
Signed-off-by: lisrte <laurent.issertial@rte-france.com>
  • Loading branch information
Lisrte authored Oct 9, 2024
1 parent 6baaab9 commit 8117594
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ void testSmib() {
dynawoSimulationParameters.setModelsParameters(modelsParameters)
.setNetworkParameters(networkParameters)
.setSolverParameters(solverParameters)
.setSolverType(DynawoSimulationParameters.SolverType.IDA)
.setWriteFinalState(false);
.setSolverType(DynawoSimulationParameters.SolverType.IDA);

DynamicSimulationResult result = provider.run(network, dynamicModelsSupplier, eventModelsSupplier, outputVariablesSupplier,
VariantManagerConstants.INITIAL_VARIANT_ID, computationManager, parameters, NO_OP)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@ public DynamicSimulationResult after(Path workingDir, ExecutionReport report) th

private void setSuccessOutputs(Path workingDir, Path outputsFolder) throws IOException {
DynawoSimulationParameters parameters = context.getDynawoSimulationParameters();
if (parameters.isWriteFinalState()) {
updateNetwork(outputsFolder);
}
updateNetwork(outputsFolder);
DumpFileParameters dumpFileParameters = parameters.getDumpFileParameters();
if (dumpFileParameters.exportDumpFile()) {
setDumpFile(outputsFolder, dumpFileParameters.dumpFileFolder(), workingDir.getFileName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class DynawoSimulationParameters extends AbstractExtension<DynamicSimulat
public static final String MODELS_OUTPUT_PARAMETERS_FILE = "models.par";
public static final String NETWORK_OUTPUT_PARAMETERS_FILE = "network.par";
public static final String SOLVER_OUTPUT_PARAMETERS_FILE = "solvers.par";
private static final boolean DEFAULT_WRITE_FINAL_STATE = true;
public static final boolean DEFAULT_USE_MODEL_SIMPLIFIERS = false;
public static final double DEFAULT_PRECISION = 1e-6;
public static final ExportMode DEFAULT_TIMELINE_EXPORT_MODE = ExportMode.TXT;
Expand Down Expand Up @@ -110,7 +109,6 @@ public String getFileName() {
private ParametersSet solverParameters;
private SolverType solverType = DEFAULT_SOLVER_TYPE;
private boolean mergeLoads = DEFAULT_MERGE_LOADS;
private boolean writeFinalState = DEFAULT_WRITE_FINAL_STATE;
private boolean useModelSimplifiers = DEFAULT_USE_MODEL_SIMPLIFIERS;
private DumpFileParameters dumpFileParameters = DumpFileParameters.createDefaultDumpFileParameters();
private double precision = DEFAULT_PRECISION;
Expand Down Expand Up @@ -154,7 +152,6 @@ public static DynawoSimulationParameters load(PlatformConfig platformConfig, Fil
c.getOptionalEnumProperty("solver.type", SolverType.class).ifPresent(parameters::setSolverType);
// If merging loads on each bus to simplify dynawo's analysis
c.getOptionalBooleanProperty("mergeLoads").ifPresent(parameters::setMergeLoads);
c.getOptionalBooleanProperty("writeFinalState").ifPresent(parameters::setWriteFinalState);
c.getOptionalBooleanProperty("useModelSimplifiers").ifPresent(parameters::setUseModelSimplifiers);
c.getOptionalDoubleProperty("precision").ifPresent(parameters::setPrecision);
c.getOptionalEnumProperty("timeline.exportMode", ExportMode.class).ifPresent(parameters::setTimelineExportMode);
Expand Down Expand Up @@ -242,15 +239,6 @@ public DynawoSimulationParameters setMergeLoads(boolean mergeLoads) {
return this;
}

public DynawoSimulationParameters setWriteFinalState(boolean writeFinalState) {
this.writeFinalState = writeFinalState;
return this;
}

public boolean isWriteFinalState() {
return writeFinalState;
}

public boolean isUseModelSimplifiers() {
return useModelSimplifiers;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private static void writeOutput(XMLStreamWriter writer, DynawoSimulationContext
writer.writeAttribute(EXPORT_MODE, parameters.getTimelineExportMode().toString());

writer.writeEmptyElement(DYN_URI, "finalState");
writer.writeAttribute("exportIIDMFile", Boolean.toString(parameters.isWriteFinalState()));
writer.writeAttribute("exportIIDMFile", Boolean.toString(true));
writer.writeAttribute("exportDumpFile", Boolean.toString(parameters.getDumpFileParameters().exportDumpFile()));

if (context.withCurveVariables()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
},
"solverType" : "IDA",
"mergeLoads" : false,
"writeFinalState" : true,
"useModelSimplifiers" : false,
"dumpFileParameters" : {
"exportDumpFile" : false,
Expand Down

0 comments on commit 8117594

Please sign in to comment.