Skip to content

Commit d12a7bc

Browse files
Add cgmes import update use cases (#33)
* Add cgmes import update use cases * Apply Reviewer's comments Signed-off-by: marquesja1 <marquesja@aia.es>
1 parent c268f1a commit d12a7bc

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,75 @@ List<Contingency> contingencies = network.getLineStream().map(l -> Contingency.l
7575
SecurityAnalysisResult result = SecurityAnalysis.run(network, contingencies).getResult();
7676
```
7777

78+
Import a CGMES model in a single step.
79+
The model is defined by the files `20251211T0000Z_1D_TSO_EQ_000` and `20251211T0000Z_1D_TSO_SSH_000`:
7880

81+
```java
82+
Path pathFile = Paths.get("/path/to/cgmes_model");
83+
Network network = Network.read(new DirectoryDataSource(pathFile, "20251211T0000Z_1D_TSO"));
84+
```
85+
86+
Import a CGMES model in two steps: first, import only the EQ file, and then update the model by reading the SSH file.
87+
The model is defined by the files `20251211T0000Z_1D_TSO_EQ_000` and `20251211T0000Z_1D_TSO_SSH_000`:
88+
89+
```java
90+
Path pathFile = Paths.get("/path/to/cgmes_model");
91+
Network network = Network.read(new DirectoryDataSource(pathFile, "20251211T0000Z_1D_TSO_EQ"));
92+
network.update(new DirectoryDataSource(pathFile, "20251211T0000Z_1D_TSO_SSH"));
93+
```
94+
95+
Import a CGMES model consisting of one EQ file (`20251211T0000Z_1D_TSO_EQ_000`) and four SSH files:
96+
midnight (`20251211T0000Z_1D_TSO_SSH_000`), morning (`20251211T0800Z_1D_TSO_SSH_000`), afternoon (`20251211T1600Z_1D_TSO_SSH_000`), and end of day (`20251211T2400Z_1D_TSO_SSH_000`).
97+
The midnight SSH file is complete and contains data for all equipment, while the remaining SSH files are partial, including only changes relative to the previous SSH file.
98+
The entire process is carried out in four steps, using a single variant:
99+
100+
```java
101+
Path pathFile = Paths.get("/path/to/cgmes_model");
102+
103+
// Import the midnight EQ and SSH files
104+
Path pathFile = Paths.get("/work/tmp/cgmes_update/partial");
105+
Network network = Network.read(new DirectoryDataSource(pathFile, "20251211T0000Z_1D_TSO"));
106+
107+
// Use previous values to fill in missing data in the partial SSH files using previous values
108+
Properties properties = new Properties();
109+
properties.put("iidm.import.cgmes.use-previous-values-during-update", "true");
110+
111+
// Update the model by importing the morning SSH file
112+
network.update(new DirectoryDataSource(pathFile, "20251211T0800Z_1D_TSO_SSH"), properties);
113+
114+
// Update the model by importing the afternoon SSH file
115+
network.update(new DirectoryDataSource(pathFile, "20251211T1600Z_1D_TSO_SSH"), properties);
116+
117+
// Update the model by importing the end of the day SSH file
118+
network.update(new DirectoryDataSource(pathFile, "20251211T2400Z_1D_TSO_SSH"), properties);
119+
```
120+
121+
Import a CGMES model consisting of one EQ file (`20251210T0000Z_1D_TSO_EQ_000`) and four SSH files: midnight (`20251210T0000Z_1D_TSO_SSH_000`), morning (`20251210T0800Z_1D_TSO_SSH_000`), afternoon (`20251210T1600Z_1D_TSO_SSH_000`), and end of day (`20251210T2400Z_1D_TSO_SSH_000`).
122+
All SSH files are complete and contain data for all equipment.
123+
The entire process is carried out in four steps, using a separate variant for each SSH file:
124+
125+
```java
126+
Path pathFile = Paths.get("/path/to/cgmes_model");
127+
128+
// Import the midnight EQ and SSH files
129+
Path pathFile = Paths.get("/work/tmp/cgmes_update/variant");
130+
Network network = Network.read(new DirectoryDataSource(pathFile, "20251210T0000Z_1D_TSO"));
131+
132+
// Update the model by importing the morning SSH file into a new variant
133+
network.getVariantManager().cloneVariant(network.getVariantManager().getWorkingVariantId(), "morning");
134+
network.getVariantManager().setWorkingVariant("morning");
135+
network.update(new DirectoryDataSource(pathFile, "20251210T0800Z_1D_TSO_SSH"));
136+
137+
// Update the model by importing the afternoon SSH file into a new variant
138+
network.getVariantManager().cloneVariant(network.getVariantManager().getWorkingVariantId(), "afternoon");
139+
network.getVariantManager().setWorkingVariant("afternoon");
140+
network.update(new DirectoryDataSource(pathFile, "20251210T1600Z_1D_TSO_SSH"));
141+
142+
// Update the model by importing the end of the day SSH file into a new variant
143+
network.getVariantManager().cloneVariant(network.getVariantManager().getWorkingVariantId(), "end-of-the-day");
144+
network.getVariantManager().setWorkingVariant("end-of-the-day");
145+
network.update(new DirectoryDataSource(pathFile, "20251210T2400Z_1D_TSO_SSH"));
146+
```
79147

80148
Load 2 CGMES files, merge both networks and run a load flow on merged network:
81149

0 commit comments

Comments
 (0)