From 9d7f46a80b40573c817b2468bbd7a1a7e206f421 Mon Sep 17 00:00:00 2001 From: Diego Alejandro Tejada Arango Date: Wed, 26 Feb 2025 08:48:30 +0100 Subject: [PATCH 01/12] Remove prettier from the pre-commit --- .pre-commit-config.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 72eefc50..24cef0e6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,12 +37,6 @@ repos: rev: 054bda51dbe278b3e86f27c890e3f3ac877d616c hooks: - id: validate-cff - - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v4.0.0-alpha.8" # Use the sha or tag you want to point at - hooks: - - id: prettier - types_or: [yaml, json] - exclude: ".copier-answers.yml" - repo: https://github.com/adrienverge/yamllint rev: v1.35.1 hooks: From 4aa55e53de4cfb841b1d80004e26abc767922559 Mon Sep 17 00:00:00 2001 From: Diego Alejandro Tejada Arango Date: Wed, 26 Feb 2025 08:48:52 +0100 Subject: [PATCH 02/12] Add JSON schema file --- src/input-schemas.json | 1017 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1017 insertions(+) create mode 100644 src/input-schemas.json diff --git a/src/input-schemas.json b/src/input-schemas.json new file mode 100644 index 00000000..12d3f980 --- /dev/null +++ b/src/input-schemas.json @@ -0,0 +1,1017 @@ +{ + "assets": { + "basic": { + "asset": { + "constraints": null, + "default": null, + "description": "Unique identifier with the name of the asset.", + "type": "VARCHAR", + "unit": null + }, + "capacity": { + "constraints": { + "minimum": 0 + }, + "default": 0, + "description": "Capacity for one unit of the asset (is therefore multiplied by number of existing plus invested units).", + "type": "DOUBLE", + "unit": "MW" + }, + "capacity_storage_energy": { + "constraints": { + "minimum": 0 + }, + "deafult": 0, + "description": "Capacity of one storage unit.", + "type": "DOUBLE", + "unit": "MWh" + }, + "consumer_balance_sense": { + "constraints": { + "OneOf": [ + "==", + ">=", + "=<" + ] + }, + "default": "==", + "description": "Is the sense of the consumer balance constraint, equal to, greater than or less than.", + "type": "VARCHAR", + "unit": null + }, + "discount_rate": { + "constraints": { + "minimum": 0 + }, + "default": 0, + "description": " e.g. 0.05 is 5 %. discount rate for the annuity calculation.", + "type": "DOUBLE", + "unit": "ratio" + }, + "economic_lifetime": { + "constraints": { + "minimum": 0 + }, + "default": 1, + "description": "Economic lifetime of the unit for annuity calculation.", + "type": "INTEGER", + "unit": "years" + }, + "energy_to_power_ratio": { + "constraints": { + "minimum": 0 + }, + "deafult": 0, + "description": "Fixed ratio between the energy storage capacity [MWh] and the discharge/charge capacity [MW] for energy storage investments where `storage_method_energy = false`.", + "type": "DOUBLE", + "units": "h" + }, + "group": { + "constraint": null, + "default": null, + "description": "Group to which the asset belongs to (null/empty/missing -> no group).", + "type": "VARCHAR", + "unit": null + }, + "investment_integer": { + "constraints": null, + "default": false, + "description": "Whether investment decisions are using integer variables.", + "type": "BOOLEAN", + "unit": null + }, + "investment_integer_storage_energy": { + "constraints": null, + "default": false, + "description": "Whether investment for storage energy is integer or continuous. It only applies for energy storage investments where `storage_method_energy = true`.", + "type": "BOOLEAN", + "unit": null + }, + "investment_method": { + "constraints": { + "OneOf": [ + "none", + "simple", + "compact" + ] + }, + "default": "none", + "description": "How investments are treated.", + "type": "VARCHAR", + "unit": null + }, + "is_seasonal": { + "constraints": null, + "default": false, + "description": "Whether seasonal storage (e.g., hydro) or not (e.g., battery)", + "type": "BOOLEAN", + "unit": null + }, + "max_ramp_down": { + "constraints": { + "minimum": 0 + }, + "deafult": 0, + "description": "Maximum ramping down rate as a portion of the capacity of asset.", + "type": "DOUBLE", + "units": "p.u./h" + }, + "max_ramp_up": { + "constraints": { + "minimum": 0 + }, + "deafult": 0, + "description": "Maximum ramping up rate as a portion of the capacity of asset.", + "type": "DOUBLE", + "units": "p.u./h" + }, + "min_operating_point": { + "constraints": { + "maximum": 1, + "minimum": 0 + }, + "default": 0, + "description": "Minimum operating point or minimum stable generation level defined as a portion of the capacity of asset.", + "type": "DOUBLE", + "unit": "p.u." + }, + "ramping": { + "constraints": null, + "default": false, + "description": "Whether asset has ramping constraints or not.", + "type": "BOOLEAN", + "unit": null + }, + "storage_method_energy": { + "constraints": null, + "default": false, + "description": "Whether there is independent investment on storage capacity or not. If false, the investment on storage capacity uses the energy_to_power_ratio as a constant fixed value.", + "type": "BOOLEAN", + "unit": null + }, + "technical_lifetime": { + "constraints": { + "minimum": 0 + }, + "default": 1, + "description": "Technical lifetime of the unit to determine for how long the capacity is considered from the commission year.", + "type": "INTEGER", + "unit": "years" + }, + "type": { + "constraints": { + "OneOf": [ + "producer", + "consumer", + "storage", + "conversion", + "hub" + ] + }, + "deafult": null, + "description": "Type of energy asset.", + "type": "VARCHAR", + "unit": null + }, + "unit_commitment": { + "constraints": null, + "default": false, + "description": "Whether asset has unit commitment constraints or not", + "type": "BOOLEAN", + "units": null + }, + "unit_commitment_integer": { + "constraints": null, + "default": false, + "description": "Whether the unit commitment variables are integer or not.", + "type": "BOOLEAN", + "unit": null + }, + "unit_commitment_method": { + "constraints": { + "OneOf": [ + null, + "basic" + ] + }, + "default": null, + "description": "Which unit commitment method to use (null/empty/missing -> no unit commitment method).", + "type": "VARCHAR", + "unit": null + }, + "use_binary_storage_method": { + "constraints": { + "OneOf": [ + null, + "binary", + "relaxed_binary" + ] + }, + "default": null, + "description": "Whether to use an extra binary variable for the storage assets to avoid charging and discharging simultaneously (null/empty/missing -> no binary).", + "type": "VARCHAR", + "units": null + } + }, + "both": { + "asset": { + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `basic` table.", + "type": "VARCHAR", + "unit": null + }, + "commission_year": { + "constraints": null, + "default": 2000, + "description": "Year of commissioning", + "type": "INTEGER", + "unit": null + }, + "decommissionable": { + "constraints": null, + "default": false, + "description": "Whether the asset can be decomission or not.", + "type": "BOOLEAN", + "unit": null + }, + "initial_storage_units": { + "constraints": null, + "default": 0, + "description": "Number of existing storage units", + "type": "DOUBLE", + "unit": "number" + }, + "initial_units": { + "constraints": null, + "default": 0, + "description": "Number of existing units", + "type": "DOUBLE", + "unit": "number" + }, + "milestone_year": { + "constraints": null, + "default": 2000, + "description": "Year of investment and operation decisions in the optimization.", + "type": "INTEGER", + "unit": null + } + }, + "commission": { + "asset": { + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `basic` table.", + "type": "VARCHAR", + "unit": null + }, + "commission_year": { + "constraints": null, + "default": 2000, + "description": "Year of commissioning.", + "type": "INTEGER", + "unit": null + }, + "fixed_cost": { + "constraints": null, + "default": null, + "description": "Fixed annual cost for the asset capacity.", + "type": "DOUBLE", + "unit": "CUR/MW/year" + }, + "fixed_cost_storage_energy": { + "constraints": null, + "default": null, + "description": "Fixed annual cost for the asset storage capacity", + "type": "DOUBLE", + "unit": "CUR/MWh/year" + }, + "investment_cost": { + "constraints": null, + "default": null, + "description": "Investment cost for the asset capacity.", + "type": "DOUBLE", + "unit": "CUR/MW" + }, + "investment_cost_storage_energy": { + "constraints": null, + "default": null, + "description": "Investment cost for the asset energy storage capacity.", + "type": "DOUBLE", + "unit": "CUR/MWh" + }, + "investment_limit": { + "constraints": null, + "default": null, + "description": "Maximum capacity for the asset investment. If the initial value is null, empty, or missing, it will be no limit.", + "type": "DOUBLE", + "unit": "MWh" + }, + "investment_limit_storage_energy": { + "constraints": null, + "default": null, + "description": "Maximum capacity for the asset storage investment. If the initial value is null, empty, or missing, it will be no limit.", + "type": "DOUBLE", + "unit": "MWh" + } + }, + "milestone": { + "asset": { + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `basic` table.", + "type": "VARCHAR", + "unit": null + }, + "initial_storage_level": { + "constraints": { + "minimum": 0 + }, + "deafult": 0, + "description": "The initial storage level at the beginning of the optimization. The final storage level needs to be above this initial value. If the initial value is null, empty, or missing, it will be optimized using a cycling constraint that links the last period to the initial period.", + "type": "DOUBLE", + "unit": "MWh" + }, + "investable": { + "constraints": null, + "default": false, + "description": "Whether there is an investment variable created for the asset or not.", + "type": "BOOLEAN", + "unit": null + }, + "max_energy_timeframe_partition": { + "constraints": { + "minimum": 0 + }, + "deafult": null, + "description": "The maximum amount of energy across the timeframe (e.g., a year) that the asset must produce. If the initial value is null, empty, or missing, it will be no limit.", + "type": "DOUBLE", + "unit": "MWh" + }, + "milestone_year": { + "constraints": null, + "default": 2000, + "description": "Year of investment and operation decisions in the optimization.", + "type": "INTEGER", + "unit": null + }, + "min_energy_timeframe_partition": { + "constraints": { + "minimum": 0 + }, + "deafult": null, + "description": "The minimum amount of energy across the timeframe (e.g., a year) that the asset must produce. If the initial value is null, empty, or missing, it will be no limit.", + "type": "DOUBLE", + "unit": "MWh" + }, + "peak_demand": { + "constraints": { + "minimum": 0 + }, + "deafult": 0, + "description": "Value that multiplies the demand profile time series.", + "type": "DOUBLE", + "unit": "MW" + }, + "storage_inflows": { + "constraints": { + "minimum": 0 + }, + "deafult": 0, + "description": "Value that multiplies the inflow profile time series.", + "type": "DOUBLE", + "unit": "MWh/year" + }, + "units_on_cost": { + "constraints": { + "minimum": 0 + }, + "deafult": 0, + "description": "Cost of keeping unit online for one hour or the objective function coefficient on `units_on` variable. e.g., no-load cost or idling cost", + "type": "DOUBLE", + "unit": "CUR/p.u./h" + } + }, + "profiles_reference": { + "asset": { + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `basic` table.", + "type": "VARCHAR", + "unit": null + }, + "commission_year": { + "constraints": null, + "default": 2000, + "description": "Year of commissioning", + "type": "INTEGER", + "unit": null + }, + "profile_name": { + "constraints": null, + "default": null, + "description": "Name of profile, used to determine data inside the DuckDB table", + "type": "VARCHAR", + "unit": null + }, + "profile_type": { + "constraints": { + "OneOf": [ + "availability", + "demand", + "inflows", + "max_storage_level", + "min_storage_level", + "max_energy", + "min_energy" + ] + }, + "default": null, + "description": "Type of profile, used to determine DuckDB table with source profile", + "type": "VARCHAR", + "unit": null + } + }, + "rep_periods_partition": { + "asset": { + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `basic` table.", + "type": "VARCHAR", + "unit": null + }, + "partition": { + "constraints": null, + "default": 1, + "description": "Partition or temporal resolution in the representative periods. For example, for a `uniform` specification `1` is hourly, `2` is every two hours.", + "type": "VARCHAR", + "unit": null + }, + "rep_period": { + "constraints": null, + "default": null, + "description": "Number of the representative period", + "type": "INTEGER", + "unit": "number" + }, + "specification": { + "constraints": { + "OneOf": [ + "uniform", + "explicit", + "math" + ] + }, + "default": "uniform", + "description": "Partition (or temporal resolution) specification in the representative periods.", + "type": "VARCHAR", + "unit": null + }, + "year": { + "constraints": null, + "default": 2000, + "description": "Milestone year.", + "type": "INTEGER", + "unit": null + } + }, + "timeframe_partition": { + "asset": { + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `basic` table.", + "type": "VARCHAR", + "unit": null + }, + "partition": { + "constraints": null, + "default": 1, + "description": "Partition or temporal resolution in the timeframe. For example, if a period is equivalent to a day then for a `uniform` specification `1` is per day, `2` is every two days.", + "type": "VARCHAR", + "unit": null + }, + "specification": { + "constraints": { + "OneOf": [ + "uniform", + "explicit", + "math" + ] + }, + "default": "uniform", + "description": "Partition (or temporal resolution) specification in the timeframe.", + "type": "VARCHAR", + "unit": null + }, + "year": { + "constraints": null, + "default": 2000, + "description": "Milestone year.", + "type": "INTEGER", + "unit": null + } + } + }, + "flows": { + "basic": { + "capacity": { + "constraints": { + "minimum": 0 + }, + "default": 0, + "description": "Capacity for one unit of the transport flow (is therefore multiplied by number of existing plus invested transport units).", + "type": "DOUBLE", + "unit": "MW" + }, + "carrier": { + "constraints": null, + "default": null, + "description": "Energy carrier", + "type": "VARCHAR", + "unit": null + }, + "discount_rate": { + "constraints": { + "minimum": 0 + }, + "default": 0, + "description": " e.g. 0.05 is 5 %. discount rate for the annuity calculation.", + "type": "DOUBLE", + "unit": "ratio" + }, + "economic_lifetime": { + "constraints": { + "minimum": 0 + }, + "default": 1, + "description": "Economic lifetime of the transport asset for annuity calculation.", + "type": "INTEGER", + "unit": "years" + }, + "from_asset": { + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `basic` table.", + "type": "VARCHAR", + "unit": null + }, + "investment_integer": { + "constraints": null, + "default": false, + "description": "Whether investment decisions are using integer variables.", + "type": "BOOLEAN", + "unit": null + }, + "is_transport": { + "constraints": null, + "default": false, + "description": "Whether a transport flow or not. Transport assets can have flows in both directions and can be invested in.", + "type": "BOOLEAN", + "unit": null + }, + "technical_lifetime": { + "constraints": { + "minimum": 0 + }, + "default": 1, + "description": "Technical lifetime of the transport asset to determine for how long the capacity is considered from the commission year.", + "type": "INTEGER", + "unit": "years" + }, + "to_asset": { + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `basic` table.", + "type": "VARCHAR", + "unit": null + } + }, + "both": { + "commission_year": { + "constraints": null, + "default": 2000, + "description": "Year of commissioning", + "type": "INTEGER", + "unit": null + }, + "decommissionable": { + "constraints": null, + "default": false, + "description": "Whether the transport asset can be decomission or not.", + "type": "BOOLEAN", + "unit": null + }, + "from_asset": { + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `basic` table.", + "type": "VARCHAR", + "unit": null + }, + "initial_export_units": { + "constraints": null, + "default": 0, + "description": "Number of existing units in from_asset -> to_asset direction", + "type": "DOUBLE", + "unit": "number" + }, + "initial_import_units": { + "constraints": null, + "default": 0, + "description": "Number of existing units in to_asset -> from_asset direction", + "type": "DOUBLE", + "unit": "number" + }, + "milestone_year": { + "constraints": null, + "default": 2000, + "description": "Year of investment and operation decisions in the optimization.", + "type": "INTEGER", + "unit": null + }, + "to_asset": { + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `basic` table.", + "type": "VARCHAR", + "unit": null + } + }, + "commission": { + "commission_year": { + "constraints": null, + "default": 2000, + "description": "Year of commissioning", + "type": "INTEGER", + "unit": null + }, + "efficiency": { + "constraints": { + "minimum": 0 + }, + "default": 1, + "description": "Efficiency of transfer in from_asset -> to_asset direction", + "type": "DOUBLE", + "unit": "ratio" + }, + "fixed_cost": { + "constraints": null, + "default": null, + "description": "Fixed annual cost for the transport asset capacity.", + "type": "DOUBLE", + "unit": "CUR/MW/year" + }, + "from_asset": { + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `basic` table.", + "type": "VARCHAR", + "unit": null + }, + "investment_cost": { + "constraints": null, + "default": null, + "description": "Investment cost for the transport asset capacity.", + "type": "DOUBLE", + "unit": "CUR/MW" + }, + "investment_limit": { + "constraints": null, + "default": null, + "description": "Maximum capacity for the transport asset investment. If the initial value is null, empty, or missing, it will be no limit.", + "type": "DOUBLE", + "unit": "MWh" + }, + "to_asset": { + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `basic` table.", + "type": "VARCHAR", + "unit": null + } + }, + "milestone": { + "from_asset": { + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `basic` table.", + "type": "VARCHAR", + "unit": null + }, + "investable": { + "constraints": null, + "default": false, + "description": "Whether there is an investment variable created for the asset or not.", + "type": "BOOLEAN", + "unit": null + }, + "milestone_year": { + "constraints": null, + "default": 2000, + "description": "Year of investment and operation decisions in the optimization.", + "type": "INTEGER", + "unit": null + }, + "to_asset": { + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `basic` table.", + "type": "VARCHAR", + "unit": null + }, + "variable_cost": { + "constraints": null, + "default": 0, + "description": "Variable cost for the flow.", + "type": "DOUBLE", + "unit": "CUR/MWh" + } + }, + "profiles_reference": { + "from_asset": { + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `basic` table.", + "type": "VARCHAR", + "unit": null + }, + "profile_name": { + "constraints": null, + "default": null, + "description": "Name of profile, used to determine data inside the DuckDB table", + "type": "VARCHAR", + "unit": null + }, + "profile_type": { + "constraints": { + "OneOf": [ + "availability" + ] + }, + "default": null, + "description": "Type of profile, used to determine DuckDB table with source profile", + "type": "VARCHAR", + "unit": null + }, + "to_asset": { + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `basic` table.", + "type": "VARCHAR", + "unit": null + }, + "year": { + "constraints": null, + "default": 2000, + "description": "Milestone year.", + "type": "INTEGER", + "unit": null + } + }, + "rep_periods_partition": { + "from_asset": { + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `basic` table.", + "type": "VARCHAR", + "unit": null + }, + "partition": { + "constraints": null, + "default": 1, + "description": "Partition or temporal resolution in the representative periods. For example, for a `uniform` specification `1` is hourly, `2` is every two hours.", + "type": "VARCHAR", + "unit": null + }, + "rep_period": { + "constraints": null, + "default": null, + "description": "Number of the representative period", + "type": "INTEGER", + "unit": "number" + }, + "specification": { + "constraints": { + "OneOf": [ + "uniform", + "explicit", + "math" + ] + }, + "default": "uniform", + "description": "Partition (or temporal resolution) specification in the representative periods.", + "type": "VARCHAR", + "unit": null + }, + "to_asset": { + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `basic` table.", + "type": "VARCHAR", + "unit": null + }, + "year": { + "constraints": null, + "default": 2000, + "description": "Milestone year.", + "type": "INTEGER", + "unit": null + } + } + }, + "groups": { + "data": { + "invest_method": { + "constraints": null, + "default": null, + "description": "true -> activate group constraints; false -> no group investment constraints", + "type": "BOOLEAN", + "unit": null + }, + "max_investment_limit": { + "constraints": null, + "default": null, + "description": "MW (Missing -> no limit)", + "type": "DOUBLE", + "unit": null + }, + "milestone_year": { + "constraints": null, + "default": 2000, + "description": "Year of investment and operation decisions in the optimization.", + "type": "INTEGER", + "unit": null + }, + "min_investment_limit": { + "constraints": null, + "default": null, + "description": "MW (Missing -> no limit)", + "type": "DOUBLE", + "unit": null + }, + "name": { + "constraints": null, + "default": null, + "description": "Name of the Group", + "type": "VARCHAR", + "unit": null + } + } + }, + "rep_periods": { + "data": { + "num_timesteps": { + "constraints": null, + "default": 8760, + "description": "Number of timesteps", + "type": "INTEGER", + "unit": null + }, + "rep_period": { + "constraints": null, + "default": 1, + "description": "Representative period number.", + "type": "INTEGER", + "unit": "number" + }, + "resolution": { + "constraints": null, + "default": 1, + "description": "Duration of each timestep", + "type": "DOUBLE", + "unit": "hours" + }, + "year": { + "constraints": null, + "default": 2000, + "description": "Milestone year.", + "type": "INTEGER", + "unit": null + } + }, + "mapping": { + "period": { + "constraints": null, + "default": 1, + "description": "Period number.", + "type": "INTEGER", + "unit": null + }, + "rep_period": { + "constraints": null, + "default": 1, + "description": "Representative period number.", + "type": "INTEGER", + "unit": null + }, + "weight": { + "constraints": null, + "default": 1, + "description": "Hours", + "type": "DOUBLE", + "unit": null + }, + "year": { + "constraints": null, + "default": 2000, + "description": "Milestone year.", + "type": "INTEGER", + "unit": null + } + }, + "profiles_data": { + "profile_name": { + "constraints": null, + "default": null, + "description": "Profile name.", + "type": "VARCHAR", + "unit": null + }, + "rep_period": { + "constraints": null, + "default": 1, + "description": "Representative period number.", + "type": "INTEGER", + "unit": null + }, + "timestep": { + "constraints": null, + "default": 1, + "description": "Timestep number.", + "type": "INTEGER", + "unit": null + }, + "value": { + "constraints": null, + "default": null, + "description": "Value of the profile.", + "type": "DOUBLE", + "unit": "p.u." + }, + "year": { + "constraints": null, + "default": 2000, + "description": "Milestone year.", + "type": "INTEGER", + "unit": null + } + } + }, + "timeframe": { + "profiles_data": { + "period": { + "constraints": null, + "default": null, + "description": "Period.", + "type": "INTEGER", + "unit": null + }, + "profile_name": { + "constraints": null, + "default": null, + "description": "Profile name.", + "type": "VARCHAR", + "unit": null + }, + "value": { + "constraints": null, + "default": null, + "description": "value of the profile.", + "type": "DOUBLE", + "unit": "p.u." + }, + "year": { + "constraints": null, + "default": 2000, + "description": "Milestone year.", + "type": "INTEGER", + "unit": null + } + } + }, + "year": { + "data": { + "is_milestone": { + "constraints": null, + "default": true, + "description": "Whether the year is a milestone year or a vintage year", + "type": "BOOLEAN", + "unit": null + }, + "length": { + "constraints": null, + "default": 8760, + "description": "HOw many hours in a year, e.g., 8760", + "type": "INTEGER", + "unit": null + }, + "year": { + "constraints": null, + "default": 2000, + "description": "Unique identifier (currently, the year itself)", + "type": "INTEGER", + "unit": null + } + } + } +} From 3fb9ccf25e563096ea31ed904706968493d2be7b Mon Sep 17 00:00:00 2001 From: Diego Alejandro Tejada Arango Date: Wed, 26 Feb 2025 09:23:28 +0100 Subject: [PATCH 03/12] Add JSON package to the dependencies --- Project.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Project.toml b/Project.toml index 933e91fa..b9904f0d 100644 --- a/Project.toml +++ b/Project.toml @@ -8,6 +8,7 @@ CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" DuckDB = "d2f5444f-75bc-4fdf-ac35-56f514c445e1" DuckDB_jll = "2cbbab25-fc8b-58cf-88d4-687a02676033" HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b" +JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" JuMP = "4076af6c-e467-56ae-b986-b466b2749572" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee" @@ -23,6 +24,7 @@ CSV = "0.10" DuckDB = "0.10, ~1.0" DuckDB_jll = "0.10, ~1.0" HiGHS = "1" +JSON = "0.21.4" JuMP = "1" MathOptInterface = "1" OrderedCollections = "1" From 59f608a2b340868608854c90c49412eaa93619cc Mon Sep 17 00:00:00 2001 From: Diego Alejandro Tejada Arango Date: Wed, 26 Feb 2025 10:40:51 +0100 Subject: [PATCH 04/12] Uniform the names in the JSON file with the table names in DuckDB --- src/input-schemas.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/input-schemas.json b/src/input-schemas.json index 12d3f980..1a1a535a 100644 --- a/src/input-schemas.json +++ b/src/input-schemas.json @@ -1,5 +1,5 @@ { - "assets": { + "asset": { "basic": { "asset": { "constraints": null, @@ -512,7 +512,7 @@ } } }, - "flows": { + "flow": { "basic": { "capacity": { "constraints": { @@ -819,7 +819,7 @@ } } }, - "groups": { + "group": { "data": { "invest_method": { "constraints": null, @@ -858,7 +858,7 @@ } } }, - "rep_periods": { + "rep_period": { "data": { "num_timesteps": { "constraints": null, From e300073e7f4382f3c74e2ac37c25351832dfcda8 Mon Sep 17 00:00:00 2001 From: Diego Alejandro Tejada Arango Date: Wed, 26 Feb 2025 10:41:40 +0100 Subject: [PATCH 05/12] Read schema from JSON file --- src/TulipaEnergyModel.jl | 1 + src/input-schemas.jl | 264 ++++++--------------------------------- 2 files changed, 42 insertions(+), 223 deletions(-) diff --git a/src/TulipaEnergyModel.jl b/src/TulipaEnergyModel.jl index d3fc3763..b673add3 100644 --- a/src/TulipaEnergyModel.jl +++ b/src/TulipaEnergyModel.jl @@ -8,6 +8,7 @@ const SQL_FOLDER = joinpath(@__DIR__, "sql") using CSV: CSV using DuckDB: DuckDB, DBInterface using TOML: TOML +using JSON: JSON using TulipaIO: TulipaIO ## Optimization diff --git a/src/input-schemas.jl b/src/input-schemas.jl index 67ba57aa..23466662 100644 --- a/src/input-schemas.jl +++ b/src/input-schemas.jl @@ -1,232 +1,50 @@ -# At the end of the file, there is a reference relating schemas and files +# read schema from file -const schemas = ( - assets = ( - # Schema for asset.csv - basic = ( - :asset => "VARCHAR", # Name of Asset (geographical?) - :type => "VARCHAR", # Producer/Consumer/Storage/Conversion - :group => "VARCHAR", # Group to which the asset belongs to (missing -> no group) - :capacity => "DOUBLE", # MW - :min_operating_point => "DOUBLE", # Minimum operating point or minimum stable generation level defined as a portion of the capacity of asset [p.u.] - :investment_method => "VARCHAR", # Which method of investment (simple/compact) - :investment_integer => "BOOLEAN", # Whether investment is integer or continuous - :technical_lifetime => "INTEGER", # years - :economic_lifetime => "INTEGER", # years - :discount_rate => "DOUBLE", # p.u. - :consumer_balance_sense => "VARCHAR", # Sense of the consumer balance constraint (default ==) - :capacity_storage_energy => "DOUBLE", # MWh - :is_seasonal => "BOOLEAN", # Whether seasonal storage (e.g. hydro) or not (e.g. battery) - :use_binary_storage_method => "VARCHAR", # Whether to use an extra binary variable for the storage assets to avoid charging and discharging simultaneously (missing;binary;relaxed_binary) - :unit_commitment => "BOOLEAN", # Whether asset has unit commitment constraints - :unit_commitment_method => "VARCHAR", # Which unit commitment method to use (i.e., basic) - :unit_commitment_integer => "BOOLEAN", # Whether the unit commitment variables are integer or not - :ramping => "BOOLEAN", # Whether asset has ramping constraints - :storage_method_energy => "BOOLEAN", # Whether storage method is energy or not (i.e., fixed_ratio) - :energy_to_power_ratio => "DOUBLE", # Hours - :investment_integer_storage_energy => "BOOLEAN", # Whether investment for storage energy is integer or continuous - :max_ramp_up => "DOUBLE", # Maximum ramping up rate as a portion of the capacity of asset [p.u./h] - :max_ramp_down => "DOUBLE", # Maximum ramping down rate as a portion of the capacity of asset [p.u./h] - ), +schema = JSON.parsefile("src/input-schemas.json"; dicttype = OrderedDict); - # Schema for asset-milestone.csv - milestone = OrderedDict( - :asset => "VARCHAR", - :milestone_year => "INTEGER", - :investable => "BOOLEAN", # Whether able to invest - :peak_demand => "DOUBLE", # MW - :storage_inflows => "DOUBLE", # MWh/year - :initial_storage_level => "DOUBLE", # MWh (Missing -> free initial level) - :min_energy_timeframe_partition => "DOUBLE", # MWh (Missing -> no limit) - :max_energy_timeframe_partition => "DOUBLE", # MWh (Missing -> no limit) - :units_on_cost => "DOUBLE", # Objective function coefficient on `units_on` variable. e.g., no-load cost or idling cost - ), - - # Schema for the asset-commission.csv - commission = OrderedDict( - :asset => "VARCHAR", - :commission_year => "INTEGER", # Year of commissioning - :fixed_cost => "DOUBLE", # kEUR/MW/year - :investment_cost => "DOUBLE", # kEUR/MW - :investment_limit => "DOUBLE", # MWh (Missing -> no limit) - :fixed_cost_storage_energy => "DOUBLE", # kEUR/MWh/year - :investment_cost_storage_energy => "DOUBLE", # kEUR/MWh - :investment_limit_storage_energy => "DOUBLE", # MWh (Missing -> no limit) - ), - - # Schema for the asset-both.csv file. - both = OrderedDict( - :asset => "VARCHAR", # Name of Asset (geographical?) - :milestone_year => "INTEGER", # Year - :commission_year => "INTEGER", # Year of commissioning - :decommissionable => "BOOLEAN", - :initial_units => "DOUBLE", # units - :initial_storage_units => "DOUBLE", # units - ), - - # Schema for the assets-profiles.csv and assets-timeframe-profiles.csv file. - profiles_reference = OrderedDict( - :asset => "VARCHAR", # Asset name - :commission_year => "INTEGER", - :profile_type => "VARCHAR", # Type of profile, used to determine source profile - :profile_name => "VARCHAR", # Name of profile, used to match with the profiles_data - ), - - # Schema for the assets-timeframe-partitions.csv file. - timeframe_partition = OrderedDict( - :asset => "VARCHAR", - :year => "INTEGER", - :specification => "VARCHAR", - :partition => "VARCHAR", - ), - - # Schema for the assets-rep-periods-partitions.csv file. - rep_periods_partition = OrderedDict( - :asset => "VARCHAR", - :year => "INTEGER", - :rep_period => "INTEGER", - :specification => "VARCHAR", - :partition => "VARCHAR", - ), +const schema_per_table_name = OrderedDict( + "asset" => OrderedDict(key => value["type"] for (key, value) in schema["asset"]["basic"]), + "asset_both" => + OrderedDict(key => value["type"] for (key, value) in schema["asset"]["both"]), + "asset_commission" => + OrderedDict(key => value["type"] for (key, value) in schema["asset"]["commission"]), + "asset_milestone" => + OrderedDict(key => value["type"] for (key, value) in schema["asset"]["milestone"]), + "assets_profiles" => OrderedDict( + key => value["type"] for (key, value) in schema["asset"]["profiles_reference"] ), - groups = ( - # Schema for the group-asset.csv file. - data = OrderedDict( - :name => "VARCHAR", # Name of the Group - :milestone_year => "INTEGER", - :invest_method => "BOOLEAN", # true -> activate group constraints; false -> no group investment constraints - :min_investment_limit => "DOUBLE", # MW (Missing -> no limit) - :max_investment_limit => "DOUBLE", # MW (Missing -> no limit) - ), + "assets_rep_periods_partitions" => OrderedDict( + key => value["type"] for (key, value) in schema["asset"]["rep_periods_partition"] ), - flows = ( - # Schema for flow.csv - basic = ( - :from_asset => "VARCHAR", # Name of Asset - :to_asset => "VARCHAR", # Name of Asset - :carrier => "VARCHAR", # (Optional?) Energy carrier - :is_transport => "BOOLEAN", # Whether a transport flow - :capacity => "DOUBLE", - :technical_lifetime => "INTEGER", - :economic_lifetime => "INTEGER", - :discount_rate => "DOUBLE", - :investment_integer => "BOOLEAN", # Whether investment is integer or continuous - ), - - # Schema for flow-milestone.csv - milestone = OrderedDict( - :from_asset => "VARCHAR", # Name of Asset - :to_asset => "VARCHAR", # Name of Asset - :milestone_year => "INTEGER", # Year of commissioning - :investable => "BOOLEAN", # Whether able to invest - :variable_cost => "DOUBLE", # kEUR/MWh - ), - - # Schema for the flow-commission.csv - commission = OrderedDict( - :from_asset => "VARCHAR", # Name of Asset - :to_asset => "VARCHAR", # Name of Asset - :commission_year => "INTEGER", # Year of commissioning - :fixed_cost => "DOUBLE", # kEUR/MWh/year - :investment_cost => "DOUBLE", # kEUR/MW - :efficiency => "DOUBLE", # p.u. (per unit) - :investment_limit => "DOUBLE", # MW - ), - - # Schema for the flow-both.csv file. - both = OrderedDict( - :from_asset => "VARCHAR", # Name of Asset - :to_asset => "VARCHAR", # Name of Asset - :milestone_year => "INTEGER", - :commission_year => "INTEGER", # Year of commissioning - :decommissionable => "BOOLEAN", - :initial_export_units => "DOUBLE", # MW - :initial_import_units => "DOUBLE", # MW - ), - - # Schema for the flows-profiles file. - profiles_reference = OrderedDict( - :from_asset => "VARCHAR", # Name of Asset - :to_asset => "VARCHAR", # Name of Asset - :year => "INTEGER", - :profile_type => "VARCHAR", # Type of profile, used to determine source profile - :profile_name => "VARCHAR", # Name of profile, used to match with the profiles_data - ), - - # Schema for the flows-rep-periods-partitions.csv file. - rep_periods_partition = OrderedDict( - :from_asset => "VARCHAR", # Name of Asset - :to_asset => "VARCHAR", # Name of Asset - :year => "INTEGER", - :rep_period => "INTEGER", - :specification => "VARCHAR", - :partition => "VARCHAR", - ), + "assets_timeframe_partitions" => OrderedDict( + key => value["type"] for (key, value) in schema["asset"]["timeframe_partition"] ), - year = ( - # Schema for year-data.csv - data = ( - :year => "INTEGER", # Unique identifier (currently, the year itself) - :length => "INTEGER", - :is_milestone => "BOOLEAN", # Whether the year is a milestone year of a vintage year - ), + "assets_timeframe_profiles" => OrderedDict( + key => value["type"] for (key, value) in schema["asset"]["profiles_reference"] ), - timeframe = ( - # Schema for the profiles-timeframe-.csv file. - profiles_data = OrderedDict( - :profile_name => "VARCHAR", # Profile name - :year => "INTEGER", - :period => "INTEGER", # Period - :value => "DOUBLE", # p.u. (per unit) - ), + "flow" => OrderedDict(key => value["type"] for (key, value) in schema["flow"]["basic"]), + "flow_both" => OrderedDict(key => value["type"] for (key, value) in schema["flow"]["both"]), + "flow_commission" => + OrderedDict(key => value["type"] for (key, value) in schema["flow"]["commission"]), + "flow_milestone" => + OrderedDict(key => value["type"] for (key, value) in schema["flow"]["milestone"]), + "flows_profiles" => OrderedDict( + key => value["type"] for (key, value) in schema["flow"]["profiles_reference"] ), - rep_periods = ( - # Schema for the rep-periods-data.csv file. - data = OrderedDict( - :year => "INTEGER", - :rep_period => "INTEGER", # Representative period number - :num_timesteps => "INTEGER", # Numer of timesteps - :resolution => "DOUBLE", # Duration of each timestep (hours) - ), - - # Schema for the rep-periods-mapping.csv file. - mapping = OrderedDict( - :year => "INTEGER", - :period => "INTEGER", # Period number - :rep_period => "INTEGER", # Representative period number - :weight => "DOUBLE", # Hours - ), - - # Schema for the profiles-rep-periods-.csv file. - profiles_data = OrderedDict( - :profile_name => "VARCHAR", # Profile name - :year => "INTEGER", - :rep_period => "INTEGER", # Representative period number - :timestep => "INTEGER", # Timestep number - :value => "DOUBLE", # p.u. (per unit) - ), + "flows_rep_periods_partitions" => OrderedDict( + key => value["type"] for (key, value) in schema["flow"]["rep_periods_partition"] ), -) - -const schema_per_table_name = OrderedDict( - "asset" => schemas.assets.basic, - "asset_both" => schemas.assets.both, - "asset_commission" => schemas.assets.commission, - "asset_milestone" => schemas.assets.milestone, - "assets_profiles" => schemas.assets.profiles_reference, - "assets_rep_periods_partitions" => schemas.assets.rep_periods_partition, - "assets_timeframe_partitions" => schemas.assets.timeframe_partition, - "assets_timeframe_profiles" => schemas.assets.profiles_reference, - "flow" => schemas.flows.basic, - "flow_both" => schemas.flows.both, - "flow_commission" => schemas.flows.commission, - "flow_milestone" => schemas.flows.milestone, - "flows_profiles" => schemas.flows.profiles_reference, - "flows_rep_periods_partitions" => schemas.flows.rep_periods_partition, - "group_asset" => schemas.groups.data, - "profiles_rep_periods" => schemas.rep_periods.profiles_data, - "profiles_timeframe" => schemas.timeframe.profiles_data, - "rep_periods_data" => schemas.rep_periods.data, - "rep_periods_mapping" => schemas.rep_periods.mapping, - "year_data" => schemas.year.data, + "group_asset" => + OrderedDict(key => value["type"] for (key, value) in schema["group"]["data"]), + "profiles_rep_periods" => OrderedDict( + key => value["type"] for (key, value) in schema["rep_period"]["profiles_data"] + ), + "profiles_timeframe" => OrderedDict( + key => value["type"] for (key, value) in schema["timeframe"]["profiles_data"] + ), + "rep_periods_data" => + OrderedDict(key => value["type"] for (key, value) in schema["rep_period"]["data"]), + "rep_periods_mapping" => + OrderedDict(key => value["type"] for (key, value) in schema["rep_period"]["mapping"]), + "year_data" => OrderedDict(key => value["type"] for (key, value) in schema["year"]["data"]), ) From 23fe9296945422c50717e21a0eb6e496a329c9f0 Mon Sep 17 00:00:00 2001 From: Diego Alejandro Tejada Arango Date: Wed, 26 Feb 2025 17:24:19 +0100 Subject: [PATCH 06/12] Update JSON file --- src/input-schemas.json | 2013 ++++++++++++++++++++-------------------- 1 file changed, 1012 insertions(+), 1001 deletions(-) diff --git a/src/input-schemas.json b/src/input-schemas.json index 1a1a535a..9b317d3a 100644 --- a/src/input-schemas.json +++ b/src/input-schemas.json @@ -1,1017 +1,1028 @@ { "asset": { - "basic": { - "asset": { - "constraints": null, - "default": null, - "description": "Unique identifier with the name of the asset.", - "type": "VARCHAR", - "unit": null - }, - "capacity": { - "constraints": { - "minimum": 0 - }, - "default": 0, - "description": "Capacity for one unit of the asset (is therefore multiplied by number of existing plus invested units).", - "type": "DOUBLE", - "unit": "MW" - }, - "capacity_storage_energy": { - "constraints": { - "minimum": 0 - }, - "deafult": 0, - "description": "Capacity of one storage unit.", - "type": "DOUBLE", - "unit": "MWh" - }, - "consumer_balance_sense": { - "constraints": { - "OneOf": [ - "==", - ">=", - "=<" - ] - }, - "default": "==", - "description": "Is the sense of the consumer balance constraint, equal to, greater than or less than.", - "type": "VARCHAR", - "unit": null - }, - "discount_rate": { - "constraints": { - "minimum": 0 - }, - "default": 0, - "description": " e.g. 0.05 is 5 %. discount rate for the annuity calculation.", - "type": "DOUBLE", - "unit": "ratio" - }, - "economic_lifetime": { - "constraints": { - "minimum": 0 - }, - "default": 1, - "description": "Economic lifetime of the unit for annuity calculation.", - "type": "INTEGER", - "unit": "years" - }, - "energy_to_power_ratio": { - "constraints": { - "minimum": 0 - }, - "deafult": 0, - "description": "Fixed ratio between the energy storage capacity [MWh] and the discharge/charge capacity [MW] for energy storage investments where `storage_method_energy = false`.", - "type": "DOUBLE", - "units": "h" - }, - "group": { - "constraint": null, - "default": null, - "description": "Group to which the asset belongs to (null/empty/missing -> no group).", - "type": "VARCHAR", - "unit": null - }, - "investment_integer": { - "constraints": null, - "default": false, - "description": "Whether investment decisions are using integer variables.", - "type": "BOOLEAN", - "unit": null - }, - "investment_integer_storage_energy": { - "constraints": null, - "default": false, - "description": "Whether investment for storage energy is integer or continuous. It only applies for energy storage investments where `storage_method_energy = true`.", - "type": "BOOLEAN", - "unit": null - }, - "investment_method": { - "constraints": { - "OneOf": [ - "none", - "simple", - "compact" - ] - }, - "default": "none", - "description": "How investments are treated.", - "type": "VARCHAR", - "unit": null - }, - "is_seasonal": { - "constraints": null, - "default": false, - "description": "Whether seasonal storage (e.g., hydro) or not (e.g., battery)", - "type": "BOOLEAN", - "unit": null - }, - "max_ramp_down": { - "constraints": { - "minimum": 0 - }, - "deafult": 0, - "description": "Maximum ramping down rate as a portion of the capacity of asset.", - "type": "DOUBLE", - "units": "p.u./h" - }, - "max_ramp_up": { - "constraints": { - "minimum": 0 - }, - "deafult": 0, - "description": "Maximum ramping up rate as a portion of the capacity of asset.", - "type": "DOUBLE", - "units": "p.u./h" - }, - "min_operating_point": { - "constraints": { - "maximum": 1, - "minimum": 0 - }, - "default": 0, - "description": "Minimum operating point or minimum stable generation level defined as a portion of the capacity of asset.", - "type": "DOUBLE", - "unit": "p.u." - }, - "ramping": { - "constraints": null, - "default": false, - "description": "Whether asset has ramping constraints or not.", - "type": "BOOLEAN", - "unit": null - }, - "storage_method_energy": { - "constraints": null, - "default": false, - "description": "Whether there is independent investment on storage capacity or not. If false, the investment on storage capacity uses the energy_to_power_ratio as a constant fixed value.", - "type": "BOOLEAN", - "unit": null - }, - "technical_lifetime": { - "constraints": { - "minimum": 0 - }, - "default": 1, - "description": "Technical lifetime of the unit to determine for how long the capacity is considered from the commission year.", - "type": "INTEGER", - "unit": "years" - }, - "type": { - "constraints": { - "OneOf": [ - "producer", - "consumer", - "storage", - "conversion", - "hub" - ] - }, - "deafult": null, - "description": "Type of energy asset.", - "type": "VARCHAR", - "unit": null - }, - "unit_commitment": { - "constraints": null, - "default": false, - "description": "Whether asset has unit commitment constraints or not", - "type": "BOOLEAN", - "units": null - }, - "unit_commitment_integer": { - "constraints": null, - "default": false, - "description": "Whether the unit commitment variables are integer or not.", - "type": "BOOLEAN", - "unit": null - }, - "unit_commitment_method": { - "constraints": { - "OneOf": [ - null, - "basic" - ] - }, - "default": null, - "description": "Which unit commitment method to use (null/empty/missing -> no unit commitment method).", - "type": "VARCHAR", - "unit": null - }, - "use_binary_storage_method": { - "constraints": { - "OneOf": [ - null, - "binary", - "relaxed_binary" - ] - }, - "default": null, - "description": "Whether to use an extra binary variable for the storage assets to avoid charging and discharging simultaneously (null/empty/missing -> no binary).", - "type": "VARCHAR", - "units": null - } - }, - "both": { - "asset": { - "constraints": null, - "default": null, - "description": "Name of the asset. Same as the one in the `basic` table.", - "type": "VARCHAR", - "unit": null - }, - "commission_year": { - "constraints": null, - "default": 2000, - "description": "Year of commissioning", - "type": "INTEGER", - "unit": null - }, - "decommissionable": { - "constraints": null, - "default": false, - "description": "Whether the asset can be decomission or not.", - "type": "BOOLEAN", - "unit": null - }, - "initial_storage_units": { - "constraints": null, - "default": 0, - "description": "Number of existing storage units", - "type": "DOUBLE", - "unit": "number" - }, - "initial_units": { - "constraints": null, - "default": 0, - "description": "Number of existing units", - "type": "DOUBLE", - "unit": "number" - }, - "milestone_year": { - "constraints": null, - "default": 2000, - "description": "Year of investment and operation decisions in the optimization.", - "type": "INTEGER", - "unit": null - } - }, - "commission": { - "asset": { - "constraints": null, - "default": null, - "description": "Name of the asset. Same as the one in the `basic` table.", - "type": "VARCHAR", - "unit": null - }, - "commission_year": { - "constraints": null, - "default": 2000, - "description": "Year of commissioning.", - "type": "INTEGER", - "unit": null - }, - "fixed_cost": { - "constraints": null, - "default": null, - "description": "Fixed annual cost for the asset capacity.", - "type": "DOUBLE", - "unit": "CUR/MW/year" - }, - "fixed_cost_storage_energy": { - "constraints": null, - "default": null, - "description": "Fixed annual cost for the asset storage capacity", - "type": "DOUBLE", - "unit": "CUR/MWh/year" - }, - "investment_cost": { - "constraints": null, - "default": null, - "description": "Investment cost for the asset capacity.", - "type": "DOUBLE", - "unit": "CUR/MW" - }, - "investment_cost_storage_energy": { - "constraints": null, - "default": null, - "description": "Investment cost for the asset energy storage capacity.", - "type": "DOUBLE", - "unit": "CUR/MWh" - }, - "investment_limit": { - "constraints": null, - "default": null, - "description": "Maximum capacity for the asset investment. If the initial value is null, empty, or missing, it will be no limit.", - "type": "DOUBLE", - "unit": "MWh" - }, - "investment_limit_storage_energy": { - "constraints": null, - "default": null, - "description": "Maximum capacity for the asset storage investment. If the initial value is null, empty, or missing, it will be no limit.", - "type": "DOUBLE", - "unit": "MWh" - } - }, - "milestone": { - "asset": { - "constraints": null, - "default": null, - "description": "Name of the asset. Same as the one in the `basic` table.", - "type": "VARCHAR", - "unit": null - }, - "initial_storage_level": { - "constraints": { - "minimum": 0 - }, - "deafult": 0, - "description": "The initial storage level at the beginning of the optimization. The final storage level needs to be above this initial value. If the initial value is null, empty, or missing, it will be optimized using a cycling constraint that links the last period to the initial period.", - "type": "DOUBLE", - "unit": "MWh" - }, - "investable": { - "constraints": null, - "default": false, - "description": "Whether there is an investment variable created for the asset or not.", - "type": "BOOLEAN", - "unit": null - }, - "max_energy_timeframe_partition": { - "constraints": { - "minimum": 0 - }, - "deafult": null, - "description": "The maximum amount of energy across the timeframe (e.g., a year) that the asset must produce. If the initial value is null, empty, or missing, it will be no limit.", - "type": "DOUBLE", - "unit": "MWh" - }, - "milestone_year": { - "constraints": null, - "default": 2000, - "description": "Year of investment and operation decisions in the optimization.", - "type": "INTEGER", - "unit": null - }, - "min_energy_timeframe_partition": { - "constraints": { - "minimum": 0 - }, - "deafult": null, - "description": "The minimum amount of energy across the timeframe (e.g., a year) that the asset must produce. If the initial value is null, empty, or missing, it will be no limit.", - "type": "DOUBLE", - "unit": "MWh" - }, - "peak_demand": { - "constraints": { - "minimum": 0 - }, - "deafult": 0, - "description": "Value that multiplies the demand profile time series.", - "type": "DOUBLE", - "unit": "MW" - }, - "storage_inflows": { - "constraints": { - "minimum": 0 - }, - "deafult": 0, - "description": "Value that multiplies the inflow profile time series.", - "type": "DOUBLE", - "unit": "MWh/year" - }, - "units_on_cost": { - "constraints": { - "minimum": 0 - }, - "deafult": 0, - "description": "Cost of keeping unit online for one hour or the objective function coefficient on `units_on` variable. e.g., no-load cost or idling cost", - "type": "DOUBLE", - "unit": "CUR/p.u./h" - } - }, - "profiles_reference": { - "asset": { - "constraints": null, - "default": null, - "description": "Name of the asset. Same as the one in the `basic` table.", - "type": "VARCHAR", - "unit": null - }, - "commission_year": { - "constraints": null, - "default": 2000, - "description": "Year of commissioning", - "type": "INTEGER", - "unit": null - }, - "profile_name": { - "constraints": null, - "default": null, - "description": "Name of profile, used to determine data inside the DuckDB table", - "type": "VARCHAR", - "unit": null - }, - "profile_type": { - "constraints": { - "OneOf": [ - "availability", - "demand", - "inflows", - "max_storage_level", - "min_storage_level", - "max_energy", - "min_energy" - ] - }, - "default": null, - "description": "Type of profile, used to determine DuckDB table with source profile", - "type": "VARCHAR", - "unit": null - } - }, - "rep_periods_partition": { - "asset": { - "constraints": null, - "default": null, - "description": "Name of the asset. Same as the one in the `basic` table.", - "type": "VARCHAR", - "unit": null - }, - "partition": { - "constraints": null, - "default": 1, - "description": "Partition or temporal resolution in the representative periods. For example, for a `uniform` specification `1` is hourly, `2` is every two hours.", - "type": "VARCHAR", - "unit": null - }, - "rep_period": { - "constraints": null, - "default": null, - "description": "Number of the representative period", - "type": "INTEGER", - "unit": "number" - }, - "specification": { - "constraints": { - "OneOf": [ - "uniform", - "explicit", - "math" - ] - }, - "default": "uniform", - "description": "Partition (or temporal resolution) specification in the representative periods.", - "type": "VARCHAR", - "unit": null - }, - "year": { - "constraints": null, - "default": 2000, - "description": "Milestone year.", - "type": "INTEGER", - "unit": null - } - }, - "timeframe_partition": { - "asset": { - "constraints": null, - "default": null, - "description": "Name of the asset. Same as the one in the `basic` table.", - "type": "VARCHAR", - "unit": null - }, - "partition": { - "constraints": null, - "default": 1, - "description": "Partition or temporal resolution in the timeframe. For example, if a period is equivalent to a day then for a `uniform` specification `1` is per day, `2` is every two days.", - "type": "VARCHAR", - "unit": null - }, - "specification": { - "constraints": { - "OneOf": [ - "uniform", - "explicit", - "math" - ] - }, - "default": "uniform", - "description": "Partition (or temporal resolution) specification in the timeframe.", - "type": "VARCHAR", - "unit": null - }, - "year": { - "constraints": null, - "default": 2000, - "description": "Milestone year.", - "type": "INTEGER", - "unit": null - } + "asset": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Unique identifier with the name of the asset.", + "type": "VARCHAR" + }, + "capacity": { + "UoM": "MW", + "constraints": { + "minimum": 0 + }, + "default": 0, + "description": "Capacity for one unit of the asset (is therefore multiplied by number of existing plus number of invested assets).", + "type": "DOUBLE" + }, + "capacity_storage_energy": { + "UoM": "MWh", + "constraints": { + "minimum": 0 + }, + "deafult": 0, + "description": "Capacity of one storage unit.", + "type": "DOUBLE" + }, + "consumer_balance_sense": { + "UoM": null, + "constraints": { + "OneOf": [ + "==", + ">=", + "=<" + ] + }, + "default": "==", + "description": "Is the sense of the consumer balance constraint, equal to, greater than or less than.", + "type": "VARCHAR" + }, + "discount_rate": { + "UoM": "ratio", + "constraints": { + "minimum": 0 + }, + "default": 0, + "description": " e.g. 0.05 is 5 %. discount rate for the annuity calculation.", + "type": "DOUBLE" + }, + "economic_lifetime": { + "UoM": "years", + "constraints": { + "minimum": 0 + }, + "default": 1, + "description": "Economic lifetime of the unit for annuity calculation.", + "type": "INTEGER" + }, + "energy_to_power_ratio": { + "UoM": "h", + "constraints": { + "minimum": 0 + }, + "deafult": 0, + "description": "Fixed ratio between the energy storage capacity [MWh] and the discharge/charge capacity [MW] for energy storage investments where `storage_method_energy = false`.", + "type": "DOUBLE" + }, + "group": { + "UoM": null, + "constraint": null, + "default": null, + "description": "Group to which the asset belongs to (null/empty/missing -> no group).", + "type": "VARCHAR" + }, + "investment_integer": { + "UoM": null, + "constraints": null, + "default": false, + "description": "Whether investment decisions are using integer variables.", + "type": "BOOLEAN" + }, + "investment_integer_storage_energy": { + "UoM": null, + "constraints": null, + "default": false, + "description": "Whether investment for storage energy is integer or continuous. It only applies for energy storage investments where `storage_method_energy = true`.", + "type": "BOOLEAN" + }, + "investment_method": { + "UoM": null, + "constraints": { + "OneOf": [ + "none", + "simple", + "compact" + ] + }, + "default": "none", + "description": "How investments are treated.", + "type": "VARCHAR" + }, + "is_seasonal": { + "UoM": null, + "constraints": null, + "default": false, + "description": "Whether seasonal storage (e.g., hydro) or not (e.g., battery)", + "type": "BOOLEAN" + }, + "max_ramp_down": { + "UoM": "p.u./h", + "constraints": { + "minimum": 0 + }, + "deafult": 0, + "description": "Maximum ramping down rate as a portion of the capacity of asset.", + "type": "DOUBLE" + }, + "max_ramp_up": { + "UoM": "p.u./h", + "constraints": { + "minimum": 0 + }, + "deafult": 0, + "description": "Maximum ramping up rate as a portion of the capacity of asset.", + "type": "DOUBLE" + }, + "min_operating_point": { + "UoM": "p.u.", + "constraints": { + "maximum": 1, + "minimum": 0 + }, + "default": 0, + "description": "Minimum operating point or minimum stable generation level defined as a portion of the capacity of asset.", + "type": "DOUBLE" + }, + "ramping": { + "UoM": null, + "constraints": null, + "default": false, + "description": "Whether asset has ramping constraints or not.", + "type": "BOOLEAN" + }, + "storage_method_energy": { + "UoM": null, + "constraints": null, + "default": false, + "description": "Whether there is independent investment on storage capacity or not. If false, the investment on storage capacity uses the energy_to_power_ratio as a constant fixed value.", + "type": "BOOLEAN" + }, + "technical_lifetime": { + "UoM": "years", + "constraints": { + "minimum": 0 + }, + "default": 1, + "description": "Technical lifetime of the unit to determine for how long the capacity is considered from the commission year.", + "type": "INTEGER" + }, + "type": { + "UoM": null, + "constraints": { + "OneOf": [ + "producer", + "consumer", + "storage", + "conversion", + "hub" + ] + }, + "deafult": null, + "description": "Type of energy asset.", + "type": "VARCHAR" + }, + "unit_commitment": { + "UoM": null, + "constraints": null, + "default": false, + "description": "Whether asset has unit commitment constraints or not", + "type": "BOOLEAN" + }, + "unit_commitment_integer": { + "UoM": null, + "constraints": null, + "default": false, + "description": "Whether the unit commitment variables are integer or not.", + "type": "BOOLEAN" + }, + "unit_commitment_method": { + "UoM": null, + "constraints": { + "OneOf": [ + null, + "basic" + ] + }, + "default": null, + "description": "Which unit commitment method to use (null/empty/missing -> no unit commitment method).", + "type": "VARCHAR" + }, + "use_binary_storage_method": { + "UoM": null, + "constraints": { + "OneOf": [ + null, + "binary", + "relaxed_binary" + ] + }, + "default": null, + "description": "Whether to use an extra binary variable for the storage assets to avoid charging and discharging simultaneously (null/empty/missing -> no binary).", + "type": "VARCHAR" + } + }, + "asset_both": { + "asset": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `asset` table.", + "type": "VARCHAR" + }, + "commission_year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Year of commissioning", + "type": "INTEGER" + }, + "decommissionable": { + "UoM": null, + "constraints": null, + "default": false, + "description": "Whether the asset can be decomission or not.", + "type": "BOOLEAN" + }, + "initial_storage_units": { + "UoM": "number", + "constraints": null, + "default": 0, + "description": "Number of existing storage units", + "type": "DOUBLE" + }, + "initial_units": { + "UoM": "number", + "constraints": null, + "default": 0, + "description": "Number of existing units", + "type": "DOUBLE" + }, + "milestone_year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Year of investment and operation decisions in the optimization.", + "type": "INTEGER" + } + }, + "asset_commission": { + "asset": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `asset` table.", + "type": "VARCHAR" + }, + "commission_year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Year of commissioning.", + "type": "INTEGER" + }, + "fixed_cost": { + "UoM": "CUR/MW/year", + "constraints": null, + "default": null, + "description": "Fixed annual cost for the asset capacity.", + "type": "DOUBLE" + }, + "fixed_cost_storage_energy": { + "UoM": "CUR/MWh/year", + "constraints": null, + "default": null, + "description": "Fixed annual cost for the asset storage capacity", + "type": "DOUBLE" + }, + "investment_cost": { + "UoM": "CUR/MW", + "constraints": null, + "default": null, + "description": "Investment cost for the asset capacity.", + "type": "DOUBLE" + }, + "investment_cost_storage_energy": { + "UoM": "CUR/MWh", + "constraints": null, + "default": null, + "description": "Investment cost for the asset energy storage capacity.", + "type": "DOUBLE" + }, + "investment_limit": { + "UoM": "MWh", + "constraints": null, + "default": null, + "description": "Maximum capacity for the asset investment. If the initial value is null, empty, or missing, it will be no limit.", + "type": "DOUBLE" + }, + "investment_limit_storage_energy": { + "UoM": "MWh", + "constraints": null, + "default": null, + "description": "Maximum capacity for the asset storage investment. If the initial value is null, empty, or missing, it will be no limit.", + "type": "DOUBLE" + } + }, + "asset_milestone": { + "asset": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `asset` table.", + "type": "VARCHAR" + }, + "initial_storage_level": { + "UoM": "MWh", + "constraints": { + "minimum": 0 + }, + "deafult": 0, + "description": "The initial storage level at the beginning of the optimization. The final storage level needs to be above this initial value. If the initial value is null, empty, or missing, it will be optimized using a cycling constraint that links the last period to the initial period.", + "type": "DOUBLE" + }, + "investable": { + "UoM": null, + "constraints": null, + "default": false, + "description": "Whether there is an investment variable created for the asset or not.", + "type": "BOOLEAN" + }, + "max_energy_timeframe_partition": { + "UoM": "MWh", + "constraints": { + "minimum": 0 + }, + "deafult": null, + "description": "The maximum amount of energy across the timeframe (e.g., a year) that the asset must produce. If the initial value is null, empty, or missing, it will be no limit.", + "type": "DOUBLE" + }, + "milestone_year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Year of investment and operation decisions in the optimization.", + "type": "INTEGER" + }, + "min_energy_timeframe_partition": { + "UoM": "MWh", + "constraints": { + "minimum": 0 + }, + "deafult": null, + "description": "The minimum amount of energy across the timeframe (e.g., a year) that the asset must produce. If the initial value is null, empty, or missing, it will be no limit.", + "type": "DOUBLE" + }, + "peak_demand": { + "UoM": "MW", + "constraints": { + "minimum": 0 + }, + "deafult": 0, + "description": "Value that multiplies the demand profile time series.", + "type": "DOUBLE" + }, + "storage_inflows": { + "UoM": "MWh/year", + "constraints": { + "minimum": 0 + }, + "deafult": 0, + "description": "Value that multiplies the inflow profile time series.", + "type": "DOUBLE" + }, + "units_on_cost": { + "UoM": "CUR/p.u./h", + "constraints": { + "minimum": 0 + }, + "deafult": 0, + "description": "Cost of keeping unit online for one hour or the objective function coefficient on `units_on` variable. e.g., no_load cost or idling cost", + "type": "DOUBLE" + } + }, + "assets_profiles": { + "asset": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `asset` table.", + "type": "VARCHAR" + }, + "commission_year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Year of commissioning", + "type": "INTEGER" + }, + "profile_name": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of profile, used to determine data inside the DuckDB table", + "type": "VARCHAR" + }, + "profile_type": { + "UoM": null, + "constraints": { + "OneOf": [ + "availability", + "demand", + "inflows", + "max_storage_level", + "min_storage_level", + "max_energy", + "min_energy" + ] + }, + "default": null, + "description": "Type of profile, used to determine DuckDB table with source profile", + "type": "VARCHAR" + } + }, + "assets_rep_periods_partitions": { + "asset": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `asset` table.", + "type": "VARCHAR" + }, + "partition": { + "UoM": null, + "constraints": null, + "default": 1, + "description": "Partition or temporal resolution in the representative periods. For example, for a `uniform` specification `1` is hourly, `2` is every two hours.", + "type": "VARCHAR" + }, + "rep_period": { + "UoM": "number", + "constraints": null, + "default": null, + "description": "Number of the representative period", + "type": "INTEGER" + }, + "specification": { + "UoM": null, + "constraints": { + "OneOf": [ + "uniform", + "explicit", + "math" + ] + }, + "default": "uniform", + "description": "Partition (or temporal resolution) specification in the representative periods.", + "type": "VARCHAR" + }, + "year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Milestone year.", + "type": "INTEGER" + } + }, + "assets_timeframe_partitions": { + "asset": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `asset` table.", + "type": "VARCHAR" + }, + "partition": { + "UoM": null, + "constraints": null, + "default": 1, + "description": "Partition or temporal resolution in the timeframe. For example, if a period is equivalent to a day then for a `uniform` specification `1` is per day, `2` is every two days.", + "type": "VARCHAR" + }, + "specification": { + "UoM": null, + "constraints": { + "OneOf": [ + "uniform", + "explicit", + "math" + ] + }, + "default": "uniform", + "description": "Partition (or temporal resolution) specification in the timeframe.", + "type": "VARCHAR" + }, + "year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Milestone year.", + "type": "INTEGER" } }, "flow": { - "basic": { - "capacity": { - "constraints": { - "minimum": 0 - }, - "default": 0, - "description": "Capacity for one unit of the transport flow (is therefore multiplied by number of existing plus invested transport units).", - "type": "DOUBLE", - "unit": "MW" - }, - "carrier": { - "constraints": null, - "default": null, - "description": "Energy carrier", - "type": "VARCHAR", - "unit": null - }, - "discount_rate": { - "constraints": { - "minimum": 0 - }, - "default": 0, - "description": " e.g. 0.05 is 5 %. discount rate for the annuity calculation.", - "type": "DOUBLE", - "unit": "ratio" - }, - "economic_lifetime": { - "constraints": { - "minimum": 0 - }, - "default": 1, - "description": "Economic lifetime of the transport asset for annuity calculation.", - "type": "INTEGER", - "unit": "years" - }, - "from_asset": { - "constraints": null, - "default": null, - "description": "Name of the asset. Same as the one in the `basic` table.", - "type": "VARCHAR", - "unit": null - }, - "investment_integer": { - "constraints": null, - "default": false, - "description": "Whether investment decisions are using integer variables.", - "type": "BOOLEAN", - "unit": null - }, - "is_transport": { - "constraints": null, - "default": false, - "description": "Whether a transport flow or not. Transport assets can have flows in both directions and can be invested in.", - "type": "BOOLEAN", - "unit": null - }, - "technical_lifetime": { - "constraints": { - "minimum": 0 - }, - "default": 1, - "description": "Technical lifetime of the transport asset to determine for how long the capacity is considered from the commission year.", - "type": "INTEGER", - "unit": "years" - }, - "to_asset": { - "constraints": null, - "default": null, - "description": "Name of the asset. Same as the one in the `basic` table.", - "type": "VARCHAR", - "unit": null - } - }, - "both": { - "commission_year": { - "constraints": null, - "default": 2000, - "description": "Year of commissioning", - "type": "INTEGER", - "unit": null - }, - "decommissionable": { - "constraints": null, - "default": false, - "description": "Whether the transport asset can be decomission or not.", - "type": "BOOLEAN", - "unit": null - }, - "from_asset": { - "constraints": null, - "default": null, - "description": "Name of the asset. Same as the one in the `basic` table.", - "type": "VARCHAR", - "unit": null - }, - "initial_export_units": { - "constraints": null, - "default": 0, - "description": "Number of existing units in from_asset -> to_asset direction", - "type": "DOUBLE", - "unit": "number" - }, - "initial_import_units": { - "constraints": null, - "default": 0, - "description": "Number of existing units in to_asset -> from_asset direction", - "type": "DOUBLE", - "unit": "number" - }, - "milestone_year": { - "constraints": null, - "default": 2000, - "description": "Year of investment and operation decisions in the optimization.", - "type": "INTEGER", - "unit": null - }, - "to_asset": { - "constraints": null, - "default": null, - "description": "Name of the asset. Same as the one in the `basic` table.", - "type": "VARCHAR", - "unit": null - } - }, - "commission": { - "commission_year": { - "constraints": null, - "default": 2000, - "description": "Year of commissioning", - "type": "INTEGER", - "unit": null - }, - "efficiency": { - "constraints": { - "minimum": 0 - }, - "default": 1, - "description": "Efficiency of transfer in from_asset -> to_asset direction", - "type": "DOUBLE", - "unit": "ratio" - }, - "fixed_cost": { - "constraints": null, - "default": null, - "description": "Fixed annual cost for the transport asset capacity.", - "type": "DOUBLE", - "unit": "CUR/MW/year" - }, - "from_asset": { - "constraints": null, - "default": null, - "description": "Name of the asset. Same as the one in the `basic` table.", - "type": "VARCHAR", - "unit": null - }, - "investment_cost": { - "constraints": null, - "default": null, - "description": "Investment cost for the transport asset capacity.", - "type": "DOUBLE", - "unit": "CUR/MW" - }, - "investment_limit": { - "constraints": null, - "default": null, - "description": "Maximum capacity for the transport asset investment. If the initial value is null, empty, or missing, it will be no limit.", - "type": "DOUBLE", - "unit": "MWh" - }, - "to_asset": { - "constraints": null, - "default": null, - "description": "Name of the asset. Same as the one in the `basic` table.", - "type": "VARCHAR", - "unit": null - } - }, - "milestone": { - "from_asset": { - "constraints": null, - "default": null, - "description": "Name of the asset. Same as the one in the `basic` table.", - "type": "VARCHAR", - "unit": null - }, - "investable": { - "constraints": null, - "default": false, - "description": "Whether there is an investment variable created for the asset or not.", - "type": "BOOLEAN", - "unit": null - }, - "milestone_year": { - "constraints": null, - "default": 2000, - "description": "Year of investment and operation decisions in the optimization.", - "type": "INTEGER", - "unit": null - }, - "to_asset": { - "constraints": null, - "default": null, - "description": "Name of the asset. Same as the one in the `basic` table.", - "type": "VARCHAR", - "unit": null - }, - "variable_cost": { - "constraints": null, - "default": 0, - "description": "Variable cost for the flow.", - "type": "DOUBLE", - "unit": "CUR/MWh" - } - }, - "profiles_reference": { - "from_asset": { - "constraints": null, - "default": null, - "description": "Name of the asset. Same as the one in the `basic` table.", - "type": "VARCHAR", - "unit": null - }, - "profile_name": { - "constraints": null, - "default": null, - "description": "Name of profile, used to determine data inside the DuckDB table", - "type": "VARCHAR", - "unit": null - }, - "profile_type": { - "constraints": { - "OneOf": [ - "availability" - ] - }, - "default": null, - "description": "Type of profile, used to determine DuckDB table with source profile", - "type": "VARCHAR", - "unit": null - }, - "to_asset": { - "constraints": null, - "default": null, - "description": "Name of the asset. Same as the one in the `basic` table.", - "type": "VARCHAR", - "unit": null - }, - "year": { - "constraints": null, - "default": 2000, - "description": "Milestone year.", - "type": "INTEGER", - "unit": null - } - }, - "rep_periods_partition": { - "from_asset": { - "constraints": null, - "default": null, - "description": "Name of the asset. Same as the one in the `basic` table.", - "type": "VARCHAR", - "unit": null - }, - "partition": { - "constraints": null, - "default": 1, - "description": "Partition or temporal resolution in the representative periods. For example, for a `uniform` specification `1` is hourly, `2` is every two hours.", - "type": "VARCHAR", - "unit": null - }, - "rep_period": { - "constraints": null, - "default": null, - "description": "Number of the representative period", - "type": "INTEGER", - "unit": "number" - }, - "specification": { - "constraints": { - "OneOf": [ - "uniform", - "explicit", - "math" - ] - }, - "default": "uniform", - "description": "Partition (or temporal resolution) specification in the representative periods.", - "type": "VARCHAR", - "unit": null - }, - "to_asset": { - "constraints": null, - "default": null, - "description": "Name of the asset. Same as the one in the `basic` table.", - "type": "VARCHAR", - "unit": null - }, - "year": { - "constraints": null, - "default": 2000, - "description": "Milestone year.", - "type": "INTEGER", - "unit": null - } + "capacity": { + "UoM": "MW", + "constraints": { + "minimum": 0 + }, + "default": 0, + "description": "Capacity for one unit of the transport flow (is therefore multiplied by number of existing plus invested number of transport assets).", + "type": "DOUBLE" + }, + "carrier": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Energy carrier", + "type": "VARCHAR" + }, + "discount_rate": { + "UoM": "ratio", + "constraints": { + "minimum": 0 + }, + "default": 0, + "description": " e.g. 0.05 is 5 %. discount rate for the annuity calculation.", + "type": "DOUBLE" + }, + "economic_lifetime": { + "UoM": "years", + "constraints": { + "minimum": 0 + }, + "default": 1, + "description": "Economic lifetime of the transport asset for annuity calculation.", + "type": "INTEGER" + }, + "from_asset": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `asset` table.", + "type": "VARCHAR" + }, + "investment_integer": { + "UoM": null, + "constraints": null, + "default": false, + "description": "Whether investment decisions are using integer variables.", + "type": "BOOLEAN" + }, + "is_transport": { + "UoM": null, + "constraints": null, + "default": false, + "description": "Whether a transport flow or not. Transport assets can have flows in both directions and can be invested in.", + "type": "BOOLEAN" + }, + "technical_lifetime": { + "UoM": "years", + "constraints": { + "minimum": 0 + }, + "default": 1, + "description": "Technical lifetime of the transport asset to determine for how long the capacity is considered from the commission year.", + "type": "INTEGER" + }, + "to_asset": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `asset` table.", + "type": "VARCHAR" } }, - "group": { - "data": { - "invest_method": { - "constraints": null, - "default": null, - "description": "true -> activate group constraints; false -> no group investment constraints", - "type": "BOOLEAN", - "unit": null - }, - "max_investment_limit": { - "constraints": null, - "default": null, - "description": "MW (Missing -> no limit)", - "type": "DOUBLE", - "unit": null - }, - "milestone_year": { - "constraints": null, - "default": 2000, - "description": "Year of investment and operation decisions in the optimization.", - "type": "INTEGER", - "unit": null - }, - "min_investment_limit": { - "constraints": null, - "default": null, - "description": "MW (Missing -> no limit)", - "type": "DOUBLE", - "unit": null - }, - "name": { - "constraints": null, - "default": null, - "description": "Name of the Group", - "type": "VARCHAR", - "unit": null - } + "flow_both": { + "commission_year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Year of commissioning", + "type": "INTEGER" + }, + "decommissionable": { + "UoM": null, + "constraints": null, + "default": false, + "description": "Whether the transport asset can be decomission or not.", + "type": "BOOLEAN" + }, + "from_asset": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `asset` table.", + "type": "VARCHAR" + }, + "initial_export_units": { + "UoM": "number", + "constraints": null, + "default": 0, + "description": "Number of existing units in `from_asset` -> `to_asset` direction", + "type": "DOUBLE" + }, + "initial_import_units": { + "UoM": "number", + "constraints": null, + "default": 0, + "description": "Number of existing units in `to_asset` -> `from_asset` direction", + "type": "DOUBLE" + }, + "milestone_year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Year of investment and operation decisions in the optimization.", + "type": "INTEGER" + }, + "to_asset": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `asset` table.", + "type": "VARCHAR" } }, - "rep_period": { - "data": { - "num_timesteps": { - "constraints": null, - "default": 8760, - "description": "Number of timesteps", - "type": "INTEGER", - "unit": null - }, - "rep_period": { - "constraints": null, - "default": 1, - "description": "Representative period number.", - "type": "INTEGER", - "unit": "number" - }, - "resolution": { - "constraints": null, - "default": 1, - "description": "Duration of each timestep", - "type": "DOUBLE", - "unit": "hours" - }, - "year": { - "constraints": null, - "default": 2000, - "description": "Milestone year.", - "type": "INTEGER", - "unit": null - } - }, - "mapping": { - "period": { - "constraints": null, - "default": 1, - "description": "Period number.", - "type": "INTEGER", - "unit": null - }, - "rep_period": { - "constraints": null, - "default": 1, - "description": "Representative period number.", - "type": "INTEGER", - "unit": null - }, - "weight": { - "constraints": null, - "default": 1, - "description": "Hours", - "type": "DOUBLE", - "unit": null - }, - "year": { - "constraints": null, - "default": 2000, - "description": "Milestone year.", - "type": "INTEGER", - "unit": null - } - }, - "profiles_data": { - "profile_name": { - "constraints": null, - "default": null, - "description": "Profile name.", - "type": "VARCHAR", - "unit": null - }, - "rep_period": { - "constraints": null, - "default": 1, - "description": "Representative period number.", - "type": "INTEGER", - "unit": null - }, - "timestep": { - "constraints": null, - "default": 1, - "description": "Timestep number.", - "type": "INTEGER", - "unit": null - }, - "value": { - "constraints": null, - "default": null, - "description": "Value of the profile.", - "type": "DOUBLE", - "unit": "p.u." - }, - "year": { - "constraints": null, - "default": 2000, - "description": "Milestone year.", - "type": "INTEGER", - "unit": null - } + "flow_commission": { + "commission_year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Year of commissioning", + "type": "INTEGER" + }, + "efficiency": { + "UoM": "ratio", + "constraints": { + "minimum": 0 + }, + "default": 1, + "description": "Efficiency of transfer in `from_asset` -> `to_asset` direction", + "type": "DOUBLE" + }, + "fixed_cost": { + "UoM": "CUR/MW/year", + "constraints": null, + "default": null, + "description": "Fixed annual cost for the transport asset capacity.", + "type": "DOUBLE" + }, + "from_asset": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `asset` table.", + "type": "VARCHAR" + }, + "investment_cost": { + "UoM": "CUR/MW", + "constraints": null, + "default": null, + "description": "Investment cost for the transport asset capacity.", + "type": "DOUBLE" + }, + "investment_limit": { + "UoM": "MWh", + "constraints": null, + "default": null, + "description": "Maximum capacity for the transport asset investment. If the initial value is null, empty, or missing, it will be no limit.", + "type": "DOUBLE" + }, + "to_asset": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `asset` table.", + "type": "VARCHAR" } }, - "timeframe": { - "profiles_data": { - "period": { - "constraints": null, - "default": null, - "description": "Period.", - "type": "INTEGER", - "unit": null - }, - "profile_name": { - "constraints": null, - "default": null, - "description": "Profile name.", - "type": "VARCHAR", - "unit": null - }, - "value": { - "constraints": null, - "default": null, - "description": "value of the profile.", - "type": "DOUBLE", - "unit": "p.u." - }, - "year": { - "constraints": null, - "default": 2000, - "description": "Milestone year.", - "type": "INTEGER", - "unit": null - } + "flow_milestone": { + "from_asset": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `asset` table.", + "type": "VARCHAR" + }, + "investable": { + "UoM": null, + "constraints": null, + "default": false, + "description": "Whether there is an investment variable created for the asset or not.", + "type": "BOOLEAN" + }, + "milestone_year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Year of investment and operation decisions in the optimization.", + "type": "INTEGER" + }, + "to_asset": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `asset` table.", + "type": "VARCHAR" + }, + "variable_cost": { + "UoM": "CUR/MWh", + "constraints": null, + "default": 0, + "description": "Variable cost for the flow.", + "type": "DOUBLE" } }, - "year": { - "data": { - "is_milestone": { - "constraints": null, - "default": true, - "description": "Whether the year is a milestone year or a vintage year", - "type": "BOOLEAN", - "unit": null - }, - "length": { - "constraints": null, - "default": 8760, - "description": "HOw many hours in a year, e.g., 8760", - "type": "INTEGER", - "unit": null - }, - "year": { - "constraints": null, - "default": 2000, - "description": "Unique identifier (currently, the year itself)", - "type": "INTEGER", - "unit": null - } + "flows_profiles": { + "from_asset": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `asset` table.", + "type": "VARCHAR" + }, + "profile_name": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of profile, used to determine data inside the DuckDB table", + "type": "VARCHAR" + }, + "profile_type": { + "UoM": null, + "constraints": { + "OneOf": [ + "availability" + ] + }, + "default": null, + "description": "Type of profile, used to determine DuckDB table with source profile", + "type": "VARCHAR" + }, + "to_asset": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `asset` table.", + "type": "VARCHAR" + }, + "year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Milestone year.", + "type": "INTEGER" + } + }, + "flows_rep_periods_partitions": { + "from_asset": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `asset` table.", + "type": "VARCHAR" + }, + "partition": { + "UoM": null, + "constraints": null, + "default": 1, + "description": "Partition or temporal resolution in the representative periods. For example, for a `uniform` specification `1` is hourly, `2` is every two hours.", + "type": "VARCHAR" + }, + "rep_period": { + "UoM": "number", + "constraints": null, + "default": null, + "description": "Number of the representative period", + "type": "INTEGER" + }, + "specification": { + "UoM": null, + "constraints": { + "OneOf": [ + "uniform", + "explicit", + "math" + ] + }, + "default": "uniform", + "description": "Partition (or temporal resolution) specification in the representative periods.", + "type": "VARCHAR" + }, + "to_asset": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of the asset. Same as the one in the `asset` table.", + "type": "VARCHAR" + }, + "year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Milestone year.", + "type": "INTEGER" + } + }, + "group_asset": { + "invest_method": { + "UoM": null, + "constraints": null, + "default": null, + "description": "true -> activate group constraints; false -> no group investment constraints", + "type": "BOOLEAN" + }, + "max_investment_limit": { + "UoM": null, + "constraints": null, + "default": null, + "description": "MW (Missing -> no limit)", + "type": "DOUBLE" + }, + "milestone_year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Year of investment and operation decisions in the optimization.", + "type": "INTEGER" + }, + "min_investment_limit": { + "UoM": null, + "constraints": null, + "default": null, + "description": "MW (Missing -> no limit)", + "type": "DOUBLE" + }, + "name": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Name of the Group", + "type": "VARCHAR" + } + }, + "profiles_rep_periods": { + "profile_name": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Profile name.", + "type": "VARCHAR" + }, + "rep_period": { + "UoM": null, + "constraints": null, + "default": 1, + "description": "Representative period number.", + "type": "INTEGER" + }, + "timestep": { + "UoM": null, + "constraints": null, + "default": 1, + "description": "Timestep number.", + "type": "INTEGER" + }, + "value": { + "UoM": "p.u.", + "constraints": null, + "default": null, + "description": "Value of the profile.", + "type": "DOUBLE" + }, + "year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Milestone year.", + "type": "INTEGER" + } + }, + "profiles_timeframe": { + "period": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Period.", + "type": "INTEGER" + }, + "profile_name": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Profile name.", + "type": "VARCHAR" + }, + "value": { + "UoM": "p.u.", + "constraints": null, + "default": null, + "description": "value of the profile.", + "type": "DOUBLE" + }, + "year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Milestone year.", + "type": "INTEGER" + } + }, + "rep_periods_data": { + "num_timesteps": { + "UoM": null, + "constraints": null, + "default": 8760, + "description": "Number of timesteps", + "type": "INTEGER" + }, + "rep_period": { + "UoM": "number", + "constraints": null, + "default": 1, + "description": "Representative period number.", + "type": "INTEGER" + }, + "resolution": { + "UoM": "hours", + "constraints": null, + "default": 1, + "description": "Duration of each timestep", + "type": "DOUBLE" + }, + "year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Milestone year.", + "type": "INTEGER" + } + }, + "rep_periods_mapping": { + "period": { + "UoM": null, + "constraints": null, + "default": 1, + "description": "Period number.", + "type": "INTEGER" + }, + "rep_period": { + "UoM": null, + "constraints": null, + "default": 1, + "description": "Representative period number.", + "type": "INTEGER" + }, + "weight": { + "UoM": null, + "constraints": null, + "default": 1, + "description": "Hours", + "type": "DOUBLE" + }, + "year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Milestone year.", + "type": "INTEGER" + } + }, + "timeframe_data": { + "num_timesteps": { + "UoM": null, + "constraints": null, + "default": 8760, + "description": "Number of timesteps of the representative period.", + "type": "INTEGER" + }, + "period": { + "UoM": null, + "constraints": null, + "default": null, + "description": "Period.", + "type": "INTEGER" + }, + "year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Unique identifier (currently, the year itself)", + "type": "INTEGER" + } + }, + "year_data": { + "is_milestone": { + "UoM": null, + "constraints": null, + "default": true, + "description": "Whether the year is a milestone year or a vintage year", + "type": "BOOLEAN" + }, + "length": { + "UoM": null, + "constraints": null, + "default": 8760, + "description": "How many hours in a year, e.g., 8760", + "type": "INTEGER" + }, + "year": { + "UoM": null, + "constraints": null, + "default": 2000, + "description": "Unique identifier (currently, the year itself)", + "type": "INTEGER" } } } From 3629d659c2360abacba4ac549e2ac25086ec3f9c Mon Sep 17 00:00:00 2001 From: Diego Alejandro Tejada Arango Date: Wed, 26 Feb 2025 17:24:46 +0100 Subject: [PATCH 07/12] Update input schemas accordingly --- src/input-schemas.jl | 56 ++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/src/input-schemas.jl b/src/input-schemas.jl index 23466662..9fde58d6 100644 --- a/src/input-schemas.jl +++ b/src/input-schemas.jl @@ -3,48 +3,42 @@ schema = JSON.parsefile("src/input-schemas.json"; dicttype = OrderedDict); const schema_per_table_name = OrderedDict( - "asset" => OrderedDict(key => value["type"] for (key, value) in schema["asset"]["basic"]), - "asset_both" => - OrderedDict(key => value["type"] for (key, value) in schema["asset"]["both"]), + "asset" => OrderedDict(key => value["type"] for (key, value) in schema["asset"]), + "asset_both" => OrderedDict(key => value["type"] for (key, value) in schema["asset_both"]), "asset_commission" => - OrderedDict(key => value["type"] for (key, value) in schema["asset"]["commission"]), + OrderedDict(key => value["type"] for (key, value) in schema["asset_commission"]), "asset_milestone" => - OrderedDict(key => value["type"] for (key, value) in schema["asset"]["milestone"]), - "assets_profiles" => OrderedDict( - key => value["type"] for (key, value) in schema["asset"]["profiles_reference"] - ), + OrderedDict(key => value["type"] for (key, value) in schema["asset_milestone"]), + "assets_profiles" => + OrderedDict(key => value["type"] for (key, value) in schema["assets_profiles"]), "assets_rep_periods_partitions" => OrderedDict( - key => value["type"] for (key, value) in schema["asset"]["rep_periods_partition"] + key => value["type"] for (key, value) in schema["assets_rep_periods_partitions"] ), "assets_timeframe_partitions" => OrderedDict( - key => value["type"] for (key, value) in schema["asset"]["timeframe_partition"] - ), - "assets_timeframe_profiles" => OrderedDict( - key => value["type"] for (key, value) in schema["asset"]["profiles_reference"] + key => value["type"] for (key, value) in schema["assets_timeframe_partitions"] ), - "flow" => OrderedDict(key => value["type"] for (key, value) in schema["flow"]["basic"]), - "flow_both" => OrderedDict(key => value["type"] for (key, value) in schema["flow"]["both"]), + "assets_timeframe_profiles" => + OrderedDict(key => value["type"] for (key, value) in schema["assets_profiles"]), + "flow" => OrderedDict(key => value["type"] for (key, value) in schema["flow"]), + "flow_both" => OrderedDict(key => value["type"] for (key, value) in schema["flow_both"]), "flow_commission" => - OrderedDict(key => value["type"] for (key, value) in schema["flow"]["commission"]), + OrderedDict(key => value["type"] for (key, value) in schema["flow_commission"]), "flow_milestone" => - OrderedDict(key => value["type"] for (key, value) in schema["flow"]["milestone"]), - "flows_profiles" => OrderedDict( - key => value["type"] for (key, value) in schema["flow"]["profiles_reference"] - ), + OrderedDict(key => value["type"] for (key, value) in schema["flow_milestone"]), + "flows_profiles" => + OrderedDict(key => value["type"] for (key, value) in schema["flows_profiles"]), "flows_rep_periods_partitions" => OrderedDict( - key => value["type"] for (key, value) in schema["flow"]["rep_periods_partition"] + key => value["type"] for (key, value) in schema["flows_rep_periods_partitions"] ), "group_asset" => - OrderedDict(key => value["type"] for (key, value) in schema["group"]["data"]), - "profiles_rep_periods" => OrderedDict( - key => value["type"] for (key, value) in schema["rep_period"]["profiles_data"] - ), - "profiles_timeframe" => OrderedDict( - key => value["type"] for (key, value) in schema["timeframe"]["profiles_data"] - ), + OrderedDict(key => value["type"] for (key, value) in schema["group_asset"]), + "profiles_rep_periods" => + OrderedDict(key => value["type"] for (key, value) in schema["profiles_rep_periods"]), + "profiles_timeframe" => + OrderedDict(key => value["type"] for (key, value) in schema["profiles_timeframe"]), "rep_periods_data" => - OrderedDict(key => value["type"] for (key, value) in schema["rep_period"]["data"]), + OrderedDict(key => value["type"] for (key, value) in schema["rep_periods_data"]), "rep_periods_mapping" => - OrderedDict(key => value["type"] for (key, value) in schema["rep_period"]["mapping"]), - "year_data" => OrderedDict(key => value["type"] for (key, value) in schema["year"]["data"]), + OrderedDict(key => value["type"] for (key, value) in schema["rep_periods_mapping"]), + "year_data" => OrderedDict(key => value["type"] for (key, value) in schema["year_data"]), ) From d796722d0cacabc50f46565e09f0f00e3b7c3e97 Mon Sep 17 00:00:00 2001 From: Diego Alejandro Tejada Arango Date: Wed, 26 Feb 2025 17:25:06 +0100 Subject: [PATCH 08/12] Update documentation --- docs/Project.toml | 2 ++ docs/src/50-schemas.md | 64 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 55 insertions(+), 11 deletions(-) diff --git a/docs/Project.toml b/docs/Project.toml index 2ab1d120..ac9861d7 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -5,7 +5,9 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" DuckDB = "d2f5444f-75bc-4fdf-ac35-56f514c445e1" GLPK = "60bf3e95-4087-53dc-ae20-288a0d20c6a6" HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b" +JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" JuMP = "4076af6c-e467-56ae-b986-b466b2749572" LiveServer = "16fef848-5104-11e9-1b77-fb7a48bbb589" +OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" TulipaEnergyModel = "5d7bd171-d18e-45a5-9111-f1f11ac5d04d" TulipaIO = "7b3808b7-0819-42d4-885c-978ba173db11" diff --git a/docs/src/50-schemas.md b/docs/src/50-schemas.md index b55ab917..d9cc343a 100644 --- a/docs/src/50-schemas.md +++ b/docs/src/50-schemas.md @@ -2,7 +2,7 @@ The optimization model parameters with the input data must follow the schema below for each table. To create these tables we currently use CSV files that follow this same schema and then convert them into tables using TulipaIO, as shown in the basic example of the [Tutorials](@ref basic-example) section. -The schemas can be accessed at any time after loading the package by typing `TulipaEnergyModel.schema_per_table_name` in the Julia console. Here is the complete list of model parameters in the schemas per table (or CSV file): +The schemas can be found in the `input-schemas.json` or can be accessed at any time after loading the package by typing `TulipaEnergyModel.schema_per_table_name` in the Julia console. Here is the complete list of model parameters in the schemas per table (or CSV file): !!! info "Optional tables/files and their defaults" The following tables/files are allowed to be missing: "assets\_rep\_periods\_partitions", "assets\_timeframe\_partitions", "assets\_timeframe\_profiles", "flows\_rep\_periods\_partitions", "group\_asset", "profiles\_timeframe". @@ -11,14 +11,56 @@ The schemas can be accessed at any time after loading the package by typing `Tul - If no group table/file is available there will be no group constraints in the model ```@eval -using Markdown, TulipaEnergyModel - -Markdown.parse( - join(["- **`$filename`**\n" * - join( - [" - `$f: $t`" for (f, t) in schema], - "\n", - ) for (filename, schema) in TulipaEnergyModel.schema_per_table_name - ] |> sort, "\n") -) +""" +The output of the following code is a Markdown text with the following structure: + +TABLE_NAME +========= + +PARAMETER_NAME + + • Description: Lorem ipsum + • Type: SQL type of the parameter + • Default: a value or "No default" + • Unit of measure: a value or "-" + • Constraints: a table or "No constraints" +""" + +using Markdown, JSON +using OrderedCollections: OrderedDict + +input_schemas = JSON.parsefile("../../src/input-schemas.json"; dicttype = OrderedDict) + +let buffer = IOBuffer() + for (i,(table_name, fields)) in enumerate(input_schemas) + write(buffer, "## Table $i : `$table_name`\n\n") + for (field_name, field_info) in fields + desc = get(field_info, "description", "No description provided") + typ = get(field_info, "type", "Unknown type") + unit = get(field_info, "UoM", "-") + default = get(field_info, "default", "No default") + constraints_val = get(field_info, "constraints", nothing) + + write(buffer, "**`$field_name`**\n\n") + write(buffer, "- Description: $desc\n\n") + write(buffer, "- Type: `$typ`\n") + write(buffer, "- Unit of measure: `$unit` \n") + write(buffer, "- Default: `$default`\n") + + if constraints_val === nothing + write(buffer, "- Constraints: No constraints\n") + elseif isa(constraints_val, OrderedDict) + write(buffer, "| Constraints | Value |\n| --- | --- |\n") + for (key, value) in constraints_val + write(buffer, "| $key | `$value` |\n") + end + write(buffer, "\n") + else + write(buffer, "- Constraints: `$(string(constraints_val))`\n") + end + end + end + Markdown.parse(String(take!(buffer))) +end + ``` From 3b5aeda21318cdcf80b6061490b94611cada7e15 Mon Sep 17 00:00:00 2001 From: Diego Alejandro Tejada Arango Date: Tue, 4 Mar 2025 19:15:09 +0100 Subject: [PATCH 09/12] Add comments from code review --- docs/src/50-schemas.md | 28 +-- src/input-schemas.json | 437 ++++++++++------------------------------- 2 files changed, 116 insertions(+), 349 deletions(-) diff --git a/docs/src/50-schemas.md b/docs/src/50-schemas.md index d9cc343a..a7f5d8e2 100644 --- a/docs/src/50-schemas.md +++ b/docs/src/50-schemas.md @@ -2,7 +2,7 @@ The optimization model parameters with the input data must follow the schema below for each table. To create these tables we currently use CSV files that follow this same schema and then convert them into tables using TulipaIO, as shown in the basic example of the [Tutorials](@ref basic-example) section. -The schemas can be found in the `input-schemas.json` or can be accessed at any time after loading the package by typing `TulipaEnergyModel.schema_per_table_name` in the Julia console. Here is the complete list of model parameters in the schemas per table (or CSV file): +The schemas can be found in the `input-schemas.json`. For more advanced users, they can also access the schemas at any time after loading the package by typing `TulipaEnergyModel.schema_per_table_name` in the Julia console. Here is the complete list of model parameters in the schemas per table (or CSV file): !!! info "Optional tables/files and their defaults" The following tables/files are allowed to be missing: "assets\_rep\_periods\_partitions", "assets\_timeframe\_partitions", "assets\_timeframe\_profiles", "flows\_rep\_periods\_partitions", "group\_asset", "profiles\_timeframe". @@ -35,28 +35,28 @@ let buffer = IOBuffer() for (i,(table_name, fields)) in enumerate(input_schemas) write(buffer, "## Table $i : `$table_name`\n\n") for (field_name, field_info) in fields - desc = get(field_info, "description", "No description provided") - typ = get(field_info, "type", "Unknown type") - unit = get(field_info, "UoM", "-") - default = get(field_info, "default", "No default") - constraints_val = get(field_info, "constraints", nothing) + _description = get(field_info, "description", "No description provided") + _type = get(field_info, "type", "Unknown type") + _unit = get(field_info, "unit of measure", "-") + _default = get(field_info, "default", "No default") + _constraints_values = get(field_info, "constraints", nothing) write(buffer, "**`$field_name`**\n\n") - write(buffer, "- Description: $desc\n\n") - write(buffer, "- Type: `$typ`\n") - write(buffer, "- Unit of measure: `$unit` \n") - write(buffer, "- Default: `$default`\n") + write(buffer, "- Description: $_description\n\n") + write(buffer, "- Type: `$_type`\n") + write(buffer, "- Unit of measure: `$_unit` \n") + write(buffer, "- Default: `$_default`\n") - if constraints_val === nothing + if _constraints_values === nothing write(buffer, "- Constraints: No constraints\n") - elseif isa(constraints_val, OrderedDict) + elseif isa(_constraints_values, OrderedDict) write(buffer, "| Constraints | Value |\n| --- | --- |\n") - for (key, value) in constraints_val + for (key, value) in _constraints_values write(buffer, "| $key | `$value` |\n") end write(buffer, "\n") else - write(buffer, "- Constraints: `$(string(constraints_val))`\n") + write(buffer, "- Constraints: `$(string(_constraints_values))`\n") end end end diff --git a/src/input-schemas.json b/src/input-schemas.json index 9b317d3a..c2066d9c 100644 --- a/src/input-schemas.json +++ b/src/input-schemas.json @@ -1,37 +1,33 @@ { "asset": { "asset": { - "UoM": null, - "constraints": null, - "default": null, "description": "Unique identifier with the name of the asset.", "type": "VARCHAR" }, "capacity": { - "UoM": "MW", "constraints": { "minimum": 0 }, "default": 0, "description": "Capacity for one unit of the asset (is therefore multiplied by number of existing plus number of invested assets).", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "MW" }, "capacity_storage_energy": { - "UoM": "MWh", "constraints": { "minimum": 0 }, - "deafult": 0, + "default": 0, "description": "Capacity of one storage unit.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "MWh" }, "consumer_balance_sense": { - "UoM": null, "constraints": { - "OneOf": [ + "oneOf": [ "==", ">=", - "=<" + "<=" ] }, "default": "==", @@ -39,57 +35,49 @@ "type": "VARCHAR" }, "discount_rate": { - "UoM": "ratio", "constraints": { "minimum": 0 }, "default": 0, "description": " e.g. 0.05 is 5 %. discount rate for the annuity calculation.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "ratio" }, "economic_lifetime": { - "UoM": "years", "constraints": { "minimum": 0 }, "default": 1, "description": "Economic lifetime of the unit for annuity calculation.", - "type": "INTEGER" + "type": "INTEGER", + "unit of measure": "years" }, "energy_to_power_ratio": { - "UoM": "h", "constraints": { "minimum": 0 }, - "deafult": 0, + "default": 0, "description": "Fixed ratio between the energy storage capacity [MWh] and the discharge/charge capacity [MW] for energy storage investments where `storage_method_energy = false`.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "h" }, "group": { - "UoM": null, - "constraint": null, - "default": null, "description": "Group to which the asset belongs to (null/empty/missing -> no group).", "type": "VARCHAR" }, "investment_integer": { - "UoM": null, - "constraints": null, "default": false, "description": "Whether investment decisions are using integer variables.", "type": "BOOLEAN" }, "investment_integer_storage_energy": { - "UoM": null, - "constraints": null, "default": false, "description": "Whether investment for storage energy is integer or continuous. It only applies for energy storage investments where `storage_method_energy = true`.", "type": "BOOLEAN" }, "investment_method": { - "UoM": null, "constraints": { - "OneOf": [ + "oneOf": [ "none", "simple", "compact" @@ -100,67 +88,60 @@ "type": "VARCHAR" }, "is_seasonal": { - "UoM": null, - "constraints": null, "default": false, "description": "Whether seasonal storage (e.g., hydro) or not (e.g., battery)", "type": "BOOLEAN" }, "max_ramp_down": { - "UoM": "p.u./h", "constraints": { "minimum": 0 }, - "deafult": 0, + "default": 0, "description": "Maximum ramping down rate as a portion of the capacity of asset.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "p.u./h" }, "max_ramp_up": { - "UoM": "p.u./h", "constraints": { "minimum": 0 }, - "deafult": 0, + "default": 0, "description": "Maximum ramping up rate as a portion of the capacity of asset.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "p.u./h" }, "min_operating_point": { - "UoM": "p.u.", "constraints": { "maximum": 1, "minimum": 0 }, "default": 0, "description": "Minimum operating point or minimum stable generation level defined as a portion of the capacity of asset.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "p.u." }, "ramping": { - "UoM": null, - "constraints": null, "default": false, "description": "Whether asset has ramping constraints or not.", "type": "BOOLEAN" }, "storage_method_energy": { - "UoM": null, - "constraints": null, "default": false, "description": "Whether there is independent investment on storage capacity or not. If false, the investment on storage capacity uses the energy_to_power_ratio as a constant fixed value.", "type": "BOOLEAN" }, "technical_lifetime": { - "UoM": "years", "constraints": { "minimum": 0 }, "default": 1, "description": "Technical lifetime of the unit to determine for how long the capacity is considered from the commission year.", - "type": "INTEGER" + "type": "INTEGER", + "unit of measure": "years" }, "type": { - "UoM": null, "constraints": { - "OneOf": [ + "oneOf": [ "producer", "consumer", "storage", @@ -168,89 +149,69 @@ "hub" ] }, - "deafult": null, "description": "Type of energy asset.", "type": "VARCHAR" }, "unit_commitment": { - "UoM": null, - "constraints": null, "default": false, "description": "Whether asset has unit commitment constraints or not", "type": "BOOLEAN" }, "unit_commitment_integer": { - "UoM": null, - "constraints": null, "default": false, "description": "Whether the unit commitment variables are integer or not.", "type": "BOOLEAN" }, "unit_commitment_method": { - "UoM": null, "constraints": { - "OneOf": [ + "oneOf": [ null, "basic" ] }, - "default": null, "description": "Which unit commitment method to use (null/empty/missing -> no unit commitment method).", "type": "VARCHAR" }, "use_binary_storage_method": { - "UoM": null, "constraints": { - "OneOf": [ + "oneOf": [ null, "binary", "relaxed_binary" ] }, - "default": null, "description": "Whether to use an extra binary variable for the storage assets to avoid charging and discharging simultaneously (null/empty/missing -> no binary).", "type": "VARCHAR" } }, "asset_both": { "asset": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of the asset. Same as the one in the `asset` table.", "type": "VARCHAR" }, "commission_year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Year of commissioning", "type": "INTEGER" }, "decommissionable": { - "UoM": null, - "constraints": null, "default": false, "description": "Whether the asset can be decomission or not.", "type": "BOOLEAN" }, "initial_storage_units": { - "UoM": "number", - "constraints": null, "default": 0, "description": "Number of existing storage units", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "number" }, "initial_units": { - "UoM": "number", - "constraints": null, "default": 0, "description": "Number of existing units", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "number" }, "milestone_year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Year of investment and operation decisions in the optimization.", "type": "INTEGER" @@ -258,165 +219,130 @@ }, "asset_commission": { "asset": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of the asset. Same as the one in the `asset` table.", "type": "VARCHAR" }, "commission_year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Year of commissioning.", "type": "INTEGER" }, "fixed_cost": { - "UoM": "CUR/MW/year", - "constraints": null, - "default": null, "description": "Fixed annual cost for the asset capacity.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "CUR/MW/year" }, "fixed_cost_storage_energy": { - "UoM": "CUR/MWh/year", - "constraints": null, - "default": null, "description": "Fixed annual cost for the asset storage capacity", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "CUR/MWh/year" }, "investment_cost": { - "UoM": "CUR/MW", - "constraints": null, - "default": null, "description": "Investment cost for the asset capacity.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "CUR/MW" }, "investment_cost_storage_energy": { - "UoM": "CUR/MWh", - "constraints": null, - "default": null, "description": "Investment cost for the asset energy storage capacity.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "CUR/MWh" }, "investment_limit": { - "UoM": "MWh", - "constraints": null, - "default": null, "description": "Maximum capacity for the asset investment. If the initial value is null, empty, or missing, it will be no limit.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "MWh" }, "investment_limit_storage_energy": { - "UoM": "MWh", - "constraints": null, - "default": null, "description": "Maximum capacity for the asset storage investment. If the initial value is null, empty, or missing, it will be no limit.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "MWh" } }, "asset_milestone": { "asset": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of the asset. Same as the one in the `asset` table.", "type": "VARCHAR" }, "initial_storage_level": { - "UoM": "MWh", "constraints": { "minimum": 0 }, - "deafult": 0, + "default": 0, "description": "The initial storage level at the beginning of the optimization. The final storage level needs to be above this initial value. If the initial value is null, empty, or missing, it will be optimized using a cycling constraint that links the last period to the initial period.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "MWh" }, "investable": { - "UoM": null, - "constraints": null, "default": false, "description": "Whether there is an investment variable created for the asset or not.", "type": "BOOLEAN" }, "max_energy_timeframe_partition": { - "UoM": "MWh", "constraints": { "minimum": 0 }, - "deafult": null, "description": "The maximum amount of energy across the timeframe (e.g., a year) that the asset must produce. If the initial value is null, empty, or missing, it will be no limit.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "MWh" }, "milestone_year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Year of investment and operation decisions in the optimization.", "type": "INTEGER" }, "min_energy_timeframe_partition": { - "UoM": "MWh", "constraints": { "minimum": 0 }, - "deafult": null, "description": "The minimum amount of energy across the timeframe (e.g., a year) that the asset must produce. If the initial value is null, empty, or missing, it will be no limit.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "MWh" }, "peak_demand": { - "UoM": "MW", "constraints": { "minimum": 0 }, - "deafult": 0, + "default": 0, "description": "Value that multiplies the demand profile time series.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "MW" }, "storage_inflows": { - "UoM": "MWh/year", "constraints": { "minimum": 0 }, - "deafult": 0, + "default": 0, "description": "Value that multiplies the inflow profile time series.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "MWh/year" }, "units_on_cost": { - "UoM": "CUR/p.u./h", "constraints": { "minimum": 0 }, - "deafult": 0, + "default": 0, "description": "Cost of keeping unit online for one hour or the objective function coefficient on `units_on` variable. e.g., no_load cost or idling cost", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "CUR/p.u./h" } }, "assets_profiles": { "asset": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of the asset. Same as the one in the `asset` table.", "type": "VARCHAR" }, "commission_year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Year of commissioning", "type": "INTEGER" }, "profile_name": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of profile, used to determine data inside the DuckDB table", "type": "VARCHAR" }, "profile_type": { - "UoM": null, "constraints": { - "OneOf": [ + "oneOf": [ "availability", "demand", "inflows", @@ -426,37 +352,28 @@ "min_energy" ] }, - "default": null, "description": "Type of profile, used to determine DuckDB table with source profile", "type": "VARCHAR" } }, "assets_rep_periods_partitions": { "asset": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of the asset. Same as the one in the `asset` table.", "type": "VARCHAR" }, "partition": { - "UoM": null, - "constraints": null, - "default": 1, + "default": "1", "description": "Partition or temporal resolution in the representative periods. For example, for a `uniform` specification `1` is hourly, `2` is every two hours.", "type": "VARCHAR" }, "rep_period": { - "UoM": "number", - "constraints": null, - "default": null, "description": "Number of the representative period", - "type": "INTEGER" + "type": "INTEGER", + "unit of measure": "number" }, "specification": { - "UoM": null, "constraints": { - "OneOf": [ + "oneOf": [ "uniform", "explicit", "math" @@ -467,8 +384,6 @@ "type": "VARCHAR" }, "year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Milestone year.", "type": "INTEGER" @@ -476,23 +391,17 @@ }, "assets_timeframe_partitions": { "asset": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of the asset. Same as the one in the `asset` table.", "type": "VARCHAR" }, "partition": { - "UoM": null, - "constraints": null, - "default": 1, + "default": "1", "description": "Partition or temporal resolution in the timeframe. For example, if a period is equivalent to a day then for a `uniform` specification `1` is per day, `2` is every two days.", "type": "VARCHAR" }, "specification": { - "UoM": null, "constraints": { - "OneOf": [ + "oneOf": [ "uniform", "explicit", "math" @@ -503,8 +412,6 @@ "type": "VARCHAR" }, "year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Milestone year.", "type": "INTEGER" @@ -512,254 +419,189 @@ }, "flow": { "capacity": { - "UoM": "MW", "constraints": { "minimum": 0 }, "default": 0, "description": "Capacity for one unit of the transport flow (is therefore multiplied by number of existing plus invested number of transport assets).", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "MW" }, "carrier": { - "UoM": null, - "constraints": null, - "default": null, "description": "Energy carrier", "type": "VARCHAR" }, "discount_rate": { - "UoM": "ratio", "constraints": { "minimum": 0 }, "default": 0, "description": " e.g. 0.05 is 5 %. discount rate for the annuity calculation.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "ratio" }, "economic_lifetime": { - "UoM": "years", "constraints": { "minimum": 0 }, "default": 1, "description": "Economic lifetime of the transport asset for annuity calculation.", - "type": "INTEGER" + "type": "INTEGER", + "unit of measure": "years" }, "from_asset": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of the asset. Same as the one in the `asset` table.", "type": "VARCHAR" }, "investment_integer": { - "UoM": null, - "constraints": null, "default": false, "description": "Whether investment decisions are using integer variables.", "type": "BOOLEAN" }, "is_transport": { - "UoM": null, - "constraints": null, "default": false, "description": "Whether a transport flow or not. Transport assets can have flows in both directions and can be invested in.", "type": "BOOLEAN" }, "technical_lifetime": { - "UoM": "years", "constraints": { "minimum": 0 }, "default": 1, "description": "Technical lifetime of the transport asset to determine for how long the capacity is considered from the commission year.", - "type": "INTEGER" + "type": "INTEGER", + "unit of measure": "years" }, "to_asset": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of the asset. Same as the one in the `asset` table.", "type": "VARCHAR" } }, "flow_both": { "commission_year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Year of commissioning", "type": "INTEGER" }, "decommissionable": { - "UoM": null, - "constraints": null, "default": false, "description": "Whether the transport asset can be decomission or not.", "type": "BOOLEAN" }, "from_asset": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of the asset. Same as the one in the `asset` table.", "type": "VARCHAR" }, "initial_export_units": { - "UoM": "number", - "constraints": null, "default": 0, "description": "Number of existing units in `from_asset` -> `to_asset` direction", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "number" }, "initial_import_units": { - "UoM": "number", - "constraints": null, "default": 0, "description": "Number of existing units in `to_asset` -> `from_asset` direction", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "number" }, "milestone_year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Year of investment and operation decisions in the optimization.", "type": "INTEGER" }, "to_asset": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of the asset. Same as the one in the `asset` table.", "type": "VARCHAR" } }, "flow_commission": { "commission_year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Year of commissioning", "type": "INTEGER" }, "efficiency": { - "UoM": "ratio", "constraints": { "minimum": 0 }, "default": 1, "description": "Efficiency of transfer in `from_asset` -> `to_asset` direction", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "ratio" }, "fixed_cost": { - "UoM": "CUR/MW/year", - "constraints": null, - "default": null, "description": "Fixed annual cost for the transport asset capacity.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "CUR/MW/year" }, "from_asset": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of the asset. Same as the one in the `asset` table.", "type": "VARCHAR" }, "investment_cost": { - "UoM": "CUR/MW", - "constraints": null, - "default": null, "description": "Investment cost for the transport asset capacity.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "CUR/MW" }, "investment_limit": { - "UoM": "MWh", - "constraints": null, - "default": null, "description": "Maximum capacity for the transport asset investment. If the initial value is null, empty, or missing, it will be no limit.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "MWh" }, "to_asset": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of the asset. Same as the one in the `asset` table.", "type": "VARCHAR" } }, "flow_milestone": { "from_asset": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of the asset. Same as the one in the `asset` table.", "type": "VARCHAR" }, "investable": { - "UoM": null, - "constraints": null, "default": false, "description": "Whether there is an investment variable created for the asset or not.", "type": "BOOLEAN" }, "milestone_year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Year of investment and operation decisions in the optimization.", "type": "INTEGER" }, "to_asset": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of the asset. Same as the one in the `asset` table.", "type": "VARCHAR" }, "variable_cost": { - "UoM": "CUR/MWh", - "constraints": null, "default": 0, "description": "Variable cost for the flow.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "CUR/MWh" } }, "flows_profiles": { "from_asset": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of the asset. Same as the one in the `asset` table.", "type": "VARCHAR" }, "profile_name": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of profile, used to determine data inside the DuckDB table", "type": "VARCHAR" }, "profile_type": { - "UoM": null, "constraints": { - "OneOf": [ + "oneOf": [ "availability" ] }, - "default": null, "description": "Type of profile, used to determine DuckDB table with source profile", "type": "VARCHAR" }, "to_asset": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of the asset. Same as the one in the `asset` table.", "type": "VARCHAR" }, "year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Milestone year.", "type": "INTEGER" @@ -767,30 +609,22 @@ }, "flows_rep_periods_partitions": { "from_asset": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of the asset. Same as the one in the `asset` table.", "type": "VARCHAR" }, "partition": { - "UoM": null, - "constraints": null, - "default": 1, + "default": "1", "description": "Partition or temporal resolution in the representative periods. For example, for a `uniform` specification `1` is hourly, `2` is every two hours.", "type": "VARCHAR" }, "rep_period": { - "UoM": "number", - "constraints": null, - "default": null, "description": "Number of the representative period", - "type": "INTEGER" + "type": "INTEGER", + "unit of measure": "number" }, "specification": { - "UoM": null, "constraints": { - "OneOf": [ + "oneOf": [ "uniform", "explicit", "math" @@ -801,15 +635,10 @@ "type": "VARCHAR" }, "to_asset": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of the asset. Same as the one in the `asset` table.", "type": "VARCHAR" }, "year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Milestone year.", "type": "INTEGER" @@ -817,73 +646,48 @@ }, "group_asset": { "invest_method": { - "UoM": null, - "constraints": null, - "default": null, "description": "true -> activate group constraints; false -> no group investment constraints", "type": "BOOLEAN" }, "max_investment_limit": { - "UoM": null, - "constraints": null, - "default": null, "description": "MW (Missing -> no limit)", "type": "DOUBLE" }, "milestone_year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Year of investment and operation decisions in the optimization.", "type": "INTEGER" }, "min_investment_limit": { - "UoM": null, - "constraints": null, - "default": null, "description": "MW (Missing -> no limit)", "type": "DOUBLE" }, "name": { - "UoM": null, - "constraints": null, - "default": null, "description": "Name of the Group", "type": "VARCHAR" } }, "profiles_rep_periods": { "profile_name": { - "UoM": null, - "constraints": null, - "default": null, "description": "Profile name.", "type": "VARCHAR" }, "rep_period": { - "UoM": null, - "constraints": null, "default": 1, "description": "Representative period number.", "type": "INTEGER" }, "timestep": { - "UoM": null, - "constraints": null, "default": 1, "description": "Timestep number.", "type": "INTEGER" }, "value": { - "UoM": "p.u.", - "constraints": null, - "default": null, "description": "Value of the profile.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "p.u." }, "year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Milestone year.", "type": "INTEGER" @@ -891,29 +695,19 @@ }, "profiles_timeframe": { "period": { - "UoM": null, - "constraints": null, - "default": null, "description": "Period.", "type": "INTEGER" }, "profile_name": { - "UoM": null, - "constraints": null, - "default": null, "description": "Profile name.", "type": "VARCHAR" }, "value": { - "UoM": "p.u.", - "constraints": null, - "default": null, "description": "value of the profile.", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "p.u." }, "year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Milestone year.", "type": "INTEGER" @@ -921,29 +715,23 @@ }, "rep_periods_data": { "num_timesteps": { - "UoM": null, - "constraints": null, "default": 8760, "description": "Number of timesteps", "type": "INTEGER" }, "rep_period": { - "UoM": "number", - "constraints": null, "default": 1, "description": "Representative period number.", - "type": "INTEGER" + "type": "INTEGER", + "unit of measure": "number" }, "resolution": { - "UoM": "hours", - "constraints": null, "default": 1, "description": "Duration of each timestep", - "type": "DOUBLE" + "type": "DOUBLE", + "unit of measure": "hours" }, "year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Milestone year.", "type": "INTEGER" @@ -951,29 +739,21 @@ }, "rep_periods_mapping": { "period": { - "UoM": null, - "constraints": null, "default": 1, "description": "Period number.", "type": "INTEGER" }, "rep_period": { - "UoM": null, - "constraints": null, "default": 1, "description": "Representative period number.", "type": "INTEGER" }, "weight": { - "UoM": null, - "constraints": null, "default": 1, "description": "Hours", "type": "DOUBLE" }, "year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Milestone year.", "type": "INTEGER" @@ -981,22 +761,15 @@ }, "timeframe_data": { "num_timesteps": { - "UoM": null, - "constraints": null, "default": 8760, "description": "Number of timesteps of the representative period.", "type": "INTEGER" }, "period": { - "UoM": null, - "constraints": null, - "default": null, "description": "Period.", "type": "INTEGER" }, "year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Unique identifier (currently, the year itself)", "type": "INTEGER" @@ -1004,22 +777,16 @@ }, "year_data": { "is_milestone": { - "UoM": null, - "constraints": null, "default": true, "description": "Whether the year is a milestone year or a vintage year", "type": "BOOLEAN" }, "length": { - "UoM": null, - "constraints": null, "default": 8760, "description": "How many hours in a year, e.g., 8760", "type": "INTEGER" }, "year": { - "UoM": null, - "constraints": null, "default": 2000, "description": "Unique identifier (currently, the year itself)", "type": "INTEGER" From 50ac53a9feb8e0d795ca0a86fc750842c7cc1da7 Mon Sep 17 00:00:00 2001 From: Diego Alejandro Tejada Arango Date: Tue, 4 Mar 2025 19:48:59 +0100 Subject: [PATCH 10/12] Add comments from code review --- src/input-schemas.jl | 40 ++-------------------------------------- src/input-schemas.json | 31 ++++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 41 deletions(-) diff --git a/src/input-schemas.jl b/src/input-schemas.jl index 9fde58d6..8cfe33ea 100644 --- a/src/input-schemas.jl +++ b/src/input-schemas.jl @@ -3,42 +3,6 @@ schema = JSON.parsefile("src/input-schemas.json"; dicttype = OrderedDict); const schema_per_table_name = OrderedDict( - "asset" => OrderedDict(key => value["type"] for (key, value) in schema["asset"]), - "asset_both" => OrderedDict(key => value["type"] for (key, value) in schema["asset_both"]), - "asset_commission" => - OrderedDict(key => value["type"] for (key, value) in schema["asset_commission"]), - "asset_milestone" => - OrderedDict(key => value["type"] for (key, value) in schema["asset_milestone"]), - "assets_profiles" => - OrderedDict(key => value["type"] for (key, value) in schema["assets_profiles"]), - "assets_rep_periods_partitions" => OrderedDict( - key => value["type"] for (key, value) in schema["assets_rep_periods_partitions"] - ), - "assets_timeframe_partitions" => OrderedDict( - key => value["type"] for (key, value) in schema["assets_timeframe_partitions"] - ), - "assets_timeframe_profiles" => - OrderedDict(key => value["type"] for (key, value) in schema["assets_profiles"]), - "flow" => OrderedDict(key => value["type"] for (key, value) in schema["flow"]), - "flow_both" => OrderedDict(key => value["type"] for (key, value) in schema["flow_both"]), - "flow_commission" => - OrderedDict(key => value["type"] for (key, value) in schema["flow_commission"]), - "flow_milestone" => - OrderedDict(key => value["type"] for (key, value) in schema["flow_milestone"]), - "flows_profiles" => - OrderedDict(key => value["type"] for (key, value) in schema["flows_profiles"]), - "flows_rep_periods_partitions" => OrderedDict( - key => value["type"] for (key, value) in schema["flows_rep_periods_partitions"] - ), - "group_asset" => - OrderedDict(key => value["type"] for (key, value) in schema["group_asset"]), - "profiles_rep_periods" => - OrderedDict(key => value["type"] for (key, value) in schema["profiles_rep_periods"]), - "profiles_timeframe" => - OrderedDict(key => value["type"] for (key, value) in schema["profiles_timeframe"]), - "rep_periods_data" => - OrderedDict(key => value["type"] for (key, value) in schema["rep_periods_data"]), - "rep_periods_mapping" => - OrderedDict(key => value["type"] for (key, value) in schema["rep_periods_mapping"]), - "year_data" => OrderedDict(key => value["type"] for (key, value) in schema["year_data"]), + schema_key => OrderedDict(key => value["type"] for (key, value) in schema_content) for + (schema_key, schema_content) in schema ) diff --git a/src/input-schemas.json b/src/input-schemas.json index c2066d9c..187e73d8 100644 --- a/src/input-schemas.json +++ b/src/input-schemas.json @@ -347,9 +347,7 @@ "demand", "inflows", "max_storage_level", - "min_storage_level", - "max_energy", - "min_energy" + "min_storage_level" ] }, "description": "Type of profile, used to determine DuckDB table with source profile", @@ -417,6 +415,33 @@ "type": "INTEGER" } }, + "assets_timeframe_profiles": { + "asset": { + "description": "Name of the asset. Same as the one in the `asset` table.", + "type": "VARCHAR" + }, + "commission_year": { + "default": 2000, + "description": "Year of commissioning", + "type": "INTEGER" + }, + "profile_name": { + "description": "Name of profile, used to determine data inside the DuckDB table", + "type": "VARCHAR" + }, + "profile_type": { + "constraints": { + "oneOf": [ + "max_storage_level", + "min_storage_level", + "max_energy", + "min_energy" + ] + }, + "description": "Type of profile, used to determine DuckDB table with source profile", + "type": "VARCHAR" + } + }, "flow": { "capacity": { "constraints": { From 43a7866b98e5bf18790aac7e3171add1e1f65410 Mon Sep 17 00:00:00 2001 From: Diego Alejandro Tejada Arango Date: Wed, 5 Mar 2025 09:37:24 +0100 Subject: [PATCH 11/12] Update JSON file with comments from code review --- docs/src/50-schemas.md | 2 +- src/input-schemas.json | 80 +++++++++++++++++++++--------------------- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/docs/src/50-schemas.md b/docs/src/50-schemas.md index a7f5d8e2..ea94e410 100644 --- a/docs/src/50-schemas.md +++ b/docs/src/50-schemas.md @@ -37,7 +37,7 @@ let buffer = IOBuffer() for (field_name, field_info) in fields _description = get(field_info, "description", "No description provided") _type = get(field_info, "type", "Unknown type") - _unit = get(field_info, "unit of measure", "-") + _unit = get(field_info, "unit_of_measure", "-") _default = get(field_info, "default", "No default") _constraints_values = get(field_info, "constraints", nothing) diff --git a/src/input-schemas.json b/src/input-schemas.json index 187e73d8..58df8374 100644 --- a/src/input-schemas.json +++ b/src/input-schemas.json @@ -11,7 +11,7 @@ "default": 0, "description": "Capacity for one unit of the asset (is therefore multiplied by number of existing plus number of invested assets).", "type": "DOUBLE", - "unit of measure": "MW" + "unit_of_measure": "MW" }, "capacity_storage_energy": { "constraints": { @@ -20,7 +20,7 @@ "default": 0, "description": "Capacity of one storage unit.", "type": "DOUBLE", - "unit of measure": "MWh" + "unit_of_measure": "MWh" }, "consumer_balance_sense": { "constraints": { @@ -41,7 +41,7 @@ "default": 0, "description": " e.g. 0.05 is 5 %. discount rate for the annuity calculation.", "type": "DOUBLE", - "unit of measure": "ratio" + "unit_of_measure": "ratio" }, "economic_lifetime": { "constraints": { @@ -50,7 +50,7 @@ "default": 1, "description": "Economic lifetime of the unit for annuity calculation.", "type": "INTEGER", - "unit of measure": "years" + "unit_of_measure": "years" }, "energy_to_power_ratio": { "constraints": { @@ -59,7 +59,7 @@ "default": 0, "description": "Fixed ratio between the energy storage capacity [MWh] and the discharge/charge capacity [MW] for energy storage investments where `storage_method_energy = false`.", "type": "DOUBLE", - "unit of measure": "h" + "unit_of_measure": "h" }, "group": { "description": "Group to which the asset belongs to (null/empty/missing -> no group).", @@ -99,7 +99,7 @@ "default": 0, "description": "Maximum ramping down rate as a portion of the capacity of asset.", "type": "DOUBLE", - "unit of measure": "p.u./h" + "unit_of_measure": "p.u./h" }, "max_ramp_up": { "constraints": { @@ -108,7 +108,7 @@ "default": 0, "description": "Maximum ramping up rate as a portion of the capacity of asset.", "type": "DOUBLE", - "unit of measure": "p.u./h" + "unit_of_measure": "p.u./h" }, "min_operating_point": { "constraints": { @@ -118,7 +118,7 @@ "default": 0, "description": "Minimum operating point or minimum stable generation level defined as a portion of the capacity of asset.", "type": "DOUBLE", - "unit of measure": "p.u." + "unit_of_measure": "p.u." }, "ramping": { "default": false, @@ -137,7 +137,7 @@ "default": 1, "description": "Technical lifetime of the unit to determine for how long the capacity is considered from the commission year.", "type": "INTEGER", - "unit of measure": "years" + "unit_of_measure": "years" }, "type": { "constraints": { @@ -203,13 +203,13 @@ "default": 0, "description": "Number of existing storage units", "type": "DOUBLE", - "unit of measure": "number" + "unit_of_measure": "number" }, "initial_units": { "default": 0, "description": "Number of existing units", "type": "DOUBLE", - "unit of measure": "number" + "unit_of_measure": "number" }, "milestone_year": { "default": 2000, @@ -230,32 +230,32 @@ "fixed_cost": { "description": "Fixed annual cost for the asset capacity.", "type": "DOUBLE", - "unit of measure": "CUR/MW/year" + "unit_of_measure": "CUR/MW/year" }, "fixed_cost_storage_energy": { "description": "Fixed annual cost for the asset storage capacity", "type": "DOUBLE", - "unit of measure": "CUR/MWh/year" + "unit_of_measure": "CUR/MWh/year" }, "investment_cost": { "description": "Investment cost for the asset capacity.", "type": "DOUBLE", - "unit of measure": "CUR/MW" + "unit_of_measure": "CUR/MW" }, "investment_cost_storage_energy": { "description": "Investment cost for the asset energy storage capacity.", "type": "DOUBLE", - "unit of measure": "CUR/MWh" + "unit_of_measure": "CUR/MWh" }, "investment_limit": { "description": "Maximum capacity for the asset investment. If the initial value is null, empty, or missing, it will be no limit.", "type": "DOUBLE", - "unit of measure": "MWh" + "unit_of_measure": "MWh" }, "investment_limit_storage_energy": { "description": "Maximum capacity for the asset storage investment. If the initial value is null, empty, or missing, it will be no limit.", "type": "DOUBLE", - "unit of measure": "MWh" + "unit_of_measure": "MWh" } }, "asset_milestone": { @@ -270,7 +270,7 @@ "default": 0, "description": "The initial storage level at the beginning of the optimization. The final storage level needs to be above this initial value. If the initial value is null, empty, or missing, it will be optimized using a cycling constraint that links the last period to the initial period.", "type": "DOUBLE", - "unit of measure": "MWh" + "unit_of_measure": "MWh" }, "investable": { "default": false, @@ -283,7 +283,7 @@ }, "description": "The maximum amount of energy across the timeframe (e.g., a year) that the asset must produce. If the initial value is null, empty, or missing, it will be no limit.", "type": "DOUBLE", - "unit of measure": "MWh" + "unit_of_measure": "MWh" }, "milestone_year": { "default": 2000, @@ -296,7 +296,7 @@ }, "description": "The minimum amount of energy across the timeframe (e.g., a year) that the asset must produce. If the initial value is null, empty, or missing, it will be no limit.", "type": "DOUBLE", - "unit of measure": "MWh" + "unit_of_measure": "MWh" }, "peak_demand": { "constraints": { @@ -305,7 +305,7 @@ "default": 0, "description": "Value that multiplies the demand profile time series.", "type": "DOUBLE", - "unit of measure": "MW" + "unit_of_measure": "MW" }, "storage_inflows": { "constraints": { @@ -314,7 +314,7 @@ "default": 0, "description": "Value that multiplies the inflow profile time series.", "type": "DOUBLE", - "unit of measure": "MWh/year" + "unit_of_measure": "MWh/year" }, "units_on_cost": { "constraints": { @@ -323,7 +323,7 @@ "default": 0, "description": "Cost of keeping unit online for one hour or the objective function coefficient on `units_on` variable. e.g., no_load cost or idling cost", "type": "DOUBLE", - "unit of measure": "CUR/p.u./h" + "unit_of_measure": "CUR/p.u./h" } }, "assets_profiles": { @@ -367,7 +367,7 @@ "rep_period": { "description": "Number of the representative period", "type": "INTEGER", - "unit of measure": "number" + "unit_of_measure": "number" }, "specification": { "constraints": { @@ -450,7 +450,7 @@ "default": 0, "description": "Capacity for one unit of the transport flow (is therefore multiplied by number of existing plus invested number of transport assets).", "type": "DOUBLE", - "unit of measure": "MW" + "unit_of_measure": "MW" }, "carrier": { "description": "Energy carrier", @@ -463,7 +463,7 @@ "default": 0, "description": " e.g. 0.05 is 5 %. discount rate for the annuity calculation.", "type": "DOUBLE", - "unit of measure": "ratio" + "unit_of_measure": "ratio" }, "economic_lifetime": { "constraints": { @@ -472,7 +472,7 @@ "default": 1, "description": "Economic lifetime of the transport asset for annuity calculation.", "type": "INTEGER", - "unit of measure": "years" + "unit_of_measure": "years" }, "from_asset": { "description": "Name of the asset. Same as the one in the `asset` table.", @@ -495,7 +495,7 @@ "default": 1, "description": "Technical lifetime of the transport asset to determine for how long the capacity is considered from the commission year.", "type": "INTEGER", - "unit of measure": "years" + "unit_of_measure": "years" }, "to_asset": { "description": "Name of the asset. Same as the one in the `asset` table.", @@ -521,13 +521,13 @@ "default": 0, "description": "Number of existing units in `from_asset` -> `to_asset` direction", "type": "DOUBLE", - "unit of measure": "number" + "unit_of_measure": "number" }, "initial_import_units": { "default": 0, "description": "Number of existing units in `to_asset` -> `from_asset` direction", "type": "DOUBLE", - "unit of measure": "number" + "unit_of_measure": "number" }, "milestone_year": { "default": 2000, @@ -552,12 +552,12 @@ "default": 1, "description": "Efficiency of transfer in `from_asset` -> `to_asset` direction", "type": "DOUBLE", - "unit of measure": "ratio" + "unit_of_measure": "ratio" }, "fixed_cost": { "description": "Fixed annual cost for the transport asset capacity.", "type": "DOUBLE", - "unit of measure": "CUR/MW/year" + "unit_of_measure": "CUR/MW/year" }, "from_asset": { "description": "Name of the asset. Same as the one in the `asset` table.", @@ -566,12 +566,12 @@ "investment_cost": { "description": "Investment cost for the transport asset capacity.", "type": "DOUBLE", - "unit of measure": "CUR/MW" + "unit_of_measure": "CUR/MW" }, "investment_limit": { "description": "Maximum capacity for the transport asset investment. If the initial value is null, empty, or missing, it will be no limit.", "type": "DOUBLE", - "unit of measure": "MWh" + "unit_of_measure": "MWh" }, "to_asset": { "description": "Name of the asset. Same as the one in the `asset` table.", @@ -601,7 +601,7 @@ "default": 0, "description": "Variable cost for the flow.", "type": "DOUBLE", - "unit of measure": "CUR/MWh" + "unit_of_measure": "CUR/MWh" } }, "flows_profiles": { @@ -645,7 +645,7 @@ "rep_period": { "description": "Number of the representative period", "type": "INTEGER", - "unit of measure": "number" + "unit_of_measure": "number" }, "specification": { "constraints": { @@ -710,7 +710,7 @@ "value": { "description": "Value of the profile.", "type": "DOUBLE", - "unit of measure": "p.u." + "unit_of_measure": "p.u." }, "year": { "default": 2000, @@ -730,7 +730,7 @@ "value": { "description": "value of the profile.", "type": "DOUBLE", - "unit of measure": "p.u." + "unit_of_measure": "p.u." }, "year": { "default": 2000, @@ -748,13 +748,13 @@ "default": 1, "description": "Representative period number.", "type": "INTEGER", - "unit of measure": "number" + "unit_of_measure": "number" }, "resolution": { "default": 1, "description": "Duration of each timestep", "type": "DOUBLE", - "unit of measure": "hours" + "unit_of_measure": "hours" }, "year": { "default": 2000, From 87cf5ee2b75d73a9153585dc6b9f1fe4b08888aa Mon Sep 17 00:00:00 2001 From: Diego Alejandro Tejada Arango Date: Wed, 5 Mar 2025 11:40:42 +0100 Subject: [PATCH 12/12] Update docs with comments from code review --- docs/src/50-schemas.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/50-schemas.md b/docs/src/50-schemas.md index ea94e410..5039ce70 100644 --- a/docs/src/50-schemas.md +++ b/docs/src/50-schemas.md @@ -22,7 +22,7 @@ PARAMETER_NAME • Description: Lorem ipsum • Type: SQL type of the parameter • Default: a value or "No default" - • Unit of measure: a value or "-" + • Unit of measure: a value or "No unit" • Constraints: a table or "No constraints" """ @@ -37,7 +37,7 @@ let buffer = IOBuffer() for (field_name, field_info) in fields _description = get(field_info, "description", "No description provided") _type = get(field_info, "type", "Unknown type") - _unit = get(field_info, "unit_of_measure", "-") + _unit = get(field_info, "unit_of_measure", "No unit") _default = get(field_info, "default", "No default") _constraints_values = get(field_info, "constraints", nothing)