Skip to content

Commit

Permalink
Merge 975c918 into fbd8a93
Browse files Browse the repository at this point in the history
  • Loading branch information
CBiasuzzi committed Dec 5, 2018
2 parents fbd8a93 + 975c918 commit f856f41
Show file tree
Hide file tree
Showing 16 changed files with 362 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,15 @@ public void run(CommandLine line, ToolRunningContext context) throws Exception {
dictionary.dump(outputDir.resolve("dict.csv"));
context.getOutputStream().println("exporting dta...");

SimulationParameters simulationParameters = SimulationParameters.load();

// export .dta
ddbClient.dumpDtaFile(outputDir, "sim.dta", network, parallelIndexes.toMap(), EurostagUtil.VERSION, dictionary.toMap());
ddbClient.dumpDtaFile(outputDir, "sim.dta", network, parallelIndexes.toMap(), EurostagUtil.VERSION, dictionary.toMap(), simulationParameters);

context.getOutputStream().println("exporting seq...");

// export .seq
EurostagScenario scenario = new EurostagScenario(SimulationParameters.load(), eurostagConfig);
EurostagScenario scenario = new EurostagScenario(simulationParameters, eurostagConfig);
try (BufferedWriter writer = Files.newBufferedWriter(outputDir.resolve(PRE_FAULT_SEQ_FILE_NAME), StandardCharsets.UTF_8)) {
scenario.writePreFaultSeq(writer, PRE_FAULT_SAC_FILE_NAME);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private void writeDtaAndControls(Domain domain, OutputStream ddbOs, OutputStream
GenericArchive archive = domain.getArchiveFactory().create(GenericArchive.class);
try (FileSystem fileSystem = ShrinkWrapFileSystems.newFileSystem(archive)) {
Path rootDir = fileSystem.getPath("/");
ddbClient.dumpDtaFile(rootDir, DTA_FILE_NAME, network, parallelIndexes.toMap(), EurostagUtil.VERSION, dictionary.toMap());
ddbClient.dumpDtaFile(rootDir, DTA_FILE_NAME, network, parallelIndexes.toMap(), EurostagUtil.VERSION, dictionary.toMap(), parameters);
}
archive.as(ZipExporter.class).exportTo(ddbOs);
//put just the generators dict csv file (extracted from the ddb files) in the common files set, to be used by wp43 transient stability index
Expand Down
4 changes: 4 additions & 0 deletions iidm-ddb/iidm-ddb-eurostag-import-export/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
<groupId>com.powsybl</groupId>
<artifactId>powsybl-iidm-api</artifactId>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-simulation-api</artifactId>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-tools</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
*/
public class DdExportConfig {

private static final String MODULE_NAME = "ddImportExport";
public static final String MODULE_NAME = "ddImportExport";

private static final boolean DEFAULT_AUTOMATON_A11 = false;
private static final boolean DEFAULT_AUTOMATON_A12 = false;
private static final boolean DEFAULT_AUTOMATON_A14 = false;
private static final boolean DEFAULT_AUTOMATON_A17 = false;
private static final boolean DEFAULT_RST = false;
private static final boolean DEFAULT_ACMC = false;
private static final boolean DEFAULT_LV_LOAD_MODELING = false;
Expand All @@ -33,10 +34,15 @@ public class DdExportConfig {
private static final boolean DEFAULT_GENPQFILTER = false;
private static final boolean DEFAULT_EXPORT_MAIN_CC_ONLY = false;
private static final boolean DEFAULT_NOSWITCH = false;
private static final String DEFAULT_AUTOMATON_A17_REFERENCE_GENERATOR = null;
private static final double DEFAULT_AUTOMATON_A17_MINIMUM_PHASE_DIFFERENCE_THRESHOLD = -240.0;
private static final double DEFAULT_AUTOMATON_A17_MAXIMUM_PHASE_DIFFERENCE_THRESHOLD = 240.0;
private static final double DEFAULT_AUTOMATON_A17_OBSERVATION_DURATION = -1;

private boolean automatonA11;
private boolean automatonA12;
private boolean automatonA14;
private boolean automatonA17;
private boolean importExportRST;
private boolean importExportACMC;
private boolean LVLoadModeling;
Expand All @@ -50,11 +56,16 @@ public class DdExportConfig {
private boolean gensPQfilter;
private boolean exportMainCCOnly;
private boolean noSwitch;
private String automatonA17AngularReferenceGenerator;
private double automatonA17MinimumPhaseDifferenceThreshold;
private double automatonA17MaximumPhaseDifferenceThreshold;
private double automatonA17ObservationDuration;

public static DdExportConfig load() {
public static DdExportConfig load(PlatformConfig platformConfig) {
boolean automatonA11 = DEFAULT_AUTOMATON_A11;
boolean automatonA12 = DEFAULT_AUTOMATON_A12;
boolean automatonA14 = DEFAULT_AUTOMATON_A14;
boolean automatonA17 = DEFAULT_AUTOMATON_A17;
boolean importExportRST = DEFAULT_RST;
boolean importExportACMC = DEFAULT_ACMC;
boolean lvLoadModeling = DEFAULT_LV_LOAD_MODELING;
Expand All @@ -68,12 +79,22 @@ public static DdExportConfig load() {
boolean gensPQfilter = DEFAULT_GENPQFILTER;
boolean exportMainCCOnly = DEFAULT_EXPORT_MAIN_CC_ONLY;
boolean noSwitch = DEFAULT_NOSWITCH;
String automatonA17AngularReferenceGenerator = DEFAULT_AUTOMATON_A17_REFERENCE_GENERATOR;
double automatonA17MinimumPhaseDifferenceThreshold = DEFAULT_AUTOMATON_A17_MINIMUM_PHASE_DIFFERENCE_THRESHOLD;
double automatonA17MaximumPhaseDifferenceThreshold = DEFAULT_AUTOMATON_A17_MAXIMUM_PHASE_DIFFERENCE_THRESHOLD;
double automatonA17ObservationDuration = DEFAULT_AUTOMATON_A17_OBSERVATION_DURATION;


if (PlatformConfig.defaultConfig().moduleExists(MODULE_NAME)) {
ModuleConfig config = PlatformConfig.defaultConfig().getModuleConfig(MODULE_NAME);
if (platformConfig.moduleExists(MODULE_NAME)) {
ModuleConfig config = platformConfig.getModuleConfig(MODULE_NAME);
automatonA11 = config.getBooleanProperty("automatonA11", DEFAULT_AUTOMATON_A11);
automatonA12 = config.getBooleanProperty("automatonA12", DEFAULT_AUTOMATON_A12);
automatonA14 = config.getBooleanProperty("automatonA14", DEFAULT_AUTOMATON_A14);
automatonA17 = config.getBooleanProperty("automatonA17", DEFAULT_AUTOMATON_A17);
automatonA17AngularReferenceGenerator = config.getStringProperty("automatonA17AngularReferenceGenerator", DEFAULT_AUTOMATON_A17_REFERENCE_GENERATOR);
automatonA17MinimumPhaseDifferenceThreshold = config.getDoubleProperty("automatonA17MinimumPhaseDifferenceThreshold", DEFAULT_AUTOMATON_A17_MINIMUM_PHASE_DIFFERENCE_THRESHOLD);
automatonA17MaximumPhaseDifferenceThreshold = config.getDoubleProperty("automatonA17MaximumPhaseDifferenceThreshold", DEFAULT_AUTOMATON_A17_MAXIMUM_PHASE_DIFFERENCE_THRESHOLD);
automatonA17ObservationDuration = config.getDoubleProperty("automatonA17ObservationDuration", DEFAULT_AUTOMATON_A17_OBSERVATION_DURATION);
importExportRST = config.getBooleanProperty("importExportRST", DEFAULT_RST);
importExportACMC = config.getBooleanProperty("importExportACMC", DEFAULT_ACMC);
lvLoadModeling = config.getBooleanProperty("LVLoadModeling", DEFAULT_LV_LOAD_MODELING);
Expand All @@ -87,30 +108,35 @@ public static DdExportConfig load() {
gensPQfilter = config.getBooleanProperty("gensPQfilter", DEFAULT_GENPQFILTER);
}

if (PlatformConfig.defaultConfig().moduleExists("eurostag-ech-export")) {
ModuleConfig config = PlatformConfig.defaultConfig().getModuleConfig("eurostag-ech-export");
if (platformConfig.moduleExists("eurostag-ech-export")) {
ModuleConfig config = platformConfig.getModuleConfig("eurostag-ech-export");
exportMainCCOnly = config.getBooleanProperty("exportMainCCOnly", DEFAULT_EXPORT_MAIN_CC_ONLY);
noSwitch = config.getBooleanProperty("noSwitch", DEFAULT_NOSWITCH);
}

return new DdExportConfig(automatonA11, automatonA12, automatonA14, importExportRST, importExportACMC,
lvLoadModeling, rstRegulInjector, rstRegulGenerator, rstRegulGeneratorDelete,
return new DdExportConfig(automatonA11, automatonA12, automatonA14, automatonA17, automatonA17AngularReferenceGenerator, automatonA17MinimumPhaseDifferenceThreshold, automatonA17MaximumPhaseDifferenceThreshold, automatonA17ObservationDuration,
importExportRST, importExportACMC, lvLoadModeling, rstRegulInjector, rstRegulGenerator, rstRegulGeneratorDelete,
acmcRegul, rstPilotGenerators, loadPatternAlpha, loadPatternBeta, gensPQfilter, exportMainCCOnly, noSwitch);
}

public static DdExportConfig load() {
return load(PlatformConfig.defaultConfig());
}

public DdExportConfig() {
this(DEFAULT_AUTOMATON_A11, DEFAULT_AUTOMATON_A12, DEFAULT_AUTOMATON_A14, DEFAULT_RST, DEFAULT_ACMC,
DEFAULT_LV_LOAD_MODELING, DEFAULT_RST_REGUL_INJECTOR, DEFAULT_RST_REGUL_GENERATOR, DEFAULT_RST_REGUL_GENERATOR_DELETE,
this(DEFAULT_AUTOMATON_A11, DEFAULT_AUTOMATON_A12, DEFAULT_AUTOMATON_A14, DEFAULT_AUTOMATON_A17, DEFAULT_AUTOMATON_A17_REFERENCE_GENERATOR, DEFAULT_AUTOMATON_A17_MINIMUM_PHASE_DIFFERENCE_THRESHOLD, DEFAULT_AUTOMATON_A17_MAXIMUM_PHASE_DIFFERENCE_THRESHOLD, DEFAULT_AUTOMATON_A17_OBSERVATION_DURATION,
DEFAULT_RST, DEFAULT_ACMC, DEFAULT_LV_LOAD_MODELING, DEFAULT_RST_REGUL_INJECTOR, DEFAULT_RST_REGUL_GENERATOR, DEFAULT_RST_REGUL_GENERATOR_DELETE,
DEFAULT_ACMC_REGUL, DEFAULT_RST_PILOT_GENERATORS, DEFAULT_LOAD_PATTERN_ALPHA, DEFAULT_LOAD_PATTERN_BETA, DEFAULT_GENPQFILTER, DEFAULT_EXPORT_MAIN_CC_ONLY, DEFAULT_NOSWITCH);
}

public DdExportConfig(boolean automatonA11, boolean automatonA12, boolean automatonA14, boolean importExportRST,
boolean importExportACMC, boolean lvLoadModeling, String rstRegulInjector,
public DdExportConfig(boolean automatonA11, boolean automatonA12, boolean automatonA14, boolean automatonA17, String automatonA17AngularReferenceGenerator, double automatonA17MinimumPhaseDifferenceThreshold, double automatonA17MaximumPhaseDifferenceThreshold, double automatonA17ObservationDuration,
boolean importExportRST, boolean importExportACMC, boolean lvLoadModeling, String rstRegulInjector,
String rstRegulGenerator, String rstRegulGeneratorDelete, String acmcRegul,
String rstPilotGenerators, float loadPatternAlpha, float loadPatternBeta, boolean gensPQfilter, boolean exportMainCCOnly, boolean noSwitch) {
this.automatonA11 = automatonA11;
this.automatonA12 = automatonA12;
this.automatonA14 = automatonA14;
this.automatonA17 = automatonA17;
this.importExportRST = importExportRST;
this.importExportACMC = importExportACMC;
this.LVLoadModeling = lvLoadModeling;
Expand All @@ -124,6 +150,10 @@ public DdExportConfig(boolean automatonA11, boolean automatonA12, boolean automa
this.gensPQfilter = gensPQfilter;
this.exportMainCCOnly = exportMainCCOnly;
this.noSwitch = noSwitch;
this.automatonA17AngularReferenceGenerator = automatonA17AngularReferenceGenerator;
this.automatonA17MinimumPhaseDifferenceThreshold = automatonA17MinimumPhaseDifferenceThreshold;
this.automatonA17MaximumPhaseDifferenceThreshold = automatonA17MaximumPhaseDifferenceThreshold;
this.automatonA17ObservationDuration = automatonA17ObservationDuration;
}

public boolean getAutomatonA11() {
Expand All @@ -138,6 +168,10 @@ public boolean getAutomatonA14() {
return automatonA14;
}

public boolean getAutomatonA17() {
return automatonA17;
}

public boolean getExportRST() {
return importExportRST;
}
Expand Down Expand Up @@ -190,6 +224,22 @@ public boolean getGensPQfilter() {
return gensPQfilter;
}

public String getAutomatonA17AngularReferenceGenerator() {
return automatonA17AngularReferenceGenerator;
}

public double getAutomatonA17MinimumPhaseDifferenceThreshold() {
return automatonA17MinimumPhaseDifferenceThreshold;
}

public double getAutomatonA17MaximumPhaseDifferenceThreshold() {
return automatonA17MaximumPhaseDifferenceThreshold;
}

public double getAutomatonA17ObservationDuration() {
return automatonA17ObservationDuration;
}

public void setAutomatonA11(Boolean automatonA11) {
this.automatonA11 = automatonA11;
}
Expand All @@ -202,6 +252,10 @@ public void setAutomatonA14(Boolean automatonA14) {
this.automatonA14 = automatonA14;
}

public void setAutomatonA17(Boolean automatonA17) {
this.automatonA17 = automatonA17;
}

public void setImportExportRST(Boolean importExportRST) {
this.importExportRST = importExportRST;
}
Expand Down Expand Up @@ -246,11 +300,31 @@ public void setGensPQfilter(boolean gensPQfilter) {
this.gensPQfilter = gensPQfilter;
}

public void setAutomatonA17AngularReferenceGenerator(String automatonA17AngularReferenceGenerator) {
this.automatonA17AngularReferenceGenerator = automatonA17AngularReferenceGenerator;
}

public void setAutomatonA17MinimumPhaseDifferenceThreshold(double automatonA17MinimumPhaseDifferenceThreshold) {
this.automatonA17MinimumPhaseDifferenceThreshold = automatonA17MinimumPhaseDifferenceThreshold;
}

public void setAutomatonA17MaximumPhaseDifferenceThreshold(double automatonA17MaximumPhaseDifferenceThreshold) {
this.automatonA17MaximumPhaseDifferenceThreshold = automatonA17MaximumPhaseDifferenceThreshold;
}

public void setAutomatonA17ObservationDuration(double automatonA17ObservationDuration) {
this.automatonA17ObservationDuration = automatonA17ObservationDuration;
}

public boolean isExportMainCCOnly() {
return exportMainCCOnly;
}

public boolean isNoSwitch() {
return noSwitch;
}

public boolean isAutomatonA17ObservationDurationSet() {
return automatonA17ObservationDuration >= 0.0;
}
}

0 comments on commit f856f41

Please sign in to comment.