Configuration#
APEM is configured through a single file at the repository root: config.json.
If you are new to the project, the most important thing to understand is this:
you do not create a separate config per run,
you edit
config.json,then you run APEM,
and APEM reads the settings from that file.
How config.json Is Used#
config.json is the runtime input for main.py.
Open
config.json.Set
run.market_model.Edit the corresponding model section.
Run:
python main.py
APEM loads the file, validates it, and executes the selected workflow.
Basic Structure#
config.json is model-scoped and has three main sections:
run: global run selectionunit_based_model: used whenrun.market_model = "unit_based_model"order_book_based_model: used whenrun.market_model = "order_book_based_model"
config.json
├── run
├── unit_based_model
└── order_book_based_model
Minimal Example#
{
"run": {
"market_model": "unit_based_model",
"verbosity": true
},
"unit_based_model": {
"dataset": "PyPSAEurLarge",
"power_flow_model": { "type": "DCOPF" },
"pricing_algorithm": "ELMP",
"solver_configuration": {
"time_limit": 3600,
"slack_penalty": 1e15
}
},
"order_book_based_model": {
"dataset": "TEST_3NODE",
"cut_type": "price based",
"euphemia_configuration": {
"network_model": "FBMC",
"max_iterations": 50
}
}
}
This example runs the unit-based workflow because run.market_model is unit_based_model.
What To Edit First#
field |
required |
purpose |
typical values |
|---|---|---|---|
|
yes |
Select active workflow. |
|
|
recommended |
Control console output level. |
|
If run.market_model = "unit_based_model", edit these first:
field |
required |
purpose |
examples |
|---|---|---|---|
|
yes |
Choose input dataset. |
|
|
yes |
Choose nodal vs zonal power-flow model. |
|
|
yes |
Choose pricing method. |
|
|
recommended |
Runtime, tolerance, and solver behavior. |
|
For zonal runs, also configure:
unit_based_model.redispatchunit_based_model.zonal_configuration
If run.market_model = "order_book_based_model", edit these first:
field |
required |
purpose |
examples |
|---|---|---|---|
|
yes |
Select order-book dataset. |
|
|
yes |
Select cut strategy. |
|
|
yes |
Select network representation. |
|
|
recommended |
Iteration/reinsertion/solver controls. |
|
Note
Redispatch is only used for zonal unit-based models (Zonal_NTC_aggregated, Zonal_NTC_multiedge, Zonal_FBMC). It is not used with DCOPF. These zonal models are only supported for PyPSAEurSmall and PyPSAEurLarge.
Two Common Starting Points#
{
"run": {
"market_model": "unit_based_model",
"verbosity": true
},
"unit_based_model": {
"dataset": "PyPSAEurLarge",
"power_flow_model": { "type": "Zonal_NTC_aggregated" },
"pricing_algorithm": "ELMP",
"redispatch": {
"algorithm": "MinCostRD",
"constraint_units": false,
"threshold": 0.001,
"alpha": 0.01
},
"solver_configuration": {
"time_limit": 3600,
"slack_penalty": 1e15
},
"zonal_configuration": {
"type": "zonal_DE2-s",
"factor": 0.8,
"base_case": "BC4"
}
}
}
Use this for zonal unit-based runs with redispatch.
For Zonal_FBMC, zonal_configuration.base_case selects the FBMC base-case construction. See FBMC for the available base cases.
For nodal runs, switch power_flow_model.type to DCOPF and usually omit redispatch and zonal_configuration.
{
"run": {
"market_model": "order_book_based_model",
"verbosity": true
},
"order_book_based_model": {
"dataset": "TEST_3NODE",
"cut_type": "price based",
"euphemia_configuration": {
"network_model": "FBMC",
"max_iterations": 50
}
}
}
Use this for the simplified EUPHEMIA-style order-book workflow.
Main Option Groups#
run.market_model
unit_based_modelorder_book_based_model
unit_based_model.dataset
IEEE_RTSPJMPyPSAEurSmallPyPSAEurLargeARPA
order_book_based_model.dataset
GENERATED_SMALLGENERATED_LARGEOMIEGMETEST_3NODETEST_3NODE_LOWCAPIEEE_RTSARPA
unit_based_model.power_flow_model.type
DCOPFZonal_NTC_aggregatedZonal_NTC_multiedgeZonal_FBMC
unit_based_model.pricing_algorithm
ELMPIPMinMWPJoinMarkup
unit_based_model.redispatch.algorithm (zonal only)
MinCostRDMinAbsCostRDMinAbsVolRD
order_book_based_model.cut_type
price basedcombinatorial bendersno good
Warning
Not every combination is supported.
For the unit-based workflow:
DCOPFis nodal. Use it without redispatch.Zonal_NTC_aggregated,Zonal_NTC_multiedge, andZonal_FBMCare zonal and only supported withPyPSAEurSmallandPyPSAEurLarge.redispatchandzonal_configurationare relevant only for zonal runs.
In practice:
choose
DCOPFfor nodal runschoose zonal models only with
PyPSAEurSmallorPyPSAEurLarge
Validation#
APEM validates config.json before running. Missing or inconsistent settings raise errors instead of running with a broken setup.
Validation is implemented in apem.config_loader.ConfigLoader.