From f638692e850096b69ae9eed6c5cc1e1aaa164951 Mon Sep 17 00:00:00 2001 From: Tom Bland Date: Tue, 5 Nov 2024 15:45:20 +0000 Subject: [PATCH 1/2] Simplify trade model (not yet working) --- src/muse/agents/factories.py | 2 +- .../data/example/trade/input/Projections.csv | 78 +++++++++---------- src/muse/data/example/trade/settings.toml | 74 ++++++------------ .../data/example/trade/technodata/Agents.csv | 6 +- .../example/trade/technodata/gas/CommIn.csv | 5 +- .../example/trade/technodata/gas/CommOut.csv | 4 +- .../trade/technodata/gas/ExistingTrade.csv | 20 ++--- .../trade/technodata/gas/Technodata.csv | 8 +- .../trade/technodata/gas/TradeTechnodata.csv | 18 +---- .../example/trade/technodata/power/CommIn.csv | 8 +- .../trade/technodata/power/CommOut.csv | 8 +- .../technodata/power/ExistingCapacity.csv | 5 ++ .../trade/technodata/power/ExistingTrade.csv | 32 -------- .../trade/technodata/power/Technodata.csv | 12 +-- .../technodata/power/TradeTechnodata.csv | 21 ----- .../preset/Residential2020Consumption.csv | 26 +++---- .../preset/Residential2030Consumption.csv | 13 ---- .../preset/Residential2050Consumption.csv | 26 +++---- .../trade/technodata/residential/Agents.csv | 5 -- .../trade/technodata/residential/CommIn.csv | 8 +- .../trade/technodata/residential/CommOut.csv | 8 +- .../residential/ExistingCapacity.csv | 10 +-- .../technodata/residential/Technodata.csv | 12 +-- tests/test_readers.py | 2 +- 24 files changed, 151 insertions(+), 260 deletions(-) create mode 100644 src/muse/data/example/trade/technodata/power/ExistingCapacity.csv delete mode 100644 src/muse/data/example/trade/technodata/power/ExistingTrade.csv delete mode 100644 src/muse/data/example/trade/technodata/power/TradeTechnodata.csv delete mode 100644 src/muse/data/example/trade/technodata/preset/Residential2030Consumption.csv delete mode 100644 src/muse/data/example/trade/technodata/residential/Agents.csv diff --git a/src/muse/agents/factories.py b/src/muse/agents/factories.py index f912ecd1e..95ab91fd8 100644 --- a/src/muse/agents/factories.py +++ b/src/muse/agents/factories.py @@ -113,7 +113,7 @@ def create_newcapa_agent( capacity = capacity.sel(region=region) existing = capacity.interp(year=year, method=interpolation) > 0 - assert set(existing.dims) == {"asset"} + # assert set(existing.dims) == {"asset"} years = [capacity.year.min().values, capacity.year.max().values] assets = xr.Dataset() diff --git a/src/muse/data/example/trade/input/Projections.csv b/src/muse/data/example/trade/input/Projections.csv index 72a3c8165..1ca5d8c9d 100644 --- a/src/muse/data/example/trade/input/Projections.csv +++ b/src/muse/data/example/trade/input/Projections.csv @@ -1,40 +1,40 @@ RegionName,Attribute,Time,electricity,gas,heat,CO2f,wind -Unit,-,Year,MUS$2010/PJ,MUS$2010/PJ,MUS$2010/PJ,MUS$2010/kt,MUS$2010/PJ -R1,CommodityPrice,2010,12.61111111,3.8972,0,0,0 -R1,CommodityPrice,2015,13.14814806,4.307,0,0,0 -R1,CommodityPrice,2020,13.98148139,4.7168,0,0,0 -R1,CommodityPrice,2025,16.27777778,5.1266,0,0,0 -R1,CommodityPrice,2030,17.1574075,5.5364,0,0,0 -R1,CommodityPrice,2035,17.50925917,5.9462,0,0,0 -R1,CommodityPrice,2040,18.05555556,6.3559,0,0,0 -R1,CommodityPrice,2045,20.37962972,6.7657,0,0,0 -R1,CommodityPrice,2050,21.5,7.1755,0,0,0 -R1,CommodityPrice,2055,22.12037028,7.1755,0,0,0 -R1,CommodityPrice,2060,22.00925917,7.1755,0,0,0 -R1,CommodityPrice,2065,22.14814806,7.1755,0,0,0 -R1,CommodityPrice,2070,22,7.1755,0,0,0 -R1,CommodityPrice,2075,22.11111111,7.1755,0,0,0 -R1,CommodityPrice,2080,21.92592583,7.1755,0,0,0 -R1,CommodityPrice,2085,21.51851861,7.1755,0,0,0 -R1,CommodityPrice,2090,21.31481472,7.1755,0,0,0 -R1,CommodityPrice,2095,21.03703694,7.1755,0,0,0 -R1,CommodityPrice,2100,20.46296306,7.1755,0,0,0 -R2,CommodityPrice,2010,17.33333333,3.8972,0,0,0 -R2,CommodityPrice,2015,15.66666667,4.307,0,0,0 -R2,CommodityPrice,2020,19.13888889,4.7168,0,0,0 -R2,CommodityPrice,2025,22.86111111,5.1266,0,0,0 -R2,CommodityPrice,2030,24.08333333,5.5364,0,0,0 -R2,CommodityPrice,2035,20.63888889,5.9462,0,0,0 -R2,CommodityPrice,2040,21.32407417,6.3559,0,0,0 -R2,CommodityPrice,2045,20.38888889,6.7657,0,0,0 -R2,CommodityPrice,2050,19.37037028,7.1755,0,0,0 -R2,CommodityPrice,2055,19.13888889,7.1755,0,0,0 -R2,CommodityPrice,2060,21.0925925,7.1755,0,0,0 -R2,CommodityPrice,2065,22.89814806,7.1755,0,0,0 -R2,CommodityPrice,2070,22.94444444,7.1755,0,0,0 -R2,CommodityPrice,2075,21.60185194,7.1755,0,0,0 -R2,CommodityPrice,2080,21.93518528,7.1755,0,0,0 -R2,CommodityPrice,2085,21.87962972,7.1755,0,0,0 -R2,CommodityPrice,2090,22.06481472,7.1755,0,0,0 -R2,CommodityPrice,2095,23.08333333,7.1755,0,0,0 -R2,CommodityPrice,2100,23.82407417,7.1755,0,0,0 +Unit,-,Year,MUS$2010/PJ,MUS$2010/PJ,MUS$2010/PJ,MUS$2010/kt,MUS$2010/kt +R1,CommodityPrice,2010,14.81481472,6.6759,100,0,0 +R1,CommodityPrice,2015,17.89814806,6.914325,100,0.052913851,0 +R1,CommodityPrice,2020,19.5,7.15275,100,0.08314119,0 +R1,CommodityPrice,2025,21.93518528,8.10645,100,0.120069795,0 +R1,CommodityPrice,2030,26.50925917,9.06015,100,0.156998399,0 +R1,CommodityPrice,2035,26.51851861,9.2191,100,0.214877567,0 +R1,CommodityPrice,2040,23.85185194,9.37805,100,0.272756734,0 +R1,CommodityPrice,2045,23.97222222,9.193829337,100,0.35394801,0 +R1,CommodityPrice,2050,24.06481472,9.009608674,100,0.435139285,0 +R1,CommodityPrice,2055,25.3425925,8.832625604,100,0.542365578,0 +R1,CommodityPrice,2060,25.53703694,8.655642534,100,0.649591871,0 +R1,CommodityPrice,2065,25.32407417,8.485612708,100,0.780892624,0 +R1,CommodityPrice,2070,23.36111111,8.315582883,100,0.912193378,0 +R1,CommodityPrice,2075,22.27777778,8.152233126,100,1.078321687,0 +R1,CommodityPrice,2080,22.25925917,7.988883368,100,1.244449995,0 +R1,CommodityPrice,2085,22.17592583,7.831951236,100,1.4253503,0 +R1,CommodityPrice,2090,22.03703694,7.675019103,100,1.606250604,0 +R1,CommodityPrice,2095,21.94444444,7.524252461,100,1.73877515,0 +R1,CommodityPrice,2100,21.39814806,7.373485819,100,1.871299697,0 +R2,CommodityPrice,2010,14.81481472,6.6759,100,0,0 +R2,CommodityPrice,2015,17.89814806,6.914325,100,0.052913851,0 +R2,CommodityPrice,2020,19.5,7.15275,100,0.08314119,0 +R2,CommodityPrice,2025,21.93518528,8.10645,100,0.120069795,0 +R2,CommodityPrice,2030,26.50925917,9.06015,100,0.156998399,0 +R2,CommodityPrice,2035,26.51851861,9.2191,100,0.214877567,0 +R2,CommodityPrice,2040,23.85185194,9.37805,100,0.272756734,0 +R2,CommodityPrice,2045,23.97222222,9.193829337,100,0.35394801,0 +R2,CommodityPrice,2050,24.06481472,9.009608674,100,0.435139285,0 +R2,CommodityPrice,2055,25.3425925,8.832625604,100,0.542365578,0 +R2,CommodityPrice,2060,25.53703694,8.655642534,100,0.649591871,0 +R2,CommodityPrice,2065,25.32407417,8.485612708,100,0.780892624,0 +R2,CommodityPrice,2070,23.36111111,8.315582883,100,0.912193378,0 +R2,CommodityPrice,2075,22.27777778,8.152233126,100,1.078321687,0 +R2,CommodityPrice,2080,22.25925917,7.988883368,100,1.244449995,0 +R2,CommodityPrice,2085,22.17592583,7.831951236,100,1.4253503,0 +R2,CommodityPrice,2090,22.03703694,7.675019103,100,1.606250604,0 +R2,CommodityPrice,2095,21.94444444,7.524252461,100,1.73877515,0 +R2,CommodityPrice,2100,21.39814806,7.373485819,100,1.871299697,0 diff --git a/src/muse/data/example/trade/settings.toml b/src/muse/data/example/trade/settings.toml index a851e6a96..d5c0621be 100644 --- a/src/muse/data/example/trade/settings.toml +++ b/src/muse/data/example/trade/settings.toml @@ -1,6 +1,6 @@ # Global settings - most REQUIRED -time_framework = [2020, 2025, 2030, 2035] +time_framework = [2020, 2025, 2030, 2035, 2040, 2045, 2050] foresight = 5 # Has to be a multiple of the minimum separation between the years in time framework regions = ["R1", "R2"] interest_rate = 0.1 @@ -30,25 +30,18 @@ budget = [] projections = '{path}/input/Projections.csv' global_commodities = '{path}/input/GlobalCommodities.csv' -[sectors.presets] -type = 'presets' -priority = 0 -consumption_path = "{path}/technodata/preset/*Consumption.csv" - [sectors.residential] type = 'default' priority = 1 dispatch_production = 'share' - -[sectors.residential.technodata] technodata = '{path}/technodata/residential/Technodata.csv' commodities_in = '{path}/technodata/residential/CommIn.csv' commodities_out = '{path}/technodata/residential/CommOut.csv' -[sectors.residential.subsectors.retro_and_new] -agents = '{path}/technodata/residential/Agents.csv' +[sectors.residential.subsectors.all] +agents = '{path}/technodata/Agents.csv' existing_capacity = '{path}/technodata/residential/ExistingCapacity.csv' -lpsolver = "scipy" +lpsolver = "scipy" # Optional, defaults to "adhoc" constraints = [ # Optional, defaults to the constraints below "max_production", @@ -58,41 +51,22 @@ constraints = [ "minimum_service", "demand_limiting_capacity" ] -demand_share = "new_and_retro" -forecast = 5 -asset_threshold = 1e-4 - -[[sectors.residential.interactions]] -net = 'new_to_retro' -interaction = 'transfer' +demand_share = "standard_demand" # Optional, default to standard_demand +forecast = 5 # Optional, defaults to 5 [sectors.power] type = 'default' priority = 2 dispatch_production = 'share' - -[sectors.power.technodata] technodata = '{path}/technodata/power/Technodata.csv' -trade = '{path}/technodata/power/TradeTechnodata.csv' commodities_in = '{path}/technodata/power/CommIn.csv' commodities_out = '{path}/technodata/power/CommOut.csv' -[sectors.power.subsectors.trade] +[sectors.power.subsectors.all] agents = '{path}/technodata/Agents.csv' -existing_capacity = '{path}/technodata/power/ExistingTrade.csv' +existing_capacity = '{path}/technodata/power/ExistingCapacity.csv' lpsolver = "scipy" -constraints = [ - # Optional, defaults to the constraints below - "max_production", - "max_capacity_expansion", - "demand", - "search_space", - "minimum_service", - "demand_limiting_capacity" -] -demand_share = "unmet_forecasted_demand" -forecast = 5 -asset_threshold = 1e-4 +demand_share = "standard_demand" [sectors.gas] type = 'default' @@ -109,24 +83,20 @@ commodities_out = '{path}/technodata/gas/CommOut.csv' agents = '{path}/technodata/Agents.csv' existing_capacity = '{path}/technodata/gas/ExistingTrade.csv' lpsolver = "scipy" -constraints = [ - # Optional, defaults to the constraints below - "max_production", - "max_capacity_expansion", - "demand", - "search_space", - "minimum_service", - "demand_limiting_capacity" -] demand_share = "unmet_forecasted_demand" -forecast = 5 -asset_threshold = 1e-4 + +[sectors.residential_presets] +type = 'presets' +priority = 0 +consumption_path = "{path}/technodata/preset/*Consumption.csv" [timeslices] level_names = ["month", "day", "hour"] -all-year.all-week.night = 1460 -all-year.all-week.morning = 1460 -all-year.all-week.afternoon = 1460 -all-year.all-week.early-peak = 1460 -all-year.all-week.late-peak = 1460 -all-year.all-week.evening = 1460 + +[timeslices.all-year.all-week] +night = 1460 +morning = 1460 +afternoon = 1460 +early-peak = 1460 +late-peak = 1460 +evening = 1460 diff --git a/src/muse/data/example/trade/technodata/Agents.csv b/src/muse/data/example/trade/technodata/Agents.csv index 42fd21d17..c5f87c36e 100644 --- a/src/muse/data/example/trade/technodata/Agents.csv +++ b/src/muse/data/example/trade/technodata/Agents.csv @@ -1,3 +1,3 @@ -AgentShare,Name,RegionName,Objective,ObjData,Objsort,SearchRule,DecisionMethod,MaturityThreshold,SpendLimit,Type -agent_share,A1,R1,ALCOE,1,TRUE,from_assets->compress->reduce_assets,singleObj,-1,inf,default -agent_share,A1,R2,ALCOE,1,TRUE,from_assets->compress->reduce_assets,singleObj,-1,inf,default +AgentShare,Name,RegionName,Objective1,Objective2,Objective3,ObjData1,ObjData2,ObjData3,Objsort1,Objsort2,Objsort3,SearchRule,DecisionMethod,Quantity,MaturityThreshold,SpendLimit,Type +Agent1,A1,R1,LCOE,,,1,,,True,,,all,singleObj,1,-1,inf,New +Agent1,A1,R2,LCOE,,,1,,,True,,,all,singleObj,1,-1,inf,New diff --git a/src/muse/data/example/trade/technodata/gas/CommIn.csv b/src/muse/data/example/trade/technodata/gas/CommIn.csv index 6550aed24..0e85ade1f 100644 --- a/src/muse/data/example/trade/technodata/gas/CommIn.csv +++ b/src/muse/data/example/trade/technodata/gas/CommIn.csv @@ -1,5 +1,4 @@ ProcessName,RegionName,Time,Level,electricity,gas,heat,CO2f,wind Unit,-,Year,-,PJ/PJ,PJ/PJ,PJ/PJ,kt/PJ,PJ/PJ -gassupply1,R1,2010,fixed,0,1,0,0,0 -gassupply1,R2,2010,fixed,0,1,0,0,0 -gassupply1,R3,2010,fixed,0,1,0,0,0 +gassupply1,R1,2020,fixed,0,0,0,0,0 +gassupply1,R2,2020,fixed,0,0,0,0,0 diff --git a/src/muse/data/example/trade/technodata/gas/CommOut.csv b/src/muse/data/example/trade/technodata/gas/CommOut.csv index 2458e775d..f0eb38ea4 100644 --- a/src/muse/data/example/trade/technodata/gas/CommOut.csv +++ b/src/muse/data/example/trade/technodata/gas/CommOut.csv @@ -1,4 +1,4 @@ ProcessName,RegionName,Time,electricity,gas,heat,CO2f,wind Unit,-,Year,PJ/PJ,PJ/PJ,PJ/PJ,kt/PJ,PJ/PJ -gassupply1,R1,2010,0,1,0,0,0 -gassupply1,R2,2010,0,1,0,0,0 +gassupply1,R1,2020,0,1,0,0,0 +gassupply1,R2,2020,0,1,0,0,0 diff --git a/src/muse/data/example/trade/technodata/gas/ExistingTrade.csv b/src/muse/data/example/trade/technodata/gas/ExistingTrade.csv index fb3ffb9e7..9c2e4c35b 100644 --- a/src/muse/data/example/trade/technodata/gas/ExistingTrade.csv +++ b/src/muse/data/example/trade/technodata/gas/ExistingTrade.csv @@ -1,12 +1,12 @@ ProcessName,RegionName,Time,R1,R2 Unit,-,Year,PJ/y,PJ/y -gassupply1,R1,2010,3000,0 -gassupply1,R1,2020,3000,0 -gassupply1,R1,2030,2100,0 -gassupply1,R1,2040,1470,0 -gassupply1,R1,2050,1029,0 -gassupply1,R2,2010,0,1200 -gassupply1,R2,2020,0,1200 -gassupply1,R2,2030,0,700 -gassupply1,R2,2040,0,490 -gassupply1,R2,2050,0,343 +gassupply1,R1,2010,15,0 +gassupply1,R1,2020,15,0 +gassupply1,R1,2030,7.5,0 +gassupply1,R1,2040,0,0 +gassupply1,R1,2050,0,0 +gassupply1,R2,2010,0,15 +gassupply1,R2,2020,0,15 +gassupply1,R2,2030,0,0.75 +gassupply1,R2,2040,0,0 +gassupply1,R2,2050,0,0 diff --git a/src/muse/data/example/trade/technodata/gas/Technodata.csv b/src/muse/data/example/trade/technodata/gas/Technodata.csv index b418fd53e..91d976b70 100644 --- a/src/muse/data/example/trade/technodata/gas/Technodata.csv +++ b/src/muse/data/example/trade/technodata/gas/Technodata.csv @@ -1,4 +1,4 @@ -ProcessName,RegionName,Time,var_par,var_exp,TechnicalLife,UtilizationFactor,ScalingSize,efficiency,InterestRate,Type,Fuel,EndUse,AgentShare -Unit,-,Year,MUS$2010/PJ,-,Years,-,PJ,%,-,-,-,-,- -gassupply1,R1,2010,3,1,10,0.9,0.00000189,86,0.1,energy,gas,gas,1 -gassupply1,R2,2010,3,1,10,0.9,0.00000189,86,0.1,energy,gas,gas,1 +ProcessName,RegionName,Time,cap_par,cap_exp,fix_par,fix_exp,var_exp,MaxCapacityAddition,MaxCapacityGrowth,TotalCapacityLimit,TechnicalLife,UtilizationFactor,ScalingSize,efficiency,InterestRate,Type,Fuel,EndUse,Agent1 +Unit,-,Year,MUS$2010/PJ_a,-,MUS$2010/PJ,-,-,PJ,%,PJ,Years,-,PJ,%,-,-,-,-,New +gassupply1,R1,2020,0,1,0,1,1,10,1,100,35,0.9,0.00000189,86,0.1,energy,gas,gas,1 +gassupply1,R2,2020,0,1,0,1,1,10,1,100,35,0.9,0.00000189,86,0.1,energy,gas,gas,1 diff --git a/src/muse/data/example/trade/technodata/gas/TradeTechnodata.csv b/src/muse/data/example/trade/technodata/gas/TradeTechnodata.csv index 9a940ae5c..300dc555d 100644 --- a/src/muse/data/example/trade/technodata/gas/TradeTechnodata.csv +++ b/src/muse/data/example/trade/technodata/gas/TradeTechnodata.csv @@ -1,15 +1,3 @@ -ProcessName,RegionName,Parameter,Unit,R1,R2,R3 -gassupply1,R1,cap_par,MUSD/PJ,3,98.013,25 -gassupply1,R2,cap_par,MUSD/PJ,7.8406,5,7.8406 -gassupply1,R1,cap_exp,MUSD/PJ,1,1,1 -gassupply1,R2,cap_exp,MUSD/PJ,1,1,1 -gassupply1,R1,fix_par,MUSD/PJ,0.3,0.98013,0.90612 -gassupply1,R2,fix_par,MUSD/PJ,0.78406,0.5,0.17434 -gassupply1,R1,fix_exp,MUSD/PJ,1,1,1 -gassupply1,R2,fix_exp,MUSD/PJ,1,1,1 -gassupply1,R1,MaxCapacityAddition,PJ/y,200,0,0.1 -gassupply1,R2,MaxCapacityAddition,PJ/y,0,200,0 -gassupply1,R1,MaxCapacityGrowth,PJ/y,1,0,0.002 -gassupply1,R2,MaxCapacityGrowth,PJ/y,0,1,0 -gassupply1,R1,TotalCapacityLimit,PJ/y,3937.219,0,1 -gassupply1,R2,TotalCapacityLimit,PJ/y,0,3937.219,0 +ProcessName,RegionName,Parameter,Unit,R1,R2 +gassupply1,R1,var_par,MUSD/PJ,2.55,2.55 +gassupply1,R2,var_par,MUSD/PJ,2.55,2.55 diff --git a/src/muse/data/example/trade/technodata/power/CommIn.csv b/src/muse/data/example/trade/technodata/power/CommIn.csv index e4095d85b..f910382d9 100644 --- a/src/muse/data/example/trade/technodata/power/CommIn.csv +++ b/src/muse/data/example/trade/technodata/power/CommIn.csv @@ -1,6 +1,6 @@ ProcessName,RegionName,Time,Level,electricity,gas,heat,CO2f,wind Unit,-,Year,-,PJ/PJ,PJ/PJ,PJ/PJ,kt/PJ,PJ/PJ -gasCCGT,R1,2010,fixed,0,1.67,0,0,0 -windturbine,R1,2010,fixed,0,0,0,0,1 -gasCCGT,R2,2010,fixed,0,2,0,0,0 -windturbine,R2,2010,fixed,0,0,0,0,1 +gasCCGT,R1,2020,fixed,0,1.67,0,0,0 +windturbine,R1,2020,fixed,0,0,0,0,1 +gasCCGT,R2,2020,fixed,0,1.67,0,0,0 +windturbine,R2,2020,fixed,0,0,0,0,1 diff --git a/src/muse/data/example/trade/technodata/power/CommOut.csv b/src/muse/data/example/trade/technodata/power/CommOut.csv index cfebcd832..a9d0ed4cc 100644 --- a/src/muse/data/example/trade/technodata/power/CommOut.csv +++ b/src/muse/data/example/trade/technodata/power/CommOut.csv @@ -1,6 +1,6 @@ ProcessName,RegionName,Time,electricity,gas,heat,CO2f,wind Unit,-,Year,PJ/PJ,PJ/PJ,PJ/PJ,kt/PJ,PJ/PJ -gasCCGT,R1,2010,1,0,0,91.66666667,0 -windturbine,R1,2010,1,0,0,0,0 -gasCCGT,R2,2010,1,0,0,91.66666667,0 -windturbine,R2,2010,1,0,0,0,0 +gasCCGT,R1,2020,1,0,0,91.67,0 +windturbine,R1,2020,1,0,0,0,0 +gasCCGT,R2,2020,1,0,0,91.67,0 +windturbine,R2,2020,1,0,0,0,0 diff --git a/src/muse/data/example/trade/technodata/power/ExistingCapacity.csv b/src/muse/data/example/trade/technodata/power/ExistingCapacity.csv new file mode 100644 index 000000000..847f4e949 --- /dev/null +++ b/src/muse/data/example/trade/technodata/power/ExistingCapacity.csv @@ -0,0 +1,5 @@ +ProcessName,RegionName,Unit,2020,2025,2030,2035,2040,2045,2050 +gasCCGT,R1,PJ/y,1,1,0,0,0,0,0 +windturbine,R1,PJ/y,0,0,0,0,0,0,0 +gasCCGT,R2,PJ/y,1,1,0,0,0,0,0 +windturbine,R2,PJ/y,0,0,0,0,0,0,0 diff --git a/src/muse/data/example/trade/technodata/power/ExistingTrade.csv b/src/muse/data/example/trade/technodata/power/ExistingTrade.csv deleted file mode 100644 index c699d5928..000000000 --- a/src/muse/data/example/trade/technodata/power/ExistingTrade.csv +++ /dev/null @@ -1,32 +0,0 @@ -ProcessName,RegionName,Time,R1,R2 -Unit,-,Year,PJ/y,PJ/y -gasCCGT,R1,2010,300,0 -gasCCGT,R1,2020,240,0 -gasCCGT,R2,2010,0,200 -gasCCGT,R2,2020,0,200 -gasCCGT,R1,2025,192,0 -gasCCGT,R2,2025,0,140 -gasCCGT,R1,2030,153.6,0 -gasCCGT,R2,2030,0,98 -gasCCGT,R1,2035,122.88,0 -gasCCGT,R2,2035,0,68.6 -gasCCGT,R1,2040,98.304,0 -gasCCGT,R2,2040,0,48.02 -gasCCGT,R1,2045,78.6432,0 -gasCCGT,R2,2045,0,33.614 -gasCCGT,R1,2050,62.91456,0 -gasCCGT,R2,2050,0,23.5298 -windturbine,R1,2020,0,0 -windturbine,R2,2020,0,0 -windturbine,R1,2025,0,0 -windturbine,R2,2025,0,0 -windturbine,R1,2030,0,0 -windturbine,R2,2030,0,0 -windturbine,R1,2035,0,0 -windturbine,R2,2035,0,0 -windturbine,R1,2040,0,0 -windturbine,R2,2040,0,0 -windturbine,R1,2045,0,0 -windturbine,R2,2045,0,0 -windturbine,R1,2050,0,0 -windturbine,R2,2050,0,0 diff --git a/src/muse/data/example/trade/technodata/power/Technodata.csv b/src/muse/data/example/trade/technodata/power/Technodata.csv index 61e971df9..d7bbf2e9a 100644 --- a/src/muse/data/example/trade/technodata/power/Technodata.csv +++ b/src/muse/data/example/trade/technodata/power/Technodata.csv @@ -1,6 +1,6 @@ -ProcessName,RegionName,Time,cap_exp,fix_exp,var_par,var_exp,TechnicalLife,UtilizationFactor,ScalingSize,efficiency,InterestRate,Type,Fuel,EndUse,AgentShare -Unit,-,Year,-,-,MUS$2010/PJ,-,Years,-,PJ,%,-,-,-,-, -gasCCGT,R1,2010,1,1,0,1,35,0.9,0.00000189,86,0.1,energy,gas,electricity,1 -windturbine,R1,2010,1,1,0,1,25,0.4,0.00000189,86,0.1,energy,wind,electricity,1 -gasCCGT,R2,2010,1,1,0,1,35,0.9,0.00000189,86,0.1,energy,gas,electricity,1 -windturbine,R2,2010,1,1,0,1,25,0.4,0.00000189,86,0.1,energy,wind,electricity,1 +ProcessName,RegionName,Time,cap_par,cap_exp,fix_par,fix_exp,var_par,var_exp,MaxCapacityAddition,MaxCapacityGrowth,TotalCapacityLimit,TechnicalLife,UtilizationFactor,ScalingSize,efficiency,InterestRate,Type,Fuel,EndUse,Agent1 +Unit,-,Year,MUS$2010/PJ_a,-,MUS$2010/PJ,-,MUS$2010/PJ,-,PJ,%,PJ,Years,-,PJ,%,-,-,-,-,New +gasCCGT,R1,2020,23.78234399,1,0,1,0,1,10,1,100,35,0.9,0.00000189,86,0.1,energy,gas,electricity,1 +windturbine,R1,2020,36.30771182,1,0,1,0,1,10,1,100,25,0.4,0.00000189,86,0.1,energy,wind,electricity,1 +gasCCGT,R2,2020,23.78234399,1,0,1,0,1,10,1,100,35,0.9,0.00000189,86,0.1,energy,gas,electricity,1 +windturbine,R2,2020,36.30771182,1,0,1,0,1,10,1,100,25,0.4,0.00000189,86,0.1,energy,wind,electricity,1 diff --git a/src/muse/data/example/trade/technodata/power/TradeTechnodata.csv b/src/muse/data/example/trade/technodata/power/TradeTechnodata.csv deleted file mode 100644 index f5af71ccd..000000000 --- a/src/muse/data/example/trade/technodata/power/TradeTechnodata.csv +++ /dev/null @@ -1,21 +0,0 @@ -ProcessName,RegionName,Parameter,Unit,R1,R2 -gasCCGT,R1,cap_par,MUSD/PJ,28.29,56.58 -windturbine,R1,cap_par,MUSD/PJ,43.2,0 -gasCCGT,R2,cap_par,MUSD/PJ,57.08,28.54 -windturbine,R2,cap_par,MUSD/PJ,0,43.57 -gasCCGT,R1,fix_par,MUSD/PJ,2.829,5.658 -windturbine,R1,fix_par,MUSD/PJ,0,0 -gasCCGT,R2,fix_par,MUSD/PJ,5.708,2.854 -windturbine,R2,fix_par,MUSD/PJ,0,0 -gasCCGT,R1,MaxCapacityAddition,PJ/y,393.72188,0 -windturbine,R1,MaxCapacityAddition,PJ/y,393.72188,0 -gasCCGT,R2,MaxCapacityAddition,PJ/y,0,393.72188 -windturbine,R2,MaxCapacityAddition,PJ/y,0,393.72188 -gasCCGT,R1,MaxCapacityGrowth,PJ/y,0.05,0.05 -windturbine,R1,MaxCapacityGrowth,PJ/y,0.05,0 -gasCCGT,R2,MaxCapacityGrowth,PJ/y,0.05,0.05 -windturbine,R2,MaxCapacityGrowth,PJ/y,0,0.05 -gasCCGT,R1,TotalCapacityLimit,PJ/y,3937.2188,0 -windturbine,R1,TotalCapacityLimit,PJ/y,3937.2188,0 -gasCCGT,R2,TotalCapacityLimit,PJ/y,0,3937.2188 -windturbine,R2,TotalCapacityLimit,PJ/y,0,3937.2188 diff --git a/src/muse/data/example/trade/technodata/preset/Residential2020Consumption.csv b/src/muse/data/example/trade/technodata/preset/Residential2020Consumption.csv index cab86f138..0b3394c3b 100644 --- a/src/muse/data/example/trade/technodata/preset/Residential2020Consumption.csv +++ b/src/muse/data/example/trade/technodata/preset/Residential2020Consumption.csv @@ -1,13 +1,13 @@ -RegionName,Timeslice,electricity,gas,CO2f,wind,heat -R1,1,0,0,0,0,73 -R1,2,0,0,0,0,103.2 -R1,3,0,0,0,0,77.4 -R1,4,0,0,0,0,77.4 -R1,5,0,0,0,0,111.8 -R1,6,0,0,0,0,77.2 -R2,1,0,0,0,0,2 -R2,2,0,0,0,0,2.2 -R2,3,0,0,0,0,1.8 -R2,4,0,0,0,0,1.8 -R2,5,0,0,0,0,2.3 -R2,6,0,0,0,0,1.8 +RegionName,Timeslice,electricity,gas,heat,CO2f,wind +R1,1,0,0,1.0,0,0 +R1,2,0,0,1.5,0,0 +R1,3,0,0,1.0,0,0 +R1,4,0,0,1.5,0,0 +R1,5,0,0,3.0,0,0 +R1,6,0,0,2.0,0,0 +R2,1,0,0,1.0,0,0 +R2,2,0,0,1.5,0,0 +R2,3,0,0,1.0,0,0 +R2,4,0,0,1.5,0,0 +R2,5,0,0,3.0,0,0 +R2,6,0,0,2.0,0,0 diff --git a/src/muse/data/example/trade/technodata/preset/Residential2030Consumption.csv b/src/muse/data/example/trade/technodata/preset/Residential2030Consumption.csv deleted file mode 100644 index b77f0f46b..000000000 --- a/src/muse/data/example/trade/technodata/preset/Residential2030Consumption.csv +++ /dev/null @@ -1,13 +0,0 @@ -RegionName,Timeslice,electricity,gas,CO2f,wind,heat -R1,1,0,0,0,0,87.6 -R1,2,0,0,0,0,123.84 -R1,3,0,0,0,0,92.88 -R1,4,0,0,0,0,92.88 -R1,5,0,0,0,0,134.16 -R1,6,0,0,0,0,92.64 -R2,1,0,0,0,0,2.4 -R2,2,0,0,0,0,2.64 -R2,3,0,0,0,0,2.16 -R2,4,0,0,0,0,2.16 -R2,5,0,0,0,0,2.76 -R2,6,0,0,0,0,2.16 diff --git a/src/muse/data/example/trade/technodata/preset/Residential2050Consumption.csv b/src/muse/data/example/trade/technodata/preset/Residential2050Consumption.csv index 9341b4292..b25b175a5 100644 --- a/src/muse/data/example/trade/technodata/preset/Residential2050Consumption.csv +++ b/src/muse/data/example/trade/technodata/preset/Residential2050Consumption.csv @@ -1,13 +1,13 @@ -RegionName,Timeslice,electricity,gas,CO2f,wind,heat -R1,1,0,0,0,0,94.9 -R1,2,0,0,0,0,134.16 -R1,3,0,0,0,0,100.62 -R1,4,0,0,0,0,100.62 -R1,5,0,0,0,0,145.34 -R1,6,0,0,0,0,100.36 -R2,1,0,0,0,0,2.6 -R2,2,0,0,0,0,2.86 -R2,3,0,0,0,0,2.34 -R2,4,0,0,0,0,2.34 -R2,5,0,0,0,0,2.99 -R2,6,0,0,0,0,2.34 +RegionName,Timeslice,electricity,gas,heat,CO2f,wind +R1,1,0,0,3.0,0,0 +R1,2,0,0,4.5,0,0 +R1,3,0,0,3.0,0,0 +R1,4,0,0,4.5,0,0 +R1,5,0,0,9.0,0,0 +R1,6,0,0,6.0,0,0 +R2,1,0,0,3.0,0,0 +R2,2,0,0,4.5,0,0 +R2,3,0,0,3.0,0,0 +R2,4,0,0,4.5,0,0 +R2,5,0,0,9.0,0,0 +R2,6,0,0,6.0,0,0 diff --git a/src/muse/data/example/trade/technodata/residential/Agents.csv b/src/muse/data/example/trade/technodata/residential/Agents.csv deleted file mode 100644 index 520b667ae..000000000 --- a/src/muse/data/example/trade/technodata/residential/Agents.csv +++ /dev/null @@ -1,5 +0,0 @@ -AgentShare,Name,RegionName,Objective1,Objective2,Objective3,ObjData1,ObjData2,ObjData3,Objsort1,Objsort2,Objsort3,SearchRule,DecisionMethod,Quantity,MaturityThreshold,Budget,Type -agent_share_1,A1,R1,LCOE,,,1,,,TRUE,,,all,singleObj,1,-1,inf,New -agent_share_2,A1,R1,LCOE,,,1,,,TRUE,,,all,singleObj,1,-1,inf,Retrofit -agent_share_1,A1,R2,LCOE,,,1,,,TRUE,,,all,singleObj,1,-1,inf,New -agent_share_2,A1,R2,LCOE,,,1,,,TRUE,,,all,singleObj,1,-1,inf,Retrofit diff --git a/src/muse/data/example/trade/technodata/residential/CommIn.csv b/src/muse/data/example/trade/technodata/residential/CommIn.csv index 67f0e4fde..d55fd41fa 100644 --- a/src/muse/data/example/trade/technodata/residential/CommIn.csv +++ b/src/muse/data/example/trade/technodata/residential/CommIn.csv @@ -1,6 +1,6 @@ ProcessName,RegionName,Time,Level,electricity,gas,heat,CO2f,wind Unit,-,Year,-,PJ/PJ,PJ/PJ,PJ/PJ,kt/PJ,PJ/PJ -gasboiler,R1,2010,fixed,0,1.162790698,0,0,0 -heatpump,R1,2010,fixed,0.4,0,0,0,0 -gasboiler,R2,2010,fixed,0,1.395348838,0,0,0 -heatpump,R2,2010,fixed,0.48,0,0,0,0 +gasboiler,R1,2020,fixed,0,1.16,0,0,0 +heatpump,R1,2020,fixed,0.4,0,0,0,0 +gasboiler,R2,2020,fixed,0,1.16,0,0,0 +heatpump,R2,2020,fixed,0.4,0,0,0,0 diff --git a/src/muse/data/example/trade/technodata/residential/CommOut.csv b/src/muse/data/example/trade/technodata/residential/CommOut.csv index 93c208776..3d3f71984 100644 --- a/src/muse/data/example/trade/technodata/residential/CommOut.csv +++ b/src/muse/data/example/trade/technodata/residential/CommOut.csv @@ -1,6 +1,6 @@ ProcessName,RegionName,Time,electricity,gas,heat,CO2f,wind Unit,-,Year,PJ/PJ,PJ/PJ,PJ/PJ,kt/PJ,PJ/PJ -gasboiler,R1,2010,0,0,1,64.70588235,0 -heatpump,R1,2010,0,0,1,0,0 -gasboiler,R2,2010,0,0,1,77.64705882,0 -heatpump,R2,2010,0,0,1,0,0 +gasboiler,R1,2020,0,0,1,64.71,0 +heatpump,R1,2020,0,0,1,0,0 +gasboiler,R2,2020,0,0,1,64.71,0 +heatpump,R2,2020,0,0,1,0,0 diff --git a/src/muse/data/example/trade/technodata/residential/ExistingCapacity.csv b/src/muse/data/example/trade/technodata/residential/ExistingCapacity.csv index 8fc854a9c..90cd566a4 100644 --- a/src/muse/data/example/trade/technodata/residential/ExistingCapacity.csv +++ b/src/muse/data/example/trade/technodata/residential/ExistingCapacity.csv @@ -1,5 +1,5 @@ -ProcessName,RegionName,Unit,2010,2020,2030,2040,2050 -gasboiler,R1,PJ/y,946.8,662.76,463.932,324.7524,227.32668 -heatpump,R1,PJ/y,0,0,0,0,0 -gasboiler,R2,PJ/y,50,35,24.5,17.15,12.005 -heatpump,R2,PJ/y,0,0,0,0,0 +ProcessName,RegionName,Unit,2020,2025,2030,2035,2040,2045,2050 +gasboiler,R1,PJ/y,10,5,0,0,0,0,0 +heatpump,R1,PJ/y,0,0,0,0,0,0,0 +gasboiler,R2,PJ/y,10,5,0,0,0,0,0 +heatpump,R2,PJ/y,0,0,0,0,0,0,0 diff --git a/src/muse/data/example/trade/technodata/residential/Technodata.csv b/src/muse/data/example/trade/technodata/residential/Technodata.csv index 9dc35cdc7..e447a93ed 100644 --- a/src/muse/data/example/trade/technodata/residential/Technodata.csv +++ b/src/muse/data/example/trade/technodata/residential/Technodata.csv @@ -1,6 +1,6 @@ -ProcessName,RegionName,Time,cap_par,cap_exp,fix_par,fix_exp,var_par,var_exp,MaxCapacityAddition,MaxCapacityGrowth,TotalCapacityLimit,TechnicalLife,UtilizationFactor,ScalingSize,efficiency,InterestRate,Type,Fuel,EndUse,Agent2 -Unit,-,Year,MUS$2010/PJ_a,-,MUS$2010/PJ,-,MUS$2010/PJ,-,PJ,-,PJ,Years,-,PJ,%,-,-,-,-,Retrofit -gasboiler,R1,2010,4.52,1,0,1,0,1,600,0.2,2000,10,0.9,0.00000189,86,0.1,energy,gas,heat,1 -heatpump,R1,2010,10.55,1,0,1,0,1,600,0.2,2000,10,0.9,0.00000189,86,0.1,energy,electricity,heat,1 -gasboiler,R2,2010,4.94,1,0,1,0,1,600,0.2,2000,10,0.9,0.00000189,86,0.1,energy,gas,heat,1 -heatpump,R2,2010,11.53,1,0,1,0,1,600,0.2,2000,10,0.9,0.00000189,86,0.1,energy,electricity,heat,1 +ProcessName,RegionName,Time,cap_par,cap_exp,fix_par,fix_exp,var_par,var_exp,MaxCapacityAddition,MaxCapacityGrowth,TotalCapacityLimit,TechnicalLife,UtilizationFactor,ScalingSize,efficiency,InterestRate,Type,Fuel,EndUse,Agent1 +Unit,-,Year,MUS$2010/PJ_a,-,MUS$2010/PJ,-,MUS$2010/PJ,-,PJ,%,PJ,Years,-,PJ,%,-,-,-,-,New +gasboiler,R1,2020,3.8,1,0,1,0,1,10,1,100,10,1,0.00000189,86,0.1,energy,gas,heat,1 +heatpump,R1,2020,8.866667,1,0,1,0,1,10,1,100,10,1,0.00000189,86,0.1,energy,electricity,heat,1 +gasboiler,R2,2020,3.8,1,0,1,0,1,10,1,100,10,1,0.00000189,86,0.1,energy,gas,heat,1 +heatpump,R2,2020,8.866667,1,0,1,0,1,10,1,20,10,1,0.00000189,86,0.1,energy,electricity,heat,1 diff --git a/tests/test_readers.py b/tests/test_readers.py index 87589d1dc..c240d047f 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -418,7 +418,7 @@ def test_read_trade_technodata(tmp_path): assert all(val == np.float64 for val in data.dtypes.values()) assert list(data.coords["dst_region"].values) == ["R1", "R2"] assert list(data.coords["technology"].values) == ["gassupply1"] - assert list(data.coords["region"].values) == ["R1", "R2", "R3"] + assert list(data.coords["region"].values) == ["R1", "R2"] assert all(var.coords.equals(data.coords) for var in data.data_vars.values()) From 02b8b824ac1c95d410ca18f2f8989c1c675971ac Mon Sep 17 00:00:00 2001 From: Tom Bland Date: Tue, 5 Nov 2024 16:35:22 +0000 Subject: [PATCH 2/2] A few small changes (still not working) --- src/muse/data/example/trade/settings.toml | 2 +- src/muse/data/example/trade/technodata/gas/Agents.csv | 3 +++ .../data/example/trade/technodata/gas/ExistingTrade.csv | 9 ++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 src/muse/data/example/trade/technodata/gas/Agents.csv diff --git a/src/muse/data/example/trade/settings.toml b/src/muse/data/example/trade/settings.toml index d5c0621be..3b829604a 100644 --- a/src/muse/data/example/trade/settings.toml +++ b/src/muse/data/example/trade/settings.toml @@ -80,7 +80,7 @@ commodities_in = '{path}/technodata/gas/CommIn.csv' commodities_out = '{path}/technodata/gas/CommOut.csv' [sectors.gas.subsectors.trade] -agents = '{path}/technodata/Agents.csv' +agents = '{path}/technodata/gas/Agents.csv' existing_capacity = '{path}/technodata/gas/ExistingTrade.csv' lpsolver = "scipy" demand_share = "unmet_forecasted_demand" diff --git a/src/muse/data/example/trade/technodata/gas/Agents.csv b/src/muse/data/example/trade/technodata/gas/Agents.csv new file mode 100644 index 000000000..504c3c4e3 --- /dev/null +++ b/src/muse/data/example/trade/technodata/gas/Agents.csv @@ -0,0 +1,3 @@ +AgentShare,Name,RegionName,Objective1,Objective2,Objective3,ObjData1,ObjData2,ObjData3,Objsort1,Objsort2,Objsort3,SearchRule,DecisionMethod,MaturityThreshold,SpendLimit,Type +Agent1,A1,R1,ALCOE,,,1,,,True,,,from_assets->compress->reduce_assets,singleObj,-1,inf,New +Agent1,A1,R2,ALCOE,,,1,,,True,,,from_assets->compress->reduce_assets,singleObj,-1,inf,New diff --git a/src/muse/data/example/trade/technodata/gas/ExistingTrade.csv b/src/muse/data/example/trade/technodata/gas/ExistingTrade.csv index 9c2e4c35b..a3f61b3c4 100644 --- a/src/muse/data/example/trade/technodata/gas/ExistingTrade.csv +++ b/src/muse/data/example/trade/technodata/gas/ExistingTrade.csv @@ -1,12 +1,15 @@ ProcessName,RegionName,Time,R1,R2 Unit,-,Year,PJ/y,PJ/y -gassupply1,R1,2010,15,0 gassupply1,R1,2020,15,0 +gassupply1,R1,2025,15,0 gassupply1,R1,2030,7.5,0 +gassupply1,R1,2035,0,0 gassupply1,R1,2040,0,0 +gassupply1,R1,2045,0,0 gassupply1,R1,2050,0,0 -gassupply1,R2,2010,0,15 gassupply1,R2,2020,0,15 -gassupply1,R2,2030,0,0.75 +gassupply1,R2,2025,0,15 +gassupply1,R2,2035,0,7.5 gassupply1,R2,2040,0,0 +gassupply1,R2,2045,0,0 gassupply1,R2,2050,0,0