Creating the EMPS FBMC input file from the LtmApi¶
This is a guide for creating the input file for the FBMC functionality for the EMPS. The guide is valid from pyltm release 0.25.3. and is still experimental.
- The following steps are necessary:
Minimal import of an existing CLI LTM v10 dataset.
Dump the imported model (
model.json) and timeseries (timeseries.h5).Define FBMC objects in the
model.jsonfile (see the FBMC example)Load and write EMPS files and the input file ptdf_constraints.h5 to a directory
Minimal import¶
A minimal import of an EMPS CLI v10 dataset is necessary for creating FBMC input file ptdf_constraints.h5, (see prerequisites for importing a CLI LTM v10 dataset Importing a classic runtime directory). The necessary files include:
MASKENETT.DATA and cap_file.h5
LtmSystem.xml
.ENMD
All importer options can be turned off for a minimal import, as shown in the example.
path = "/path/to/ltm/runtime/directory"
session.import_directory(path,import_market_steps=False,import_loads=False,
recalculate_average_yearly_inflow=False,import_detailed_hydro=False,import_wind=False)
Dumping the model¶
Dump the model and timeseries to files with the following method.
session.dump_model(path,model_filename="minimal_model.json",timeseries_filename="timeseries.h5")
These files can be used a starting point for creating the FBMC input. Check that the minimal_model.json file contains the object keys:
global_settingsareasdclinesconnections
In global_settings find the key timesteps_per_week and adjust it to your dataset’s time resolution.
Define the FBMC parameters¶
It is recommended to read the sections FBMC example and Flow-Based Market-Coupling functionality as an introduction.
Necessary input:
Mapping of emps areas in bidding zones.
Bidding Zones
"bidding_zones": [
{
"#comment": "numedal",
"name": "N1",
"is_fbmc": true
},
{
"#comment": "tev and battery",
"name": "N2",
"is_fbmc": true
},
{
"#comment": "otra",
"name": "N3",
"is_fbmc": true
},
{
"#comment": "HVDC numedal",
"name": "N1_hvdc",
"is_fbmc": true
},
{
"#comment": "HVDC tev",
"name": "N2_hvdc",
"is_fbmc": true
},
{
"#comment": "HVDC otra",
"name": "N3_hvdc",
"is_fbmc": true
}
],
- Exogenous FBMC domain parameters must be provided as
cnes: RAM
Zone-to-slack PTDFs for relevant bidding zones
- Exogenous FBMC domain parameters must be provided as
CNEs
"cnes": [
{
"name": "N1-N2",
"cnecName": "Test1",
"biddingZoneFrom": "N1",
"biddingZoneTo": "N2",
"active": {
"name": "",
"timestamps": [
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
1
]
]
},
"ram": {
"name": "",
"timestamps": [
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
20.0
]
]
},
"ptdf": {
"N1": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.33333,
0.33333
]
]
},
"N2": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
-0.33333,
-0.33333
]
]
},
"N3": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
},
"N1_HVDC": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.33333,
0.33333
]
]
},
"N2_HVDC": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
-0.33333,
-0.33333
]
]
},
"N3_HVDC": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
}
}
},
{
"name": "N2-N3",
"cnecName": "Test2",
"biddingZoneFrom": "N2",
"biddingZoneTo": "N3",
"active": {
"name": "",
"timestamps": [
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
1
]
]
},
"ram": {
"name": "",
"timestamps": [
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
20.0
]
]
},
"ptdf": {
"N1": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.33333,
0.33333
]
]
},
"N2": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.66666,
0.66666
]
]
},
"N3": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
},
"N1_HVDC": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.33333,
0.33333
]
]
},
"N2_HVDC": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.66666,
0.66666
]
]
},
"N3_HVDC": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
}
}
},
{
"name": "N3-N1",
"cnecName": "Test3",
"biddingZoneFrom": "N3",
"biddingZoneTo": "N1",
"active": {
"name": "",
"timestamps": [
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
1
]
]
},
"ram": {
"name": "",
"timestamps": [
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
20.0
]
]
},
"ptdf": {
"N1": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
-0.66666,
-0.66666
]
]
},
"N2": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
-0.33333,
-0.33333
]
]
},
"N3": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
},
"N1_HVDC": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
-0.66666,
-0.66666
]
]
},
"N2_HVDC": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
-0.33333,
-0.33333
]
]
},
"N3_HVDC": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
}
}
},
{
"name": "N1_HVDC-N1",
"cnecName": "Test3",
"biddingZoneFrom": "N1_HVDC",
"biddingZoneTo": "N1",
"active": {
"name": "",
"timestamps": [
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
1
]
]
},
"ram": {
"name": "",
"timestamps": [
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
20.0
]
]
},
"ptdf": {
"N1": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
},
"N2": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
},
"N3": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
},
"N1_HVDC": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
1.0,
1.0
]
]
},
"N2_HVDC": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
},
"N3_HVDC": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
}
}
},
{
"name": "N2_HVDC-N2",
"cnecName": "Test3",
"biddingZoneFrom": "N2_HVDC",
"biddingZoneTo": "N2",
"active": {
"name": "",
"timestamps": [
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
1
]
]
},
"ram": {
"name": "",
"timestamps": [
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
20.0
]
]
},
"ptdf": {
"N1": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
},
"N2": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
},
"N3": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
},
"N1_HVDC": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
},
"N2_HVDC": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
1.0,
1.0
]
]
},
"N3_HVDC": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
}
}
},
{
"name": "N3_HVDC-N3",
"cnecName": "Test3",
"biddingZoneFrom": "N3_HVDC",
"biddingZoneTo": "N3",
"active": {
"name": "",
"timestamps": [
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
1
]
]
},
"ram": {
"name": "",
"timestamps": [
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
20.0
]
]
},
"ptdf": {
"N1": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
},
"N2": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
},
"N3": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
},
"N1_HVDC": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
},
"N2_HVDC": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
0.0,
0.0
]
]
},
"N3_HVDC": {
"timestamps": [
"2025-02-12T23:00:00Z",
"2025-02-13T00:00:00Z"
],
"scenarios": [
[
1.0,
1.0
]
]
}
}
}
]
The FBMC parameters can be provided by for example a calculator as the Småstein project or obtain from the JAO publication tool https://publicationtool.jao.eu/nordic/api/.
If using an input file from the JAO publication tool obtained through their API is used, the input file can be referenced in global_settings and the LtmApi will read the file.
"global_settings": {
"jao_data_source": "test_jao_2hour.json"
}
Note
- Disclaimer:
If the input structure from the JAO API changes, please inform SINTEF and we can adjust the file-parser. We get no automatic notice of such changes.
Load and write model¶
To create the EMPS FBMC input file ptdf_constraints.h5 see example below:
# Load model from file.
session.load(filename="minimal_model.json")
# Write model to disk, and automatically generate an output directory.
session.write_model()
Check the output directory to obtain the input file.