Skip to content

Commit b4d3cb5

Browse files
CBiasuzzisylvlecl
authored andcommitted
if enabled in config, adds an A17 entry in the dta file for Eurostag
1 parent fbd8a93 commit b4d3cb5

File tree

3 files changed

+130
-6
lines changed

3 files changed

+130
-6
lines changed

iidm-ddb/iidm-ddb-eurostag-import-export/src/main/java/eu/itesla_project/iidm/ddb/eurostag_imp_exp/DdExportConfig.java

+72-6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public class DdExportConfig {
2020
private static final boolean DEFAULT_AUTOMATON_A11 = false;
2121
private static final boolean DEFAULT_AUTOMATON_A12 = false;
2222
private static final boolean DEFAULT_AUTOMATON_A14 = false;
23+
private static final boolean DEFAULT_AUTOMATON_A17 = false;
2324
private static final boolean DEFAULT_RST = false;
2425
private static final boolean DEFAULT_ACMC = false;
2526
private static final boolean DEFAULT_LV_LOAD_MODELING = false;
@@ -33,10 +34,15 @@ public class DdExportConfig {
3334
private static final boolean DEFAULT_GENPQFILTER = false;
3435
private static final boolean DEFAULT_EXPORT_MAIN_CC_ONLY = false;
3536
private static final boolean DEFAULT_NOSWITCH = false;
37+
private static final String DEFAULT_AUTOMATON_A17_REFERENCE_GENERATOR = null;
38+
private static final double DEFAULT_AUTOMATON_A17_MINIMUM_PHASE_DIFFERENCE_THRESHOLD = -240.0;
39+
private static final double DEFAULT_AUTOMATON_A17_MAXIMUM_PHASE_DIFFERENCE_THRESHOLD = 240.0;
40+
private static final double DEFAULT_AUTOMATON_A17_OBSERVATION_DURATION = 15.0;
3641

3742
private boolean automatonA11;
3843
private boolean automatonA12;
3944
private boolean automatonA14;
45+
private boolean automatonA17;
4046
private boolean importExportRST;
4147
private boolean importExportACMC;
4248
private boolean LVLoadModeling;
@@ -50,11 +56,16 @@ public class DdExportConfig {
5056
private boolean gensPQfilter;
5157
private boolean exportMainCCOnly;
5258
private boolean noSwitch;
59+
private String automatonA17AngularReferenceGenerator;
60+
private double automatonA17MinimumPhaseDifferenceThreshold;
61+
private double automatonA17MaximumPhaseDifferenceThreshold;
62+
private double automatonA17ObservationDuration;
5363

5464
public static DdExportConfig load() {
5565
boolean automatonA11 = DEFAULT_AUTOMATON_A11;
5666
boolean automatonA12 = DEFAULT_AUTOMATON_A12;
5767
boolean automatonA14 = DEFAULT_AUTOMATON_A14;
68+
boolean automatonA17 = DEFAULT_AUTOMATON_A17;
5869
boolean importExportRST = DEFAULT_RST;
5970
boolean importExportACMC = DEFAULT_ACMC;
6071
boolean lvLoadModeling = DEFAULT_LV_LOAD_MODELING;
@@ -68,12 +79,22 @@ public static DdExportConfig load() {
6879
boolean gensPQfilter = DEFAULT_GENPQFILTER;
6980
boolean exportMainCCOnly = DEFAULT_EXPORT_MAIN_CC_ONLY;
7081
boolean noSwitch = DEFAULT_NOSWITCH;
82+
String automatonA17AngularReferenceGenerator = DEFAULT_AUTOMATON_A17_REFERENCE_GENERATOR;
83+
double automatonA17MinimumPhaseDifferenceThreshold = DEFAULT_AUTOMATON_A17_MINIMUM_PHASE_DIFFERENCE_THRESHOLD;
84+
double automatonA17MaximumPhaseDifferenceThreshold = DEFAULT_AUTOMATON_A17_MAXIMUM_PHASE_DIFFERENCE_THRESHOLD;
85+
double automatonA17ObservationDuration = DEFAULT_AUTOMATON_A17_OBSERVATION_DURATION;
86+
7187

7288
if (PlatformConfig.defaultConfig().moduleExists(MODULE_NAME)) {
7389
ModuleConfig config = PlatformConfig.defaultConfig().getModuleConfig(MODULE_NAME);
7490
automatonA11 = config.getBooleanProperty("automatonA11", DEFAULT_AUTOMATON_A11);
7591
automatonA12 = config.getBooleanProperty("automatonA12", DEFAULT_AUTOMATON_A12);
7692
automatonA14 = config.getBooleanProperty("automatonA14", DEFAULT_AUTOMATON_A14);
93+
automatonA17 = config.getBooleanProperty("automatonA17", DEFAULT_AUTOMATON_A17);
94+
automatonA17AngularReferenceGenerator = config.getStringProperty("automatonA17AngularReferenceGenerator", DEFAULT_AUTOMATON_A17_REFERENCE_GENERATOR);
95+
automatonA17MinimumPhaseDifferenceThreshold = config.getDoubleProperty("automatonA17MinimumPhaseDifferenceThreshold", DEFAULT_AUTOMATON_A17_MINIMUM_PHASE_DIFFERENCE_THRESHOLD);
96+
automatonA17MaximumPhaseDifferenceThreshold = config.getDoubleProperty("automatonA17MaximumPhaseDifferenceThreshold", DEFAULT_AUTOMATON_A17_MAXIMUM_PHASE_DIFFERENCE_THRESHOLD);
97+
automatonA17ObservationDuration = config.getDoubleProperty("automatonA17ObservationDuration", DEFAULT_AUTOMATON_A17_OBSERVATION_DURATION);
7798
importExportRST = config.getBooleanProperty("importExportRST", DEFAULT_RST);
7899
importExportACMC = config.getBooleanProperty("importExportACMC", DEFAULT_ACMC);
79100
lvLoadModeling = config.getBooleanProperty("LVLoadModeling", DEFAULT_LV_LOAD_MODELING);
@@ -93,24 +114,25 @@ public static DdExportConfig load() {
93114
noSwitch = config.getBooleanProperty("noSwitch", DEFAULT_NOSWITCH);
94115
}
95116

96-
return new DdExportConfig(automatonA11, automatonA12, automatonA14, importExportRST, importExportACMC,
97-
lvLoadModeling, rstRegulInjector, rstRegulGenerator, rstRegulGeneratorDelete,
117+
return new DdExportConfig(automatonA11, automatonA12, automatonA14, automatonA17, automatonA17AngularReferenceGenerator, automatonA17MinimumPhaseDifferenceThreshold, automatonA17MaximumPhaseDifferenceThreshold, automatonA17ObservationDuration,
118+
importExportRST, importExportACMC, lvLoadModeling, rstRegulInjector, rstRegulGenerator, rstRegulGeneratorDelete,
98119
acmcRegul, rstPilotGenerators, loadPatternAlpha, loadPatternBeta, gensPQfilter, exportMainCCOnly, noSwitch);
99120
}
100121

101122
public DdExportConfig() {
102-
this(DEFAULT_AUTOMATON_A11, DEFAULT_AUTOMATON_A12, DEFAULT_AUTOMATON_A14, DEFAULT_RST, DEFAULT_ACMC,
103-
DEFAULT_LV_LOAD_MODELING, DEFAULT_RST_REGUL_INJECTOR, DEFAULT_RST_REGUL_GENERATOR, DEFAULT_RST_REGUL_GENERATOR_DELETE,
123+
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,
124+
DEFAULT_RST, DEFAULT_ACMC, DEFAULT_LV_LOAD_MODELING, DEFAULT_RST_REGUL_INJECTOR, DEFAULT_RST_REGUL_GENERATOR, DEFAULT_RST_REGUL_GENERATOR_DELETE,
104125
DEFAULT_ACMC_REGUL, DEFAULT_RST_PILOT_GENERATORS, DEFAULT_LOAD_PATTERN_ALPHA, DEFAULT_LOAD_PATTERN_BETA, DEFAULT_GENPQFILTER, DEFAULT_EXPORT_MAIN_CC_ONLY, DEFAULT_NOSWITCH);
105126
}
106127

107-
public DdExportConfig(boolean automatonA11, boolean automatonA12, boolean automatonA14, boolean importExportRST,
108-
boolean importExportACMC, boolean lvLoadModeling, String rstRegulInjector,
128+
public DdExportConfig(boolean automatonA11, boolean automatonA12, boolean automatonA14, boolean automatonA17, String automatonA17AngularReferenceGenerator, double automatonA17MinimumPhaseDifferenceThreshold, double automatonA17MaximumPhaseDifferenceThreshold, double automatonA17ObservationDuration,
129+
boolean importExportRST, boolean importExportACMC, boolean lvLoadModeling, String rstRegulInjector,
109130
String rstRegulGenerator, String rstRegulGeneratorDelete, String acmcRegul,
110131
String rstPilotGenerators, float loadPatternAlpha, float loadPatternBeta, boolean gensPQfilter, boolean exportMainCCOnly, boolean noSwitch) {
111132
this.automatonA11 = automatonA11;
112133
this.automatonA12 = automatonA12;
113134
this.automatonA14 = automatonA14;
135+
this.automatonA17 = automatonA17;
114136
this.importExportRST = importExportRST;
115137
this.importExportACMC = importExportACMC;
116138
this.LVLoadModeling = lvLoadModeling;
@@ -124,6 +146,10 @@ public DdExportConfig(boolean automatonA11, boolean automatonA12, boolean automa
124146
this.gensPQfilter = gensPQfilter;
125147
this.exportMainCCOnly = exportMainCCOnly;
126148
this.noSwitch = noSwitch;
149+
this.automatonA17AngularReferenceGenerator = automatonA17AngularReferenceGenerator;
150+
this.automatonA17MinimumPhaseDifferenceThreshold = automatonA17MinimumPhaseDifferenceThreshold;
151+
this.automatonA17MaximumPhaseDifferenceThreshold = automatonA17MaximumPhaseDifferenceThreshold;
152+
this.automatonA17ObservationDuration = automatonA17ObservationDuration;
127153
}
128154

129155
public boolean getAutomatonA11() {
@@ -138,6 +164,10 @@ public boolean getAutomatonA14() {
138164
return automatonA14;
139165
}
140166

167+
public boolean getAutomatonA17() {
168+
return automatonA17;
169+
}
170+
141171
public boolean getExportRST() {
142172
return importExportRST;
143173
}
@@ -190,6 +220,22 @@ public boolean getGensPQfilter() {
190220
return gensPQfilter;
191221
}
192222

223+
public String getAutomatonA17AngularReferenceGenerator() {
224+
return automatonA17AngularReferenceGenerator;
225+
}
226+
227+
public double getAutomatonA17MinimumPhaseDifferenceThreshold() {
228+
return automatonA17MinimumPhaseDifferenceThreshold;
229+
}
230+
231+
public double getAutomatonA17MaximumPhaseDifferenceThreshold() {
232+
return automatonA17MaximumPhaseDifferenceThreshold;
233+
}
234+
235+
public double getAutomatonA17ObservationDuration() {
236+
return automatonA17ObservationDuration;
237+
}
238+
193239
public void setAutomatonA11(Boolean automatonA11) {
194240
this.automatonA11 = automatonA11;
195241
}
@@ -202,6 +248,10 @@ public void setAutomatonA14(Boolean automatonA14) {
202248
this.automatonA14 = automatonA14;
203249
}
204250

251+
public void setAutomatonA17(Boolean automatonA17) {
252+
this.automatonA17 = automatonA17;
253+
}
254+
205255
public void setImportExportRST(Boolean importExportRST) {
206256
this.importExportRST = importExportRST;
207257
}
@@ -246,6 +296,22 @@ public void setGensPQfilter(boolean gensPQfilter) {
246296
this.gensPQfilter = gensPQfilter;
247297
}
248298

299+
public void setAutomatonA17AngularReferenceGenerator(String automatonA17AngularReferenceGenerator) {
300+
this.automatonA17AngularReferenceGenerator = automatonA17AngularReferenceGenerator;
301+
}
302+
303+
public void setAutomatonA17MinimumPhaseDifferenceThreshold(double automatonA17MinimumPhaseDifferenceThreshold) {
304+
this.automatonA17MinimumPhaseDifferenceThreshold = automatonA17MinimumPhaseDifferenceThreshold;
305+
}
306+
307+
public void setAutomatonA17MaximumPhaseDifferenceThreshold(double automatonA17MaximumPhaseDifferenceThreshold) {
308+
this.automatonA17MaximumPhaseDifferenceThreshold = automatonA17MaximumPhaseDifferenceThreshold;
309+
}
310+
311+
public void setAutomatonA17ObservationDuration(double automatonA17ObservationDuration) {
312+
this.automatonA17ObservationDuration = automatonA17ObservationDuration;
313+
}
314+
249315
public boolean isExportMainCCOnly() {
250316
return exportMainCCOnly;
251317
}

iidm-ddb/iidm-ddb-eurostag-import-export/src/main/java/eu/itesla_project/iidm/ddb/eurostag_imp_exp/DdbDtaImpExp.java

+45
Original file line numberDiff line numberDiff line change
@@ -1894,7 +1894,52 @@ public void dumpDataAutomatons(SimulatorInst eurostagSim, DDBManager ddbmanager,
18941894
}
18951895
DtaParser.dumpAutomatonHeader("A14", true, dtaOutStream);
18961896
}
1897+
if (configExport.getAutomatonA17()) {
1898+
//A17
1899+
dumpDataAutomatonA17(dtaOutStream, iidm2eurostagId);
1900+
}
1901+
}
1902+
1903+
public void dumpDataAutomatonA17(PrintStream out, Map<String, String> iidm2eurostagId) throws IOException {
1904+
String refGenId = configExport.getAutomatonA17AngularReferenceGenerator();
1905+
String automatonId = "A17";
1906+
if (refGenId == null) {
1907+
log.warn("Dump automaton {}: an angular reference generator id must be declared (attribute automatonA17AngularReferenceGenerator)", automatonId);
1908+
} else {
1909+
Generator refGen = network.getGenerator(refGenId);
1910+
if (refGen == null) {
1911+
log.warn("Dump automaton {}: skipping generator {}: no generators with this ID exist", automatonId, refGenId);
1912+
} else {
1913+
if (!iidm2eurostagId.containsKey(refGenId)) {
1914+
log.warn("Dump automaton {}: skipping generator {}: no mapped eurostag id exists, for it", automatonId, refGenId);
1915+
} else {
1916+
String refGenEurostagId = iidm2eurostagId.get(refGenId);
1917+
log.debug("Dump automaton {}: generator id: {} mapped to eurostag id: {}", automatonId, refGenId, refGenEurostagId);
1918+
try {
1919+
DtaParser.dumpAutomatonHeader(automatonId, false, out);
1920+
HashMap<String, Object> zm = new HashMap<String, Object>();
1921+
zm.put("RESEARCH_CRITERION", "1");
1922+
zm.put("AUTO_DEVICE_FUNCTIONING_MODE", "1");
1923+
zm.put("machine.name", refGenEurostagId);
1924+
zm.put("SAMIN", configExport.getAutomatonA17MinimumPhaseDifferenceThreshold());
1925+
zm.put("SAMAX", configExport.getAutomatonA17MaximumPhaseDifferenceThreshold());
1926+
zm.put("DOBSA", configExport.getAutomatonA17ObservationDuration());
1927+
zm.put("TYPE_REFERENCE", " ");
1928+
zm.put("SVMIN", "0.");
1929+
zm.put("SVMAX", "0.");
1930+
zm.put("DELAIV", "0.");
1931+
zm.put("DOBSV", "0.");
1932+
EurostagRecord eRecord = new EurostagRecord(automatonId, zm);
1933+
DtaParser.dumpZone(eRecord, out);
1934+
DtaParser.dumpAutomatonHeader(automatonId, true, out);
1935+
} catch (ParseException e) {
1936+
log.error(e.getMessage(), e);
1937+
}
1938+
}
1939+
}
1940+
}
18971941
}
1942+
18981943
public void dumpDataGeneratorAutomaton(Generator g, SimulatorInst simInst, String typeName, PrintStream out, Map<String, String> iidm2eurostagId) throws IOException {
18991944
if (g == null) {
19001945
throw new RuntimeException("Generator must be not null");

iidm-ddb/iidm-ddb-eurostag-import-export/src/main/java/eu/itesla_project/iidm/ddb/eurostag_imp_exp/DtaParser.java

+13
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ private DtaParser(final String name) {
121121
"tap.direction,TMAN,V1,V2,TV1,TDEL"
122122
});
123123

124+
componentsVariablesNames.put("A17", new String[]{
125+
"RESEARCH_CRITERION", "AUTO_DEVICE_FUNCTIONING_MODE",
126+
"machine.name", "SAMIN", "SAMAX", "DOBSA",
127+
"TYPE_REFERENCE", "SVMIN", "SVMAX", "DELAIV", "DOBSV"
128+
});
129+
124130
componentsVariablesNames.put("A33_ACMC", new String[]{
125131
"keyword,ma.name,interface.name,block.number,c.type,S1,S2,S3,T1,TDEL",
126132
"",
@@ -240,6 +246,12 @@ private DtaParser(final String name) {
240246
"(17X, A2, 10X, F8, 7X, F8, 1X, F8, 1X, F8, 1X, F8)"
241247
});
242248

249+
componentsDescriptors.put("A17", new String[]{
250+
"(A1, 1X, A1)",
251+
"(A8, 1X, F8, 1X, F8, 10X, F8)",
252+
"(A1, 8X, F8, 1X, F8, 1X, F8, 1X, F8)"
253+
});
254+
243255
componentsDescriptors.put("A33_ACMC", new String[]{
244256
"(A3,1X,A8,1X,A8,1X,A8,1X,I1,1X,F8,1X,F8,1X,F8,1X,F8,1X,F8)",
245257
"()",
@@ -496,6 +508,7 @@ public static void dumpZone(EurostagRecord zone, PrintStream out) throws ParseEx
496508
case "A11":
497509
case "A12":
498510
case "A14":
511+
case "A17":
499512
int acountl = 1;
500513
String[] recordsFormattinga = componentsDescriptors.get(zone.typeName);
501514
for (String string : recordsFormattinga) {

0 commit comments

Comments
 (0)