Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Market Calibration Areas

Market calibration areas (samkjøringsområder) is used to group areas into greater areas.

Motivating example:

Numedal belongs to area MarketArea1. Otta belongs to MarketArea2.

Numedal and Otta are connected with a DC-line.

This JSON example represents the above model, where certain non-relevant, but required parts are cut for clarity:

{
    "model": {
        "market_calibration_areas": [
            {
                "name": "market_area_1"
            },
            {
                "name": "market_area_2"
            }
        ],
        "areas": [
            {
                "name": "numedal"
            },
            {
                "name": "otta"
            }
        ],
        "dclines": [
            {
                "name": "DC_A"
            }
        ],
        "connections": [
            {
                "from": "numedal",
                "to": "DC_A"
            },
            {
                "from": "DC_A",
                "to": "otta"
            },
            {
                "from": "numedal",
                "to": "market_area_1"
            },
            {
                "from": "otta",
                "to": "market_area_2"
            }
        ]
    }
}

Multiple areas:

To expand on the example above, to have multiple areas per area, connect the area object to the market calibration area.

Full JSON source listing:

Expand to see full JSON listing with 2 market calibration areas and 6 areas.
{
    "$schema": "https://gitlab.sintef.no/energy/ltm/pyltmapi/-/raw/main/model.schema.json",
    "model": {
        "global_settings": {
            "name": "global_settings",
            "output_path": "testout_market_calibration_areas/",
            "calc_water_value_flag": {
                "timestamps": [
                    "2024-01-01T00:00:00Z",
                    "2026-12-28T00:00:00Z"
                ],
                "scenarios": [
                    [
                        1,
                        0
                    ]
                ]
            },
            "historical_period": {
                "timestamps": [
                    "2000-01-01T00:00:00Z",
                    "2002-01-01T00:00:00Z"
                ],
                "scenarios": [
                    [
                        1,
                        0
                    ]
                ]
            },
            "simulation_price_period": {
                "#comment": "prisavsnitt -> PRISREKKE.DATA",
                "timestamps": [
                    "2024-01-01T00:00:00Z",
                    "2024-01-02T00:00:00Z",
                    "2024-01-03T00:00:00Z",
                    "2024-01-04T00:00:00Z",
                    "2024-01-05T00:00:00Z"
                ],
                "scenarios": [
                    [
                        1,
                        2,
                        3,
                        4,
                        5
                    ]
                ]
            }
        },
        "market_calibration_areas": [
            {
                "name": "market_area_1"
            },
            {
                "name": "market_area_2"
            }
        ],
        "areas": [
            {
                "name": "numedal"
            },
            {
                "name": "rjukan"
            },
            {
                "name": "ustaoset"
            },
            {
                "name": "otta"
            },
            {
                "name": "nordherad"
            },
            {
                "name": "litldalen"
            }
        ],
        "dclines": [
            {
                "name": "DC_A",
                "forward_capacity": {
                    "timestamps": [
                        "2024-01-01T00:00:00Z"
                    ],
                    "scenarios": [
                        [
                            50
                        ]
                    ]
                },
                "backward_capacity": {
                    "timestamps": [
                        "2024-01-01T00:00:00Z"
                    ],
                    "scenarios": [
                        [
                            50
                        ]
                    ]
                },
                "loss_percentage": 1.0,
                "forward_cost": 2.0,
                "backward_cost": 3.0
            },
            {
                "name": "RJU_NUM",
                "forward_capacity": {
                    "timestamps": [
                        "2024-01-01T00:00:00Z"
                    ],
                    "scenarios": [
                        [
                            50
                        ]
                    ]
                },
                "backward_capacity": {
                    "timestamps": [
                        "2024-01-01T00:00:00Z"
                    ],
                    "scenarios": [
                        [
                            50
                        ]
                    ]
                },
                "loss_percentage": 1.0,
                "forward_cost": 2.0,
                "backward_cost": 3.0
            },
            {
                "name": "UST_NUM",
                "forward_capacity": {
                    "timestamps": [
                        "2024-01-01T00:00:00Z"
                    ],
                    "scenarios": [
                        [
                            50
                        ]
                    ]
                },
                "backward_capacity": {
                    "timestamps": [
                        "2024-01-01T00:00:00Z"
                    ],
                    "scenarios": [
                        [
                            50
                        ]
                    ]
                },
                "loss_percentage": 1.0,
                "forward_cost": 2.0,
                "backward_cost": 3.0
            },
            {
                "name": "NOR_OTT",
                "forward_capacity": {
                    "timestamps": [
                        "2024-01-01T00:00:00Z"
                    ],
                    "scenarios": [
                        [
                            50
                        ]
                    ]
                },
                "backward_capacity": {
                    "timestamps": [
                        "2024-01-01T00:00:00Z"
                    ],
                    "scenarios": [
                        [
                            50
                        ]
                    ]
                },
                "loss_percentage": 1.0,
                "forward_cost": 2.0,
                "backward_cost": 3.0
            },
            {
                "name": "LIT_OTT",
                "forward_capacity": {
                    "timestamps": [
                        "2024-01-01T00:00:00Z"
                    ],
                    "scenarios": [
                        [
                            50
                        ]
                    ]
                },
                "backward_capacity": {
                    "timestamps": [
                        "2024-01-01T00:00:00Z"
                    ],
                    "scenarios": [
                        [
                            50
                        ]
                    ]
                },
                "loss_percentage": 1.0,
                "forward_cost": 2.0,
                "backward_cost": 3.0
            }
        ],
        "connections": [
            {
                "from": "numedal",
                "to": "market_area_1"
            },
            {
                "from": "rjukan",
                "to": "market_area_1"
            },
            {
                "from": "ustaoset",
                "to": "market_area_1"
            },
            {
                "from": "otta",
                "to": "market_area_2"
            },
            {
                "from": "nordherad",
                "to": "market_area_2"
            },
            {
                "from": "litldalen",
                "to": "market_area_2"
            },
            {
                "from": "numedal",
                "to": "DC_A"
            },
            {
                "from": "DC_A",
                "to": "otta"
            },
            {
                "from": "rjukan",
                "to": "RJU_NUM"
            },
            {
                "from": "RJU_NUM",
                "to": "numedal"
            },
            {
                "from": "ustaoset",
                "to": "UST_NUM"
            },
            {
                "from": "UST_NUM",
                "to": "numedal"
            },
            {
                "from": "nordherad",
                "to": "NOR_OTT"
            },
            {
                "from": "NOR_OTT",
                "to": "otta"
            },
            {
                "from": "litldalen",
                "to": "LIT_OTT"
            },
            {
                "from": "LIT_OTT",
                "to": "otta"
            }
        ]
    }
}

Example code:

import os

from pyltmapi import LtmSession

with LtmSession("market_calibration_areas_session") as session:
    session.load(filename="market_calibration_areas.json")
    session.write_model()



from pyltmapi import LtmSession

with LtmSession("simulation") as session:
    lake_mead = session.model.add("area", "lake_mead")
    dam = session.model.add("reservoir", "hoover_dam")
    plant = session.model.add("plant", "power_plant")
    river = session.model.add("reservoir", "colorado_river")

    session.connect(lake_mead, dam)
    session.connect(dam, plant)
    session.connect(plant, river)

    session.write_model()
    _, results = session.execute_model()