From 7d27905b67022a7c176287f5b486bde1d1c444dc Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Tue, 24 Sep 2024 14:17:28 -0600 Subject: [PATCH 01/40] updating db pipeline --- src/generate_structs.jl | 80 +++++++++++------------ src/models/generated/DemandRequirement.jl | 12 ++-- src/models/generated/StorageTechnology.jl | 6 +- 3 files changed, 47 insertions(+), 51 deletions(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index 30f2c48..a3094be 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -319,6 +319,8 @@ function dataframe_to_structs(df_dict::Dict) #Initialize Portfolio p = Portfolio(0.07) + test_zone = Zone(name="test", id=1) + #Populate SupplyTechnology structs from database (new builds) topologies = df_dict["balancing_topologies"] supply_curves = filter("description" => contains("Supply"), df_dict["piecewise_linear"]) @@ -354,9 +356,9 @@ function dataframe_to_structs(df_dict::Dict) t = SupplyTechnology{parametric}(; #Data pulled from DB name=string(row[!, "technology_id"][1]), - id=row[!, "technology_id"][1], - inv_cost_per_mwyr=InputOutputCurve(PiecewiseLinearData(supply_curve_parsed)), - om_costs=ThermalGenerationCost( + gen_ID=row[!, "technology_id"][1], + capital_costs=InputOutputCurve(PiecewiseLinearData(supply_curve_parsed)), + operation_costs=ThermalGenerationCost( variable=CostCurve(LinearCurve(row[!, "vom_cost"][1])), fixed=row[!, "fom_cost"][1], start_up=0.0, @@ -365,12 +367,11 @@ function dataframe_to_structs(df_dict::Dict) balancing_topology=string(row[!, "balancing_topology"][1]), prime_mover_type=map_prime_mover(row[!, "prime_mover"][1]), fuel=row[!, "fuel_type"][1], - zone=area_int, + zone=test_zone, #Problem ones, need to write functions to extract base_power=100.0, - existing_cap_mw=0.0, - cap_size=250.0, + initial_capacity=0.0, # Data we should have but dont currently start_fuel_mmbtu_per_mw=2.0, @@ -383,11 +384,10 @@ function dataframe_to_structs(df_dict::Dict) ramp_up_percentage=0.64, #Placeholder or default values (modeling assumptions) - region="MA", #this one can probably just be removed from the structs, just descriptor for GenX available=true, - min_cap_mw=0.0, - min_power=0.0, - max_cap_mw=-1, + minimum_required_capacity=0.0, + min_generation_percentage=0.0, + maximum_capacity=-1, power_systems_type=string(parametric), cluster=1, reg_max=0.25, @@ -408,20 +408,17 @@ function dataframe_to_structs(df_dict::Dict) t = SupplyTechnology{parametric}(; # Data pulled from DB name=row["name"], - id=row["unit_id"], - inv_cost_per_mwyr=LinearCurve(0.0), #just assume zero since pre-existing? + gen_ID=row["unit_id"], + capital_costs=LinearCurve(0.0), #just assume zero since pre-existing? balancing_topology=string(row["balancing_topology"]), prime_mover_type=map_prime_mover(row["prime_mover"]), fuel=row["fuel_type"], - zone=area_int, + zone=test_zone, base_power=row["base_power"], - existing_cap_mw=row["rating"], - - # Problem ones, need to write functions to extract - cap_size=250.0, + initial_capacity=row["rating"], # Data we should have but dont currently - om_costs=ThermalGenerationCost( + operation_costs=ThermalGenerationCost( variable=CostCurve(LinearCurve(0.0)), fixed=0.0, start_up=0.0, @@ -437,11 +434,10 @@ function dataframe_to_structs(df_dict::Dict) ramp_up_percentage=0.64, #Placeholder or default values (modeling assumptions) - region="MA", available=true, - min_cap_mw=0.0, - min_power=0.0, - max_cap_mw=-1, + minimum_required_capacity=0.0, + min_generation_percentage=0.0, + maximum_capacity=-1, power_systems_type=string(parametric), cluster=1, reg_max=0.25, @@ -463,41 +459,42 @@ function dataframe_to_structs(df_dict::Dict) name=row["name"], base_power=row["base_power"], # Natural Units id=row["storage_unit_id"], - zone=area_int, + zone=test_zone, prime_mover_type=map_prime_mover(row["prime_mover"]), balancing_topology=row["balancing_topology"], - existing_cap_mw=row["rating"], - existing_cap_mwh=row["max_capacity"], + existing_cap_power=row["rating"], + existing_cap_energy=row["max_capacity"], #stuff we dont have but probably should - om_costs=StorageCost( + om_costs_energy=StorageCost( + charge_variable_cost=CostCurve(LinearCurve(0.0)), + discharge_variable_cost=CostCurve(LinearCurve(0.0)), + fixed=0.0, + start_up=0.0, + shut_down=0.0, + ), + om_costs_power=StorageCost( charge_variable_cost=CostCurve(LinearCurve(0.0)), discharge_variable_cost=CostCurve(LinearCurve(0.0)), fixed=0.0, start_up=0.0, shut_down=0.0, ), - fixed_om_cost_per_mwhyr=LinearCurve(0.0), eff_up=0.92, eff_down=0.92, storage_tech=StorageTech.LIB, #Default or placeholder values - inv_cost_per_mwyr=LinearCurve(0.0), - inv_cost_charge_per_mwyr=LinearCurve(0.0), - inv_cost_per_mwhyr=LinearCurve(0.0), + capital_costs_power=LinearCurve(0.0), + capital_costs_energy=LinearCurve(0.0), available=true, - region="ME", - cluster=0, - self_disch=0.0, + losses=0.0, min_duration=1.0, max_duration=10.0, - min_cap_mwh=0.0, - min_cap_mw=0.0, - min_charge_cap_mw=-1, - max_cap_mw=-1, - max_charge_cap_mw=-1, - max_cap_mwh=-1, + min_cap_energy=0.0, + min_cap_power=0.0, + max_cap_energy=1e8, + max_cap_power=1e8, power_systems_type="Test", ) add_technology!(p, s) @@ -518,12 +515,11 @@ function dataframe_to_structs(df_dict::Dict) demand_array = TimeArray(dates, demand) ts = SingleTimeSeries(string(row["entity_attribute_id"]), demand_array) #How to parse this timestamp stuff?? - + @show test_zone d = DemandRequirement{ElectricLoad}( #Data pulled from DB name=string(row["entity_attribute_id"]), - region=row["area"], - zone=parse(Int64, row["area"]), + zone=test_zone,#parse(Int64, row["area"]), #Placeholder/default values available=true, diff --git a/src/models/generated/DemandRequirement.jl b/src/models/generated/DemandRequirement.jl index 7b52fcf..f7f3aee 100644 --- a/src/models/generated/DemandRequirement.jl +++ b/src/models/generated/DemandRequirement.jl @@ -7,11 +7,11 @@ This file is auto-generated. Do not edit. """ mutable struct DemandRequirement{T <: PSY.StaticInjection} <: Technology name::String - zone::Int64 + zone::Union{Nothing, Zone} power_systems_type::String internal::InfrastructureSystemsInternal ext::Dict - demand_mw::Float64 + demand_mw::Union{Nothing, Zone} available::Bool end @@ -19,18 +19,18 @@ This file is auto-generated. Do not edit. # Arguments - `name::String`: The technology name -- `zone::Int64`: Zone Number +- `zone::Union{Nothing, Zone}`: Zone Number - `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling - `internal::InfrastructureSystemsInternal`: (default: `InfrastructureSystemsInternal()`) Internal field - `ext::Dict`: (default: `Dict()`) Option for providing additional data -- `demand_mw::Float64`: (default: `0.0`) Demand profile in MW +- `demand_mw::Union{Nothing, Zone}`: (default: `0.0`) Demand profile in MW - `available::Bool`: (default: `true`) identifies whether the technology is available """ mutable struct DemandRequirement{T <: PSY.StaticInjection} <: Technology "The technology name" name::String "Zone Number" - zone::Int64 + zone::Union{Nothing, Zone} "maps to a valid PowerSystems.jl for PCM modeling" power_systems_type::String "Internal field" @@ -38,7 +38,7 @@ mutable struct DemandRequirement{T <: PSY.StaticInjection} <: Technology "Option for providing additional data" ext::Dict "Demand profile in MW" - demand_mw::Float64 + demand_mw::Union{Nothing, Zone} "identifies whether the technology is available" available::Bool end diff --git a/src/models/generated/StorageTechnology.jl b/src/models/generated/StorageTechnology.jl index 4ba669b..94c601f 100644 --- a/src/models/generated/StorageTechnology.jl +++ b/src/models/generated/StorageTechnology.jl @@ -8,7 +8,7 @@ This file is auto-generated. Do not edit. mutable struct StorageTechnology{T <: PSY.Storage} <: Technology base_power::Float64 om_costs_energy::PSY.OperationalCost - zone::Int64 + zone::Union{Nothing, Zone} prime_mover_type::PrimeMovers existing_cap_energy::Float64 rsv_cost::Float64 @@ -43,7 +43,7 @@ This file is auto-generated. Do not edit. # Arguments - `base_power::Float64`: Base power - `om_costs_energy::PSY.OperationalCost`: (default: `StorageCost()`) Fixed and variable O&M costs for a technology -- `zone::Int64`: Zone number +- `zone::Union{Nothing, Zone}`: Zone number - `prime_mover_type::PrimeMovers`: (default: `PrimeMovers.OT`) Prime mover for generator - `existing_cap_energy::Float64`: (default: `0.0`) Pre-existing energy capacity for a technology (MWh) - `rsv_cost::Float64`: (default: `0.0`) Cost of providing upwards spinning or contingency reserves @@ -78,7 +78,7 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology "Fixed and variable O&M costs for a technology" om_costs_energy::PSY.OperationalCost "Zone number" - zone::Int64 + zone::Union{Nothing, Zone} "Prime mover for generator" prime_mover_type::PrimeMovers "Pre-existing energy capacity for a technology (MWh)" From d01707ec243795d7e88ac6ba693c9039e80b4e22 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Tue, 24 Sep 2024 15:00:22 -0600 Subject: [PATCH 02/40] placeholder om data for new builds --- src/generate_structs.jl | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index a3094be..7348f65 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -358,12 +358,6 @@ function dataframe_to_structs(df_dict::Dict) name=string(row[!, "technology_id"][1]), gen_ID=row[!, "technology_id"][1], capital_costs=InputOutputCurve(PiecewiseLinearData(supply_curve_parsed)), - operation_costs=ThermalGenerationCost( - variable=CostCurve(LinearCurve(row[!, "vom_cost"][1])), - fixed=row[!, "fom_cost"][1], - start_up=0.0, - shut_down=0.0, - ), balancing_topology=string(row[!, "balancing_topology"][1]), prime_mover_type=map_prime_mover(row[!, "prime_mover"][1]), fuel=row[!, "fuel_type"][1], @@ -374,6 +368,12 @@ function dataframe_to_structs(df_dict::Dict) initial_capacity=0.0, # Data we should have but dont currently + operation_costs=ThermalGenerationCost( + variable=CostCurve(LinearCurve(0.0)), + fixed=0.0, + start_up=0.0, + shut_down=0.0, + ), start_fuel_mmbtu_per_mw=2.0, start_cost_per_mw=91.0, up_time=6.0, @@ -392,7 +392,6 @@ function dataframe_to_structs(df_dict::Dict) cluster=1, reg_max=0.25, rsv_max=0.5, - #new_build = 1 ) add_technology!(p, t) end From 76a58e95e6c1ef1e22d0cfd5b837a189d328f4c7 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Tue, 24 Sep 2024 15:05:01 -0600 Subject: [PATCH 03/40] fix typo in demand --- src/models/generated/DemandRequirement.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/models/generated/DemandRequirement.jl b/src/models/generated/DemandRequirement.jl index f7f3aee..ec7f6d0 100644 --- a/src/models/generated/DemandRequirement.jl +++ b/src/models/generated/DemandRequirement.jl @@ -11,7 +11,7 @@ This file is auto-generated. Do not edit. power_systems_type::String internal::InfrastructureSystemsInternal ext::Dict - demand_mw::Union{Nothing, Zone} + demand_mw::Float64 available::Bool end @@ -23,7 +23,7 @@ This file is auto-generated. Do not edit. - `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling - `internal::InfrastructureSystemsInternal`: (default: `InfrastructureSystemsInternal()`) Internal field - `ext::Dict`: (default: `Dict()`) Option for providing additional data -- `demand_mw::Union{Nothing, Zone}`: (default: `0.0`) Demand profile in MW +- `demand_mw::Float64`: (default: `0.0`) Demand profile in MW - `available::Bool`: (default: `true`) identifies whether the technology is available """ mutable struct DemandRequirement{T <: PSY.StaticInjection} <: Technology @@ -38,7 +38,7 @@ mutable struct DemandRequirement{T <: PSY.StaticInjection} <: Technology "Option for providing additional data" ext::Dict "Demand profile in MW" - demand_mw::Union{Nothing, Zone} + demand_mw::Float64 "identifies whether the technology is available" available::Bool end From 1c60955fff0a77c05314fcb1c245b16a3c254e9a Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Tue, 24 Sep 2024 15:11:06 -0600 Subject: [PATCH 04/40] field name changes --- src/generate_structs.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index 7348f65..3b7712d 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -554,12 +554,11 @@ function dataframe_to_structs(df_dict::Dict) tx = TransportTechnology{Branch}(; name=string(rownumber(row)), - network_lines=rownumber(row), + network_id = rownumber(row), available=true, start_region=parse(Int64, row["area_from"]), end_region=parse(Int64, row["area_to"]), maximum_new_capacity=row["max_flow_from"], - maximum_flow=row["max_flow_from"], existing_line_capacity=existing_capacity, #stuff we don't have, but probably should From 1ec8756757fe20a6d1c5bf6eb2c3bcba9c24e17e Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Tue, 24 Sep 2024 15:12:57 -0600 Subject: [PATCH 05/40] change placeholder values --- src/generate_structs.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index 3b7712d..ef98224 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -387,7 +387,7 @@ function dataframe_to_structs(df_dict::Dict) available=true, minimum_required_capacity=0.0, min_generation_percentage=0.0, - maximum_capacity=-1, + maximum_capacity=1e8, power_systems_type=string(parametric), cluster=1, reg_max=0.25, @@ -436,7 +436,7 @@ function dataframe_to_structs(df_dict::Dict) available=true, minimum_required_capacity=0.0, min_generation_percentage=0.0, - maximum_capacity=-1, + maximum_capacity=1e8, power_systems_type=string(parametric), cluster=1, reg_max=0.25, From 696f1b5cdf1c3d5fb5341e5904a28a776f3b1dd8 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Tue, 24 Sep 2024 15:22:10 -0600 Subject: [PATCH 06/40] added zones --- src/generate_structs.jl | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index ef98224..7e13462 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -319,8 +319,13 @@ function dataframe_to_structs(df_dict::Dict) #Initialize Portfolio p = Portfolio(0.07) - test_zone = Zone(name="test", id=1) - + #initialize Zone structs + zones = [] + for row_zone in eachrow(df_dict["areas"]) + z = Zone(name = string("zone_", row_zone["name"]), id=parse(Int64, row_zone["name"])) + push!(zones, z) + end + @show zones #Populate SupplyTechnology structs from database (new builds) topologies = df_dict["balancing_topologies"] supply_curves = filter("description" => contains("Supply"), df_dict["piecewise_linear"]) @@ -361,7 +366,7 @@ function dataframe_to_structs(df_dict::Dict) balancing_topology=string(row[!, "balancing_topology"][1]), prime_mover_type=map_prime_mover(row[!, "prime_mover"][1]), fuel=row[!, "fuel_type"][1], - zone=test_zone, + zone=zones[area_int], #Problem ones, need to write functions to extract base_power=100.0, @@ -412,7 +417,7 @@ function dataframe_to_structs(df_dict::Dict) balancing_topology=string(row["balancing_topology"]), prime_mover_type=map_prime_mover(row["prime_mover"]), fuel=row["fuel_type"], - zone=test_zone, + zone=zones[area_int], base_power=row["base_power"], initial_capacity=row["rating"], @@ -458,7 +463,7 @@ function dataframe_to_structs(df_dict::Dict) name=row["name"], base_power=row["base_power"], # Natural Units id=row["storage_unit_id"], - zone=test_zone, + zone=zones[area_int], prime_mover_type=map_prime_mover(row["prime_mover"]), balancing_topology=row["balancing_topology"], existing_cap_power=row["rating"], @@ -513,12 +518,15 @@ function dataframe_to_structs(df_dict::Dict) demand = ts_parsed[2] demand_array = TimeArray(dates, demand) ts = SingleTimeSeries(string(row["entity_attribute_id"]), demand_array) + + area_int = parse(Int64, row["area"]) + #How to parse this timestamp stuff?? - @show test_zone + d = DemandRequirement{ElectricLoad}( #Data pulled from DB name=string(row["entity_attribute_id"]), - zone=test_zone,#parse(Int64, row["area"]), + zone=zones[area_int],#parse(Int64, row["area"]), #Placeholder/default values available=true, From 7f24d95dc802931885353a54fc39e185a50ac9f4 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Wed, 25 Sep 2024 11:32:12 -0600 Subject: [PATCH 07/40] add fields for initial state of charge and discrete investment decisons --- src/models/generated/DemandRequirement.jl | 6 +-- src/models/generated/StorageTechnology.jl | 50 +++++++++++++++++------ src/models/generated/SupplyTechnology.jl | 12 +++++- src/models/generated/includes.jl | 8 ++++ 4 files changed, 58 insertions(+), 18 deletions(-) diff --git a/src/models/generated/DemandRequirement.jl b/src/models/generated/DemandRequirement.jl index 7b52fcf..ec7f6d0 100644 --- a/src/models/generated/DemandRequirement.jl +++ b/src/models/generated/DemandRequirement.jl @@ -7,7 +7,7 @@ This file is auto-generated. Do not edit. """ mutable struct DemandRequirement{T <: PSY.StaticInjection} <: Technology name::String - zone::Int64 + zone::Union{Nothing, Zone} power_systems_type::String internal::InfrastructureSystemsInternal ext::Dict @@ -19,7 +19,7 @@ This file is auto-generated. Do not edit. # Arguments - `name::String`: The technology name -- `zone::Int64`: Zone Number +- `zone::Union{Nothing, Zone}`: Zone Number - `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling - `internal::InfrastructureSystemsInternal`: (default: `InfrastructureSystemsInternal()`) Internal field - `ext::Dict`: (default: `Dict()`) Option for providing additional data @@ -30,7 +30,7 @@ mutable struct DemandRequirement{T <: PSY.StaticInjection} <: Technology "The technology name" name::String "Zone Number" - zone::Int64 + zone::Union{Nothing, Zone} "maps to a valid PowerSystems.jl for PCM modeling" power_systems_type::String "Internal field" diff --git a/src/models/generated/StorageTechnology.jl b/src/models/generated/StorageTechnology.jl index 4ba669b..8c9c9bc 100644 --- a/src/models/generated/StorageTechnology.jl +++ b/src/models/generated/StorageTechnology.jl @@ -8,7 +8,7 @@ This file is auto-generated. Do not edit. mutable struct StorageTechnology{T <: PSY.Storage} <: Technology base_power::Float64 om_costs_energy::PSY.OperationalCost - zone::Int64 + zone::Union{Nothing, Zone} prime_mover_type::PrimeMovers existing_cap_energy::Float64 rsv_cost::Float64 @@ -18,6 +18,7 @@ This file is auto-generated. Do not edit. storage_tech::StorageTech capital_costs_power::PSY.ValueCurve max_duration::Float64 + unit_size_power::Float64 id::Int64 min_cap_power::Float64 capital_costs_energy::PSY.ValueCurve @@ -30,8 +31,10 @@ This file is auto-generated. Do not edit. om_costs_power::PSY.OperationalCost balancing_topology::String min_cap_energy::Float64 - ext::Dict + initial_state_of_charge::Float64 eff_up::Float64 + unit_size_energy::Float64 + ext::Dict reg_cost::Float64 min_duration::Float64 max_cap_energy::Float64 @@ -43,7 +46,7 @@ This file is auto-generated. Do not edit. # Arguments - `base_power::Float64`: Base power - `om_costs_energy::PSY.OperationalCost`: (default: `StorageCost()`) Fixed and variable O&M costs for a technology -- `zone::Int64`: Zone number +- `zone::Union{Nothing, Zone}`: Zone number - `prime_mover_type::PrimeMovers`: (default: `PrimeMovers.OT`) Prime mover for generator - `existing_cap_energy::Float64`: (default: `0.0`) Pre-existing energy capacity for a technology (MWh) - `rsv_cost::Float64`: (default: `0.0`) Cost of providing upwards spinning or contingency reserves @@ -53,6 +56,7 @@ This file is auto-generated. Do not edit. - `storage_tech::StorageTech`: Storage Technology Type - `capital_costs_power::PSY.ValueCurve`: (default: `LinearCurve(0.0)`) Capital costs for investing in a technology. - `max_duration::Float64`: (default: `1000.0`) Maximum allowable durection for a storage technology +- `unit_size_power::Float64`: (default: `0.0`) Used for discrete investment decisions. Size of each unit being built (MW) - `id::Int64`: ID for individual generator - `min_cap_power::Float64`: (default: `0.0`) Minimum required power capacity for a storage technology - `capital_costs_energy::PSY.ValueCurve`: (default: `LinearCurve(0.0)`) Capital costs for investing in a technology. @@ -65,8 +69,10 @@ This file is auto-generated. Do not edit. - `om_costs_power::PSY.OperationalCost`: (default: `StorageCost()`) Fixed and variable O&M costs for a technology - `balancing_topology::String`: Set of balancing nodes - `min_cap_energy::Float64`: (default: `0.0`) Minimum required energy capacity for a storage technology -- `ext::Dict`: (default: `Dict()`) Option for providing additional data +- `initial_state_of_charge::Float64`: (default: `0.0`) State of charge for storage technology in the first timepoint (MWh). - `eff_up::Float64`: (default: `1.0`) Efficiency of charging storage +- `unit_size_energy::Float64`: (default: `0.0`) Used for discrete investment decisions. Size of each unit being built (MW) +- `ext::Dict`: (default: `Dict()`) Option for providing additional data - `reg_cost::Float64`: (default: `0.0`) Cost of providing regulation reserves - `min_duration::Float64`: (default: `0.0`) Minimum required durection for a storage technology - `max_cap_energy::Float64`: (default: `1e8`) Maximum allowable installed energy capacity for a storage technology @@ -78,7 +84,7 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology "Fixed and variable O&M costs for a technology" om_costs_energy::PSY.OperationalCost "Zone number" - zone::Int64 + zone::Union{Nothing, Zone} "Prime mover for generator" prime_mover_type::PrimeMovers "Pre-existing energy capacity for a technology (MWh)" @@ -97,6 +103,8 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology capital_costs_power::PSY.ValueCurve "Maximum allowable durection for a storage technology" max_duration::Float64 + "Used for discrete investment decisions. Size of each unit being built (MW)" + unit_size_power::Float64 "ID for individual generator" id::Int64 "Minimum required power capacity for a storage technology" @@ -121,10 +129,14 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology balancing_topology::String "Minimum required energy capacity for a storage technology" min_cap_energy::Float64 - "Option for providing additional data" - ext::Dict + "State of charge for storage technology in the first timepoint (MWh)." + initial_state_of_charge::Float64 "Efficiency of charging storage" eff_up::Float64 + "Used for discrete investment decisions. Size of each unit being built (MW)" + unit_size_energy::Float64 + "Option for providing additional data" + ext::Dict "Cost of providing regulation reserves " reg_cost::Float64 "Minimum required durection for a storage technology" @@ -136,8 +148,8 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology end -function StorageTechnology{T}(; base_power, om_costs_energy=StorageCost(), zone, prime_mover_type=PrimeMovers.OT, existing_cap_energy=0.0, rsv_cost=0.0, available, existing_cap_power=0.0, name, storage_tech, capital_costs_power=LinearCurve(0.0), max_duration=1000.0, id, min_cap_power=0.0, capital_costs_energy=LinearCurve(0.0), losses=1.0, eff_down=1.0, rsv_max=0.0, max_cap_power=1e8, power_systems_type, internal=InfrastructureSystemsInternal(), om_costs_power=StorageCost(), balancing_topology, min_cap_energy=0.0, ext=Dict(), eff_up=1.0, reg_cost=0.0, min_duration=0.0, max_cap_energy=1e8, reg_max=0.0, ) where T <: PSY.Storage - StorageTechnology{T}(base_power, om_costs_energy, zone, prime_mover_type, existing_cap_energy, rsv_cost, available, existing_cap_power, name, storage_tech, capital_costs_power, max_duration, id, min_cap_power, capital_costs_energy, losses, eff_down, rsv_max, max_cap_power, power_systems_type, internal, om_costs_power, balancing_topology, min_cap_energy, ext, eff_up, reg_cost, min_duration, max_cap_energy, reg_max, ) +function StorageTechnology{T}(; base_power, om_costs_energy=StorageCost(), zone, prime_mover_type=PrimeMovers.OT, existing_cap_energy=0.0, rsv_cost=0.0, available, existing_cap_power=0.0, name, storage_tech, capital_costs_power=LinearCurve(0.0), max_duration=1000.0, unit_size_power=0.0, id, min_cap_power=0.0, capital_costs_energy=LinearCurve(0.0), losses=1.0, eff_down=1.0, rsv_max=0.0, max_cap_power=1e8, power_systems_type, internal=InfrastructureSystemsInternal(), om_costs_power=StorageCost(), balancing_topology, min_cap_energy=0.0, initial_state_of_charge=0.0, eff_up=1.0, unit_size_energy=0.0, ext=Dict(), reg_cost=0.0, min_duration=0.0, max_cap_energy=1e8, reg_max=0.0, ) where T <: PSY.Storage + StorageTechnology{T}(base_power, om_costs_energy, zone, prime_mover_type, existing_cap_energy, rsv_cost, available, existing_cap_power, name, storage_tech, capital_costs_power, max_duration, unit_size_power, id, min_cap_power, capital_costs_energy, losses, eff_down, rsv_max, max_cap_power, power_systems_type, internal, om_costs_power, balancing_topology, min_cap_energy, initial_state_of_charge, eff_up, unit_size_energy, ext, reg_cost, min_duration, max_cap_energy, reg_max, ) end """Get [`StorageTechnology`](@ref) `base_power`.""" @@ -164,6 +176,8 @@ get_storage_tech(value::StorageTechnology) = value.storage_tech get_capital_costs_power(value::StorageTechnology) = value.capital_costs_power """Get [`StorageTechnology`](@ref) `max_duration`.""" get_max_duration(value::StorageTechnology) = value.max_duration +"""Get [`StorageTechnology`](@ref) `unit_size_power`.""" +get_unit_size_power(value::StorageTechnology) = value.unit_size_power """Get [`StorageTechnology`](@ref) `id`.""" get_id(value::StorageTechnology) = value.id """Get [`StorageTechnology`](@ref) `min_cap_power`.""" @@ -188,10 +202,14 @@ get_om_costs_power(value::StorageTechnology) = value.om_costs_power get_balancing_topology(value::StorageTechnology) = value.balancing_topology """Get [`StorageTechnology`](@ref) `min_cap_energy`.""" get_min_cap_energy(value::StorageTechnology) = value.min_cap_energy -"""Get [`StorageTechnology`](@ref) `ext`.""" -get_ext(value::StorageTechnology) = value.ext +"""Get [`StorageTechnology`](@ref) `initial_state_of_charge`.""" +get_initial_state_of_charge(value::StorageTechnology) = value.initial_state_of_charge """Get [`StorageTechnology`](@ref) `eff_up`.""" get_eff_up(value::StorageTechnology) = value.eff_up +"""Get [`StorageTechnology`](@ref) `unit_size_energy`.""" +get_unit_size_energy(value::StorageTechnology) = value.unit_size_energy +"""Get [`StorageTechnology`](@ref) `ext`.""" +get_ext(value::StorageTechnology) = value.ext """Get [`StorageTechnology`](@ref) `reg_cost`.""" get_reg_cost(value::StorageTechnology) = value.reg_cost """Get [`StorageTechnology`](@ref) `min_duration`.""" @@ -225,6 +243,8 @@ set_storage_tech!(value::StorageTechnology, val) = value.storage_tech = val set_capital_costs_power!(value::StorageTechnology, val) = value.capital_costs_power = val """Set [`StorageTechnology`](@ref) `max_duration`.""" set_max_duration!(value::StorageTechnology, val) = value.max_duration = val +"""Set [`StorageTechnology`](@ref) `unit_size_power`.""" +set_unit_size_power!(value::StorageTechnology, val) = value.unit_size_power = val """Set [`StorageTechnology`](@ref) `id`.""" set_id!(value::StorageTechnology, val) = value.id = val """Set [`StorageTechnology`](@ref) `min_cap_power`.""" @@ -249,10 +269,14 @@ set_om_costs_power!(value::StorageTechnology, val) = value.om_costs_power = val set_balancing_topology!(value::StorageTechnology, val) = value.balancing_topology = val """Set [`StorageTechnology`](@ref) `min_cap_energy`.""" set_min_cap_energy!(value::StorageTechnology, val) = value.min_cap_energy = val -"""Set [`StorageTechnology`](@ref) `ext`.""" -set_ext!(value::StorageTechnology, val) = value.ext = val +"""Set [`StorageTechnology`](@ref) `initial_state_of_charge`.""" +set_initial_state_of_charge!(value::StorageTechnology, val) = value.initial_state_of_charge = val """Set [`StorageTechnology`](@ref) `eff_up`.""" set_eff_up!(value::StorageTechnology, val) = value.eff_up = val +"""Set [`StorageTechnology`](@ref) `unit_size_energy`.""" +set_unit_size_energy!(value::StorageTechnology, val) = value.unit_size_energy = val +"""Set [`StorageTechnology`](@ref) `ext`.""" +set_ext!(value::StorageTechnology, val) = value.ext = val """Set [`StorageTechnology`](@ref) `reg_cost`.""" set_reg_cost!(value::StorageTechnology, val) = value.reg_cost = val """Set [`StorageTechnology`](@ref) `min_duration`.""" diff --git a/src/models/generated/SupplyTechnology.jl b/src/models/generated/SupplyTechnology.jl index 4330078..4e2c093 100644 --- a/src/models/generated/SupplyTechnology.jl +++ b/src/models/generated/SupplyTechnology.jl @@ -36,6 +36,7 @@ This file is auto-generated. Do not edit. maximum_capacity::Float64 cluster::Int64 ramp_up_percentage::Float64 + unit_size::Float64 reg_cost::Float64 min_generation_percentage::Float64 start_cost_per_mw::Float64 @@ -76,6 +77,7 @@ This file is auto-generated. Do not edit. - `maximum_capacity::Float64`: (default: `Inf`) Maximum allowable installed capacity for a technology - `cluster::Int64`: (default: `1`) Number of the cluster when representing multiple clusters of a given technology in a given region. - `ramp_up_percentage::Float64`: (default: `100.0`) Maximum increase in output between operation periods. Fraction of total capacity +- `unit_size::Float64`: (default: `0.0`) Used for discrete investment decisions. Size of each unit being built (MW) - `reg_cost::Float64`: (default: `0.0`) Cost of providing regulation reserves - `min_generation_percentage::Float64`: (default: `0.0`) Minimum generation as a fraction of total capacity - `start_cost_per_mw::Float64`: (default: `0.0`) Cost per MW of nameplate capacity to start a generator (/MW per start). @@ -143,6 +145,8 @@ mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology cluster::Int64 "Maximum increase in output between operation periods. Fraction of total capacity" ramp_up_percentage::Float64 + "Used for discrete investment decisions. Size of each unit being built (MW)" + unit_size::Float64 "Cost of providing regulation reserves " reg_cost::Float64 "Minimum generation as a fraction of total capacity" @@ -156,8 +160,8 @@ mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology end -function SupplyTechnology{T}(; base_power, heat_rate_mmbtu_per_mwh=0.0, zone=nothing, prime_mover_type=PrimeMovers.OT, minimum_required_capacity=0.0, cofire_level_min=nothing, capital_costs=LinearCurve(0.0), outage_factor=1.0, rsv_cost=0.0, cofire_start_max=nothing, gen_ID, available=True, co2=0.0, name, cofire_start_min=nothing, ramp_dn_percentage=100.0, down_time=0.0, initial_capacity=0.0, start_fuel_mmbtu_per_mw=0.0, operation_costs=ThermalGenerationCost(), rsv_max=0.0, fuel=ThermalFuels.OTHER, power_systems_type, cofire_level_max=nothing, internal=InfrastructureSystemsInternal(), ext=Dict(), balancing_topology, maximum_capacity=Inf, cluster=1, ramp_up_percentage=100.0, reg_cost=0.0, min_generation_percentage=0.0, start_cost_per_mw=0.0, reg_max=0.0, up_time=0.0, ) where T <: PSY.Generator - SupplyTechnology{T}(base_power, heat_rate_mmbtu_per_mwh, zone, prime_mover_type, minimum_required_capacity, cofire_level_min, capital_costs, outage_factor, rsv_cost, cofire_start_max, gen_ID, available, co2, name, cofire_start_min, ramp_dn_percentage, down_time, initial_capacity, start_fuel_mmbtu_per_mw, operation_costs, rsv_max, fuel, power_systems_type, cofire_level_max, internal, ext, balancing_topology, maximum_capacity, cluster, ramp_up_percentage, reg_cost, min_generation_percentage, start_cost_per_mw, reg_max, up_time, ) +function SupplyTechnology{T}(; base_power, heat_rate_mmbtu_per_mwh=0.0, zone=nothing, prime_mover_type=PrimeMovers.OT, minimum_required_capacity=0.0, cofire_level_min=nothing, capital_costs=LinearCurve(0.0), outage_factor=1.0, rsv_cost=0.0, cofire_start_max=nothing, gen_ID, available=True, co2=0.0, name, cofire_start_min=nothing, ramp_dn_percentage=100.0, down_time=0.0, initial_capacity=0.0, start_fuel_mmbtu_per_mw=0.0, operation_costs=ThermalGenerationCost(), rsv_max=0.0, fuel=ThermalFuels.OTHER, power_systems_type, cofire_level_max=nothing, internal=InfrastructureSystemsInternal(), ext=Dict(), balancing_topology, maximum_capacity=Inf, cluster=1, ramp_up_percentage=100.0, unit_size=0.0, reg_cost=0.0, min_generation_percentage=0.0, start_cost_per_mw=0.0, reg_max=0.0, up_time=0.0, ) where T <: PSY.Generator + SupplyTechnology{T}(base_power, heat_rate_mmbtu_per_mwh, zone, prime_mover_type, minimum_required_capacity, cofire_level_min, capital_costs, outage_factor, rsv_cost, cofire_start_max, gen_ID, available, co2, name, cofire_start_min, ramp_dn_percentage, down_time, initial_capacity, start_fuel_mmbtu_per_mw, operation_costs, rsv_max, fuel, power_systems_type, cofire_level_max, internal, ext, balancing_topology, maximum_capacity, cluster, ramp_up_percentage, unit_size, reg_cost, min_generation_percentage, start_cost_per_mw, reg_max, up_time, ) end """Get [`SupplyTechnology`](@ref) `base_power`.""" @@ -220,6 +224,8 @@ get_maximum_capacity(value::SupplyTechnology) = value.maximum_capacity get_cluster(value::SupplyTechnology) = value.cluster """Get [`SupplyTechnology`](@ref) `ramp_up_percentage`.""" get_ramp_up_percentage(value::SupplyTechnology) = value.ramp_up_percentage +"""Get [`SupplyTechnology`](@ref) `unit_size`.""" +get_unit_size(value::SupplyTechnology) = value.unit_size """Get [`SupplyTechnology`](@ref) `reg_cost`.""" get_reg_cost(value::SupplyTechnology) = value.reg_cost """Get [`SupplyTechnology`](@ref) `min_generation_percentage`.""" @@ -291,6 +297,8 @@ set_maximum_capacity!(value::SupplyTechnology, val) = value.maximum_capacity = v set_cluster!(value::SupplyTechnology, val) = value.cluster = val """Set [`SupplyTechnology`](@ref) `ramp_up_percentage`.""" set_ramp_up_percentage!(value::SupplyTechnology, val) = value.ramp_up_percentage = val +"""Set [`SupplyTechnology`](@ref) `unit_size`.""" +set_unit_size!(value::SupplyTechnology, val) = value.unit_size = val """Set [`SupplyTechnology`](@ref) `reg_cost`.""" set_reg_cost!(value::SupplyTechnology, val) = value.reg_cost = val """Set [`SupplyTechnology`](@ref) `min_generation_percentage`.""" diff --git a/src/models/generated/includes.jl b/src/models/generated/includes.jl index 820bec6..d4637c1 100644 --- a/src/models/generated/includes.jl +++ b/src/models/generated/includes.jl @@ -51,6 +51,7 @@ export get_gen_ID export get_heat_rate_mmbtu_per_mwh export get_id export get_initial_capacity +export get_initial_state_of_charge export get_line_loss export get_losses export get_max_cap_energy @@ -95,6 +96,9 @@ export get_start_fuel_mmbtu_per_mw export get_start_region export get_storage_tech export get_technology_efficiency +export get_unit_size +export get_unit_size_energy +export get_unit_size_power export get_up_time export get_var_cost_per_mwh export get_voll @@ -138,6 +142,7 @@ export set_gen_ID! export set_heat_rate_mmbtu_per_mwh! export set_id! export set_initial_capacity! +export set_initial_state_of_charge! export set_line_loss! export set_losses! export set_max_cap_energy! @@ -182,6 +187,9 @@ export set_start_fuel_mmbtu_per_mw! export set_start_region! export set_storage_tech! export set_technology_efficiency! +export set_unit_size! +export set_unit_size_energy! +export set_unit_size_power! export set_up_time! export set_var_cost_per_mwh! export set_voll! From 7238d02d29af53f88699dd027c10192dcc3078b2 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Thu, 26 Sep 2024 08:14:24 -0600 Subject: [PATCH 08/40] remove show --- src/generate_structs.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index 7e13462..0757267 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -325,7 +325,6 @@ function dataframe_to_structs(df_dict::Dict) z = Zone(name = string("zone_", row_zone["name"]), id=parse(Int64, row_zone["name"])) push!(zones, z) end - @show zones #Populate SupplyTechnology structs from database (new builds) topologies = df_dict["balancing_topologies"] supply_curves = filter("description" => contains("Supply"), df_dict["piecewise_linear"]) From 1d96f96d0e508f5b8de0f4811a8d0fa8fb29ab77 Mon Sep 17 00:00:00 2001 From: prao7 Date: Thu, 26 Sep 2024 10:05:46 -0600 Subject: [PATCH 09/40] pipeline addition of some of the operational data --- src/generate_structs.jl | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index 0757267..97c1771 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -407,6 +407,11 @@ function dataframe_to_structs(df_dict::Dict) area = topologies[topologies.name .== row["balancing_topology"], "area"][1] area_int = parse(Int64, area) + # This will return all rows where entity_id matches any value in the tech_id vector + tech_id = row["unit_id"] + result = filter(row -> row[:entity_id] in tech_id, df_dict["attributes"]) + + parametric = map_prime_mover_to_parametric(row["prime_mover"]) t = SupplyTechnology{parametric}(; # Data pulled from DB @@ -423,22 +428,22 @@ function dataframe_to_structs(df_dict::Dict) # Data we should have but dont currently operation_costs=ThermalGenerationCost( variable=CostCurve(LinearCurve(0.0)), - fixed=0.0, + fixed=filter(row -> occursin("FOM", row[:name]), result), start_up=0.0, shut_down=0.0, ), start_fuel_mmbtu_per_mw=2.0, - start_cost_per_mw=91.0, - up_time=6.0, - down_time=6.0, - heat_rate_mmbtu_per_mwh=7.43, - co2=0.05306, + start_cost_per_mw=filter(row -> occursin("Startup Cost", row[:name]), result), + up_time=filter(row -> occursin("Uptime", row[:name]), result), + down_time=filter(row -> occursin("Downtime", row[:name]), result), + heat_rate_mmbtu_per_mwh=filter(row -> occursin("Heat Rate", row[:name]), result), + co2=filter(row -> occursin("CO2", row[:name]), result), ramp_dn_percentage=0.64, ramp_up_percentage=0.64, #Placeholder or default values (modeling assumptions) available=true, - minimum_required_capacity=0.0, + minimum_required_capacity=filter(row -> occursin("Minimum Stable", row[:name]), result), min_generation_percentage=0.0, maximum_capacity=1e8, power_systems_type=string(parametric), From f2fc4e40f02b045eabeb69fcb8049fa44bc22edb Mon Sep 17 00:00:00 2001 From: prao7 Date: Thu, 26 Sep 2024 11:41:02 -0600 Subject: [PATCH 10/40] fixes to type pulled from db --- src/generate_structs.jl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index 97c1771..c7364cc 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -428,22 +428,23 @@ function dataframe_to_structs(df_dict::Dict) # Data we should have but dont currently operation_costs=ThermalGenerationCost( variable=CostCurve(LinearCurve(0.0)), - fixed=filter(row -> occursin("FOM", row[:name]), result), + fixed=result[occursin("FOM", result[:name]), :value][1] + , start_up=0.0, shut_down=0.0, ), start_fuel_mmbtu_per_mw=2.0, - start_cost_per_mw=filter(row -> occursin("Startup Cost", row[:name]), result), - up_time=filter(row -> occursin("Uptime", row[:name]), result), - down_time=filter(row -> occursin("Downtime", row[:name]), result), - heat_rate_mmbtu_per_mwh=filter(row -> occursin("Heat Rate", row[:name]), result), - co2=filter(row -> occursin("CO2", row[:name]), result), + start_cost_per_mw=result[occursin("Startup Cost", result[:name]), :value][1], + up_time=result[occursin("Uptime", result[:name]), :value][1], + down_time=result[occursin("Downtime", result[:name]), :value][1], + heat_rate_mmbtu_per_mwh=result[occursin("Heat Rate", result[:name]), :value][1], + co2=result[occursin("CO2", result[:name]), :value][1], ramp_dn_percentage=0.64, ramp_up_percentage=0.64, #Placeholder or default values (modeling assumptions) available=true, - minimum_required_capacity=filter(row -> occursin("Minimum Stable", row[:name]), result), + minimum_required_capacity=result[occursin("Minimum Stable", result[:name]), :value][1], min_generation_percentage=0.0, maximum_capacity=1e8, power_systems_type=string(parametric), From 8e0bf2fcc89b8160d3d3b39f924894fe0096a765 Mon Sep 17 00:00:00 2001 From: prao7 Date: Thu, 26 Sep 2024 13:16:26 -0600 Subject: [PATCH 11/40] corrections to syntax --- src/generate_structs.jl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index c7364cc..f8463bf 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -428,23 +428,23 @@ function dataframe_to_structs(df_dict::Dict) # Data we should have but dont currently operation_costs=ThermalGenerationCost( variable=CostCurve(LinearCurve(0.0)), - fixed=result[occursin("FOM", result[:name]), :value][1] + fixed=result[occursin.("FOM", result[!, :name]), :value] , start_up=0.0, shut_down=0.0, ), start_fuel_mmbtu_per_mw=2.0, - start_cost_per_mw=result[occursin("Startup Cost", result[:name]), :value][1], - up_time=result[occursin("Uptime", result[:name]), :value][1], - down_time=result[occursin("Downtime", result[:name]), :value][1], - heat_rate_mmbtu_per_mwh=result[occursin("Heat Rate", result[:name]), :value][1], - co2=result[occursin("CO2", result[:name]), :value][1], + start_cost_per_mw=result[occursin.("Startup Cost", result[!, :name]), :value], + up_time=result[occursin.("Uptime", result[!, :name]), :value], + down_time=result[occursin.("Downtime", result[!, :name]), :value], + heat_rate_mmbtu_per_mwh=rresult[occursin.("Heat Rate", result[!, :name]), :value], + co2=result[occursin.("CO2", result[!, :name]), :value], ramp_dn_percentage=0.64, ramp_up_percentage=0.64, #Placeholder or default values (modeling assumptions) available=true, - minimum_required_capacity=result[occursin("Minimum Stable", result[:name]), :value][1], + minimum_required_capacity=result[occursin.("Minimum Stable", result[!, :name]), :value], min_generation_percentage=0.0, maximum_capacity=1e8, power_systems_type=string(parametric), From 418d437ea1c389b3aa57518e9e0cf559a0f16c04 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Thu, 26 Sep 2024 13:41:11 -0600 Subject: [PATCH 12/40] indexing typos --- src/generate_structs.jl | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index f8463bf..c2d418c 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -411,7 +411,7 @@ function dataframe_to_structs(df_dict::Dict) tech_id = row["unit_id"] result = filter(row -> row[:entity_id] in tech_id, df_dict["attributes"]) - + @show result[occursin.("Startup Cost", result[!, :name]), :value][1] parametric = map_prime_mover_to_parametric(row["prime_mover"]) t = SupplyTechnology{parametric}(; # Data pulled from DB @@ -428,23 +428,22 @@ function dataframe_to_structs(df_dict::Dict) # Data we should have but dont currently operation_costs=ThermalGenerationCost( variable=CostCurve(LinearCurve(0.0)), - fixed=result[occursin.("FOM", result[!, :name]), :value] - , + fixed=result[occursin.("FOM", result[!, :name]), :value][1], start_up=0.0, shut_down=0.0, ), start_fuel_mmbtu_per_mw=2.0, - start_cost_per_mw=result[occursin.("Startup Cost", result[!, :name]), :value], - up_time=result[occursin.("Uptime", result[!, :name]), :value], - down_time=result[occursin.("Downtime", result[!, :name]), :value], - heat_rate_mmbtu_per_mwh=rresult[occursin.("Heat Rate", result[!, :name]), :value], - co2=result[occursin.("CO2", result[!, :name]), :value], + start_cost_per_mw=result[occursin.("Startup Cost", result[!, :name]), :value][1], + up_time=result[occursin.("Uptime", result[!, :name]), :value][1], + down_time=result[occursin.("Downtime", result[!, :name]), :value][1], + heat_rate_mmbtu_per_mwh=result[occursin.("Heat Rate", result[!, :name]), :value][1], + co2=result[occursin.("CO2", result[!, :name]), :value][1], ramp_dn_percentage=0.64, ramp_up_percentage=0.64, #Placeholder or default values (modeling assumptions) available=true, - minimum_required_capacity=result[occursin.("Minimum Stable", result[!, :name]), :value], + minimum_required_capacity=result[occursin.("Minimum Stable", result[!, :name]), :value][1], min_generation_percentage=0.0, maximum_capacity=1e8, power_systems_type=string(parametric), From 7ca757b92add10b2832bbcbd22ddf78f02936853 Mon Sep 17 00:00:00 2001 From: prao7 Date: Thu, 26 Sep 2024 14:15:45 -0600 Subject: [PATCH 13/40] co2 and heat rate fix --- src/generate_structs.jl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index c2d418c..61d7255 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -410,6 +410,9 @@ function dataframe_to_structs(df_dict::Dict) # This will return all rows where entity_id matches any value in the tech_id vector tech_id = row["unit_id"] result = filter(row -> row[:entity_id] in tech_id, df_dict["attributes"]) + heat_rate_piecewise_lin = df_dict["piecewise_linear"][df_dict["piecewise_linear"][!, :entity_attribute_id] .== tech_id, :]["piecewise_linear_blob"] + parse_json_to_arrays(heat_rate_piecewise_lin) + @show result[occursin.("Startup Cost", result[!, :name]), :value][1] parametric = map_prime_mover_to_parametric(row["prime_mover"]) @@ -436,8 +439,9 @@ function dataframe_to_structs(df_dict::Dict) start_cost_per_mw=result[occursin.("Startup Cost", result[!, :name]), :value][1], up_time=result[occursin.("Uptime", result[!, :name]), :value][1], down_time=result[occursin.("Downtime", result[!, :name]), :value][1], - heat_rate_mmbtu_per_mwh=result[occursin.("Heat Rate", result[!, :name]), :value][1], - co2=result[occursin.("CO2", result[!, :name]), :value][1], + heat_rate_mmbtu_per_mwh=parse_json_to_arrays(heat_rate_piecewise_lin), + co2=length(result[occursin.("CO2", result[!, :name]), :value]) > 0 ? + coalesce(result[occursin.("CO2", result[!, :name]), :value][1], 0.0) : 0.0, ramp_dn_percentage=0.64, ramp_up_percentage=0.64, From 74459bdec9103b035f32a63334c43c8fbb8379ee Mon Sep 17 00:00:00 2001 From: prao7 Date: Thu, 26 Sep 2024 14:23:30 -0600 Subject: [PATCH 14/40] syntax correction --- src/generate_structs.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index 61d7255..cecc5e8 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -410,8 +410,7 @@ function dataframe_to_structs(df_dict::Dict) # This will return all rows where entity_id matches any value in the tech_id vector tech_id = row["unit_id"] result = filter(row -> row[:entity_id] in tech_id, df_dict["attributes"]) - heat_rate_piecewise_lin = df_dict["piecewise_linear"][df_dict["piecewise_linear"][!, :entity_attribute_id] .== tech_id, :]["piecewise_linear_blob"] - parse_json_to_arrays(heat_rate_piecewise_lin) + heat_rate_piecewise_lin = df_dict["piecewise_linear"][df_dict["piecewise_linear"][!, :entity_attribute_id] .== tech_id, :][:, "piecewise_linear_blob"] @show result[occursin.("Startup Cost", result[!, :name]), :value][1] From 99760fa5712365d124847218d028abcb571bca76 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Thu, 26 Sep 2024 14:58:20 -0600 Subject: [PATCH 15/40] bug fix --- src/generate_structs.jl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index cecc5e8..540da1b 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -410,10 +410,12 @@ function dataframe_to_structs(df_dict::Dict) # This will return all rows where entity_id matches any value in the tech_id vector tech_id = row["unit_id"] result = filter(row -> row[:entity_id] in tech_id, df_dict["attributes"]) - heat_rate_piecewise_lin = df_dict["piecewise_linear"][df_dict["piecewise_linear"][!, :entity_attribute_id] .== tech_id, :][:, "piecewise_linear_blob"] + + gen_entity_attribute_id = isempty(df_dict["attributes"][df_dict["attributes"][!, :entity_id] .== tech_id .&& occursin.("Heat Rate", df_dict["attributes"][!, :name]), :entity_attribute_id]) ? 0.0 : df_dict["attributes"][df_dict["attributes"][!, :entity_id] .== tech_id .&& occursin.("Heat Rate", df_dict["attributes"][!, :name]), :entity_attribute_id][1] + heat_rate_piecewise_lin = df_dict["piecewise_linear"][df_dict["piecewise_linear"][!, :entity_attribute_id] .== gen_entity_attribute_id, :][:, "piecewise_linear_blob"][1] - @show result[occursin.("Startup Cost", result[!, :name]), :value][1] + @show heat_rate_piecewise_lin parametric = map_prime_mover_to_parametric(row["prime_mover"]) t = SupplyTechnology{parametric}(; # Data pulled from DB @@ -438,7 +440,7 @@ function dataframe_to_structs(df_dict::Dict) start_cost_per_mw=result[occursin.("Startup Cost", result[!, :name]), :value][1], up_time=result[occursin.("Uptime", result[!, :name]), :value][1], down_time=result[occursin.("Downtime", result[!, :name]), :value][1], - heat_rate_mmbtu_per_mwh=parse_json_to_arrays(heat_rate_piecewise_lin), + heat_rate_mmbtu_per_mwh=0.0,#parse_json_to_arrays(heat_rate_piecewise_lin), co2=length(result[occursin.("CO2", result[!, :name]), :value]) > 0 ? coalesce(result[occursin.("CO2", result[!, :name]), :value][1], 0.0) : 0.0, ramp_dn_percentage=0.64, From f4912de1ace67094d368a2512e77165e86b0aa31 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Wed, 16 Oct 2024 10:46:33 -0600 Subject: [PATCH 16/40] add three separate structs for TransportTechnology --- src/generate_structs.jl | 2 +- src/models/generated/ACTransportTechnology.jl | 159 ++++++++++++++++++ src/models/generated/DemandRequirement.jl | 6 +- .../generated/ExistingTransportTechnology.jl | 159 ++++++++++++++++++ .../generated/HVDCTransportTechnology.jl | 159 ++++++++++++++++++ src/models/generated/StorageTechnology.jl | 6 +- src/models/generated/SupplyTechnology.jl | 6 +- src/models/generated/TransportTechnology.jl | 159 ------------------ src/models/generated/includes.jl | 4 +- 9 files changed, 490 insertions(+), 170 deletions(-) create mode 100644 src/models/generated/ACTransportTechnology.jl create mode 100644 src/models/generated/ExistingTransportTechnology.jl create mode 100644 src/models/generated/HVDCTransportTechnology.jl delete mode 100644 src/models/generated/TransportTechnology.jl diff --git a/src/generate_structs.jl b/src/generate_structs.jl index 30f2c48..6a881e4 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -11,7 +11,7 @@ function generate_invest_structs(directory, data::JSONSchema.Schema; print_resul unique_accessor_functions = Set{String}() unique_setter_functions = Set{String}() - for (struct_name, input) in data.data["\$defs"] + for (struct_name, input) in data.data["components"]["schemas"] properties = input["properties"] item = Dict{String, Any}() item["has_internal"] = false diff --git a/src/models/generated/ACTransportTechnology.jl b/src/models/generated/ACTransportTechnology.jl new file mode 100644 index 0000000..84af753 --- /dev/null +++ b/src/models/generated/ACTransportTechnology.jl @@ -0,0 +1,159 @@ +#= +This file is auto-generated. Do not edit. +=# + +#! format: off + +""" + mutable struct ACTransportTechnology{T <: PSY.Device} <: Technology + capital_cost::PSY.ValueCurve + start_region::Int64 + available::Bool + name::String + capital_recovery_factor::Int64 + end_region::Int64 + power_systems_type::String + angle_limit::Float64 + internal::InfrastructureSystemsInternal + ext::Dict + resistance::Float64 + voltage::Float64 + network_id::Int64 + maximum_new_capacity::Float64 + existing_line_capacity::Float64 + wacc::Float64 + line_loss::Float64 + end + + + +# Arguments +- `capital_cost::PSY.ValueCurve`: Cost of adding new capacity to the inter-regional transmission line. +- `start_region::Int64`: Start region for transport technology +- `available::Bool`: identifies whether the technology is available +- `name::String`: Name +- `capital_recovery_factor::Int64`: (default: `0`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. +- `end_region::Int64`: End region for transport technology +- `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling +- `angle_limit::Float64`: (default: `0.0`) Votlage angle limit (radians) +- `internal::InfrastructureSystemsInternal`: (default: `InfrastructureSystemsInternal()`) Internal field +- `ext::Dict`: (default: `Dict()`) Option for providing additional data +- `resistance::Float64`: (default: `0.0`) Technology resistance in Ohms +- `voltage::Float64`: (default: `0.0`) Technology resistance in Ohms +- `network_id::Int64`: Numerical Index +- `maximum_new_capacity::Float64`: Maximum capacity that can be added to transmission line (MW) +- `existing_line_capacity::Float64`: Existing capacity of transport technology (MW) +- `wacc::Float64`: (default: `0`) Weighted average cost of capital +- `line_loss::Float64`: Transmission loss for each transport technology (%) +""" +mutable struct ACTransportTechnology{T <: PSY.Device} <: Technology + "Cost of adding new capacity to the inter-regional transmission line." + capital_cost::PSY.ValueCurve + "Start region for transport technology" + start_region::Int64 + "identifies whether the technology is available" + available::Bool + "Name" + name::String + "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion." + capital_recovery_factor::Int64 + "End region for transport technology" + end_region::Int64 + "maps to a valid PowerSystems.jl for PCM modeling" + power_systems_type::String + "Votlage angle limit (radians)" + angle_limit::Float64 + "Internal field" + internal::InfrastructureSystemsInternal + "Option for providing additional data" + ext::Dict + "Technology resistance in Ohms" + resistance::Float64 + "Technology resistance in Ohms" + voltage::Float64 + "Numerical Index" + network_id::Int64 + "Maximum capacity that can be added to transmission line (MW)" + maximum_new_capacity::Float64 + "Existing capacity of transport technology (MW)" + existing_line_capacity::Float64 + "Weighted average cost of capital" + wacc::Float64 + "Transmission loss for each transport technology (%)" + line_loss::Float64 +end + + +function ACTransportTechnology{T}(; capital_cost, start_region, available, name, capital_recovery_factor=0, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device + ACTransportTechnology{T}(capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, existing_line_capacity, wacc, line_loss, ) +end + +"""Get [`ACTransportTechnology`](@ref) `capital_cost`.""" +get_capital_cost(value::ACTransportTechnology) = value.capital_cost +"""Get [`ACTransportTechnology`](@ref) `start_region`.""" +get_start_region(value::ACTransportTechnology) = value.start_region +"""Get [`ACTransportTechnology`](@ref) `available`.""" +get_available(value::ACTransportTechnology) = value.available +"""Get [`ACTransportTechnology`](@ref) `name`.""" +get_name(value::ACTransportTechnology) = value.name +"""Get [`ACTransportTechnology`](@ref) `capital_recovery_factor`.""" +get_capital_recovery_factor(value::ACTransportTechnology) = value.capital_recovery_factor +"""Get [`ACTransportTechnology`](@ref) `end_region`.""" +get_end_region(value::ACTransportTechnology) = value.end_region +"""Get [`ACTransportTechnology`](@ref) `power_systems_type`.""" +get_power_systems_type(value::ACTransportTechnology) = value.power_systems_type +"""Get [`ACTransportTechnology`](@ref) `angle_limit`.""" +get_angle_limit(value::ACTransportTechnology) = value.angle_limit +"""Get [`ACTransportTechnology`](@ref) `internal`.""" +get_internal(value::ACTransportTechnology) = value.internal +"""Get [`ACTransportTechnology`](@ref) `ext`.""" +get_ext(value::ACTransportTechnology) = value.ext +"""Get [`ACTransportTechnology`](@ref) `resistance`.""" +get_resistance(value::ACTransportTechnology) = value.resistance +"""Get [`ACTransportTechnology`](@ref) `voltage`.""" +get_voltage(value::ACTransportTechnology) = value.voltage +"""Get [`ACTransportTechnology`](@ref) `network_id`.""" +get_network_id(value::ACTransportTechnology) = value.network_id +"""Get [`ACTransportTechnology`](@ref) `maximum_new_capacity`.""" +get_maximum_new_capacity(value::ACTransportTechnology) = value.maximum_new_capacity +"""Get [`ACTransportTechnology`](@ref) `existing_line_capacity`.""" +get_existing_line_capacity(value::ACTransportTechnology) = value.existing_line_capacity +"""Get [`ACTransportTechnology`](@ref) `wacc`.""" +get_wacc(value::ACTransportTechnology) = value.wacc +"""Get [`ACTransportTechnology`](@ref) `line_loss`.""" +get_line_loss(value::ACTransportTechnology) = value.line_loss + +"""Set [`ACTransportTechnology`](@ref) `capital_cost`.""" +set_capital_cost!(value::ACTransportTechnology, val) = value.capital_cost = val +"""Set [`ACTransportTechnology`](@ref) `start_region`.""" +set_start_region!(value::ACTransportTechnology, val) = value.start_region = val +"""Set [`ACTransportTechnology`](@ref) `available`.""" +set_available!(value::ACTransportTechnology, val) = value.available = val +"""Set [`ACTransportTechnology`](@ref) `name`.""" +set_name!(value::ACTransportTechnology, val) = value.name = val +"""Set [`ACTransportTechnology`](@ref) `capital_recovery_factor`.""" +set_capital_recovery_factor!(value::ACTransportTechnology, val) = value.capital_recovery_factor = val +"""Set [`ACTransportTechnology`](@ref) `end_region`.""" +set_end_region!(value::ACTransportTechnology, val) = value.end_region = val +"""Set [`ACTransportTechnology`](@ref) `power_systems_type`.""" +set_power_systems_type!(value::ACTransportTechnology, val) = value.power_systems_type = val +"""Set [`ACTransportTechnology`](@ref) `angle_limit`.""" +set_angle_limit!(value::ACTransportTechnology, val) = value.angle_limit = val +"""Set [`ACTransportTechnology`](@ref) `internal`.""" +set_internal!(value::ACTransportTechnology, val) = value.internal = val +"""Set [`ACTransportTechnology`](@ref) `ext`.""" +set_ext!(value::ACTransportTechnology, val) = value.ext = val +"""Set [`ACTransportTechnology`](@ref) `resistance`.""" +set_resistance!(value::ACTransportTechnology, val) = value.resistance = val +"""Set [`ACTransportTechnology`](@ref) `voltage`.""" +set_voltage!(value::ACTransportTechnology, val) = value.voltage = val +"""Set [`ACTransportTechnology`](@ref) `network_id`.""" +set_network_id!(value::ACTransportTechnology, val) = value.network_id = val +"""Set [`ACTransportTechnology`](@ref) `maximum_new_capacity`.""" +set_maximum_new_capacity!(value::ACTransportTechnology, val) = value.maximum_new_capacity = val +"""Set [`ACTransportTechnology`](@ref) `existing_line_capacity`.""" +set_existing_line_capacity!(value::ACTransportTechnology, val) = value.existing_line_capacity = val +"""Set [`ACTransportTechnology`](@ref) `wacc`.""" +set_wacc!(value::ACTransportTechnology, val) = value.wacc = val +"""Set [`ACTransportTechnology`](@ref) `line_loss`.""" +set_line_loss!(value::ACTransportTechnology, val) = value.line_loss = val diff --git a/src/models/generated/DemandRequirement.jl b/src/models/generated/DemandRequirement.jl index ec7f6d0..a2022e9 100644 --- a/src/models/generated/DemandRequirement.jl +++ b/src/models/generated/DemandRequirement.jl @@ -7,7 +7,7 @@ This file is auto-generated. Do not edit. """ mutable struct DemandRequirement{T <: PSY.StaticInjection} <: Technology name::String - zone::Union{Nothing, Zone} + zone::Union{Nothing, Int64, Zone} power_systems_type::String internal::InfrastructureSystemsInternal ext::Dict @@ -19,7 +19,7 @@ This file is auto-generated. Do not edit. # Arguments - `name::String`: The technology name -- `zone::Union{Nothing, Zone}`: Zone Number +- `zone::Union{Nothing, Int64, Zone}`: Zone Number - `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling - `internal::InfrastructureSystemsInternal`: (default: `InfrastructureSystemsInternal()`) Internal field - `ext::Dict`: (default: `Dict()`) Option for providing additional data @@ -30,7 +30,7 @@ mutable struct DemandRequirement{T <: PSY.StaticInjection} <: Technology "The technology name" name::String "Zone Number" - zone::Union{Nothing, Zone} + zone::Union{Nothing, Int64, Zone} "maps to a valid PowerSystems.jl for PCM modeling" power_systems_type::String "Internal field" diff --git a/src/models/generated/ExistingTransportTechnology.jl b/src/models/generated/ExistingTransportTechnology.jl new file mode 100644 index 0000000..3eaae42 --- /dev/null +++ b/src/models/generated/ExistingTransportTechnology.jl @@ -0,0 +1,159 @@ +#= +This file is auto-generated. Do not edit. +=# + +#! format: off + +""" + mutable struct ExistingTransportTechnology{T <: PSY.Device} <: Technology + capital_cost::PSY.ValueCurve + start_region::Int64 + available::Bool + name::String + capital_recovery_factor::Int64 + end_region::Int64 + power_systems_type::String + angle_limit::Float64 + internal::InfrastructureSystemsInternal + ext::Dict + resistance::Float64 + voltage::Float64 + network_id::Int64 + maximum_new_capacity::Float64 + existing_line_capacity::Float64 + wacc::Float64 + line_loss::Float64 + end + + + +# Arguments +- `capital_cost::PSY.ValueCurve`: Cost of adding new capacity to the inter-regional transmission line. +- `start_region::Int64`: Start region for transport technology +- `available::Bool`: identifies whether the technology is available +- `name::String`: Name +- `capital_recovery_factor::Int64`: (default: `0`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. +- `end_region::Int64`: End region for transport technology +- `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling +- `angle_limit::Float64`: (default: `0.0`) Votlage angle limit (radians) +- `internal::InfrastructureSystemsInternal`: (default: `InfrastructureSystemsInternal()`) Internal field +- `ext::Dict`: (default: `Dict()`) Option for providing additional data +- `resistance::Float64`: (default: `0.0`) Technology resistance in Ohms +- `voltage::Float64`: (default: `0.0`) Technology resistance in Ohms +- `network_id::Int64`: Numerical Index +- `maximum_new_capacity::Float64`: Maximum capacity that can be added to transmission line (MW) +- `existing_line_capacity::Float64`: Existing capacity of transport technology (MW) +- `wacc::Float64`: (default: `0`) Weighted average cost of capital +- `line_loss::Float64`: Transmission loss for each transport technology (%) +""" +mutable struct ExistingTransportTechnology{T <: PSY.Device} <: Technology + "Cost of adding new capacity to the inter-regional transmission line." + capital_cost::PSY.ValueCurve + "Start region for transport technology" + start_region::Int64 + "identifies whether the technology is available" + available::Bool + "Name" + name::String + "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion." + capital_recovery_factor::Int64 + "End region for transport technology" + end_region::Int64 + "maps to a valid PowerSystems.jl for PCM modeling" + power_systems_type::String + "Votlage angle limit (radians)" + angle_limit::Float64 + "Internal field" + internal::InfrastructureSystemsInternal + "Option for providing additional data" + ext::Dict + "Technology resistance in Ohms" + resistance::Float64 + "Technology resistance in Ohms" + voltage::Float64 + "Numerical Index" + network_id::Int64 + "Maximum capacity that can be added to transmission line (MW)" + maximum_new_capacity::Float64 + "Existing capacity of transport technology (MW)" + existing_line_capacity::Float64 + "Weighted average cost of capital" + wacc::Float64 + "Transmission loss for each transport technology (%)" + line_loss::Float64 +end + + +function ExistingTransportTechnology{T}(; capital_cost, start_region, available, name, capital_recovery_factor=0, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device + ExistingTransportTechnology{T}(capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, existing_line_capacity, wacc, line_loss, ) +end + +"""Get [`ExistingTransportTechnology`](@ref) `capital_cost`.""" +get_capital_cost(value::ExistingTransportTechnology) = value.capital_cost +"""Get [`ExistingTransportTechnology`](@ref) `start_region`.""" +get_start_region(value::ExistingTransportTechnology) = value.start_region +"""Get [`ExistingTransportTechnology`](@ref) `available`.""" +get_available(value::ExistingTransportTechnology) = value.available +"""Get [`ExistingTransportTechnology`](@ref) `name`.""" +get_name(value::ExistingTransportTechnology) = value.name +"""Get [`ExistingTransportTechnology`](@ref) `capital_recovery_factor`.""" +get_capital_recovery_factor(value::ExistingTransportTechnology) = value.capital_recovery_factor +"""Get [`ExistingTransportTechnology`](@ref) `end_region`.""" +get_end_region(value::ExistingTransportTechnology) = value.end_region +"""Get [`ExistingTransportTechnology`](@ref) `power_systems_type`.""" +get_power_systems_type(value::ExistingTransportTechnology) = value.power_systems_type +"""Get [`ExistingTransportTechnology`](@ref) `angle_limit`.""" +get_angle_limit(value::ExistingTransportTechnology) = value.angle_limit +"""Get [`ExistingTransportTechnology`](@ref) `internal`.""" +get_internal(value::ExistingTransportTechnology) = value.internal +"""Get [`ExistingTransportTechnology`](@ref) `ext`.""" +get_ext(value::ExistingTransportTechnology) = value.ext +"""Get [`ExistingTransportTechnology`](@ref) `resistance`.""" +get_resistance(value::ExistingTransportTechnology) = value.resistance +"""Get [`ExistingTransportTechnology`](@ref) `voltage`.""" +get_voltage(value::ExistingTransportTechnology) = value.voltage +"""Get [`ExistingTransportTechnology`](@ref) `network_id`.""" +get_network_id(value::ExistingTransportTechnology) = value.network_id +"""Get [`ExistingTransportTechnology`](@ref) `maximum_new_capacity`.""" +get_maximum_new_capacity(value::ExistingTransportTechnology) = value.maximum_new_capacity +"""Get [`ExistingTransportTechnology`](@ref) `existing_line_capacity`.""" +get_existing_line_capacity(value::ExistingTransportTechnology) = value.existing_line_capacity +"""Get [`ExistingTransportTechnology`](@ref) `wacc`.""" +get_wacc(value::ExistingTransportTechnology) = value.wacc +"""Get [`ExistingTransportTechnology`](@ref) `line_loss`.""" +get_line_loss(value::ExistingTransportTechnology) = value.line_loss + +"""Set [`ExistingTransportTechnology`](@ref) `capital_cost`.""" +set_capital_cost!(value::ExistingTransportTechnology, val) = value.capital_cost = val +"""Set [`ExistingTransportTechnology`](@ref) `start_region`.""" +set_start_region!(value::ExistingTransportTechnology, val) = value.start_region = val +"""Set [`ExistingTransportTechnology`](@ref) `available`.""" +set_available!(value::ExistingTransportTechnology, val) = value.available = val +"""Set [`ExistingTransportTechnology`](@ref) `name`.""" +set_name!(value::ExistingTransportTechnology, val) = value.name = val +"""Set [`ExistingTransportTechnology`](@ref) `capital_recovery_factor`.""" +set_capital_recovery_factor!(value::ExistingTransportTechnology, val) = value.capital_recovery_factor = val +"""Set [`ExistingTransportTechnology`](@ref) `end_region`.""" +set_end_region!(value::ExistingTransportTechnology, val) = value.end_region = val +"""Set [`ExistingTransportTechnology`](@ref) `power_systems_type`.""" +set_power_systems_type!(value::ExistingTransportTechnology, val) = value.power_systems_type = val +"""Set [`ExistingTransportTechnology`](@ref) `angle_limit`.""" +set_angle_limit!(value::ExistingTransportTechnology, val) = value.angle_limit = val +"""Set [`ExistingTransportTechnology`](@ref) `internal`.""" +set_internal!(value::ExistingTransportTechnology, val) = value.internal = val +"""Set [`ExistingTransportTechnology`](@ref) `ext`.""" +set_ext!(value::ExistingTransportTechnology, val) = value.ext = val +"""Set [`ExistingTransportTechnology`](@ref) `resistance`.""" +set_resistance!(value::ExistingTransportTechnology, val) = value.resistance = val +"""Set [`ExistingTransportTechnology`](@ref) `voltage`.""" +set_voltage!(value::ExistingTransportTechnology, val) = value.voltage = val +"""Set [`ExistingTransportTechnology`](@ref) `network_id`.""" +set_network_id!(value::ExistingTransportTechnology, val) = value.network_id = val +"""Set [`ExistingTransportTechnology`](@ref) `maximum_new_capacity`.""" +set_maximum_new_capacity!(value::ExistingTransportTechnology, val) = value.maximum_new_capacity = val +"""Set [`ExistingTransportTechnology`](@ref) `existing_line_capacity`.""" +set_existing_line_capacity!(value::ExistingTransportTechnology, val) = value.existing_line_capacity = val +"""Set [`ExistingTransportTechnology`](@ref) `wacc`.""" +set_wacc!(value::ExistingTransportTechnology, val) = value.wacc = val +"""Set [`ExistingTransportTechnology`](@ref) `line_loss`.""" +set_line_loss!(value::ExistingTransportTechnology, val) = value.line_loss = val diff --git a/src/models/generated/HVDCTransportTechnology.jl b/src/models/generated/HVDCTransportTechnology.jl new file mode 100644 index 0000000..014769e --- /dev/null +++ b/src/models/generated/HVDCTransportTechnology.jl @@ -0,0 +1,159 @@ +#= +This file is auto-generated. Do not edit. +=# + +#! format: off + +""" + mutable struct HVDCTransportTechnology{T <: PSY.Device} <: Technology + capital_cost::PSY.ValueCurve + start_region::Int64 + available::Bool + name::String + capital_recovery_factor::Int64 + end_region::Int64 + power_systems_type::String + angle_limit::Float64 + internal::InfrastructureSystemsInternal + ext::Dict + resistance::Float64 + voltage::Float64 + network_id::Int64 + maximum_new_capacity::Float64 + existing_line_capacity::Float64 + wacc::Float64 + line_loss::Float64 + end + + + +# Arguments +- `capital_cost::PSY.ValueCurve`: Cost of adding new capacity to the inter-regional transmission line. +- `start_region::Int64`: Start region for transport technology +- `available::Bool`: identifies whether the technology is available +- `name::String`: Name +- `capital_recovery_factor::Int64`: (default: `0`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. +- `end_region::Int64`: End region for transport technology +- `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling +- `angle_limit::Float64`: (default: `0.0`) Votlage angle limit (radians) +- `internal::InfrastructureSystemsInternal`: (default: `InfrastructureSystemsInternal()`) Internal field +- `ext::Dict`: (default: `Dict()`) Option for providing additional data +- `resistance::Float64`: (default: `0.0`) Technology resistance in Ohms +- `voltage::Float64`: (default: `0.0`) Technology resistance in Ohms +- `network_id::Int64`: Numerical Index +- `maximum_new_capacity::Float64`: Maximum capacity that can be added to transmission line (MW) +- `existing_line_capacity::Float64`: Existing capacity of transport technology (MW) +- `wacc::Float64`: (default: `0`) Weighted average cost of capital +- `line_loss::Float64`: Transmission loss for each transport technology (%) +""" +mutable struct HVDCTransportTechnology{T <: PSY.Device} <: Technology + "Cost of adding new capacity to the inter-regional transmission line." + capital_cost::PSY.ValueCurve + "Start region for transport technology" + start_region::Int64 + "identifies whether the technology is available" + available::Bool + "Name" + name::String + "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion." + capital_recovery_factor::Int64 + "End region for transport technology" + end_region::Int64 + "maps to a valid PowerSystems.jl for PCM modeling" + power_systems_type::String + "Votlage angle limit (radians)" + angle_limit::Float64 + "Internal field" + internal::InfrastructureSystemsInternal + "Option for providing additional data" + ext::Dict + "Technology resistance in Ohms" + resistance::Float64 + "Technology resistance in Ohms" + voltage::Float64 + "Numerical Index" + network_id::Int64 + "Maximum capacity that can be added to transmission line (MW)" + maximum_new_capacity::Float64 + "Existing capacity of transport technology (MW)" + existing_line_capacity::Float64 + "Weighted average cost of capital" + wacc::Float64 + "Transmission loss for each transport technology (%)" + line_loss::Float64 +end + + +function HVDCTransportTechnology{T}(; capital_cost, start_region, available, name, capital_recovery_factor=0, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device + HVDCTransportTechnology{T}(capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, existing_line_capacity, wacc, line_loss, ) +end + +"""Get [`HVDCTransportTechnology`](@ref) `capital_cost`.""" +get_capital_cost(value::HVDCTransportTechnology) = value.capital_cost +"""Get [`HVDCTransportTechnology`](@ref) `start_region`.""" +get_start_region(value::HVDCTransportTechnology) = value.start_region +"""Get [`HVDCTransportTechnology`](@ref) `available`.""" +get_available(value::HVDCTransportTechnology) = value.available +"""Get [`HVDCTransportTechnology`](@ref) `name`.""" +get_name(value::HVDCTransportTechnology) = value.name +"""Get [`HVDCTransportTechnology`](@ref) `capital_recovery_factor`.""" +get_capital_recovery_factor(value::HVDCTransportTechnology) = value.capital_recovery_factor +"""Get [`HVDCTransportTechnology`](@ref) `end_region`.""" +get_end_region(value::HVDCTransportTechnology) = value.end_region +"""Get [`HVDCTransportTechnology`](@ref) `power_systems_type`.""" +get_power_systems_type(value::HVDCTransportTechnology) = value.power_systems_type +"""Get [`HVDCTransportTechnology`](@ref) `angle_limit`.""" +get_angle_limit(value::HVDCTransportTechnology) = value.angle_limit +"""Get [`HVDCTransportTechnology`](@ref) `internal`.""" +get_internal(value::HVDCTransportTechnology) = value.internal +"""Get [`HVDCTransportTechnology`](@ref) `ext`.""" +get_ext(value::HVDCTransportTechnology) = value.ext +"""Get [`HVDCTransportTechnology`](@ref) `resistance`.""" +get_resistance(value::HVDCTransportTechnology) = value.resistance +"""Get [`HVDCTransportTechnology`](@ref) `voltage`.""" +get_voltage(value::HVDCTransportTechnology) = value.voltage +"""Get [`HVDCTransportTechnology`](@ref) `network_id`.""" +get_network_id(value::HVDCTransportTechnology) = value.network_id +"""Get [`HVDCTransportTechnology`](@ref) `maximum_new_capacity`.""" +get_maximum_new_capacity(value::HVDCTransportTechnology) = value.maximum_new_capacity +"""Get [`HVDCTransportTechnology`](@ref) `existing_line_capacity`.""" +get_existing_line_capacity(value::HVDCTransportTechnology) = value.existing_line_capacity +"""Get [`HVDCTransportTechnology`](@ref) `wacc`.""" +get_wacc(value::HVDCTransportTechnology) = value.wacc +"""Get [`HVDCTransportTechnology`](@ref) `line_loss`.""" +get_line_loss(value::HVDCTransportTechnology) = value.line_loss + +"""Set [`HVDCTransportTechnology`](@ref) `capital_cost`.""" +set_capital_cost!(value::HVDCTransportTechnology, val) = value.capital_cost = val +"""Set [`HVDCTransportTechnology`](@ref) `start_region`.""" +set_start_region!(value::HVDCTransportTechnology, val) = value.start_region = val +"""Set [`HVDCTransportTechnology`](@ref) `available`.""" +set_available!(value::HVDCTransportTechnology, val) = value.available = val +"""Set [`HVDCTransportTechnology`](@ref) `name`.""" +set_name!(value::HVDCTransportTechnology, val) = value.name = val +"""Set [`HVDCTransportTechnology`](@ref) `capital_recovery_factor`.""" +set_capital_recovery_factor!(value::HVDCTransportTechnology, val) = value.capital_recovery_factor = val +"""Set [`HVDCTransportTechnology`](@ref) `end_region`.""" +set_end_region!(value::HVDCTransportTechnology, val) = value.end_region = val +"""Set [`HVDCTransportTechnology`](@ref) `power_systems_type`.""" +set_power_systems_type!(value::HVDCTransportTechnology, val) = value.power_systems_type = val +"""Set [`HVDCTransportTechnology`](@ref) `angle_limit`.""" +set_angle_limit!(value::HVDCTransportTechnology, val) = value.angle_limit = val +"""Set [`HVDCTransportTechnology`](@ref) `internal`.""" +set_internal!(value::HVDCTransportTechnology, val) = value.internal = val +"""Set [`HVDCTransportTechnology`](@ref) `ext`.""" +set_ext!(value::HVDCTransportTechnology, val) = value.ext = val +"""Set [`HVDCTransportTechnology`](@ref) `resistance`.""" +set_resistance!(value::HVDCTransportTechnology, val) = value.resistance = val +"""Set [`HVDCTransportTechnology`](@ref) `voltage`.""" +set_voltage!(value::HVDCTransportTechnology, val) = value.voltage = val +"""Set [`HVDCTransportTechnology`](@ref) `network_id`.""" +set_network_id!(value::HVDCTransportTechnology, val) = value.network_id = val +"""Set [`HVDCTransportTechnology`](@ref) `maximum_new_capacity`.""" +set_maximum_new_capacity!(value::HVDCTransportTechnology, val) = value.maximum_new_capacity = val +"""Set [`HVDCTransportTechnology`](@ref) `existing_line_capacity`.""" +set_existing_line_capacity!(value::HVDCTransportTechnology, val) = value.existing_line_capacity = val +"""Set [`HVDCTransportTechnology`](@ref) `wacc`.""" +set_wacc!(value::HVDCTransportTechnology, val) = value.wacc = val +"""Set [`HVDCTransportTechnology`](@ref) `line_loss`.""" +set_line_loss!(value::HVDCTransportTechnology, val) = value.line_loss = val diff --git a/src/models/generated/StorageTechnology.jl b/src/models/generated/StorageTechnology.jl index 8c9c9bc..821217e 100644 --- a/src/models/generated/StorageTechnology.jl +++ b/src/models/generated/StorageTechnology.jl @@ -8,7 +8,7 @@ This file is auto-generated. Do not edit. mutable struct StorageTechnology{T <: PSY.Storage} <: Technology base_power::Float64 om_costs_energy::PSY.OperationalCost - zone::Union{Nothing, Zone} + zone::Union{Nothing, Int64, Zone} prime_mover_type::PrimeMovers existing_cap_energy::Float64 rsv_cost::Float64 @@ -46,7 +46,7 @@ This file is auto-generated. Do not edit. # Arguments - `base_power::Float64`: Base power - `om_costs_energy::PSY.OperationalCost`: (default: `StorageCost()`) Fixed and variable O&M costs for a technology -- `zone::Union{Nothing, Zone}`: Zone number +- `zone::Union{Nothing, Int64, Zone}`: Zone number - `prime_mover_type::PrimeMovers`: (default: `PrimeMovers.OT`) Prime mover for generator - `existing_cap_energy::Float64`: (default: `0.0`) Pre-existing energy capacity for a technology (MWh) - `rsv_cost::Float64`: (default: `0.0`) Cost of providing upwards spinning or contingency reserves @@ -84,7 +84,7 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology "Fixed and variable O&M costs for a technology" om_costs_energy::PSY.OperationalCost "Zone number" - zone::Union{Nothing, Zone} + zone::Union{Nothing, Int64, Zone} "Prime mover for generator" prime_mover_type::PrimeMovers "Pre-existing energy capacity for a technology (MWh)" diff --git a/src/models/generated/SupplyTechnology.jl b/src/models/generated/SupplyTechnology.jl index 4e2c093..d0f5b8c 100644 --- a/src/models/generated/SupplyTechnology.jl +++ b/src/models/generated/SupplyTechnology.jl @@ -8,7 +8,7 @@ This file is auto-generated. Do not edit. mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology base_power::Float64 heat_rate_mmbtu_per_mwh::Union{Float64, PSY.ValueCurve, Dict{ThermalFuels, PSY.ValueCurve}} - zone::Union{Nothing, Zone} + zone::Union{Nothing, Int64, Zone} prime_mover_type::PrimeMovers minimum_required_capacity::Float64 cofire_level_min::Union{Nothing, Dict{ThermalFuels, Float64}} @@ -49,7 +49,7 @@ This file is auto-generated. Do not edit. # Arguments - `base_power::Float64`: Base power - `heat_rate_mmbtu_per_mwh::Union{Float64, PSY.ValueCurve, Dict{ThermalFuels, PSY.ValueCurve}}`: (default: `0.0`) Heat rate of generator, MMBTU/MWh -- `zone::Union{Nothing, Zone}`: (default: `nothing`) Zone where tech operates in +- `zone::Union{Nothing, Int64, Zone}`: (default: `nothing`) Zone where tech operates in - `prime_mover_type::PrimeMovers`: (default: `PrimeMovers.OT`) Prime mover for generator - `minimum_required_capacity::Float64`: (default: `0.0`) Minimum required capacity for a technology - `cofire_level_min::Union{Nothing, Dict{ThermalFuels, Float64}}`: (default: `nothing`) Minimum blending level of each fuel during normal generation process for multi-fuel generator @@ -90,7 +90,7 @@ mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology "Heat rate of generator, MMBTU/MWh" heat_rate_mmbtu_per_mwh::Union{Float64, PSY.ValueCurve, Dict{ThermalFuels, PSY.ValueCurve}} "Zone where tech operates in" - zone::Union{Nothing, Zone} + zone::Union{Nothing, Int64, Zone} "Prime mover for generator" prime_mover_type::PrimeMovers "Minimum required capacity for a technology" diff --git a/src/models/generated/TransportTechnology.jl b/src/models/generated/TransportTechnology.jl deleted file mode 100644 index 2aa9784..0000000 --- a/src/models/generated/TransportTechnology.jl +++ /dev/null @@ -1,159 +0,0 @@ -#= -This file is auto-generated. Do not edit. -=# - -#! format: off - -""" - mutable struct TransportTechnology{T <: PSY.Device} <: Technology - capital_cost::PSY.ValueCurve - start_region::Int64 - available::Bool - name::String - capital_recovery_factor::Int64 - end_region::Int64 - power_systems_type::String - angle_limit::Float64 - internal::InfrastructureSystemsInternal - ext::Dict - resistance::Float64 - voltage::Float64 - network_id::Int64 - maximum_new_capacity::Float64 - existing_line_capacity::Float64 - wacc::Float64 - line_loss::Float64 - end - - - -# Arguments -- `capital_cost::PSY.ValueCurve`: Cost of adding new capacity to the inter-regional transmission line. -- `start_region::Int64`: Start region for transport technology -- `available::Bool`: identifies whether the technology is available -- `name::String`: Name -- `capital_recovery_factor::Int64`: (default: `0`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. -- `end_region::Int64`: End region for transport technology -- `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling -- `angle_limit::Float64`: (default: `0.0`) Votlage angle limit (radians) -- `internal::InfrastructureSystemsInternal`: (default: `InfrastructureSystemsInternal()`) Internal field -- `ext::Dict`: (default: `Dict()`) Option for providing additional data -- `resistance::Float64`: (default: `0.0`) Technology resistance in Ohms -- `voltage::Float64`: (default: `0.0`) Technology resistance in Ohms -- `network_id::Int64`: Numerical Index -- `maximum_new_capacity::Float64`: Maximum capacity that can be added to transmission line (MW) -- `existing_line_capacity::Float64`: Existing capacity of transport technology (MW) -- `wacc::Float64`: (default: `0`) Weighted average cost of capital -- `line_loss::Float64`: Transmission loss for each transport technology (%) -""" -mutable struct TransportTechnology{T <: PSY.Device} <: Technology - "Cost of adding new capacity to the inter-regional transmission line." - capital_cost::PSY.ValueCurve - "Start region for transport technology" - start_region::Int64 - "identifies whether the technology is available" - available::Bool - "Name" - name::String - "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion." - capital_recovery_factor::Int64 - "End region for transport technology" - end_region::Int64 - "maps to a valid PowerSystems.jl for PCM modeling" - power_systems_type::String - "Votlage angle limit (radians)" - angle_limit::Float64 - "Internal field" - internal::InfrastructureSystemsInternal - "Option for providing additional data" - ext::Dict - "Technology resistance in Ohms" - resistance::Float64 - "Technology resistance in Ohms" - voltage::Float64 - "Numerical Index" - network_id::Int64 - "Maximum capacity that can be added to transmission line (MW)" - maximum_new_capacity::Float64 - "Existing capacity of transport technology (MW)" - existing_line_capacity::Float64 - "Weighted average cost of capital" - wacc::Float64 - "Transmission loss for each transport technology (%)" - line_loss::Float64 -end - - -function TransportTechnology{T}(; capital_cost, start_region, available, name, capital_recovery_factor=0, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device - TransportTechnology{T}(capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, existing_line_capacity, wacc, line_loss, ) -end - -"""Get [`TransportTechnology`](@ref) `capital_cost`.""" -get_capital_cost(value::TransportTechnology) = value.capital_cost -"""Get [`TransportTechnology`](@ref) `start_region`.""" -get_start_region(value::TransportTechnology) = value.start_region -"""Get [`TransportTechnology`](@ref) `available`.""" -get_available(value::TransportTechnology) = value.available -"""Get [`TransportTechnology`](@ref) `name`.""" -get_name(value::TransportTechnology) = value.name -"""Get [`TransportTechnology`](@ref) `capital_recovery_factor`.""" -get_capital_recovery_factor(value::TransportTechnology) = value.capital_recovery_factor -"""Get [`TransportTechnology`](@ref) `end_region`.""" -get_end_region(value::TransportTechnology) = value.end_region -"""Get [`TransportTechnology`](@ref) `power_systems_type`.""" -get_power_systems_type(value::TransportTechnology) = value.power_systems_type -"""Get [`TransportTechnology`](@ref) `angle_limit`.""" -get_angle_limit(value::TransportTechnology) = value.angle_limit -"""Get [`TransportTechnology`](@ref) `internal`.""" -get_internal(value::TransportTechnology) = value.internal -"""Get [`TransportTechnology`](@ref) `ext`.""" -get_ext(value::TransportTechnology) = value.ext -"""Get [`TransportTechnology`](@ref) `resistance`.""" -get_resistance(value::TransportTechnology) = value.resistance -"""Get [`TransportTechnology`](@ref) `voltage`.""" -get_voltage(value::TransportTechnology) = value.voltage -"""Get [`TransportTechnology`](@ref) `network_id`.""" -get_network_id(value::TransportTechnology) = value.network_id -"""Get [`TransportTechnology`](@ref) `maximum_new_capacity`.""" -get_maximum_new_capacity(value::TransportTechnology) = value.maximum_new_capacity -"""Get [`TransportTechnology`](@ref) `existing_line_capacity`.""" -get_existing_line_capacity(value::TransportTechnology) = value.existing_line_capacity -"""Get [`TransportTechnology`](@ref) `wacc`.""" -get_wacc(value::TransportTechnology) = value.wacc -"""Get [`TransportTechnology`](@ref) `line_loss`.""" -get_line_loss(value::TransportTechnology) = value.line_loss - -"""Set [`TransportTechnology`](@ref) `capital_cost`.""" -set_capital_cost!(value::TransportTechnology, val) = value.capital_cost = val -"""Set [`TransportTechnology`](@ref) `start_region`.""" -set_start_region!(value::TransportTechnology, val) = value.start_region = val -"""Set [`TransportTechnology`](@ref) `available`.""" -set_available!(value::TransportTechnology, val) = value.available = val -"""Set [`TransportTechnology`](@ref) `name`.""" -set_name!(value::TransportTechnology, val) = value.name = val -"""Set [`TransportTechnology`](@ref) `capital_recovery_factor`.""" -set_capital_recovery_factor!(value::TransportTechnology, val) = value.capital_recovery_factor = val -"""Set [`TransportTechnology`](@ref) `end_region`.""" -set_end_region!(value::TransportTechnology, val) = value.end_region = val -"""Set [`TransportTechnology`](@ref) `power_systems_type`.""" -set_power_systems_type!(value::TransportTechnology, val) = value.power_systems_type = val -"""Set [`TransportTechnology`](@ref) `angle_limit`.""" -set_angle_limit!(value::TransportTechnology, val) = value.angle_limit = val -"""Set [`TransportTechnology`](@ref) `internal`.""" -set_internal!(value::TransportTechnology, val) = value.internal = val -"""Set [`TransportTechnology`](@ref) `ext`.""" -set_ext!(value::TransportTechnology, val) = value.ext = val -"""Set [`TransportTechnology`](@ref) `resistance`.""" -set_resistance!(value::TransportTechnology, val) = value.resistance = val -"""Set [`TransportTechnology`](@ref) `voltage`.""" -set_voltage!(value::TransportTechnology, val) = value.voltage = val -"""Set [`TransportTechnology`](@ref) `network_id`.""" -set_network_id!(value::TransportTechnology, val) = value.network_id = val -"""Set [`TransportTechnology`](@ref) `maximum_new_capacity`.""" -set_maximum_new_capacity!(value::TransportTechnology, val) = value.maximum_new_capacity = val -"""Set [`TransportTechnology`](@ref) `existing_line_capacity`.""" -set_existing_line_capacity!(value::TransportTechnology, val) = value.existing_line_capacity = val -"""Set [`TransportTechnology`](@ref) `wacc`.""" -set_wacc!(value::TransportTechnology, val) = value.wacc = val -"""Set [`TransportTechnology`](@ref) `line_loss`.""" -set_line_loss!(value::TransportTechnology, val) = value.line_loss = val diff --git a/src/models/generated/includes.jl b/src/models/generated/includes.jl index d4637c1..48b4d72 100644 --- a/src/models/generated/includes.jl +++ b/src/models/generated/includes.jl @@ -4,12 +4,14 @@ include("SupplyTechnology.jl") include("DemandRequirement.jl") include("RetirementPotential.jl") include("ExistingCapacity.jl") +include("ACTransportTechnology.jl") include("AggregateRetrofitPotential.jl") include("DemandSideTechnology.jl") include("AggregateRetirementPotential.jl") +include("ExistingTransportTechnology.jl") +include("HVDCTransportTechnology.jl") include("StorageTechnology.jl") include("CarbonCaps.jl") -include("TransportTechnology.jl") include("RetrofitPotential.jl") include("CurtailableDemandSideTechnology.jl") include("FlexibleDemandTechnology.jl") From 71951f47bc9129033246fffa9b9714bc96d666e9 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Wed, 16 Oct 2024 12:13:39 -0600 Subject: [PATCH 17/40] replace zone type with region --- src/models/generated/ACTransportTechnology.jl | 12 ++--- src/models/generated/CarbonCaps.jl | 10 ++-- src/models/generated/DemandRequirement.jl | 20 +++---- .../generated/ExistingTransportTechnology.jl | 12 ++--- .../generated/HVDCTransportTechnology.jl | 12 ++--- src/models/generated/StorageTechnology.jl | 52 +++++++++---------- src/models/generated/SupplyTechnology.jl | 36 ++++++------- src/models/generated/includes.jl | 4 +- 8 files changed, 79 insertions(+), 79 deletions(-) diff --git a/src/models/generated/ACTransportTechnology.jl b/src/models/generated/ACTransportTechnology.jl index 84af753..21472d5 100644 --- a/src/models/generated/ACTransportTechnology.jl +++ b/src/models/generated/ACTransportTechnology.jl @@ -7,11 +7,11 @@ This file is auto-generated. Do not edit. """ mutable struct ACTransportTechnology{T <: PSY.Device} <: Technology capital_cost::PSY.ValueCurve - start_region::Int64 + start_region::Region available::Bool name::String capital_recovery_factor::Int64 - end_region::Int64 + end_region::Region power_systems_type::String angle_limit::Float64 internal::InfrastructureSystemsInternal @@ -29,11 +29,11 @@ This file is auto-generated. Do not edit. # Arguments - `capital_cost::PSY.ValueCurve`: Cost of adding new capacity to the inter-regional transmission line. -- `start_region::Int64`: Start region for transport technology +- `start_region::Region`: Start region for transport technology - `available::Bool`: identifies whether the technology is available - `name::String`: Name - `capital_recovery_factor::Int64`: (default: `0`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. -- `end_region::Int64`: End region for transport technology +- `end_region::Region`: End region for transport technology - `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling - `angle_limit::Float64`: (default: `0.0`) Votlage angle limit (radians) - `internal::InfrastructureSystemsInternal`: (default: `InfrastructureSystemsInternal()`) Internal field @@ -50,7 +50,7 @@ mutable struct ACTransportTechnology{T <: PSY.Device} <: Technology "Cost of adding new capacity to the inter-regional transmission line." capital_cost::PSY.ValueCurve "Start region for transport technology" - start_region::Int64 + start_region::Region "identifies whether the technology is available" available::Bool "Name" @@ -58,7 +58,7 @@ mutable struct ACTransportTechnology{T <: PSY.Device} <: Technology "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion." capital_recovery_factor::Int64 "End region for transport technology" - end_region::Int64 + end_region::Region "maps to a valid PowerSystems.jl for PCM modeling" power_systems_type::String "Votlage angle limit (radians)" diff --git a/src/models/generated/CarbonCaps.jl b/src/models/generated/CarbonCaps.jl index a4a1cb3..825763f 100644 --- a/src/models/generated/CarbonCaps.jl +++ b/src/models/generated/CarbonCaps.jl @@ -9,7 +9,7 @@ This file is auto-generated. Do not edit. name::String power_systems_type::String pricecap::Float64 - eligible_zones::Vector{Int64} + eligible_zones::Vector{Region} internal::InfrastructureSystemsInternal co_2_max_tons_mwh::Float64 ext::Dict @@ -23,7 +23,7 @@ This file is auto-generated. Do not edit. - `name::String`: The technology name - `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling - `pricecap::Float64`: (default: `Inf`) pricecap value for carbon caps -- `eligible_zones::Vector{Int64}`: (default: `Vector{Int64}()`) List of zones that contribute to the carbon cap constraint. +- `eligible_zones::Vector{Region}`: (default: `Vector{Region}()`) List of regions that contribute to the carbon cap constraint. - `internal::InfrastructureSystemsInternal`: (default: `InfrastructureSystemsInternal()`) Internal field - `co_2_max_tons_mwh::Float64`: (default: `1`) Emission limit in terms of rate (tCO@/MWh) - `ext::Dict`: (default: `Dict()`) Option for providing additional data @@ -37,8 +37,8 @@ mutable struct CarbonCaps <: Requirements power_systems_type::String "pricecap value for carbon caps" pricecap::Float64 - "List of zones that contribute to the carbon cap constraint." - eligible_zones::Vector{Int64} + "List of regions that contribute to the carbon cap constraint." + eligible_zones::Vector{Region} "Internal field" internal::InfrastructureSystemsInternal "Emission limit in terms of rate (tCO@/MWh)" @@ -52,7 +52,7 @@ mutable struct CarbonCaps <: Requirements end -function CarbonCaps(; name, power_systems_type, pricecap=Inf, eligible_zones=Vector{Int64}(), internal=InfrastructureSystemsInternal(), co_2_max_tons_mwh=1, ext=Dict(), co_2_max_mtons=Vector{Int64}(), available, ) +function CarbonCaps(; name, power_systems_type, pricecap=Inf, eligible_zones=Vector{Region}(), internal=InfrastructureSystemsInternal(), co_2_max_tons_mwh=1, ext=Dict(), co_2_max_mtons=Vector{Int64}(), available, ) CarbonCaps(name, power_systems_type, pricecap, eligible_zones, internal, co_2_max_tons_mwh, ext, co_2_max_mtons, available, ) end diff --git a/src/models/generated/DemandRequirement.jl b/src/models/generated/DemandRequirement.jl index a2022e9..f835ddd 100644 --- a/src/models/generated/DemandRequirement.jl +++ b/src/models/generated/DemandRequirement.jl @@ -7,11 +7,11 @@ This file is auto-generated. Do not edit. """ mutable struct DemandRequirement{T <: PSY.StaticInjection} <: Technology name::String - zone::Union{Nothing, Int64, Zone} power_systems_type::String internal::InfrastructureSystemsInternal ext::Dict demand_mw::Float64 + region::Union{Nothing, Region} available::Bool end @@ -19,18 +19,16 @@ This file is auto-generated. Do not edit. # Arguments - `name::String`: The technology name -- `zone::Union{Nothing, Int64, Zone}`: Zone Number - `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling - `internal::InfrastructureSystemsInternal`: (default: `InfrastructureSystemsInternal()`) Internal field - `ext::Dict`: (default: `Dict()`) Option for providing additional data - `demand_mw::Float64`: (default: `0.0`) Demand profile in MW +- `region::Union{Nothing, Region}`: Region - `available::Bool`: (default: `true`) identifies whether the technology is available """ mutable struct DemandRequirement{T <: PSY.StaticInjection} <: Technology "The technology name" name::String - "Zone Number" - zone::Union{Nothing, Int64, Zone} "maps to a valid PowerSystems.jl for PCM modeling" power_systems_type::String "Internal field" @@ -39,19 +37,19 @@ mutable struct DemandRequirement{T <: PSY.StaticInjection} <: Technology ext::Dict "Demand profile in MW" demand_mw::Float64 + "Region" + region::Union{Nothing, Region} "identifies whether the technology is available" available::Bool end -function DemandRequirement{T}(; name, zone, power_systems_type, internal=InfrastructureSystemsInternal(), ext=Dict(), demand_mw=0.0, available=true, ) where T <: PSY.StaticInjection - DemandRequirement{T}(name, zone, power_systems_type, internal, ext, demand_mw, available, ) +function DemandRequirement{T}(; name, power_systems_type, internal=InfrastructureSystemsInternal(), ext=Dict(), demand_mw=0.0, region, available=true, ) where T <: PSY.StaticInjection + DemandRequirement{T}(name, power_systems_type, internal, ext, demand_mw, region, available, ) end """Get [`DemandRequirement`](@ref) `name`.""" get_name(value::DemandRequirement) = value.name -"""Get [`DemandRequirement`](@ref) `zone`.""" -get_zone(value::DemandRequirement) = value.zone """Get [`DemandRequirement`](@ref) `power_systems_type`.""" get_power_systems_type(value::DemandRequirement) = value.power_systems_type """Get [`DemandRequirement`](@ref) `internal`.""" @@ -60,13 +58,13 @@ get_internal(value::DemandRequirement) = value.internal get_ext(value::DemandRequirement) = value.ext """Get [`DemandRequirement`](@ref) `demand_mw`.""" get_demand_mw(value::DemandRequirement) = value.demand_mw +"""Get [`DemandRequirement`](@ref) `region`.""" +get_region(value::DemandRequirement) = value.region """Get [`DemandRequirement`](@ref) `available`.""" get_available(value::DemandRequirement) = value.available """Set [`DemandRequirement`](@ref) `name`.""" set_name!(value::DemandRequirement, val) = value.name = val -"""Set [`DemandRequirement`](@ref) `zone`.""" -set_zone!(value::DemandRequirement, val) = value.zone = val """Set [`DemandRequirement`](@ref) `power_systems_type`.""" set_power_systems_type!(value::DemandRequirement, val) = value.power_systems_type = val """Set [`DemandRequirement`](@ref) `internal`.""" @@ -75,5 +73,7 @@ set_internal!(value::DemandRequirement, val) = value.internal = val set_ext!(value::DemandRequirement, val) = value.ext = val """Set [`DemandRequirement`](@ref) `demand_mw`.""" set_demand_mw!(value::DemandRequirement, val) = value.demand_mw = val +"""Set [`DemandRequirement`](@ref) `region`.""" +set_region!(value::DemandRequirement, val) = value.region = val """Set [`DemandRequirement`](@ref) `available`.""" set_available!(value::DemandRequirement, val) = value.available = val diff --git a/src/models/generated/ExistingTransportTechnology.jl b/src/models/generated/ExistingTransportTechnology.jl index 3eaae42..9a32cb7 100644 --- a/src/models/generated/ExistingTransportTechnology.jl +++ b/src/models/generated/ExistingTransportTechnology.jl @@ -7,11 +7,11 @@ This file is auto-generated. Do not edit. """ mutable struct ExistingTransportTechnology{T <: PSY.Device} <: Technology capital_cost::PSY.ValueCurve - start_region::Int64 + start_region::Region available::Bool name::String capital_recovery_factor::Int64 - end_region::Int64 + end_region::Region power_systems_type::String angle_limit::Float64 internal::InfrastructureSystemsInternal @@ -29,11 +29,11 @@ This file is auto-generated. Do not edit. # Arguments - `capital_cost::PSY.ValueCurve`: Cost of adding new capacity to the inter-regional transmission line. -- `start_region::Int64`: Start region for transport technology +- `start_region::Region`: Start region for transport technology - `available::Bool`: identifies whether the technology is available - `name::String`: Name - `capital_recovery_factor::Int64`: (default: `0`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. -- `end_region::Int64`: End region for transport technology +- `end_region::Region`: End region for transport technology - `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling - `angle_limit::Float64`: (default: `0.0`) Votlage angle limit (radians) - `internal::InfrastructureSystemsInternal`: (default: `InfrastructureSystemsInternal()`) Internal field @@ -50,7 +50,7 @@ mutable struct ExistingTransportTechnology{T <: PSY.Device} <: Technology "Cost of adding new capacity to the inter-regional transmission line." capital_cost::PSY.ValueCurve "Start region for transport technology" - start_region::Int64 + start_region::Region "identifies whether the technology is available" available::Bool "Name" @@ -58,7 +58,7 @@ mutable struct ExistingTransportTechnology{T <: PSY.Device} <: Technology "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion." capital_recovery_factor::Int64 "End region for transport technology" - end_region::Int64 + end_region::Region "maps to a valid PowerSystems.jl for PCM modeling" power_systems_type::String "Votlage angle limit (radians)" diff --git a/src/models/generated/HVDCTransportTechnology.jl b/src/models/generated/HVDCTransportTechnology.jl index 014769e..8972d23 100644 --- a/src/models/generated/HVDCTransportTechnology.jl +++ b/src/models/generated/HVDCTransportTechnology.jl @@ -7,11 +7,11 @@ This file is auto-generated. Do not edit. """ mutable struct HVDCTransportTechnology{T <: PSY.Device} <: Technology capital_cost::PSY.ValueCurve - start_region::Int64 + start_region::Region available::Bool name::String capital_recovery_factor::Int64 - end_region::Int64 + end_region::Region power_systems_type::String angle_limit::Float64 internal::InfrastructureSystemsInternal @@ -29,11 +29,11 @@ This file is auto-generated. Do not edit. # Arguments - `capital_cost::PSY.ValueCurve`: Cost of adding new capacity to the inter-regional transmission line. -- `start_region::Int64`: Start region for transport technology +- `start_region::Region`: Start region for transport technology - `available::Bool`: identifies whether the technology is available - `name::String`: Name - `capital_recovery_factor::Int64`: (default: `0`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. -- `end_region::Int64`: End region for transport technology +- `end_region::Region`: End region for transport technology - `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling - `angle_limit::Float64`: (default: `0.0`) Votlage angle limit (radians) - `internal::InfrastructureSystemsInternal`: (default: `InfrastructureSystemsInternal()`) Internal field @@ -50,7 +50,7 @@ mutable struct HVDCTransportTechnology{T <: PSY.Device} <: Technology "Cost of adding new capacity to the inter-regional transmission line." capital_cost::PSY.ValueCurve "Start region for transport technology" - start_region::Int64 + start_region::Region "identifies whether the technology is available" available::Bool "Name" @@ -58,7 +58,7 @@ mutable struct HVDCTransportTechnology{T <: PSY.Device} <: Technology "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion." capital_recovery_factor::Int64 "End region for transport technology" - end_region::Int64 + end_region::Region "maps to a valid PowerSystems.jl for PCM modeling" power_systems_type::String "Votlage angle limit (radians)" diff --git a/src/models/generated/StorageTechnology.jl b/src/models/generated/StorageTechnology.jl index 821217e..9cf5a1f 100644 --- a/src/models/generated/StorageTechnology.jl +++ b/src/models/generated/StorageTechnology.jl @@ -8,9 +8,8 @@ This file is auto-generated. Do not edit. mutable struct StorageTechnology{T <: PSY.Storage} <: Technology base_power::Float64 om_costs_energy::PSY.OperationalCost - zone::Union{Nothing, Int64, Zone} - prime_mover_type::PrimeMovers existing_cap_energy::Float64 + prime_mover_type::PrimeMovers rsv_cost::Float64 available::Bool existing_cap_power::Float64 @@ -31,9 +30,10 @@ This file is auto-generated. Do not edit. om_costs_power::PSY.OperationalCost balancing_topology::String min_cap_energy::Float64 + region::Union{Nothing, Region} initial_state_of_charge::Float64 - eff_up::Float64 unit_size_energy::Float64 + eff_up::Float64 ext::Dict reg_cost::Float64 min_duration::Float64 @@ -46,9 +46,8 @@ This file is auto-generated. Do not edit. # Arguments - `base_power::Float64`: Base power - `om_costs_energy::PSY.OperationalCost`: (default: `StorageCost()`) Fixed and variable O&M costs for a technology -- `zone::Union{Nothing, Int64, Zone}`: Zone number -- `prime_mover_type::PrimeMovers`: (default: `PrimeMovers.OT`) Prime mover for generator - `existing_cap_energy::Float64`: (default: `0.0`) Pre-existing energy capacity for a technology (MWh) +- `prime_mover_type::PrimeMovers`: (default: `PrimeMovers.OT`) Prime mover for generator - `rsv_cost::Float64`: (default: `0.0`) Cost of providing upwards spinning or contingency reserves - `available::Bool`: identifies whether the technology is available - `existing_cap_power::Float64`: (default: `0.0`) Pre-existing power capacity for a technology (MW) @@ -69,9 +68,10 @@ This file is auto-generated. Do not edit. - `om_costs_power::PSY.OperationalCost`: (default: `StorageCost()`) Fixed and variable O&M costs for a technology - `balancing_topology::String`: Set of balancing nodes - `min_cap_energy::Float64`: (default: `0.0`) Minimum required energy capacity for a storage technology +- `region::Union{Nothing, Region}`: Region - `initial_state_of_charge::Float64`: (default: `0.0`) State of charge for storage technology in the first timepoint (MWh). -- `eff_up::Float64`: (default: `1.0`) Efficiency of charging storage - `unit_size_energy::Float64`: (default: `0.0`) Used for discrete investment decisions. Size of each unit being built (MW) +- `eff_up::Float64`: (default: `1.0`) Efficiency of charging storage - `ext::Dict`: (default: `Dict()`) Option for providing additional data - `reg_cost::Float64`: (default: `0.0`) Cost of providing regulation reserves - `min_duration::Float64`: (default: `0.0`) Minimum required durection for a storage technology @@ -83,12 +83,10 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology base_power::Float64 "Fixed and variable O&M costs for a technology" om_costs_energy::PSY.OperationalCost - "Zone number" - zone::Union{Nothing, Int64, Zone} - "Prime mover for generator" - prime_mover_type::PrimeMovers "Pre-existing energy capacity for a technology (MWh)" existing_cap_energy::Float64 + "Prime mover for generator" + prime_mover_type::PrimeMovers "Cost of providing upwards spinning or contingency reserves" rsv_cost::Float64 "identifies whether the technology is available" @@ -129,12 +127,14 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology balancing_topology::String "Minimum required energy capacity for a storage technology" min_cap_energy::Float64 + "Region" + region::Union{Nothing, Region} "State of charge for storage technology in the first timepoint (MWh)." initial_state_of_charge::Float64 - "Efficiency of charging storage" - eff_up::Float64 "Used for discrete investment decisions. Size of each unit being built (MW)" unit_size_energy::Float64 + "Efficiency of charging storage" + eff_up::Float64 "Option for providing additional data" ext::Dict "Cost of providing regulation reserves " @@ -148,20 +148,18 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology end -function StorageTechnology{T}(; base_power, om_costs_energy=StorageCost(), zone, prime_mover_type=PrimeMovers.OT, existing_cap_energy=0.0, rsv_cost=0.0, available, existing_cap_power=0.0, name, storage_tech, capital_costs_power=LinearCurve(0.0), max_duration=1000.0, unit_size_power=0.0, id, min_cap_power=0.0, capital_costs_energy=LinearCurve(0.0), losses=1.0, eff_down=1.0, rsv_max=0.0, max_cap_power=1e8, power_systems_type, internal=InfrastructureSystemsInternal(), om_costs_power=StorageCost(), balancing_topology, min_cap_energy=0.0, initial_state_of_charge=0.0, eff_up=1.0, unit_size_energy=0.0, ext=Dict(), reg_cost=0.0, min_duration=0.0, max_cap_energy=1e8, reg_max=0.0, ) where T <: PSY.Storage - StorageTechnology{T}(base_power, om_costs_energy, zone, prime_mover_type, existing_cap_energy, rsv_cost, available, existing_cap_power, name, storage_tech, capital_costs_power, max_duration, unit_size_power, id, min_cap_power, capital_costs_energy, losses, eff_down, rsv_max, max_cap_power, power_systems_type, internal, om_costs_power, balancing_topology, min_cap_energy, initial_state_of_charge, eff_up, unit_size_energy, ext, reg_cost, min_duration, max_cap_energy, reg_max, ) +function StorageTechnology{T}(; base_power, om_costs_energy=StorageCost(), existing_cap_energy=0.0, prime_mover_type=PrimeMovers.OT, rsv_cost=0.0, available, existing_cap_power=0.0, name, storage_tech, capital_costs_power=LinearCurve(0.0), max_duration=1000.0, unit_size_power=0.0, id, min_cap_power=0.0, capital_costs_energy=LinearCurve(0.0), losses=1.0, eff_down=1.0, rsv_max=0.0, max_cap_power=1e8, power_systems_type, internal=InfrastructureSystemsInternal(), om_costs_power=StorageCost(), balancing_topology, min_cap_energy=0.0, region, initial_state_of_charge=0.0, unit_size_energy=0.0, eff_up=1.0, ext=Dict(), reg_cost=0.0, min_duration=0.0, max_cap_energy=1e8, reg_max=0.0, ) where T <: PSY.Storage + StorageTechnology{T}(base_power, om_costs_energy, existing_cap_energy, prime_mover_type, rsv_cost, available, existing_cap_power, name, storage_tech, capital_costs_power, max_duration, unit_size_power, id, min_cap_power, capital_costs_energy, losses, eff_down, rsv_max, max_cap_power, power_systems_type, internal, om_costs_power, balancing_topology, min_cap_energy, region, initial_state_of_charge, unit_size_energy, eff_up, ext, reg_cost, min_duration, max_cap_energy, reg_max, ) end """Get [`StorageTechnology`](@ref) `base_power`.""" get_base_power(value::StorageTechnology) = value.base_power """Get [`StorageTechnology`](@ref) `om_costs_energy`.""" get_om_costs_energy(value::StorageTechnology) = value.om_costs_energy -"""Get [`StorageTechnology`](@ref) `zone`.""" -get_zone(value::StorageTechnology) = value.zone -"""Get [`StorageTechnology`](@ref) `prime_mover_type`.""" -get_prime_mover_type(value::StorageTechnology) = value.prime_mover_type """Get [`StorageTechnology`](@ref) `existing_cap_energy`.""" get_existing_cap_energy(value::StorageTechnology) = value.existing_cap_energy +"""Get [`StorageTechnology`](@ref) `prime_mover_type`.""" +get_prime_mover_type(value::StorageTechnology) = value.prime_mover_type """Get [`StorageTechnology`](@ref) `rsv_cost`.""" get_rsv_cost(value::StorageTechnology) = value.rsv_cost """Get [`StorageTechnology`](@ref) `available`.""" @@ -202,12 +200,14 @@ get_om_costs_power(value::StorageTechnology) = value.om_costs_power get_balancing_topology(value::StorageTechnology) = value.balancing_topology """Get [`StorageTechnology`](@ref) `min_cap_energy`.""" get_min_cap_energy(value::StorageTechnology) = value.min_cap_energy +"""Get [`StorageTechnology`](@ref) `region`.""" +get_region(value::StorageTechnology) = value.region """Get [`StorageTechnology`](@ref) `initial_state_of_charge`.""" get_initial_state_of_charge(value::StorageTechnology) = value.initial_state_of_charge -"""Get [`StorageTechnology`](@ref) `eff_up`.""" -get_eff_up(value::StorageTechnology) = value.eff_up """Get [`StorageTechnology`](@ref) `unit_size_energy`.""" get_unit_size_energy(value::StorageTechnology) = value.unit_size_energy +"""Get [`StorageTechnology`](@ref) `eff_up`.""" +get_eff_up(value::StorageTechnology) = value.eff_up """Get [`StorageTechnology`](@ref) `ext`.""" get_ext(value::StorageTechnology) = value.ext """Get [`StorageTechnology`](@ref) `reg_cost`.""" @@ -223,12 +223,10 @@ get_reg_max(value::StorageTechnology) = value.reg_max set_base_power!(value::StorageTechnology, val) = value.base_power = val """Set [`StorageTechnology`](@ref) `om_costs_energy`.""" set_om_costs_energy!(value::StorageTechnology, val) = value.om_costs_energy = val -"""Set [`StorageTechnology`](@ref) `zone`.""" -set_zone!(value::StorageTechnology, val) = value.zone = val -"""Set [`StorageTechnology`](@ref) `prime_mover_type`.""" -set_prime_mover_type!(value::StorageTechnology, val) = value.prime_mover_type = val """Set [`StorageTechnology`](@ref) `existing_cap_energy`.""" set_existing_cap_energy!(value::StorageTechnology, val) = value.existing_cap_energy = val +"""Set [`StorageTechnology`](@ref) `prime_mover_type`.""" +set_prime_mover_type!(value::StorageTechnology, val) = value.prime_mover_type = val """Set [`StorageTechnology`](@ref) `rsv_cost`.""" set_rsv_cost!(value::StorageTechnology, val) = value.rsv_cost = val """Set [`StorageTechnology`](@ref) `available`.""" @@ -269,12 +267,14 @@ set_om_costs_power!(value::StorageTechnology, val) = value.om_costs_power = val set_balancing_topology!(value::StorageTechnology, val) = value.balancing_topology = val """Set [`StorageTechnology`](@ref) `min_cap_energy`.""" set_min_cap_energy!(value::StorageTechnology, val) = value.min_cap_energy = val +"""Set [`StorageTechnology`](@ref) `region`.""" +set_region!(value::StorageTechnology, val) = value.region = val """Set [`StorageTechnology`](@ref) `initial_state_of_charge`.""" set_initial_state_of_charge!(value::StorageTechnology, val) = value.initial_state_of_charge = val -"""Set [`StorageTechnology`](@ref) `eff_up`.""" -set_eff_up!(value::StorageTechnology, val) = value.eff_up = val """Set [`StorageTechnology`](@ref) `unit_size_energy`.""" set_unit_size_energy!(value::StorageTechnology, val) = value.unit_size_energy = val +"""Set [`StorageTechnology`](@ref) `eff_up`.""" +set_eff_up!(value::StorageTechnology, val) = value.eff_up = val """Set [`StorageTechnology`](@ref) `ext`.""" set_ext!(value::StorageTechnology, val) = value.ext = val """Set [`StorageTechnology`](@ref) `reg_cost`.""" diff --git a/src/models/generated/SupplyTechnology.jl b/src/models/generated/SupplyTechnology.jl index d0f5b8c..b28416e 100644 --- a/src/models/generated/SupplyTechnology.jl +++ b/src/models/generated/SupplyTechnology.jl @@ -8,12 +8,11 @@ This file is auto-generated. Do not edit. mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology base_power::Float64 heat_rate_mmbtu_per_mwh::Union{Float64, PSY.ValueCurve, Dict{ThermalFuels, PSY.ValueCurve}} - zone::Union{Nothing, Int64, Zone} + outage_factor::Float64 prime_mover_type::PrimeMovers minimum_required_capacity::Float64 cofire_level_min::Union{Nothing, Dict{ThermalFuels, Float64}} capital_costs::PSY.ValueCurve - outage_factor::Float64 rsv_cost::Float64 cofire_start_max::Union{Nothing, Dict{ThermalFuels, Float64}} gen_ID::Int64 @@ -33,6 +32,7 @@ This file is auto-generated. Do not edit. internal::InfrastructureSystemsInternal ext::Dict balancing_topology::String + region::Union{Nothing, Region} maximum_capacity::Float64 cluster::Int64 ramp_up_percentage::Float64 @@ -49,12 +49,11 @@ This file is auto-generated. Do not edit. # Arguments - `base_power::Float64`: Base power - `heat_rate_mmbtu_per_mwh::Union{Float64, PSY.ValueCurve, Dict{ThermalFuels, PSY.ValueCurve}}`: (default: `0.0`) Heat rate of generator, MMBTU/MWh -- `zone::Union{Nothing, Int64, Zone}`: (default: `nothing`) Zone where tech operates in +- `outage_factor::Float64`: (default: `1.0`) Derating factor to account for planned or forced outages of a technology - `prime_mover_type::PrimeMovers`: (default: `PrimeMovers.OT`) Prime mover for generator - `minimum_required_capacity::Float64`: (default: `0.0`) Minimum required capacity for a technology - `cofire_level_min::Union{Nothing, Dict{ThermalFuels, Float64}}`: (default: `nothing`) Minimum blending level of each fuel during normal generation process for multi-fuel generator - `capital_costs::PSY.ValueCurve`: (default: `LinearCurve(0.0)`) Capital costs for investing in a technology. -- `outage_factor::Float64`: (default: `1.0`) Derating factor to account for planned or forced outages of a technology - `rsv_cost::Float64`: (default: `0.0`) Cost of providing upwards spinning or contingency reserves - `cofire_start_max::Union{Nothing, Dict{ThermalFuels, Float64}}`: (default: `nothing`) Maximum blending level of each fuel during start-up process for multi-fuel generator - `gen_ID::Int64`: ID for individual generator @@ -74,6 +73,7 @@ This file is auto-generated. Do not edit. - `internal::InfrastructureSystemsInternal`: (default: `InfrastructureSystemsInternal()`) Internal field - `ext::Dict`: (default: `Dict()`) Option for providing additional data - `balancing_topology::String`: Set of balancing nodes +- `region::Union{Nothing, Region}`: (default: `nothing`) Zone where tech operates in - `maximum_capacity::Float64`: (default: `Inf`) Maximum allowable installed capacity for a technology - `cluster::Int64`: (default: `1`) Number of the cluster when representing multiple clusters of a given technology in a given region. - `ramp_up_percentage::Float64`: (default: `100.0`) Maximum increase in output between operation periods. Fraction of total capacity @@ -89,8 +89,8 @@ mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology base_power::Float64 "Heat rate of generator, MMBTU/MWh" heat_rate_mmbtu_per_mwh::Union{Float64, PSY.ValueCurve, Dict{ThermalFuels, PSY.ValueCurve}} - "Zone where tech operates in" - zone::Union{Nothing, Int64, Zone} + "Derating factor to account for planned or forced outages of a technology" + outage_factor::Float64 "Prime mover for generator" prime_mover_type::PrimeMovers "Minimum required capacity for a technology" @@ -99,8 +99,6 @@ mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology cofire_level_min::Union{Nothing, Dict{ThermalFuels, Float64}} "Capital costs for investing in a technology." capital_costs::PSY.ValueCurve - "Derating factor to account for planned or forced outages of a technology" - outage_factor::Float64 "Cost of providing upwards spinning or contingency reserves" rsv_cost::Float64 "Maximum blending level of each fuel during start-up process for multi-fuel generator" @@ -139,6 +137,8 @@ mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology ext::Dict "Set of balancing nodes" balancing_topology::String + "Zone where tech operates in" + region::Union{Nothing, Region} "Maximum allowable installed capacity for a technology" maximum_capacity::Float64 "Number of the cluster when representing multiple clusters of a given technology in a given region." @@ -160,16 +160,16 @@ mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology end -function SupplyTechnology{T}(; base_power, heat_rate_mmbtu_per_mwh=0.0, zone=nothing, prime_mover_type=PrimeMovers.OT, minimum_required_capacity=0.0, cofire_level_min=nothing, capital_costs=LinearCurve(0.0), outage_factor=1.0, rsv_cost=0.0, cofire_start_max=nothing, gen_ID, available=True, co2=0.0, name, cofire_start_min=nothing, ramp_dn_percentage=100.0, down_time=0.0, initial_capacity=0.0, start_fuel_mmbtu_per_mw=0.0, operation_costs=ThermalGenerationCost(), rsv_max=0.0, fuel=ThermalFuels.OTHER, power_systems_type, cofire_level_max=nothing, internal=InfrastructureSystemsInternal(), ext=Dict(), balancing_topology, maximum_capacity=Inf, cluster=1, ramp_up_percentage=100.0, unit_size=0.0, reg_cost=0.0, min_generation_percentage=0.0, start_cost_per_mw=0.0, reg_max=0.0, up_time=0.0, ) where T <: PSY.Generator - SupplyTechnology{T}(base_power, heat_rate_mmbtu_per_mwh, zone, prime_mover_type, minimum_required_capacity, cofire_level_min, capital_costs, outage_factor, rsv_cost, cofire_start_max, gen_ID, available, co2, name, cofire_start_min, ramp_dn_percentage, down_time, initial_capacity, start_fuel_mmbtu_per_mw, operation_costs, rsv_max, fuel, power_systems_type, cofire_level_max, internal, ext, balancing_topology, maximum_capacity, cluster, ramp_up_percentage, unit_size, reg_cost, min_generation_percentage, start_cost_per_mw, reg_max, up_time, ) +function SupplyTechnology{T}(; base_power, heat_rate_mmbtu_per_mwh=0.0, outage_factor=1.0, prime_mover_type=PrimeMovers.OT, minimum_required_capacity=0.0, cofire_level_min=nothing, capital_costs=LinearCurve(0.0), rsv_cost=0.0, cofire_start_max=nothing, gen_ID, available=True, co2=0.0, name, cofire_start_min=nothing, ramp_dn_percentage=100.0, down_time=0.0, initial_capacity=0.0, start_fuel_mmbtu_per_mw=0.0, operation_costs=ThermalGenerationCost(), rsv_max=0.0, fuel=ThermalFuels.OTHER, power_systems_type, cofire_level_max=nothing, internal=InfrastructureSystemsInternal(), ext=Dict(), balancing_topology, region=nothing, maximum_capacity=Inf, cluster=1, ramp_up_percentage=100.0, unit_size=0.0, reg_cost=0.0, min_generation_percentage=0.0, start_cost_per_mw=0.0, reg_max=0.0, up_time=0.0, ) where T <: PSY.Generator + SupplyTechnology{T}(base_power, heat_rate_mmbtu_per_mwh, outage_factor, prime_mover_type, minimum_required_capacity, cofire_level_min, capital_costs, rsv_cost, cofire_start_max, gen_ID, available, co2, name, cofire_start_min, ramp_dn_percentage, down_time, initial_capacity, start_fuel_mmbtu_per_mw, operation_costs, rsv_max, fuel, power_systems_type, cofire_level_max, internal, ext, balancing_topology, region, maximum_capacity, cluster, ramp_up_percentage, unit_size, reg_cost, min_generation_percentage, start_cost_per_mw, reg_max, up_time, ) end """Get [`SupplyTechnology`](@ref) `base_power`.""" get_base_power(value::SupplyTechnology) = value.base_power """Get [`SupplyTechnology`](@ref) `heat_rate_mmbtu_per_mwh`.""" get_heat_rate_mmbtu_per_mwh(value::SupplyTechnology) = value.heat_rate_mmbtu_per_mwh -"""Get [`SupplyTechnology`](@ref) `zone`.""" -get_zone(value::SupplyTechnology) = value.zone +"""Get [`SupplyTechnology`](@ref) `outage_factor`.""" +get_outage_factor(value::SupplyTechnology) = value.outage_factor """Get [`SupplyTechnology`](@ref) `prime_mover_type`.""" get_prime_mover_type(value::SupplyTechnology) = value.prime_mover_type """Get [`SupplyTechnology`](@ref) `minimum_required_capacity`.""" @@ -178,8 +178,6 @@ get_minimum_required_capacity(value::SupplyTechnology) = value.minimum_required_ get_cofire_level_min(value::SupplyTechnology) = value.cofire_level_min """Get [`SupplyTechnology`](@ref) `capital_costs`.""" get_capital_costs(value::SupplyTechnology) = value.capital_costs -"""Get [`SupplyTechnology`](@ref) `outage_factor`.""" -get_outage_factor(value::SupplyTechnology) = value.outage_factor """Get [`SupplyTechnology`](@ref) `rsv_cost`.""" get_rsv_cost(value::SupplyTechnology) = value.rsv_cost """Get [`SupplyTechnology`](@ref) `cofire_start_max`.""" @@ -218,6 +216,8 @@ get_internal(value::SupplyTechnology) = value.internal get_ext(value::SupplyTechnology) = value.ext """Get [`SupplyTechnology`](@ref) `balancing_topology`.""" get_balancing_topology(value::SupplyTechnology) = value.balancing_topology +"""Get [`SupplyTechnology`](@ref) `region`.""" +get_region(value::SupplyTechnology) = value.region """Get [`SupplyTechnology`](@ref) `maximum_capacity`.""" get_maximum_capacity(value::SupplyTechnology) = value.maximum_capacity """Get [`SupplyTechnology`](@ref) `cluster`.""" @@ -241,8 +241,8 @@ get_up_time(value::SupplyTechnology) = value.up_time set_base_power!(value::SupplyTechnology, val) = value.base_power = val """Set [`SupplyTechnology`](@ref) `heat_rate_mmbtu_per_mwh`.""" set_heat_rate_mmbtu_per_mwh!(value::SupplyTechnology, val) = value.heat_rate_mmbtu_per_mwh = val -"""Set [`SupplyTechnology`](@ref) `zone`.""" -set_zone!(value::SupplyTechnology, val) = value.zone = val +"""Set [`SupplyTechnology`](@ref) `outage_factor`.""" +set_outage_factor!(value::SupplyTechnology, val) = value.outage_factor = val """Set [`SupplyTechnology`](@ref) `prime_mover_type`.""" set_prime_mover_type!(value::SupplyTechnology, val) = value.prime_mover_type = val """Set [`SupplyTechnology`](@ref) `minimum_required_capacity`.""" @@ -251,8 +251,6 @@ set_minimum_required_capacity!(value::SupplyTechnology, val) = value.minimum_req set_cofire_level_min!(value::SupplyTechnology, val) = value.cofire_level_min = val """Set [`SupplyTechnology`](@ref) `capital_costs`.""" set_capital_costs!(value::SupplyTechnology, val) = value.capital_costs = val -"""Set [`SupplyTechnology`](@ref) `outage_factor`.""" -set_outage_factor!(value::SupplyTechnology, val) = value.outage_factor = val """Set [`SupplyTechnology`](@ref) `rsv_cost`.""" set_rsv_cost!(value::SupplyTechnology, val) = value.rsv_cost = val """Set [`SupplyTechnology`](@ref) `cofire_start_max`.""" @@ -291,6 +289,8 @@ set_internal!(value::SupplyTechnology, val) = value.internal = val set_ext!(value::SupplyTechnology, val) = value.ext = val """Set [`SupplyTechnology`](@ref) `balancing_topology`.""" set_balancing_topology!(value::SupplyTechnology, val) = value.balancing_topology = val +"""Set [`SupplyTechnology`](@ref) `region`.""" +set_region!(value::SupplyTechnology, val) = value.region = val """Set [`SupplyTechnology`](@ref) `maximum_capacity`.""" set_maximum_capacity!(value::SupplyTechnology, val) = value.maximum_capacity = val """Set [`SupplyTechnology`](@ref) `cluster`.""" diff --git a/src/models/generated/includes.jl b/src/models/generated/includes.jl index 48b4d72..dd784fb 100644 --- a/src/models/generated/includes.jl +++ b/src/models/generated/includes.jl @@ -85,6 +85,7 @@ export get_ramp_dn_percentage export get_ramp_up_percentage export get_reg_cost export get_reg_max +export get_region export get_resistance export get_retirement_potential export get_retrofit_fraction @@ -106,7 +107,6 @@ export get_var_cost_per_mwh export get_voll export get_voltage export get_wacc -export get_zone export set_angle_limit! export set_available! export set_balancing_topology! @@ -176,6 +176,7 @@ export set_ramp_dn_percentage! export set_ramp_up_percentage! export set_reg_cost! export set_reg_max! +export set_region! export set_resistance! export set_retirement_potential! export set_retrofit_fraction! @@ -197,4 +198,3 @@ export set_var_cost_per_mwh! export set_voll! export set_voltage! export set_wacc! -export set_zone! From 0f08f38b6fd968930451fa01165ceadecfb3f05d Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Wed, 16 Oct 2024 19:08:50 -0600 Subject: [PATCH 18/40] add default to region --- src/models/generated/StorageTechnology.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/models/generated/StorageTechnology.jl b/src/models/generated/StorageTechnology.jl index 9cf5a1f..9879c90 100644 --- a/src/models/generated/StorageTechnology.jl +++ b/src/models/generated/StorageTechnology.jl @@ -68,7 +68,7 @@ This file is auto-generated. Do not edit. - `om_costs_power::PSY.OperationalCost`: (default: `StorageCost()`) Fixed and variable O&M costs for a technology - `balancing_topology::String`: Set of balancing nodes - `min_cap_energy::Float64`: (default: `0.0`) Minimum required energy capacity for a storage technology -- `region::Union{Nothing, Region}`: Region +- `region::Union{Nothing, Region}`: (default: `nothing`) Region - `initial_state_of_charge::Float64`: (default: `0.0`) State of charge for storage technology in the first timepoint (MWh). - `unit_size_energy::Float64`: (default: `0.0`) Used for discrete investment decisions. Size of each unit being built (MW) - `eff_up::Float64`: (default: `1.0`) Efficiency of charging storage @@ -148,7 +148,7 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology end -function StorageTechnology{T}(; base_power, om_costs_energy=StorageCost(), existing_cap_energy=0.0, prime_mover_type=PrimeMovers.OT, rsv_cost=0.0, available, existing_cap_power=0.0, name, storage_tech, capital_costs_power=LinearCurve(0.0), max_duration=1000.0, unit_size_power=0.0, id, min_cap_power=0.0, capital_costs_energy=LinearCurve(0.0), losses=1.0, eff_down=1.0, rsv_max=0.0, max_cap_power=1e8, power_systems_type, internal=InfrastructureSystemsInternal(), om_costs_power=StorageCost(), balancing_topology, min_cap_energy=0.0, region, initial_state_of_charge=0.0, unit_size_energy=0.0, eff_up=1.0, ext=Dict(), reg_cost=0.0, min_duration=0.0, max_cap_energy=1e8, reg_max=0.0, ) where T <: PSY.Storage +function StorageTechnology{T}(; base_power, om_costs_energy=StorageCost(), existing_cap_energy=0.0, prime_mover_type=PrimeMovers.OT, rsv_cost=0.0, available, existing_cap_power=0.0, name, storage_tech, capital_costs_power=LinearCurve(0.0), max_duration=1000.0, unit_size_power=0.0, id, min_cap_power=0.0, capital_costs_energy=LinearCurve(0.0), losses=1.0, eff_down=1.0, rsv_max=0.0, max_cap_power=1e8, power_systems_type, internal=InfrastructureSystemsInternal(), om_costs_power=StorageCost(), balancing_topology, min_cap_energy=0.0, region=nothing, initial_state_of_charge=0.0, unit_size_energy=0.0, eff_up=1.0, ext=Dict(), reg_cost=0.0, min_duration=0.0, max_cap_energy=1e8, reg_max=0.0, ) where T <: PSY.Storage StorageTechnology{T}(base_power, om_costs_energy, existing_cap_energy, prime_mover_type, rsv_cost, available, existing_cap_power, name, storage_tech, capital_costs_power, max_duration, unit_size_power, id, min_cap_power, capital_costs_energy, losses, eff_down, rsv_max, max_cap_power, power_systems_type, internal, om_costs_power, balancing_topology, min_cap_energy, region, initial_state_of_charge, unit_size_energy, eff_up, ext, reg_cost, min_duration, max_cap_energy, reg_max, ) end From 39c545cfd58a26aa6ae581c3e3c5cfdc02f3cd2a Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Thu, 17 Oct 2024 12:24:10 -0600 Subject: [PATCH 19/40] add get_regions --- src/PowerSystemsInvestmentsPortfolios.jl | 1 + src/portfolio.jl | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/PowerSystemsInvestmentsPortfolios.jl b/src/PowerSystemsInvestmentsPortfolios.jl index f718841..fbff4e8 100644 --- a/src/PowerSystemsInvestmentsPortfolios.jl +++ b/src/PowerSystemsInvestmentsPortfolios.jl @@ -59,6 +59,7 @@ export MinimumCapacityRequirements export Region export Zone +export get_regions export get_technologies export get_technology export get_requirements diff --git a/src/portfolio.jl b/src/portfolio.jl index 42e930c..bed49c8 100644 --- a/src/portfolio.jl +++ b/src/portfolio.jl @@ -191,6 +191,10 @@ function add_region!( return end +function get_regions(::Type{T}, portfolio::Portfolio;) where {T <: Region} + return IS.get_components(T, portfolio.data) +end + """ Add many technologies to the portfolio at once. From 430feb79126c6fc37590a5ec6f19b2abdc9f09d4 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Sat, 19 Oct 2024 12:21:42 -0600 Subject: [PATCH 20/40] add TransportTechnologies to exports --- src/PowerSystemsInvestmentsPortfolios.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/PowerSystemsInvestmentsPortfolios.jl b/src/PowerSystemsInvestmentsPortfolios.jl index fbff4e8..7f3c1d1 100644 --- a/src/PowerSystemsInvestmentsPortfolios.jl +++ b/src/PowerSystemsInvestmentsPortfolios.jl @@ -44,7 +44,9 @@ export Portfolio export Technology export Requirements export SupplyTechnology -export TransportTechnology +export ACTransportTechnology +export HVDCTransportTechnology +export ExistingTransportTechnology export StorageTechnology export DemandRequirement export DemandsideTechnology From acdc4f77f06db3b70c84ddc31bb7de5add160335 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Sat, 19 Oct 2024 12:48:28 -0600 Subject: [PATCH 21/40] base_power --- src/models/generated/ACTransportTechnology.jl | 12 ++++++++++-- src/models/generated/ExistingTransportTechnology.jl | 12 ++++++++++-- src/models/generated/HVDCTransportTechnology.jl | 12 ++++++++++-- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/models/generated/ACTransportTechnology.jl b/src/models/generated/ACTransportTechnology.jl index 21472d5..276f3f0 100644 --- a/src/models/generated/ACTransportTechnology.jl +++ b/src/models/generated/ACTransportTechnology.jl @@ -6,6 +6,7 @@ This file is auto-generated. Do not edit. """ mutable struct ACTransportTechnology{T <: PSY.Device} <: Technology + base_power::Float64 capital_cost::PSY.ValueCurve start_region::Region available::Bool @@ -28,6 +29,7 @@ This file is auto-generated. Do not edit. # Arguments +- `base_power::Float64`: Base power - `capital_cost::PSY.ValueCurve`: Cost of adding new capacity to the inter-regional transmission line. - `start_region::Region`: Start region for transport technology - `available::Bool`: identifies whether the technology is available @@ -47,6 +49,8 @@ This file is auto-generated. Do not edit. - `line_loss::Float64`: Transmission loss for each transport technology (%) """ mutable struct ACTransportTechnology{T <: PSY.Device} <: Technology + "Base power" + base_power::Float64 "Cost of adding new capacity to the inter-regional transmission line." capital_cost::PSY.ValueCurve "Start region for transport technology" @@ -84,10 +88,12 @@ mutable struct ACTransportTechnology{T <: PSY.Device} <: Technology end -function ACTransportTechnology{T}(; capital_cost, start_region, available, name, capital_recovery_factor=0, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device - ACTransportTechnology{T}(capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, existing_line_capacity, wacc, line_loss, ) +function ACTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, capital_recovery_factor=0, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device + ACTransportTechnology{T}(base_power, capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, existing_line_capacity, wacc, line_loss, ) end +"""Get [`ACTransportTechnology`](@ref) `base_power`.""" +get_base_power(value::ACTransportTechnology) = value.base_power """Get [`ACTransportTechnology`](@ref) `capital_cost`.""" get_capital_cost(value::ACTransportTechnology) = value.capital_cost """Get [`ACTransportTechnology`](@ref) `start_region`.""" @@ -123,6 +129,8 @@ get_wacc(value::ACTransportTechnology) = value.wacc """Get [`ACTransportTechnology`](@ref) `line_loss`.""" get_line_loss(value::ACTransportTechnology) = value.line_loss +"""Set [`ACTransportTechnology`](@ref) `base_power`.""" +set_base_power!(value::ACTransportTechnology, val) = value.base_power = val """Set [`ACTransportTechnology`](@ref) `capital_cost`.""" set_capital_cost!(value::ACTransportTechnology, val) = value.capital_cost = val """Set [`ACTransportTechnology`](@ref) `start_region`.""" diff --git a/src/models/generated/ExistingTransportTechnology.jl b/src/models/generated/ExistingTransportTechnology.jl index 9a32cb7..1582f9b 100644 --- a/src/models/generated/ExistingTransportTechnology.jl +++ b/src/models/generated/ExistingTransportTechnology.jl @@ -6,6 +6,7 @@ This file is auto-generated. Do not edit. """ mutable struct ExistingTransportTechnology{T <: PSY.Device} <: Technology + base_power::Float64 capital_cost::PSY.ValueCurve start_region::Region available::Bool @@ -28,6 +29,7 @@ This file is auto-generated. Do not edit. # Arguments +- `base_power::Float64`: Base power - `capital_cost::PSY.ValueCurve`: Cost of adding new capacity to the inter-regional transmission line. - `start_region::Region`: Start region for transport technology - `available::Bool`: identifies whether the technology is available @@ -47,6 +49,8 @@ This file is auto-generated. Do not edit. - `line_loss::Float64`: Transmission loss for each transport technology (%) """ mutable struct ExistingTransportTechnology{T <: PSY.Device} <: Technology + "Base power" + base_power::Float64 "Cost of adding new capacity to the inter-regional transmission line." capital_cost::PSY.ValueCurve "Start region for transport technology" @@ -84,10 +88,12 @@ mutable struct ExistingTransportTechnology{T <: PSY.Device} <: Technology end -function ExistingTransportTechnology{T}(; capital_cost, start_region, available, name, capital_recovery_factor=0, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device - ExistingTransportTechnology{T}(capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, existing_line_capacity, wacc, line_loss, ) +function ExistingTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, capital_recovery_factor=0, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device + ExistingTransportTechnology{T}(base_power, capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, existing_line_capacity, wacc, line_loss, ) end +"""Get [`ExistingTransportTechnology`](@ref) `base_power`.""" +get_base_power(value::ExistingTransportTechnology) = value.base_power """Get [`ExistingTransportTechnology`](@ref) `capital_cost`.""" get_capital_cost(value::ExistingTransportTechnology) = value.capital_cost """Get [`ExistingTransportTechnology`](@ref) `start_region`.""" @@ -123,6 +129,8 @@ get_wacc(value::ExistingTransportTechnology) = value.wacc """Get [`ExistingTransportTechnology`](@ref) `line_loss`.""" get_line_loss(value::ExistingTransportTechnology) = value.line_loss +"""Set [`ExistingTransportTechnology`](@ref) `base_power`.""" +set_base_power!(value::ExistingTransportTechnology, val) = value.base_power = val """Set [`ExistingTransportTechnology`](@ref) `capital_cost`.""" set_capital_cost!(value::ExistingTransportTechnology, val) = value.capital_cost = val """Set [`ExistingTransportTechnology`](@ref) `start_region`.""" diff --git a/src/models/generated/HVDCTransportTechnology.jl b/src/models/generated/HVDCTransportTechnology.jl index 8972d23..a994d5d 100644 --- a/src/models/generated/HVDCTransportTechnology.jl +++ b/src/models/generated/HVDCTransportTechnology.jl @@ -6,6 +6,7 @@ This file is auto-generated. Do not edit. """ mutable struct HVDCTransportTechnology{T <: PSY.Device} <: Technology + base_power::Float64 capital_cost::PSY.ValueCurve start_region::Region available::Bool @@ -28,6 +29,7 @@ This file is auto-generated. Do not edit. # Arguments +- `base_power::Float64`: Base power - `capital_cost::PSY.ValueCurve`: Cost of adding new capacity to the inter-regional transmission line. - `start_region::Region`: Start region for transport technology - `available::Bool`: identifies whether the technology is available @@ -47,6 +49,8 @@ This file is auto-generated. Do not edit. - `line_loss::Float64`: Transmission loss for each transport technology (%) """ mutable struct HVDCTransportTechnology{T <: PSY.Device} <: Technology + "Base power" + base_power::Float64 "Cost of adding new capacity to the inter-regional transmission line." capital_cost::PSY.ValueCurve "Start region for transport technology" @@ -84,10 +88,12 @@ mutable struct HVDCTransportTechnology{T <: PSY.Device} <: Technology end -function HVDCTransportTechnology{T}(; capital_cost, start_region, available, name, capital_recovery_factor=0, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device - HVDCTransportTechnology{T}(capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, existing_line_capacity, wacc, line_loss, ) +function HVDCTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, capital_recovery_factor=0, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device + HVDCTransportTechnology{T}(base_power, capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, existing_line_capacity, wacc, line_loss, ) end +"""Get [`HVDCTransportTechnology`](@ref) `base_power`.""" +get_base_power(value::HVDCTransportTechnology) = value.base_power """Get [`HVDCTransportTechnology`](@ref) `capital_cost`.""" get_capital_cost(value::HVDCTransportTechnology) = value.capital_cost """Get [`HVDCTransportTechnology`](@ref) `start_region`.""" @@ -123,6 +129,8 @@ get_wacc(value::HVDCTransportTechnology) = value.wacc """Get [`HVDCTransportTechnology`](@ref) `line_loss`.""" get_line_loss(value::HVDCTransportTechnology) = value.line_loss +"""Set [`HVDCTransportTechnology`](@ref) `base_power`.""" +set_base_power!(value::HVDCTransportTechnology, val) = value.base_power = val """Set [`HVDCTransportTechnology`](@ref) `capital_cost`.""" set_capital_cost!(value::HVDCTransportTechnology, val) = value.capital_cost = val """Set [`HVDCTransportTechnology`](@ref) `start_region`.""" From 62af45b0aafbf31d5b6b5a48498d8ada9a662594 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Mon, 28 Oct 2024 13:28:23 -0600 Subject: [PATCH 22/40] change gen_id to id --- src/models/generated/SupplyTechnology.jl | 36 ++++++++++++------------ src/models/generated/includes.jl | 2 -- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/models/generated/SupplyTechnology.jl b/src/models/generated/SupplyTechnology.jl index b28416e..081d42c 100644 --- a/src/models/generated/SupplyTechnology.jl +++ b/src/models/generated/SupplyTechnology.jl @@ -15,12 +15,12 @@ This file is auto-generated. Do not edit. capital_costs::PSY.ValueCurve rsv_cost::Float64 cofire_start_max::Union{Nothing, Dict{ThermalFuels, Float64}} - gen_ID::Int64 available::Bool co2::Union{Float64, Dict{String, Float64}, Dict{ThermalFuels, Float64}} - name::String cofire_start_min::Union{Nothing, Dict{ThermalFuels, Float64}} + name::String ramp_dn_percentage::Float64 + id::Int64 down_time::Float64 initial_capacity::Float64 start_fuel_mmbtu_per_mw::Float64 @@ -56,12 +56,12 @@ This file is auto-generated. Do not edit. - `capital_costs::PSY.ValueCurve`: (default: `LinearCurve(0.0)`) Capital costs for investing in a technology. - `rsv_cost::Float64`: (default: `0.0`) Cost of providing upwards spinning or contingency reserves - `cofire_start_max::Union{Nothing, Dict{ThermalFuels, Float64}}`: (default: `nothing`) Maximum blending level of each fuel during start-up process for multi-fuel generator -- `gen_ID::Int64`: ID for individual generator - `available::Bool`: (default: `True`) identifies whether the technology is available - `co2::Union{Float64, Dict{String, Float64}, Dict{ThermalFuels, Float64}}`: (default: `0.0`) Carbon Intensity of fuel -- `name::String`: The technology name - `cofire_start_min::Union{Nothing, Dict{ThermalFuels, Float64}}`: (default: `nothing`) Minimum blending level of each fuel during start-up process for multi-fuel generator +- `name::String`: The technology name - `ramp_dn_percentage::Float64`: (default: `100.0`) Maximum decrease in output between operation periods. Fraction of total capacity +- `id::Int64`: ID for individual generator - `down_time::Float64`: (default: `0.0`) Minimum amount of time a resource has to remain in the shutdown state. - `initial_capacity::Float64`: (default: `0.0`) Pre-existing capacity for a technology - `start_fuel_mmbtu_per_mw::Float64`: (default: `0.0`) Startup fuel use per MW of nameplate capacity of each generator (MMBtu/MW per start) @@ -103,18 +103,18 @@ mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology rsv_cost::Float64 "Maximum blending level of each fuel during start-up process for multi-fuel generator" cofire_start_max::Union{Nothing, Dict{ThermalFuels, Float64}} - "ID for individual generator" - gen_ID::Int64 "identifies whether the technology is available" available::Bool "Carbon Intensity of fuel" co2::Union{Float64, Dict{String, Float64}, Dict{ThermalFuels, Float64}} - "The technology name" - name::String "Minimum blending level of each fuel during start-up process for multi-fuel generator" cofire_start_min::Union{Nothing, Dict{ThermalFuels, Float64}} + "The technology name" + name::String "Maximum decrease in output between operation periods. Fraction of total capacity" ramp_dn_percentage::Float64 + "ID for individual generator" + id::Int64 "Minimum amount of time a resource has to remain in the shutdown state." down_time::Float64 "Pre-existing capacity for a technology" @@ -160,8 +160,8 @@ mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology end -function SupplyTechnology{T}(; base_power, heat_rate_mmbtu_per_mwh=0.0, outage_factor=1.0, prime_mover_type=PrimeMovers.OT, minimum_required_capacity=0.0, cofire_level_min=nothing, capital_costs=LinearCurve(0.0), rsv_cost=0.0, cofire_start_max=nothing, gen_ID, available=True, co2=0.0, name, cofire_start_min=nothing, ramp_dn_percentage=100.0, down_time=0.0, initial_capacity=0.0, start_fuel_mmbtu_per_mw=0.0, operation_costs=ThermalGenerationCost(), rsv_max=0.0, fuel=ThermalFuels.OTHER, power_systems_type, cofire_level_max=nothing, internal=InfrastructureSystemsInternal(), ext=Dict(), balancing_topology, region=nothing, maximum_capacity=Inf, cluster=1, ramp_up_percentage=100.0, unit_size=0.0, reg_cost=0.0, min_generation_percentage=0.0, start_cost_per_mw=0.0, reg_max=0.0, up_time=0.0, ) where T <: PSY.Generator - SupplyTechnology{T}(base_power, heat_rate_mmbtu_per_mwh, outage_factor, prime_mover_type, minimum_required_capacity, cofire_level_min, capital_costs, rsv_cost, cofire_start_max, gen_ID, available, co2, name, cofire_start_min, ramp_dn_percentage, down_time, initial_capacity, start_fuel_mmbtu_per_mw, operation_costs, rsv_max, fuel, power_systems_type, cofire_level_max, internal, ext, balancing_topology, region, maximum_capacity, cluster, ramp_up_percentage, unit_size, reg_cost, min_generation_percentage, start_cost_per_mw, reg_max, up_time, ) +function SupplyTechnology{T}(; base_power, heat_rate_mmbtu_per_mwh=0.0, outage_factor=1.0, prime_mover_type=PrimeMovers.OT, minimum_required_capacity=0.0, cofire_level_min=nothing, capital_costs=LinearCurve(0.0), rsv_cost=0.0, cofire_start_max=nothing, available=True, co2=0.0, cofire_start_min=nothing, name, ramp_dn_percentage=100.0, id, down_time=0.0, initial_capacity=0.0, start_fuel_mmbtu_per_mw=0.0, operation_costs=ThermalGenerationCost(), rsv_max=0.0, fuel=ThermalFuels.OTHER, power_systems_type, cofire_level_max=nothing, internal=InfrastructureSystemsInternal(), ext=Dict(), balancing_topology, region=nothing, maximum_capacity=Inf, cluster=1, ramp_up_percentage=100.0, unit_size=0.0, reg_cost=0.0, min_generation_percentage=0.0, start_cost_per_mw=0.0, reg_max=0.0, up_time=0.0, ) where T <: PSY.Generator + SupplyTechnology{T}(base_power, heat_rate_mmbtu_per_mwh, outage_factor, prime_mover_type, minimum_required_capacity, cofire_level_min, capital_costs, rsv_cost, cofire_start_max, available, co2, cofire_start_min, name, ramp_dn_percentage, id, down_time, initial_capacity, start_fuel_mmbtu_per_mw, operation_costs, rsv_max, fuel, power_systems_type, cofire_level_max, internal, ext, balancing_topology, region, maximum_capacity, cluster, ramp_up_percentage, unit_size, reg_cost, min_generation_percentage, start_cost_per_mw, reg_max, up_time, ) end """Get [`SupplyTechnology`](@ref) `base_power`.""" @@ -182,18 +182,18 @@ get_capital_costs(value::SupplyTechnology) = value.capital_costs get_rsv_cost(value::SupplyTechnology) = value.rsv_cost """Get [`SupplyTechnology`](@ref) `cofire_start_max`.""" get_cofire_start_max(value::SupplyTechnology) = value.cofire_start_max -"""Get [`SupplyTechnology`](@ref) `gen_ID`.""" -get_gen_ID(value::SupplyTechnology) = value.gen_ID """Get [`SupplyTechnology`](@ref) `available`.""" get_available(value::SupplyTechnology) = value.available """Get [`SupplyTechnology`](@ref) `co2`.""" get_co2(value::SupplyTechnology) = value.co2 -"""Get [`SupplyTechnology`](@ref) `name`.""" -get_name(value::SupplyTechnology) = value.name """Get [`SupplyTechnology`](@ref) `cofire_start_min`.""" get_cofire_start_min(value::SupplyTechnology) = value.cofire_start_min +"""Get [`SupplyTechnology`](@ref) `name`.""" +get_name(value::SupplyTechnology) = value.name """Get [`SupplyTechnology`](@ref) `ramp_dn_percentage`.""" get_ramp_dn_percentage(value::SupplyTechnology) = value.ramp_dn_percentage +"""Get [`SupplyTechnology`](@ref) `id`.""" +get_id(value::SupplyTechnology) = value.id """Get [`SupplyTechnology`](@ref) `down_time`.""" get_down_time(value::SupplyTechnology) = value.down_time """Get [`SupplyTechnology`](@ref) `initial_capacity`.""" @@ -255,18 +255,18 @@ set_capital_costs!(value::SupplyTechnology, val) = value.capital_costs = val set_rsv_cost!(value::SupplyTechnology, val) = value.rsv_cost = val """Set [`SupplyTechnology`](@ref) `cofire_start_max`.""" set_cofire_start_max!(value::SupplyTechnology, val) = value.cofire_start_max = val -"""Set [`SupplyTechnology`](@ref) `gen_ID`.""" -set_gen_ID!(value::SupplyTechnology, val) = value.gen_ID = val """Set [`SupplyTechnology`](@ref) `available`.""" set_available!(value::SupplyTechnology, val) = value.available = val """Set [`SupplyTechnology`](@ref) `co2`.""" set_co2!(value::SupplyTechnology, val) = value.co2 = val -"""Set [`SupplyTechnology`](@ref) `name`.""" -set_name!(value::SupplyTechnology, val) = value.name = val """Set [`SupplyTechnology`](@ref) `cofire_start_min`.""" set_cofire_start_min!(value::SupplyTechnology, val) = value.cofire_start_min = val +"""Set [`SupplyTechnology`](@ref) `name`.""" +set_name!(value::SupplyTechnology, val) = value.name = val """Set [`SupplyTechnology`](@ref) `ramp_dn_percentage`.""" set_ramp_dn_percentage!(value::SupplyTechnology, val) = value.ramp_dn_percentage = val +"""Set [`SupplyTechnology`](@ref) `id`.""" +set_id!(value::SupplyTechnology, val) = value.id = val """Set [`SupplyTechnology`](@ref) `down_time`.""" set_down_time!(value::SupplyTechnology, val) = value.down_time = val """Set [`SupplyTechnology`](@ref) `initial_capacity`.""" diff --git a/src/models/generated/includes.jl b/src/models/generated/includes.jl index dd784fb..738c4c7 100644 --- a/src/models/generated/includes.jl +++ b/src/models/generated/includes.jl @@ -49,7 +49,6 @@ export get_existing_capacity export get_existing_line_capacity export get_ext export get_fuel -export get_gen_ID export get_heat_rate_mmbtu_per_mwh export get_id export get_initial_capacity @@ -140,7 +139,6 @@ export set_existing_capacity! export set_existing_line_capacity! export set_ext! export set_fuel! -export set_gen_ID! export set_heat_rate_mmbtu_per_mwh! export set_id! export set_initial_capacity! From fb8c47ca10f2e1b945f42aac94d0f7307e076c20 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Mon, 28 Oct 2024 13:31:55 -0600 Subject: [PATCH 23/40] update exports --- src/PowerSystemsInvestmentsPortfolios.jl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/PowerSystemsInvestmentsPortfolios.jl b/src/PowerSystemsInvestmentsPortfolios.jl index 7f3c1d1..e263d46 100644 --- a/src/PowerSystemsInvestmentsPortfolios.jl +++ b/src/PowerSystemsInvestmentsPortfolios.jl @@ -53,14 +53,17 @@ export DemandsideTechnology export FlexibleDemandTechnology export Electrolyzers export CurtailableDemandSideTechnology -export RetireableCapacity -export RetrofitCapacity +export RetirementPotential +export AggregateRetirementPotential +export RetrofitPotential +export AggregateRetrofitPotential export ExistingCapacity export CarbonCaps export MinimumCapacityRequirements export Region export Zone +export get_name export get_regions export get_technologies export get_technology From 90844e5f19d8810b193388760dea8d36f3fb9be7 Mon Sep 17 00:00:00 2001 From: prao7 Date: Thu, 31 Oct 2024 11:30:12 -0600 Subject: [PATCH 24/40] corrected supply curve --- src/generate_structs.jl | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index 540da1b..7722143 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -327,18 +327,15 @@ function dataframe_to_structs(df_dict::Dict) end #Populate SupplyTechnology structs from database (new builds) topologies = df_dict["balancing_topologies"] - supply_curves = filter("description" => contains("Supply"), df_dict["piecewise_linear"]) + supply_curves = filter("entity_type" => contains("supply_technologies"), df_dict["attributes"]) for row_pw in eachrow(supply_curves) # Extract supply curves and IDs eaid = row_pw["entity_attribute_id"] - supply_curve = row_pw["piecewise_linear_blob"] + supply_curve = row_pw["value"] supply_curve_parsed = parse_json_to_arrays(supply_curve) - id = df_dict["attributes"][ - df_dict["attributes"][!, "entity_attribute_id"] .== eaid, - "entity_id", - ] + id = eaid # Find corresponding supply technology for that supply curve row = df_dict["supply_technologies"][ From 81120ba0530e47b1dc393f67663b183802b3dec4 Mon Sep 17 00:00:00 2001 From: prao7 Date: Thu, 31 Oct 2024 12:51:13 -0600 Subject: [PATCH 25/40] heat rate fixed on the generation units --- src/generate_structs.jl | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index 7722143..5d6212b 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -406,10 +406,15 @@ function dataframe_to_structs(df_dict::Dict) # This will return all rows where entity_id matches any value in the tech_id vector tech_id = row["unit_id"] - result = filter(row -> row[:entity_id] in tech_id, df_dict["attributes"]) - - gen_entity_attribute_id = isempty(df_dict["attributes"][df_dict["attributes"][!, :entity_id] .== tech_id .&& occursin.("Heat Rate", df_dict["attributes"][!, :name]), :entity_attribute_id]) ? 0.0 : df_dict["attributes"][df_dict["attributes"][!, :entity_id] .== tech_id .&& occursin.("Heat Rate", df_dict["attributes"][!, :name]), :entity_attribute_id][1] - heat_rate_piecewise_lin = df_dict["piecewise_linear"][df_dict["piecewise_linear"][!, :entity_attribute_id] .== gen_entity_attribute_id, :][:, "piecewise_linear_blob"][1] + result = isempty(filter(row -> row[:entity_id] == tech_id, df_dict["attributes"])) ? 0 : filter(row -> row[:entity_id] == tech_id, df_dict["attributes"]) + + # Extract the blob from the heat rate data + if result != 0 + heat_rate_unparsed = row["value"] + heat_rate_piecewise_lin = parse_json_to_arrays(heat_rate_unparsed) + else + heat_rate_piecewise_lin = 0.0 + end @show heat_rate_piecewise_lin @@ -437,7 +442,7 @@ function dataframe_to_structs(df_dict::Dict) start_cost_per_mw=result[occursin.("Startup Cost", result[!, :name]), :value][1], up_time=result[occursin.("Uptime", result[!, :name]), :value][1], down_time=result[occursin.("Downtime", result[!, :name]), :value][1], - heat_rate_mmbtu_per_mwh=0.0,#parse_json_to_arrays(heat_rate_piecewise_lin), + heat_rate_mmbtu_per_mwh=heat_rate_piecewise_lin, co2=length(result[occursin.("CO2", result[!, :name]), :value]) > 0 ? coalesce(result[occursin.("CO2", result[!, :name]), :value][1], 0.0) : 0.0, ramp_dn_percentage=0.64, @@ -514,7 +519,7 @@ function dataframe_to_structs(df_dict::Dict) for row in eachrow(df_dict["demand_requirements"]) #start in time_series eaid = row["entity_attribute_id"] - ts_blob = filter("entity_attribute_id" => isequal(eaid), df_dict["time_series"])[ + ts_blob = filter("entity_id" => isequal(eaid), df_dict["entities"])[ !, "time_series_blob", ][1] From b1befa456e8343c3defe52310770d78a2590356a Mon Sep 17 00:00:00 2001 From: prao7 Date: Thu, 31 Oct 2024 13:27:13 -0600 Subject: [PATCH 26/40] starting to figure out how the time series needs to be added --- src/generate_structs.jl | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index 5d6212b..6562ded 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -416,6 +416,13 @@ function dataframe_to_structs(df_dict::Dict) heat_rate_piecewise_lin = 0.0 end + if row["fuel_type"] == "Solar" || row["fuel_type"] == "Wind" + # Put in time series for the solar and Wind + eaid = row["unit_id"] + ts_index = filter("entity_id" => isequal(eaid), df_dict["entities"])["entity_id"] + ts = filter("entity_id" => isequal(ts_index), df_dict["time_series"]) + # TODO: Need to figure out how to parse the timestamp and values and add to the time series + end @show heat_rate_piecewise_lin parametric = map_prime_mover_to_parametric(row["prime_mover"]) @@ -519,11 +526,11 @@ function dataframe_to_structs(df_dict::Dict) for row in eachrow(df_dict["demand_requirements"]) #start in time_series eaid = row["entity_attribute_id"] - ts_blob = filter("entity_id" => isequal(eaid), df_dict["entities"])[ - !, - "time_series_blob", - ][1] - ts_parsed = parse_timestamps_and_values(ts_blob) + ts_index = filter("entity_id" => isequal(eaid), df_dict["entities"])["entity_id"] + + # Collect all rows in the time_series table that match the entity_id + ts = filter("entity_id" => isequal(ts_index), df_dict["time_series"]) + dates = ts_parsed[1] #fix this later, dates syntax is inconsistent so hard to parse dates = DateTime("2020-01-01T00:00:00"):Hour(1):DateTime("2020-12-31T23:00:00") demand = ts_parsed[2] From 348eed750dc52f6248938e7eda620cf87a0eb46c Mon Sep 17 00:00:00 2001 From: prao7 Date: Thu, 31 Oct 2024 14:37:15 -0600 Subject: [PATCH 27/40] time series test --- src/generate_structs.jl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index 6562ded..5d9b73a 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -530,10 +530,13 @@ function dataframe_to_structs(df_dict::Dict) # Collect all rows in the time_series table that match the entity_id ts = filter("entity_id" => isequal(ts_index), df_dict["time_series"]) + ts_parsed = collect(ts[:, :value]) + + # Parsing the timestamps into Dates + timestamps = DateTime.(ts[!, :timestamp], "yyyy-m-d-H") - dates = ts_parsed[1] #fix this later, dates syntax is inconsistent so hard to parse - dates = DateTime("2020-01-01T00:00:00"):Hour(1):DateTime("2020-12-31T23:00:00") - demand = ts_parsed[2] + dates = timestamps[1]:Hour(1):timestamps[end] + demand = ts_parsed demand_array = TimeArray(dates, demand) ts = SingleTimeSeries(string(row["entity_attribute_id"]), demand_array) From fac0113283fcdb9777f757e7056ad3a826870cee Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Thu, 31 Oct 2024 15:33:45 -0600 Subject: [PATCH 28/40] add decoding to parser --- Project.toml | 1 + src/PowerSystemsInvestmentsPortfolios.jl | 1 + src/generate_structs.jl | 16 ++++++++++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index e7b2528..69114c2 100644 --- a/Project.toml +++ b/Project.toml @@ -14,6 +14,7 @@ JSONSchema = "7d188eb4-7ad8-530c-ae41-71a32a6d4692" PowerSystems = "bcd98974-b02a-5e2f-9ee0-a103f5c450dd" PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d" SQLite = "0aa819cd-b072-5ff4-a722-6bc24af294d9" +StringEncodings = "69024149-9ee7-55f6-a4c4-859efe599b68" TimeSeries = "9e3dc215-6440-5c97-bce1-76c03772f85e" [compat] diff --git a/src/PowerSystemsInvestmentsPortfolios.jl b/src/PowerSystemsInvestmentsPortfolios.jl index f718841..f2fffe7 100644 --- a/src/PowerSystemsInvestmentsPortfolios.jl +++ b/src/PowerSystemsInvestmentsPortfolios.jl @@ -39,6 +39,7 @@ using DataFrames using PowerSystems using Dates using TimeSeries +using StringEncodings export Portfolio export Technology diff --git a/src/generate_structs.jl b/src/generate_structs.jl index 5d9b73a..e3c3b30 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -333,20 +333,26 @@ function dataframe_to_structs(df_dict::Dict) # Extract supply curves and IDs eaid = row_pw["entity_attribute_id"] supply_curve = row_pw["value"] + supply_curve = decode(supply_curve, "UTF-8") supply_curve_parsed = parse_json_to_arrays(supply_curve) id = eaid # Find corresponding supply technology for that supply curve + # TODO: Add check to only do the rest of this is this returns a real (and not an empty dataframe) row = df_dict["supply_technologies"][ df_dict["supply_technologies"][!, "technology_id"] .== id, :, ] #extract area - area = topologies[topologies.name .== row[!, "balancing_topology"][1], "area"][1] - area_int = parse(Int64, area) - + if !isempty(row) + area = topologies[topologies.name .== row[!, "balancing_topology"][1], "area"][1] + area_int = parse(Int64, area) + + else + continue + end #extract supply curve, does every supply_technology have a supply curve? #id = row["technology_id"] #eaid = df_dict["attributes"][df_dict["attributes"] .== id, "entity_attribute_id"][1] @@ -409,13 +415,15 @@ function dataframe_to_structs(df_dict::Dict) result = isempty(filter(row -> row[:entity_id] == tech_id, df_dict["attributes"])) ? 0 : filter(row -> row[:entity_id] == tech_id, df_dict["attributes"]) # Extract the blob from the heat rate data + #TODO: Fix this please if result != 0 heat_rate_unparsed = row["value"] heat_rate_piecewise_lin = parse_json_to_arrays(heat_rate_unparsed) else heat_rate_piecewise_lin = 0.0 end - + #heat_rate_piecewise_lin = 0.0 + if row["fuel_type"] == "Solar" || row["fuel_type"] == "Wind" # Put in time series for the solar and Wind eaid = row["unit_id"] From 8d0cf7f4d1c24c183e38651a438d49dec5f7a63d Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Tue, 19 Nov 2024 11:17:12 -0700 Subject: [PATCH 29/40] add cluster to storage --- src/models/generated/StorageTechnology.jl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/models/generated/StorageTechnology.jl b/src/models/generated/StorageTechnology.jl index 9879c90..8643714 100644 --- a/src/models/generated/StorageTechnology.jl +++ b/src/models/generated/StorageTechnology.jl @@ -34,6 +34,7 @@ This file is auto-generated. Do not edit. initial_state_of_charge::Float64 unit_size_energy::Float64 eff_up::Float64 + cluster::Int64 ext::Dict reg_cost::Float64 min_duration::Float64 @@ -72,6 +73,7 @@ This file is auto-generated. Do not edit. - `initial_state_of_charge::Float64`: (default: `0.0`) State of charge for storage technology in the first timepoint (MWh). - `unit_size_energy::Float64`: (default: `0.0`) Used for discrete investment decisions. Size of each unit being built (MW) - `eff_up::Float64`: (default: `1.0`) Efficiency of charging storage +- `cluster::Int64`: (default: `1`) Number of the cluster when representing multiple clusters of a given technology in a given region. - `ext::Dict`: (default: `Dict()`) Option for providing additional data - `reg_cost::Float64`: (default: `0.0`) Cost of providing regulation reserves - `min_duration::Float64`: (default: `0.0`) Minimum required durection for a storage technology @@ -135,6 +137,8 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology unit_size_energy::Float64 "Efficiency of charging storage" eff_up::Float64 + "Number of the cluster when representing multiple clusters of a given technology in a given region." + cluster::Int64 "Option for providing additional data" ext::Dict "Cost of providing regulation reserves " @@ -148,8 +152,8 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology end -function StorageTechnology{T}(; base_power, om_costs_energy=StorageCost(), existing_cap_energy=0.0, prime_mover_type=PrimeMovers.OT, rsv_cost=0.0, available, existing_cap_power=0.0, name, storage_tech, capital_costs_power=LinearCurve(0.0), max_duration=1000.0, unit_size_power=0.0, id, min_cap_power=0.0, capital_costs_energy=LinearCurve(0.0), losses=1.0, eff_down=1.0, rsv_max=0.0, max_cap_power=1e8, power_systems_type, internal=InfrastructureSystemsInternal(), om_costs_power=StorageCost(), balancing_topology, min_cap_energy=0.0, region=nothing, initial_state_of_charge=0.0, unit_size_energy=0.0, eff_up=1.0, ext=Dict(), reg_cost=0.0, min_duration=0.0, max_cap_energy=1e8, reg_max=0.0, ) where T <: PSY.Storage - StorageTechnology{T}(base_power, om_costs_energy, existing_cap_energy, prime_mover_type, rsv_cost, available, existing_cap_power, name, storage_tech, capital_costs_power, max_duration, unit_size_power, id, min_cap_power, capital_costs_energy, losses, eff_down, rsv_max, max_cap_power, power_systems_type, internal, om_costs_power, balancing_topology, min_cap_energy, region, initial_state_of_charge, unit_size_energy, eff_up, ext, reg_cost, min_duration, max_cap_energy, reg_max, ) +function StorageTechnology{T}(; base_power, om_costs_energy=StorageCost(), existing_cap_energy=0.0, prime_mover_type=PrimeMovers.OT, rsv_cost=0.0, available, existing_cap_power=0.0, name, storage_tech, capital_costs_power=LinearCurve(0.0), max_duration=1000.0, unit_size_power=0.0, id, min_cap_power=0.0, capital_costs_energy=LinearCurve(0.0), losses=1.0, eff_down=1.0, rsv_max=0.0, max_cap_power=1e8, power_systems_type, internal=InfrastructureSystemsInternal(), om_costs_power=StorageCost(), balancing_topology, min_cap_energy=0.0, region=nothing, initial_state_of_charge=0.0, unit_size_energy=0.0, eff_up=1.0, cluster=1, ext=Dict(), reg_cost=0.0, min_duration=0.0, max_cap_energy=1e8, reg_max=0.0, ) where T <: PSY.Storage + StorageTechnology{T}(base_power, om_costs_energy, existing_cap_energy, prime_mover_type, rsv_cost, available, existing_cap_power, name, storage_tech, capital_costs_power, max_duration, unit_size_power, id, min_cap_power, capital_costs_energy, losses, eff_down, rsv_max, max_cap_power, power_systems_type, internal, om_costs_power, balancing_topology, min_cap_energy, region, initial_state_of_charge, unit_size_energy, eff_up, cluster, ext, reg_cost, min_duration, max_cap_energy, reg_max, ) end """Get [`StorageTechnology`](@ref) `base_power`.""" @@ -208,6 +212,8 @@ get_initial_state_of_charge(value::StorageTechnology) = value.initial_state_of_c get_unit_size_energy(value::StorageTechnology) = value.unit_size_energy """Get [`StorageTechnology`](@ref) `eff_up`.""" get_eff_up(value::StorageTechnology) = value.eff_up +"""Get [`StorageTechnology`](@ref) `cluster`.""" +get_cluster(value::StorageTechnology) = value.cluster """Get [`StorageTechnology`](@ref) `ext`.""" get_ext(value::StorageTechnology) = value.ext """Get [`StorageTechnology`](@ref) `reg_cost`.""" @@ -275,6 +281,8 @@ set_initial_state_of_charge!(value::StorageTechnology, val) = value.initial_stat set_unit_size_energy!(value::StorageTechnology, val) = value.unit_size_energy = val """Set [`StorageTechnology`](@ref) `eff_up`.""" set_eff_up!(value::StorageTechnology, val) = value.eff_up = val +"""Set [`StorageTechnology`](@ref) `cluster`.""" +set_cluster!(value::StorageTechnology, val) = value.cluster = val """Set [`StorageTechnology`](@ref) `ext`.""" set_ext!(value::StorageTechnology, val) = value.ext = val """Set [`StorageTechnology`](@ref) `reg_cost`.""" From 6bdd3e731095637c34a95edd18e0dc8328ddca46 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Wed, 20 Nov 2024 13:33:31 -0700 Subject: [PATCH 30/40] add crf and lifetime for supply and storage --- src/models/generated/ACTransportTechnology.jl | 4 +-- .../generated/ExistingTransportTechnology.jl | 4 +-- .../generated/HVDCTransportTechnology.jl | 4 +-- src/models/generated/StorageTechnology.jl | 26 +++++++++++++++---- src/models/generated/SupplyTechnology.jl | 26 +++++++++++++++---- src/models/generated/includes.jl | 2 ++ 6 files changed, 50 insertions(+), 16 deletions(-) diff --git a/src/models/generated/ACTransportTechnology.jl b/src/models/generated/ACTransportTechnology.jl index 276f3f0..80ef3a1 100644 --- a/src/models/generated/ACTransportTechnology.jl +++ b/src/models/generated/ACTransportTechnology.jl @@ -34,7 +34,7 @@ This file is auto-generated. Do not edit. - `start_region::Region`: Start region for transport technology - `available::Bool`: identifies whether the technology is available - `name::String`: Name -- `capital_recovery_factor::Int64`: (default: `0`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. +- `capital_recovery_factor::Int64`: (default: `30`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. - `end_region::Region`: End region for transport technology - `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling - `angle_limit::Float64`: (default: `0.0`) Votlage angle limit (radians) @@ -88,7 +88,7 @@ mutable struct ACTransportTechnology{T <: PSY.Device} <: Technology end -function ACTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, capital_recovery_factor=0, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device +function ACTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, capital_recovery_factor=30, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device ACTransportTechnology{T}(base_power, capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, existing_line_capacity, wacc, line_loss, ) end diff --git a/src/models/generated/ExistingTransportTechnology.jl b/src/models/generated/ExistingTransportTechnology.jl index 1582f9b..af2f4da 100644 --- a/src/models/generated/ExistingTransportTechnology.jl +++ b/src/models/generated/ExistingTransportTechnology.jl @@ -34,7 +34,7 @@ This file is auto-generated. Do not edit. - `start_region::Region`: Start region for transport technology - `available::Bool`: identifies whether the technology is available - `name::String`: Name -- `capital_recovery_factor::Int64`: (default: `0`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. +- `capital_recovery_factor::Int64`: (default: `30`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. - `end_region::Region`: End region for transport technology - `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling - `angle_limit::Float64`: (default: `0.0`) Votlage angle limit (radians) @@ -88,7 +88,7 @@ mutable struct ExistingTransportTechnology{T <: PSY.Device} <: Technology end -function ExistingTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, capital_recovery_factor=0, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device +function ExistingTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, capital_recovery_factor=30, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device ExistingTransportTechnology{T}(base_power, capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, existing_line_capacity, wacc, line_loss, ) end diff --git a/src/models/generated/HVDCTransportTechnology.jl b/src/models/generated/HVDCTransportTechnology.jl index a994d5d..7d84f98 100644 --- a/src/models/generated/HVDCTransportTechnology.jl +++ b/src/models/generated/HVDCTransportTechnology.jl @@ -34,7 +34,7 @@ This file is auto-generated. Do not edit. - `start_region::Region`: Start region for transport technology - `available::Bool`: identifies whether the technology is available - `name::String`: Name -- `capital_recovery_factor::Int64`: (default: `0`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. +- `capital_recovery_factor::Int64`: (default: `30`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. - `end_region::Region`: End region for transport technology - `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling - `angle_limit::Float64`: (default: `0.0`) Votlage angle limit (radians) @@ -88,7 +88,7 @@ mutable struct HVDCTransportTechnology{T <: PSY.Device} <: Technology end -function HVDCTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, capital_recovery_factor=0, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device +function HVDCTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, capital_recovery_factor=30, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device HVDCTransportTechnology{T}(base_power, capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, existing_line_capacity, wacc, line_loss, ) end diff --git a/src/models/generated/StorageTechnology.jl b/src/models/generated/StorageTechnology.jl index 8643714..6e07c0d 100644 --- a/src/models/generated/StorageTechnology.jl +++ b/src/models/generated/StorageTechnology.jl @@ -10,6 +10,7 @@ This file is auto-generated. Do not edit. om_costs_energy::PSY.OperationalCost existing_cap_energy::Float64 prime_mover_type::PrimeMovers + lifetime::Int rsv_cost::Float64 available::Bool existing_cap_power::Float64 @@ -18,6 +19,7 @@ This file is auto-generated. Do not edit. capital_costs_power::PSY.ValueCurve max_duration::Float64 unit_size_power::Float64 + capital_recovery_factor::Int64 id::Int64 min_cap_power::Float64 capital_costs_energy::PSY.ValueCurve @@ -30,7 +32,7 @@ This file is auto-generated. Do not edit. om_costs_power::PSY.OperationalCost balancing_topology::String min_cap_energy::Float64 - region::Union{Nothing, Region} + region::Union{Nothing, Region, Vector{Region}} initial_state_of_charge::Float64 unit_size_energy::Float64 eff_up::Float64 @@ -49,6 +51,7 @@ This file is auto-generated. Do not edit. - `om_costs_energy::PSY.OperationalCost`: (default: `StorageCost()`) Fixed and variable O&M costs for a technology - `existing_cap_energy::Float64`: (default: `0.0`) Pre-existing energy capacity for a technology (MWh) - `prime_mover_type::PrimeMovers`: (default: `PrimeMovers.OT`) Prime mover for generator +- `lifetime::Int`: (default: `100`) Maximum number of years a technology can be active once installed - `rsv_cost::Float64`: (default: `0.0`) Cost of providing upwards spinning or contingency reserves - `available::Bool`: identifies whether the technology is available - `existing_cap_power::Float64`: (default: `0.0`) Pre-existing power capacity for a technology (MW) @@ -57,6 +60,7 @@ This file is auto-generated. Do not edit. - `capital_costs_power::PSY.ValueCurve`: (default: `LinearCurve(0.0)`) Capital costs for investing in a technology. - `max_duration::Float64`: (default: `1000.0`) Maximum allowable durection for a storage technology - `unit_size_power::Float64`: (default: `0.0`) Used for discrete investment decisions. Size of each unit being built (MW) +- `capital_recovery_factor::Int64`: (default: `30`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs. - `id::Int64`: ID for individual generator - `min_cap_power::Float64`: (default: `0.0`) Minimum required power capacity for a storage technology - `capital_costs_energy::PSY.ValueCurve`: (default: `LinearCurve(0.0)`) Capital costs for investing in a technology. @@ -69,7 +73,7 @@ This file is auto-generated. Do not edit. - `om_costs_power::PSY.OperationalCost`: (default: `StorageCost()`) Fixed and variable O&M costs for a technology - `balancing_topology::String`: Set of balancing nodes - `min_cap_energy::Float64`: (default: `0.0`) Minimum required energy capacity for a storage technology -- `region::Union{Nothing, Region}`: (default: `nothing`) Region +- `region::Union{Nothing, Region, Vector{Region}}`: (default: `nothing`) Region - `initial_state_of_charge::Float64`: (default: `0.0`) State of charge for storage technology in the first timepoint (MWh). - `unit_size_energy::Float64`: (default: `0.0`) Used for discrete investment decisions. Size of each unit being built (MW) - `eff_up::Float64`: (default: `1.0`) Efficiency of charging storage @@ -89,6 +93,8 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology existing_cap_energy::Float64 "Prime mover for generator" prime_mover_type::PrimeMovers + "Maximum number of years a technology can be active once installed" + lifetime::Int "Cost of providing upwards spinning or contingency reserves" rsv_cost::Float64 "identifies whether the technology is available" @@ -105,6 +111,8 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology max_duration::Float64 "Used for discrete investment decisions. Size of each unit being built (MW)" unit_size_power::Float64 + "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs." + capital_recovery_factor::Int64 "ID for individual generator" id::Int64 "Minimum required power capacity for a storage technology" @@ -130,7 +138,7 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology "Minimum required energy capacity for a storage technology" min_cap_energy::Float64 "Region" - region::Union{Nothing, Region} + region::Union{Nothing, Region, Vector{Region}} "State of charge for storage technology in the first timepoint (MWh)." initial_state_of_charge::Float64 "Used for discrete investment decisions. Size of each unit being built (MW)" @@ -152,8 +160,8 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology end -function StorageTechnology{T}(; base_power, om_costs_energy=StorageCost(), existing_cap_energy=0.0, prime_mover_type=PrimeMovers.OT, rsv_cost=0.0, available, existing_cap_power=0.0, name, storage_tech, capital_costs_power=LinearCurve(0.0), max_duration=1000.0, unit_size_power=0.0, id, min_cap_power=0.0, capital_costs_energy=LinearCurve(0.0), losses=1.0, eff_down=1.0, rsv_max=0.0, max_cap_power=1e8, power_systems_type, internal=InfrastructureSystemsInternal(), om_costs_power=StorageCost(), balancing_topology, min_cap_energy=0.0, region=nothing, initial_state_of_charge=0.0, unit_size_energy=0.0, eff_up=1.0, cluster=1, ext=Dict(), reg_cost=0.0, min_duration=0.0, max_cap_energy=1e8, reg_max=0.0, ) where T <: PSY.Storage - StorageTechnology{T}(base_power, om_costs_energy, existing_cap_energy, prime_mover_type, rsv_cost, available, existing_cap_power, name, storage_tech, capital_costs_power, max_duration, unit_size_power, id, min_cap_power, capital_costs_energy, losses, eff_down, rsv_max, max_cap_power, power_systems_type, internal, om_costs_power, balancing_topology, min_cap_energy, region, initial_state_of_charge, unit_size_energy, eff_up, cluster, ext, reg_cost, min_duration, max_cap_energy, reg_max, ) +function StorageTechnology{T}(; base_power, om_costs_energy=StorageCost(), existing_cap_energy=0.0, prime_mover_type=PrimeMovers.OT, lifetime=100, rsv_cost=0.0, available, existing_cap_power=0.0, name, storage_tech, capital_costs_power=LinearCurve(0.0), max_duration=1000.0, unit_size_power=0.0, capital_recovery_factor=30, id, min_cap_power=0.0, capital_costs_energy=LinearCurve(0.0), losses=1.0, eff_down=1.0, rsv_max=0.0, max_cap_power=1e8, power_systems_type, internal=InfrastructureSystemsInternal(), om_costs_power=StorageCost(), balancing_topology, min_cap_energy=0.0, region=nothing, initial_state_of_charge=0.0, unit_size_energy=0.0, eff_up=1.0, cluster=1, ext=Dict(), reg_cost=0.0, min_duration=0.0, max_cap_energy=1e8, reg_max=0.0, ) where T <: PSY.Storage + StorageTechnology{T}(base_power, om_costs_energy, existing_cap_energy, prime_mover_type, lifetime, rsv_cost, available, existing_cap_power, name, storage_tech, capital_costs_power, max_duration, unit_size_power, capital_recovery_factor, id, min_cap_power, capital_costs_energy, losses, eff_down, rsv_max, max_cap_power, power_systems_type, internal, om_costs_power, balancing_topology, min_cap_energy, region, initial_state_of_charge, unit_size_energy, eff_up, cluster, ext, reg_cost, min_duration, max_cap_energy, reg_max, ) end """Get [`StorageTechnology`](@ref) `base_power`.""" @@ -164,6 +172,8 @@ get_om_costs_energy(value::StorageTechnology) = value.om_costs_energy get_existing_cap_energy(value::StorageTechnology) = value.existing_cap_energy """Get [`StorageTechnology`](@ref) `prime_mover_type`.""" get_prime_mover_type(value::StorageTechnology) = value.prime_mover_type +"""Get [`StorageTechnology`](@ref) `lifetime`.""" +get_lifetime(value::StorageTechnology) = value.lifetime """Get [`StorageTechnology`](@ref) `rsv_cost`.""" get_rsv_cost(value::StorageTechnology) = value.rsv_cost """Get [`StorageTechnology`](@ref) `available`.""" @@ -180,6 +190,8 @@ get_capital_costs_power(value::StorageTechnology) = value.capital_costs_power get_max_duration(value::StorageTechnology) = value.max_duration """Get [`StorageTechnology`](@ref) `unit_size_power`.""" get_unit_size_power(value::StorageTechnology) = value.unit_size_power +"""Get [`StorageTechnology`](@ref) `capital_recovery_factor`.""" +get_capital_recovery_factor(value::StorageTechnology) = value.capital_recovery_factor """Get [`StorageTechnology`](@ref) `id`.""" get_id(value::StorageTechnology) = value.id """Get [`StorageTechnology`](@ref) `min_cap_power`.""" @@ -233,6 +245,8 @@ set_om_costs_energy!(value::StorageTechnology, val) = value.om_costs_energy = va set_existing_cap_energy!(value::StorageTechnology, val) = value.existing_cap_energy = val """Set [`StorageTechnology`](@ref) `prime_mover_type`.""" set_prime_mover_type!(value::StorageTechnology, val) = value.prime_mover_type = val +"""Set [`StorageTechnology`](@ref) `lifetime`.""" +set_lifetime!(value::StorageTechnology, val) = value.lifetime = val """Set [`StorageTechnology`](@ref) `rsv_cost`.""" set_rsv_cost!(value::StorageTechnology, val) = value.rsv_cost = val """Set [`StorageTechnology`](@ref) `available`.""" @@ -249,6 +263,8 @@ set_capital_costs_power!(value::StorageTechnology, val) = value.capital_costs_po set_max_duration!(value::StorageTechnology, val) = value.max_duration = val """Set [`StorageTechnology`](@ref) `unit_size_power`.""" set_unit_size_power!(value::StorageTechnology, val) = value.unit_size_power = val +"""Set [`StorageTechnology`](@ref) `capital_recovery_factor`.""" +set_capital_recovery_factor!(value::StorageTechnology, val) = value.capital_recovery_factor = val """Set [`StorageTechnology`](@ref) `id`.""" set_id!(value::StorageTechnology, val) = value.id = val """Set [`StorageTechnology`](@ref) `min_cap_power`.""" diff --git a/src/models/generated/SupplyTechnology.jl b/src/models/generated/SupplyTechnology.jl index 081d42c..caaf325 100644 --- a/src/models/generated/SupplyTechnology.jl +++ b/src/models/generated/SupplyTechnology.jl @@ -13,6 +13,7 @@ This file is auto-generated. Do not edit. minimum_required_capacity::Float64 cofire_level_min::Union{Nothing, Dict{ThermalFuels, Float64}} capital_costs::PSY.ValueCurve + lifetime::Int rsv_cost::Float64 cofire_start_max::Union{Nothing, Dict{ThermalFuels, Float64}} available::Bool @@ -20,6 +21,7 @@ This file is auto-generated. Do not edit. cofire_start_min::Union{Nothing, Dict{ThermalFuels, Float64}} name::String ramp_dn_percentage::Float64 + capital_recovery_factor::Int64 id::Int64 down_time::Float64 initial_capacity::Float64 @@ -32,7 +34,7 @@ This file is auto-generated. Do not edit. internal::InfrastructureSystemsInternal ext::Dict balancing_topology::String - region::Union{Nothing, Region} + region::Union{Nothing, Region, Vector{Region}} maximum_capacity::Float64 cluster::Int64 ramp_up_percentage::Float64 @@ -54,6 +56,7 @@ This file is auto-generated. Do not edit. - `minimum_required_capacity::Float64`: (default: `0.0`) Minimum required capacity for a technology - `cofire_level_min::Union{Nothing, Dict{ThermalFuels, Float64}}`: (default: `nothing`) Minimum blending level of each fuel during normal generation process for multi-fuel generator - `capital_costs::PSY.ValueCurve`: (default: `LinearCurve(0.0)`) Capital costs for investing in a technology. +- `lifetime::Int`: (default: `100`) Maximum number of years a technology can be active once installed - `rsv_cost::Float64`: (default: `0.0`) Cost of providing upwards spinning or contingency reserves - `cofire_start_max::Union{Nothing, Dict{ThermalFuels, Float64}}`: (default: `nothing`) Maximum blending level of each fuel during start-up process for multi-fuel generator - `available::Bool`: (default: `True`) identifies whether the technology is available @@ -61,6 +64,7 @@ This file is auto-generated. Do not edit. - `cofire_start_min::Union{Nothing, Dict{ThermalFuels, Float64}}`: (default: `nothing`) Minimum blending level of each fuel during start-up process for multi-fuel generator - `name::String`: The technology name - `ramp_dn_percentage::Float64`: (default: `100.0`) Maximum decrease in output between operation periods. Fraction of total capacity +- `capital_recovery_factor::Int64`: (default: `30`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs. - `id::Int64`: ID for individual generator - `down_time::Float64`: (default: `0.0`) Minimum amount of time a resource has to remain in the shutdown state. - `initial_capacity::Float64`: (default: `0.0`) Pre-existing capacity for a technology @@ -73,7 +77,7 @@ This file is auto-generated. Do not edit. - `internal::InfrastructureSystemsInternal`: (default: `InfrastructureSystemsInternal()`) Internal field - `ext::Dict`: (default: `Dict()`) Option for providing additional data - `balancing_topology::String`: Set of balancing nodes -- `region::Union{Nothing, Region}`: (default: `nothing`) Zone where tech operates in +- `region::Union{Nothing, Region, Vector{Region}}`: (default: `nothing`) Zone where tech operates in - `maximum_capacity::Float64`: (default: `Inf`) Maximum allowable installed capacity for a technology - `cluster::Int64`: (default: `1`) Number of the cluster when representing multiple clusters of a given technology in a given region. - `ramp_up_percentage::Float64`: (default: `100.0`) Maximum increase in output between operation periods. Fraction of total capacity @@ -99,6 +103,8 @@ mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology cofire_level_min::Union{Nothing, Dict{ThermalFuels, Float64}} "Capital costs for investing in a technology." capital_costs::PSY.ValueCurve + "Maximum number of years a technology can be active once installed" + lifetime::Int "Cost of providing upwards spinning or contingency reserves" rsv_cost::Float64 "Maximum blending level of each fuel during start-up process for multi-fuel generator" @@ -113,6 +119,8 @@ mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology name::String "Maximum decrease in output between operation periods. Fraction of total capacity" ramp_dn_percentage::Float64 + "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs." + capital_recovery_factor::Int64 "ID for individual generator" id::Int64 "Minimum amount of time a resource has to remain in the shutdown state." @@ -138,7 +146,7 @@ mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology "Set of balancing nodes" balancing_topology::String "Zone where tech operates in" - region::Union{Nothing, Region} + region::Union{Nothing, Region, Vector{Region}} "Maximum allowable installed capacity for a technology" maximum_capacity::Float64 "Number of the cluster when representing multiple clusters of a given technology in a given region." @@ -160,8 +168,8 @@ mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology end -function SupplyTechnology{T}(; base_power, heat_rate_mmbtu_per_mwh=0.0, outage_factor=1.0, prime_mover_type=PrimeMovers.OT, minimum_required_capacity=0.0, cofire_level_min=nothing, capital_costs=LinearCurve(0.0), rsv_cost=0.0, cofire_start_max=nothing, available=True, co2=0.0, cofire_start_min=nothing, name, ramp_dn_percentage=100.0, id, down_time=0.0, initial_capacity=0.0, start_fuel_mmbtu_per_mw=0.0, operation_costs=ThermalGenerationCost(), rsv_max=0.0, fuel=ThermalFuels.OTHER, power_systems_type, cofire_level_max=nothing, internal=InfrastructureSystemsInternal(), ext=Dict(), balancing_topology, region=nothing, maximum_capacity=Inf, cluster=1, ramp_up_percentage=100.0, unit_size=0.0, reg_cost=0.0, min_generation_percentage=0.0, start_cost_per_mw=0.0, reg_max=0.0, up_time=0.0, ) where T <: PSY.Generator - SupplyTechnology{T}(base_power, heat_rate_mmbtu_per_mwh, outage_factor, prime_mover_type, minimum_required_capacity, cofire_level_min, capital_costs, rsv_cost, cofire_start_max, available, co2, cofire_start_min, name, ramp_dn_percentage, id, down_time, initial_capacity, start_fuel_mmbtu_per_mw, operation_costs, rsv_max, fuel, power_systems_type, cofire_level_max, internal, ext, balancing_topology, region, maximum_capacity, cluster, ramp_up_percentage, unit_size, reg_cost, min_generation_percentage, start_cost_per_mw, reg_max, up_time, ) +function SupplyTechnology{T}(; base_power, heat_rate_mmbtu_per_mwh=0.0, outage_factor=1.0, prime_mover_type=PrimeMovers.OT, minimum_required_capacity=0.0, cofire_level_min=nothing, capital_costs=LinearCurve(0.0), lifetime=100, rsv_cost=0.0, cofire_start_max=nothing, available=True, co2=0.0, cofire_start_min=nothing, name, ramp_dn_percentage=100.0, capital_recovery_factor=30, id, down_time=0.0, initial_capacity=0.0, start_fuel_mmbtu_per_mw=0.0, operation_costs=ThermalGenerationCost(), rsv_max=0.0, fuel=ThermalFuels.OTHER, power_systems_type, cofire_level_max=nothing, internal=InfrastructureSystemsInternal(), ext=Dict(), balancing_topology, region=nothing, maximum_capacity=Inf, cluster=1, ramp_up_percentage=100.0, unit_size=0.0, reg_cost=0.0, min_generation_percentage=0.0, start_cost_per_mw=0.0, reg_max=0.0, up_time=0.0, ) where T <: PSY.Generator + SupplyTechnology{T}(base_power, heat_rate_mmbtu_per_mwh, outage_factor, prime_mover_type, minimum_required_capacity, cofire_level_min, capital_costs, lifetime, rsv_cost, cofire_start_max, available, co2, cofire_start_min, name, ramp_dn_percentage, capital_recovery_factor, id, down_time, initial_capacity, start_fuel_mmbtu_per_mw, operation_costs, rsv_max, fuel, power_systems_type, cofire_level_max, internal, ext, balancing_topology, region, maximum_capacity, cluster, ramp_up_percentage, unit_size, reg_cost, min_generation_percentage, start_cost_per_mw, reg_max, up_time, ) end """Get [`SupplyTechnology`](@ref) `base_power`.""" @@ -178,6 +186,8 @@ get_minimum_required_capacity(value::SupplyTechnology) = value.minimum_required_ get_cofire_level_min(value::SupplyTechnology) = value.cofire_level_min """Get [`SupplyTechnology`](@ref) `capital_costs`.""" get_capital_costs(value::SupplyTechnology) = value.capital_costs +"""Get [`SupplyTechnology`](@ref) `lifetime`.""" +get_lifetime(value::SupplyTechnology) = value.lifetime """Get [`SupplyTechnology`](@ref) `rsv_cost`.""" get_rsv_cost(value::SupplyTechnology) = value.rsv_cost """Get [`SupplyTechnology`](@ref) `cofire_start_max`.""" @@ -192,6 +202,8 @@ get_cofire_start_min(value::SupplyTechnology) = value.cofire_start_min get_name(value::SupplyTechnology) = value.name """Get [`SupplyTechnology`](@ref) `ramp_dn_percentage`.""" get_ramp_dn_percentage(value::SupplyTechnology) = value.ramp_dn_percentage +"""Get [`SupplyTechnology`](@ref) `capital_recovery_factor`.""" +get_capital_recovery_factor(value::SupplyTechnology) = value.capital_recovery_factor """Get [`SupplyTechnology`](@ref) `id`.""" get_id(value::SupplyTechnology) = value.id """Get [`SupplyTechnology`](@ref) `down_time`.""" @@ -251,6 +263,8 @@ set_minimum_required_capacity!(value::SupplyTechnology, val) = value.minimum_req set_cofire_level_min!(value::SupplyTechnology, val) = value.cofire_level_min = val """Set [`SupplyTechnology`](@ref) `capital_costs`.""" set_capital_costs!(value::SupplyTechnology, val) = value.capital_costs = val +"""Set [`SupplyTechnology`](@ref) `lifetime`.""" +set_lifetime!(value::SupplyTechnology, val) = value.lifetime = val """Set [`SupplyTechnology`](@ref) `rsv_cost`.""" set_rsv_cost!(value::SupplyTechnology, val) = value.rsv_cost = val """Set [`SupplyTechnology`](@ref) `cofire_start_max`.""" @@ -265,6 +279,8 @@ set_cofire_start_min!(value::SupplyTechnology, val) = value.cofire_start_min = v set_name!(value::SupplyTechnology, val) = value.name = val """Set [`SupplyTechnology`](@ref) `ramp_dn_percentage`.""" set_ramp_dn_percentage!(value::SupplyTechnology, val) = value.ramp_dn_percentage = val +"""Set [`SupplyTechnology`](@ref) `capital_recovery_factor`.""" +set_capital_recovery_factor!(value::SupplyTechnology, val) = value.capital_recovery_factor = val """Set [`SupplyTechnology`](@ref) `id`.""" set_id!(value::SupplyTechnology, val) = value.id = val """Set [`SupplyTechnology`](@ref) `down_time`.""" diff --git a/src/models/generated/includes.jl b/src/models/generated/includes.jl index 738c4c7..d7a20fa 100644 --- a/src/models/generated/includes.jl +++ b/src/models/generated/includes.jl @@ -53,6 +53,7 @@ export get_heat_rate_mmbtu_per_mwh export get_id export get_initial_capacity export get_initial_state_of_charge +export get_lifetime export get_line_loss export get_losses export get_max_cap_energy @@ -143,6 +144,7 @@ export set_heat_rate_mmbtu_per_mwh! export set_id! export set_initial_capacity! export set_initial_state_of_charge! +export set_lifetime! export set_line_loss! export set_losses! export set_max_cap_energy! From 5eb0acd0fcf12eb7f208a141bc2c2142252bc91f Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Wed, 20 Nov 2024 15:10:15 -0700 Subject: [PATCH 31/40] add base_year --- src/models/generated/ACTransportTechnology.jl | 12 ++++++++++-- src/models/generated/ExistingTransportTechnology.jl | 12 ++++++++++-- src/models/generated/HVDCTransportTechnology.jl | 12 ++++++++++-- src/models/generated/StorageTechnology.jl | 12 ++++++++++-- src/models/generated/SupplyTechnology.jl | 12 ++++++++++-- src/models/generated/includes.jl | 2 ++ src/portfolio.jl | 1 + 7 files changed, 53 insertions(+), 10 deletions(-) diff --git a/src/models/generated/ACTransportTechnology.jl b/src/models/generated/ACTransportTechnology.jl index 80ef3a1..2a94273 100644 --- a/src/models/generated/ACTransportTechnology.jl +++ b/src/models/generated/ACTransportTechnology.jl @@ -21,6 +21,7 @@ This file is auto-generated. Do not edit. voltage::Float64 network_id::Int64 maximum_new_capacity::Float64 + base_year::Int existing_line_capacity::Float64 wacc::Float64 line_loss::Float64 @@ -44,6 +45,7 @@ This file is auto-generated. Do not edit. - `voltage::Float64`: (default: `0.0`) Technology resistance in Ohms - `network_id::Int64`: Numerical Index - `maximum_new_capacity::Float64`: Maximum capacity that can be added to transmission line (MW) +- `base_year::Int`: (default: `2020`) Reference year for technology data - `existing_line_capacity::Float64`: Existing capacity of transport technology (MW) - `wacc::Float64`: (default: `0`) Weighted average cost of capital - `line_loss::Float64`: Transmission loss for each transport technology (%) @@ -79,6 +81,8 @@ mutable struct ACTransportTechnology{T <: PSY.Device} <: Technology network_id::Int64 "Maximum capacity that can be added to transmission line (MW)" maximum_new_capacity::Float64 + "Reference year for technology data" + base_year::Int "Existing capacity of transport technology (MW)" existing_line_capacity::Float64 "Weighted average cost of capital" @@ -88,8 +92,8 @@ mutable struct ACTransportTechnology{T <: PSY.Device} <: Technology end -function ACTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, capital_recovery_factor=30, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device - ACTransportTechnology{T}(base_power, capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, existing_line_capacity, wacc, line_loss, ) +function ACTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, capital_recovery_factor=30, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, base_year=2020, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device + ACTransportTechnology{T}(base_power, capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, base_year, existing_line_capacity, wacc, line_loss, ) end """Get [`ACTransportTechnology`](@ref) `base_power`.""" @@ -122,6 +126,8 @@ get_voltage(value::ACTransportTechnology) = value.voltage get_network_id(value::ACTransportTechnology) = value.network_id """Get [`ACTransportTechnology`](@ref) `maximum_new_capacity`.""" get_maximum_new_capacity(value::ACTransportTechnology) = value.maximum_new_capacity +"""Get [`ACTransportTechnology`](@ref) `base_year`.""" +get_base_year(value::ACTransportTechnology) = value.base_year """Get [`ACTransportTechnology`](@ref) `existing_line_capacity`.""" get_existing_line_capacity(value::ACTransportTechnology) = value.existing_line_capacity """Get [`ACTransportTechnology`](@ref) `wacc`.""" @@ -159,6 +165,8 @@ set_voltage!(value::ACTransportTechnology, val) = value.voltage = val set_network_id!(value::ACTransportTechnology, val) = value.network_id = val """Set [`ACTransportTechnology`](@ref) `maximum_new_capacity`.""" set_maximum_new_capacity!(value::ACTransportTechnology, val) = value.maximum_new_capacity = val +"""Set [`ACTransportTechnology`](@ref) `base_year`.""" +set_base_year!(value::ACTransportTechnology, val) = value.base_year = val """Set [`ACTransportTechnology`](@ref) `existing_line_capacity`.""" set_existing_line_capacity!(value::ACTransportTechnology, val) = value.existing_line_capacity = val """Set [`ACTransportTechnology`](@ref) `wacc`.""" diff --git a/src/models/generated/ExistingTransportTechnology.jl b/src/models/generated/ExistingTransportTechnology.jl index af2f4da..bbfcd30 100644 --- a/src/models/generated/ExistingTransportTechnology.jl +++ b/src/models/generated/ExistingTransportTechnology.jl @@ -21,6 +21,7 @@ This file is auto-generated. Do not edit. voltage::Float64 network_id::Int64 maximum_new_capacity::Float64 + base_year::Int existing_line_capacity::Float64 wacc::Float64 line_loss::Float64 @@ -44,6 +45,7 @@ This file is auto-generated. Do not edit. - `voltage::Float64`: (default: `0.0`) Technology resistance in Ohms - `network_id::Int64`: Numerical Index - `maximum_new_capacity::Float64`: Maximum capacity that can be added to transmission line (MW) +- `base_year::Int`: (default: `2020`) Reference year for technology data - `existing_line_capacity::Float64`: Existing capacity of transport technology (MW) - `wacc::Float64`: (default: `0`) Weighted average cost of capital - `line_loss::Float64`: Transmission loss for each transport technology (%) @@ -79,6 +81,8 @@ mutable struct ExistingTransportTechnology{T <: PSY.Device} <: Technology network_id::Int64 "Maximum capacity that can be added to transmission line (MW)" maximum_new_capacity::Float64 + "Reference year for technology data" + base_year::Int "Existing capacity of transport technology (MW)" existing_line_capacity::Float64 "Weighted average cost of capital" @@ -88,8 +92,8 @@ mutable struct ExistingTransportTechnology{T <: PSY.Device} <: Technology end -function ExistingTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, capital_recovery_factor=30, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device - ExistingTransportTechnology{T}(base_power, capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, existing_line_capacity, wacc, line_loss, ) +function ExistingTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, capital_recovery_factor=30, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, base_year=2020, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device + ExistingTransportTechnology{T}(base_power, capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, base_year, existing_line_capacity, wacc, line_loss, ) end """Get [`ExistingTransportTechnology`](@ref) `base_power`.""" @@ -122,6 +126,8 @@ get_voltage(value::ExistingTransportTechnology) = value.voltage get_network_id(value::ExistingTransportTechnology) = value.network_id """Get [`ExistingTransportTechnology`](@ref) `maximum_new_capacity`.""" get_maximum_new_capacity(value::ExistingTransportTechnology) = value.maximum_new_capacity +"""Get [`ExistingTransportTechnology`](@ref) `base_year`.""" +get_base_year(value::ExistingTransportTechnology) = value.base_year """Get [`ExistingTransportTechnology`](@ref) `existing_line_capacity`.""" get_existing_line_capacity(value::ExistingTransportTechnology) = value.existing_line_capacity """Get [`ExistingTransportTechnology`](@ref) `wacc`.""" @@ -159,6 +165,8 @@ set_voltage!(value::ExistingTransportTechnology, val) = value.voltage = val set_network_id!(value::ExistingTransportTechnology, val) = value.network_id = val """Set [`ExistingTransportTechnology`](@ref) `maximum_new_capacity`.""" set_maximum_new_capacity!(value::ExistingTransportTechnology, val) = value.maximum_new_capacity = val +"""Set [`ExistingTransportTechnology`](@ref) `base_year`.""" +set_base_year!(value::ExistingTransportTechnology, val) = value.base_year = val """Set [`ExistingTransportTechnology`](@ref) `existing_line_capacity`.""" set_existing_line_capacity!(value::ExistingTransportTechnology, val) = value.existing_line_capacity = val """Set [`ExistingTransportTechnology`](@ref) `wacc`.""" diff --git a/src/models/generated/HVDCTransportTechnology.jl b/src/models/generated/HVDCTransportTechnology.jl index 7d84f98..b3a9a88 100644 --- a/src/models/generated/HVDCTransportTechnology.jl +++ b/src/models/generated/HVDCTransportTechnology.jl @@ -21,6 +21,7 @@ This file is auto-generated. Do not edit. voltage::Float64 network_id::Int64 maximum_new_capacity::Float64 + base_year::Int existing_line_capacity::Float64 wacc::Float64 line_loss::Float64 @@ -44,6 +45,7 @@ This file is auto-generated. Do not edit. - `voltage::Float64`: (default: `0.0`) Technology resistance in Ohms - `network_id::Int64`: Numerical Index - `maximum_new_capacity::Float64`: Maximum capacity that can be added to transmission line (MW) +- `base_year::Int`: (default: `2020`) Reference year for technology data - `existing_line_capacity::Float64`: Existing capacity of transport technology (MW) - `wacc::Float64`: (default: `0`) Weighted average cost of capital - `line_loss::Float64`: Transmission loss for each transport technology (%) @@ -79,6 +81,8 @@ mutable struct HVDCTransportTechnology{T <: PSY.Device} <: Technology network_id::Int64 "Maximum capacity that can be added to transmission line (MW)" maximum_new_capacity::Float64 + "Reference year for technology data" + base_year::Int "Existing capacity of transport technology (MW)" existing_line_capacity::Float64 "Weighted average cost of capital" @@ -88,8 +92,8 @@ mutable struct HVDCTransportTechnology{T <: PSY.Device} <: Technology end -function HVDCTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, capital_recovery_factor=30, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device - HVDCTransportTechnology{T}(base_power, capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, existing_line_capacity, wacc, line_loss, ) +function HVDCTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, capital_recovery_factor=30, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, base_year=2020, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device + HVDCTransportTechnology{T}(base_power, capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, base_year, existing_line_capacity, wacc, line_loss, ) end """Get [`HVDCTransportTechnology`](@ref) `base_power`.""" @@ -122,6 +126,8 @@ get_voltage(value::HVDCTransportTechnology) = value.voltage get_network_id(value::HVDCTransportTechnology) = value.network_id """Get [`HVDCTransportTechnology`](@ref) `maximum_new_capacity`.""" get_maximum_new_capacity(value::HVDCTransportTechnology) = value.maximum_new_capacity +"""Get [`HVDCTransportTechnology`](@ref) `base_year`.""" +get_base_year(value::HVDCTransportTechnology) = value.base_year """Get [`HVDCTransportTechnology`](@ref) `existing_line_capacity`.""" get_existing_line_capacity(value::HVDCTransportTechnology) = value.existing_line_capacity """Get [`HVDCTransportTechnology`](@ref) `wacc`.""" @@ -159,6 +165,8 @@ set_voltage!(value::HVDCTransportTechnology, val) = value.voltage = val set_network_id!(value::HVDCTransportTechnology, val) = value.network_id = val """Set [`HVDCTransportTechnology`](@ref) `maximum_new_capacity`.""" set_maximum_new_capacity!(value::HVDCTransportTechnology, val) = value.maximum_new_capacity = val +"""Set [`HVDCTransportTechnology`](@ref) `base_year`.""" +set_base_year!(value::HVDCTransportTechnology, val) = value.base_year = val """Set [`HVDCTransportTechnology`](@ref) `existing_line_capacity`.""" set_existing_line_capacity!(value::HVDCTransportTechnology, val) = value.existing_line_capacity = val """Set [`HVDCTransportTechnology`](@ref) `wacc`.""" diff --git a/src/models/generated/StorageTechnology.jl b/src/models/generated/StorageTechnology.jl index 6e07c0d..fba3379 100644 --- a/src/models/generated/StorageTechnology.jl +++ b/src/models/generated/StorageTechnology.jl @@ -38,6 +38,7 @@ This file is auto-generated. Do not edit. eff_up::Float64 cluster::Int64 ext::Dict + base_year::Int reg_cost::Float64 min_duration::Float64 max_cap_energy::Float64 @@ -79,6 +80,7 @@ This file is auto-generated. Do not edit. - `eff_up::Float64`: (default: `1.0`) Efficiency of charging storage - `cluster::Int64`: (default: `1`) Number of the cluster when representing multiple clusters of a given technology in a given region. - `ext::Dict`: (default: `Dict()`) Option for providing additional data +- `base_year::Int`: (default: `2020`) Reference year for technology data - `reg_cost::Float64`: (default: `0.0`) Cost of providing regulation reserves - `min_duration::Float64`: (default: `0.0`) Minimum required durection for a storage technology - `max_cap_energy::Float64`: (default: `1e8`) Maximum allowable installed energy capacity for a storage technology @@ -149,6 +151,8 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology cluster::Int64 "Option for providing additional data" ext::Dict + "Reference year for technology data" + base_year::Int "Cost of providing regulation reserves " reg_cost::Float64 "Minimum required durection for a storage technology" @@ -160,8 +164,8 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology end -function StorageTechnology{T}(; base_power, om_costs_energy=StorageCost(), existing_cap_energy=0.0, prime_mover_type=PrimeMovers.OT, lifetime=100, rsv_cost=0.0, available, existing_cap_power=0.0, name, storage_tech, capital_costs_power=LinearCurve(0.0), max_duration=1000.0, unit_size_power=0.0, capital_recovery_factor=30, id, min_cap_power=0.0, capital_costs_energy=LinearCurve(0.0), losses=1.0, eff_down=1.0, rsv_max=0.0, max_cap_power=1e8, power_systems_type, internal=InfrastructureSystemsInternal(), om_costs_power=StorageCost(), balancing_topology, min_cap_energy=0.0, region=nothing, initial_state_of_charge=0.0, unit_size_energy=0.0, eff_up=1.0, cluster=1, ext=Dict(), reg_cost=0.0, min_duration=0.0, max_cap_energy=1e8, reg_max=0.0, ) where T <: PSY.Storage - StorageTechnology{T}(base_power, om_costs_energy, existing_cap_energy, prime_mover_type, lifetime, rsv_cost, available, existing_cap_power, name, storage_tech, capital_costs_power, max_duration, unit_size_power, capital_recovery_factor, id, min_cap_power, capital_costs_energy, losses, eff_down, rsv_max, max_cap_power, power_systems_type, internal, om_costs_power, balancing_topology, min_cap_energy, region, initial_state_of_charge, unit_size_energy, eff_up, cluster, ext, reg_cost, min_duration, max_cap_energy, reg_max, ) +function StorageTechnology{T}(; base_power, om_costs_energy=StorageCost(), existing_cap_energy=0.0, prime_mover_type=PrimeMovers.OT, lifetime=100, rsv_cost=0.0, available, existing_cap_power=0.0, name, storage_tech, capital_costs_power=LinearCurve(0.0), max_duration=1000.0, unit_size_power=0.0, capital_recovery_factor=30, id, min_cap_power=0.0, capital_costs_energy=LinearCurve(0.0), losses=1.0, eff_down=1.0, rsv_max=0.0, max_cap_power=1e8, power_systems_type, internal=InfrastructureSystemsInternal(), om_costs_power=StorageCost(), balancing_topology, min_cap_energy=0.0, region=nothing, initial_state_of_charge=0.0, unit_size_energy=0.0, eff_up=1.0, cluster=1, ext=Dict(), base_year=2020, reg_cost=0.0, min_duration=0.0, max_cap_energy=1e8, reg_max=0.0, ) where T <: PSY.Storage + StorageTechnology{T}(base_power, om_costs_energy, existing_cap_energy, prime_mover_type, lifetime, rsv_cost, available, existing_cap_power, name, storage_tech, capital_costs_power, max_duration, unit_size_power, capital_recovery_factor, id, min_cap_power, capital_costs_energy, losses, eff_down, rsv_max, max_cap_power, power_systems_type, internal, om_costs_power, balancing_topology, min_cap_energy, region, initial_state_of_charge, unit_size_energy, eff_up, cluster, ext, base_year, reg_cost, min_duration, max_cap_energy, reg_max, ) end """Get [`StorageTechnology`](@ref) `base_power`.""" @@ -228,6 +232,8 @@ get_eff_up(value::StorageTechnology) = value.eff_up get_cluster(value::StorageTechnology) = value.cluster """Get [`StorageTechnology`](@ref) `ext`.""" get_ext(value::StorageTechnology) = value.ext +"""Get [`StorageTechnology`](@ref) `base_year`.""" +get_base_year(value::StorageTechnology) = value.base_year """Get [`StorageTechnology`](@ref) `reg_cost`.""" get_reg_cost(value::StorageTechnology) = value.reg_cost """Get [`StorageTechnology`](@ref) `min_duration`.""" @@ -301,6 +307,8 @@ set_eff_up!(value::StorageTechnology, val) = value.eff_up = val set_cluster!(value::StorageTechnology, val) = value.cluster = val """Set [`StorageTechnology`](@ref) `ext`.""" set_ext!(value::StorageTechnology, val) = value.ext = val +"""Set [`StorageTechnology`](@ref) `base_year`.""" +set_base_year!(value::StorageTechnology, val) = value.base_year = val """Set [`StorageTechnology`](@ref) `reg_cost`.""" set_reg_cost!(value::StorageTechnology, val) = value.reg_cost = val """Set [`StorageTechnology`](@ref) `min_duration`.""" diff --git a/src/models/generated/SupplyTechnology.jl b/src/models/generated/SupplyTechnology.jl index caaf325..4a0a707 100644 --- a/src/models/generated/SupplyTechnology.jl +++ b/src/models/generated/SupplyTechnology.jl @@ -38,6 +38,7 @@ This file is auto-generated. Do not edit. maximum_capacity::Float64 cluster::Int64 ramp_up_percentage::Float64 + base_year::Int unit_size::Float64 reg_cost::Float64 min_generation_percentage::Float64 @@ -81,6 +82,7 @@ This file is auto-generated. Do not edit. - `maximum_capacity::Float64`: (default: `Inf`) Maximum allowable installed capacity for a technology - `cluster::Int64`: (default: `1`) Number of the cluster when representing multiple clusters of a given technology in a given region. - `ramp_up_percentage::Float64`: (default: `100.0`) Maximum increase in output between operation periods. Fraction of total capacity +- `base_year::Int`: (default: `2020`) Reference year for technology data - `unit_size::Float64`: (default: `0.0`) Used for discrete investment decisions. Size of each unit being built (MW) - `reg_cost::Float64`: (default: `0.0`) Cost of providing regulation reserves - `min_generation_percentage::Float64`: (default: `0.0`) Minimum generation as a fraction of total capacity @@ -153,6 +155,8 @@ mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology cluster::Int64 "Maximum increase in output between operation periods. Fraction of total capacity" ramp_up_percentage::Float64 + "Reference year for technology data" + base_year::Int "Used for discrete investment decisions. Size of each unit being built (MW)" unit_size::Float64 "Cost of providing regulation reserves " @@ -168,8 +172,8 @@ mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology end -function SupplyTechnology{T}(; base_power, heat_rate_mmbtu_per_mwh=0.0, outage_factor=1.0, prime_mover_type=PrimeMovers.OT, minimum_required_capacity=0.0, cofire_level_min=nothing, capital_costs=LinearCurve(0.0), lifetime=100, rsv_cost=0.0, cofire_start_max=nothing, available=True, co2=0.0, cofire_start_min=nothing, name, ramp_dn_percentage=100.0, capital_recovery_factor=30, id, down_time=0.0, initial_capacity=0.0, start_fuel_mmbtu_per_mw=0.0, operation_costs=ThermalGenerationCost(), rsv_max=0.0, fuel=ThermalFuels.OTHER, power_systems_type, cofire_level_max=nothing, internal=InfrastructureSystemsInternal(), ext=Dict(), balancing_topology, region=nothing, maximum_capacity=Inf, cluster=1, ramp_up_percentage=100.0, unit_size=0.0, reg_cost=0.0, min_generation_percentage=0.0, start_cost_per_mw=0.0, reg_max=0.0, up_time=0.0, ) where T <: PSY.Generator - SupplyTechnology{T}(base_power, heat_rate_mmbtu_per_mwh, outage_factor, prime_mover_type, minimum_required_capacity, cofire_level_min, capital_costs, lifetime, rsv_cost, cofire_start_max, available, co2, cofire_start_min, name, ramp_dn_percentage, capital_recovery_factor, id, down_time, initial_capacity, start_fuel_mmbtu_per_mw, operation_costs, rsv_max, fuel, power_systems_type, cofire_level_max, internal, ext, balancing_topology, region, maximum_capacity, cluster, ramp_up_percentage, unit_size, reg_cost, min_generation_percentage, start_cost_per_mw, reg_max, up_time, ) +function SupplyTechnology{T}(; base_power, heat_rate_mmbtu_per_mwh=0.0, outage_factor=1.0, prime_mover_type=PrimeMovers.OT, minimum_required_capacity=0.0, cofire_level_min=nothing, capital_costs=LinearCurve(0.0), lifetime=100, rsv_cost=0.0, cofire_start_max=nothing, available=True, co2=0.0, cofire_start_min=nothing, name, ramp_dn_percentage=100.0, capital_recovery_factor=30, id, down_time=0.0, initial_capacity=0.0, start_fuel_mmbtu_per_mw=0.0, operation_costs=ThermalGenerationCost(), rsv_max=0.0, fuel=ThermalFuels.OTHER, power_systems_type, cofire_level_max=nothing, internal=InfrastructureSystemsInternal(), ext=Dict(), balancing_topology, region=nothing, maximum_capacity=Inf, cluster=1, ramp_up_percentage=100.0, base_year=2020, unit_size=0.0, reg_cost=0.0, min_generation_percentage=0.0, start_cost_per_mw=0.0, reg_max=0.0, up_time=0.0, ) where T <: PSY.Generator + SupplyTechnology{T}(base_power, heat_rate_mmbtu_per_mwh, outage_factor, prime_mover_type, minimum_required_capacity, cofire_level_min, capital_costs, lifetime, rsv_cost, cofire_start_max, available, co2, cofire_start_min, name, ramp_dn_percentage, capital_recovery_factor, id, down_time, initial_capacity, start_fuel_mmbtu_per_mw, operation_costs, rsv_max, fuel, power_systems_type, cofire_level_max, internal, ext, balancing_topology, region, maximum_capacity, cluster, ramp_up_percentage, base_year, unit_size, reg_cost, min_generation_percentage, start_cost_per_mw, reg_max, up_time, ) end """Get [`SupplyTechnology`](@ref) `base_power`.""" @@ -236,6 +240,8 @@ get_maximum_capacity(value::SupplyTechnology) = value.maximum_capacity get_cluster(value::SupplyTechnology) = value.cluster """Get [`SupplyTechnology`](@ref) `ramp_up_percentage`.""" get_ramp_up_percentage(value::SupplyTechnology) = value.ramp_up_percentage +"""Get [`SupplyTechnology`](@ref) `base_year`.""" +get_base_year(value::SupplyTechnology) = value.base_year """Get [`SupplyTechnology`](@ref) `unit_size`.""" get_unit_size(value::SupplyTechnology) = value.unit_size """Get [`SupplyTechnology`](@ref) `reg_cost`.""" @@ -313,6 +319,8 @@ set_maximum_capacity!(value::SupplyTechnology, val) = value.maximum_capacity = v set_cluster!(value::SupplyTechnology, val) = value.cluster = val """Set [`SupplyTechnology`](@ref) `ramp_up_percentage`.""" set_ramp_up_percentage!(value::SupplyTechnology, val) = value.ramp_up_percentage = val +"""Set [`SupplyTechnology`](@ref) `base_year`.""" +set_base_year!(value::SupplyTechnology, val) = value.base_year = val """Set [`SupplyTechnology`](@ref) `unit_size`.""" set_unit_size!(value::SupplyTechnology, val) = value.unit_size = val """Set [`SupplyTechnology`](@ref) `reg_cost`.""" diff --git a/src/models/generated/includes.jl b/src/models/generated/includes.jl index d7a20fa..924c582 100644 --- a/src/models/generated/includes.jl +++ b/src/models/generated/includes.jl @@ -20,6 +20,7 @@ export get_angle_limit export get_available export get_balancing_topology export get_base_power +export get_base_year export get_capital_cost export get_capital_costs export get_capital_costs_energy @@ -111,6 +112,7 @@ export set_angle_limit! export set_available! export set_balancing_topology! export set_base_power! +export set_base_year! export set_capital_cost! export set_capital_costs! export set_capital_costs_energy! diff --git a/src/portfolio.jl b/src/portfolio.jl index bed49c8..fea69c6 100644 --- a/src/portfolio.jl +++ b/src/portfolio.jl @@ -21,6 +21,7 @@ end mutable struct Portfolio <: IS.InfrastructureSystemsType aggregation::Type{<:Union{PSY.ACBus, PSY.AggregationTopology}} discount_rate::Float64 + base_year::Int data::IS.SystemData # Inputs to the model investment_schedule::Dict # Investment decisions container i.e., model outputs. Container TBD #units_settings::IS.SystemUnitsSettings From e8d2d9b05faecd666d9f4d2e86b7b77b7720a6e4 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Wed, 20 Nov 2024 15:17:33 -0700 Subject: [PATCH 32/40] fix base_year --- src/portfolio.jl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/portfolio.jl b/src/portfolio.jl index fea69c6..4549c97 100644 --- a/src/portfolio.jl +++ b/src/portfolio.jl @@ -33,6 +33,7 @@ mutable struct Portfolio <: IS.InfrastructureSystemsType function Portfolio( aggregation, discount_rate::Float64, + base_year::Int, data, investment_schedule::Dict, #units_settings::IS.SystemUnitsSettings, @@ -57,6 +58,7 @@ mutable struct Portfolio <: IS.InfrastructureSystemsType return new( aggregation, discount_rate, + base_year, data, investment_schedule, #units_settings, @@ -125,6 +127,16 @@ Get the name of the portfolio. """ get_name(val::Portfolio) = val.metadata.name +""" +Set the base year of the portfolio. +""" +set_base_year!(val::Portfolio, year::Int) = val.base_year = year + +""" +Get the base year of the portfolio. +""" +get_base_year(val::Portfolio) = val.base_year + """ Set the description of the portfolio. """ From c80c60e40b47de511314fe562b3de47875d1048b Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Wed, 20 Nov 2024 15:26:39 -0700 Subject: [PATCH 33/40] add inflation rate and fix base year --- src/portfolio.jl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/portfolio.jl b/src/portfolio.jl index 4549c97..0e6ef7c 100644 --- a/src/portfolio.jl +++ b/src/portfolio.jl @@ -21,6 +21,7 @@ end mutable struct Portfolio <: IS.InfrastructureSystemsType aggregation::Type{<:Union{PSY.ACBus, PSY.AggregationTopology}} discount_rate::Float64 + inflation_rate::Float base_year::Int data::IS.SystemData # Inputs to the model investment_schedule::Dict # Investment decisions container i.e., model outputs. Container TBD @@ -33,6 +34,7 @@ mutable struct Portfolio <: IS.InfrastructureSystemsType function Portfolio( aggregation, discount_rate::Float64, + inflation_rate::Float64, base_year::Int, data, investment_schedule::Dict, @@ -58,6 +60,7 @@ mutable struct Portfolio <: IS.InfrastructureSystemsType return new( aggregation, discount_rate, + inflation_rate, base_year, data, investment_schedule, @@ -82,11 +85,13 @@ end """ Construct an empty `Portfolio`. Useful for building a Portfolio from scratch. """ -function Portfolio(discount_rate; kwargs...) +function Portfolio(discount_rate, inflation_rate, base_year; kwargs...) data = PSY._create_system_data_from_kwargs(; kwargs...) return Portfolio( DEFAULT_AGGREGATION, discount_rate, + inflation_rate, + base_year, data, Dict(), IS.InfrastructureSystemsInternal(), @@ -96,11 +101,13 @@ end """ Construct an empty `Portfolio` specifying aggregation. Useful for building a Portfolio from scratch. """ -function Portfolio(aggregation, discount_rate; kwargs...) +function Portfolio(aggregation, discount_rate, inflation_rate, base_year; kwargs...) data = _create_system_data_from_kwargs(; kwargs...) return Portfolio( aggregation, discount_rate, + inflation_rate, + base_year, data, Dict(), IS.InfrastructureSystemsInternal(), From ebdf2b7233202d7242ee19bd3dc702c68bf40ad9 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Wed, 20 Nov 2024 15:33:30 -0700 Subject: [PATCH 34/40] float to float64 --- src/portfolio.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/portfolio.jl b/src/portfolio.jl index 0e6ef7c..b205e7b 100644 --- a/src/portfolio.jl +++ b/src/portfolio.jl @@ -21,7 +21,7 @@ end mutable struct Portfolio <: IS.InfrastructureSystemsType aggregation::Type{<:Union{PSY.ACBus, PSY.AggregationTopology}} discount_rate::Float64 - inflation_rate::Float + inflation_rate::Float64 base_year::Int data::IS.SystemData # Inputs to the model investment_schedule::Dict # Investment decisions container i.e., model outputs. Container TBD From ef411cf9feed734b58a223511a9cb19a538098f7 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Thu, 21 Nov 2024 10:22:58 -0700 Subject: [PATCH 35/40] add interest_rate --- src/models/generated/ACTransportTechnology.jl | 28 +++++++----- .../generated/ExistingTransportTechnology.jl | 20 ++++----- .../generated/HVDCTransportTechnology.jl | 28 +++++++----- src/models/generated/StorageTechnology.jl | 28 +++++++----- src/models/generated/SupplyTechnology.jl | 44 +++++++++++-------- src/models/generated/includes.jl | 6 ++- 6 files changed, 94 insertions(+), 60 deletions(-) diff --git a/src/models/generated/ACTransportTechnology.jl b/src/models/generated/ACTransportTechnology.jl index 2a94273..c42ce28 100644 --- a/src/models/generated/ACTransportTechnology.jl +++ b/src/models/generated/ACTransportTechnology.jl @@ -11,11 +11,11 @@ This file is auto-generated. Do not edit. start_region::Region available::Bool name::String - capital_recovery_factor::Int64 end_region::Region power_systems_type::String angle_limit::Float64 internal::InfrastructureSystemsInternal + interest_rate::Float64 ext::Dict resistance::Float64 voltage::Float64 @@ -25,6 +25,7 @@ This file is auto-generated. Do not edit. existing_line_capacity::Float64 wacc::Float64 line_loss::Float64 + capital_recovery_period::Int64 end @@ -35,11 +36,11 @@ This file is auto-generated. Do not edit. - `start_region::Region`: Start region for transport technology - `available::Bool`: identifies whether the technology is available - `name::String`: Name -- `capital_recovery_factor::Int64`: (default: `30`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. - `end_region::Region`: End region for transport technology - `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling - `angle_limit::Float64`: (default: `0.0`) Votlage angle limit (radians) - `internal::InfrastructureSystemsInternal`: (default: `InfrastructureSystemsInternal()`) Internal field +- `interest_rate::Float64`: (default: `0.07`) Interest rate for technology - `ext::Dict`: (default: `Dict()`) Option for providing additional data - `resistance::Float64`: (default: `0.0`) Technology resistance in Ohms - `voltage::Float64`: (default: `0.0`) Technology resistance in Ohms @@ -49,6 +50,7 @@ This file is auto-generated. Do not edit. - `existing_line_capacity::Float64`: Existing capacity of transport technology (MW) - `wacc::Float64`: (default: `0`) Weighted average cost of capital - `line_loss::Float64`: Transmission loss for each transport technology (%) +- `capital_recovery_period::Int64`: (default: `30`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. """ mutable struct ACTransportTechnology{T <: PSY.Device} <: Technology "Base power" @@ -61,8 +63,6 @@ mutable struct ACTransportTechnology{T <: PSY.Device} <: Technology available::Bool "Name" name::String - "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion." - capital_recovery_factor::Int64 "End region for transport technology" end_region::Region "maps to a valid PowerSystems.jl for PCM modeling" @@ -71,6 +71,8 @@ mutable struct ACTransportTechnology{T <: PSY.Device} <: Technology angle_limit::Float64 "Internal field" internal::InfrastructureSystemsInternal + "Interest rate for technology" + interest_rate::Float64 "Option for providing additional data" ext::Dict "Technology resistance in Ohms" @@ -89,11 +91,13 @@ mutable struct ACTransportTechnology{T <: PSY.Device} <: Technology wacc::Float64 "Transmission loss for each transport technology (%)" line_loss::Float64 + "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion." + capital_recovery_period::Int64 end -function ACTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, capital_recovery_factor=30, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, base_year=2020, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device - ACTransportTechnology{T}(base_power, capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, base_year, existing_line_capacity, wacc, line_loss, ) +function ACTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), interest_rate=0.07, ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, base_year=2020, existing_line_capacity, wacc=0, line_loss, capital_recovery_period=30, ) where T <: PSY.Device + ACTransportTechnology{T}(base_power, capital_cost, start_region, available, name, end_region, power_systems_type, angle_limit, internal, interest_rate, ext, resistance, voltage, network_id, maximum_new_capacity, base_year, existing_line_capacity, wacc, line_loss, capital_recovery_period, ) end """Get [`ACTransportTechnology`](@ref) `base_power`.""" @@ -106,8 +110,6 @@ get_start_region(value::ACTransportTechnology) = value.start_region get_available(value::ACTransportTechnology) = value.available """Get [`ACTransportTechnology`](@ref) `name`.""" get_name(value::ACTransportTechnology) = value.name -"""Get [`ACTransportTechnology`](@ref) `capital_recovery_factor`.""" -get_capital_recovery_factor(value::ACTransportTechnology) = value.capital_recovery_factor """Get [`ACTransportTechnology`](@ref) `end_region`.""" get_end_region(value::ACTransportTechnology) = value.end_region """Get [`ACTransportTechnology`](@ref) `power_systems_type`.""" @@ -116,6 +118,8 @@ get_power_systems_type(value::ACTransportTechnology) = value.power_systems_type get_angle_limit(value::ACTransportTechnology) = value.angle_limit """Get [`ACTransportTechnology`](@ref) `internal`.""" get_internal(value::ACTransportTechnology) = value.internal +"""Get [`ACTransportTechnology`](@ref) `interest_rate`.""" +get_interest_rate(value::ACTransportTechnology) = value.interest_rate """Get [`ACTransportTechnology`](@ref) `ext`.""" get_ext(value::ACTransportTechnology) = value.ext """Get [`ACTransportTechnology`](@ref) `resistance`.""" @@ -134,6 +138,8 @@ get_existing_line_capacity(value::ACTransportTechnology) = value.existing_line_c get_wacc(value::ACTransportTechnology) = value.wacc """Get [`ACTransportTechnology`](@ref) `line_loss`.""" get_line_loss(value::ACTransportTechnology) = value.line_loss +"""Get [`ACTransportTechnology`](@ref) `capital_recovery_period`.""" +get_capital_recovery_period(value::ACTransportTechnology) = value.capital_recovery_period """Set [`ACTransportTechnology`](@ref) `base_power`.""" set_base_power!(value::ACTransportTechnology, val) = value.base_power = val @@ -145,8 +151,6 @@ set_start_region!(value::ACTransportTechnology, val) = value.start_region = val set_available!(value::ACTransportTechnology, val) = value.available = val """Set [`ACTransportTechnology`](@ref) `name`.""" set_name!(value::ACTransportTechnology, val) = value.name = val -"""Set [`ACTransportTechnology`](@ref) `capital_recovery_factor`.""" -set_capital_recovery_factor!(value::ACTransportTechnology, val) = value.capital_recovery_factor = val """Set [`ACTransportTechnology`](@ref) `end_region`.""" set_end_region!(value::ACTransportTechnology, val) = value.end_region = val """Set [`ACTransportTechnology`](@ref) `power_systems_type`.""" @@ -155,6 +159,8 @@ set_power_systems_type!(value::ACTransportTechnology, val) = value.power_systems set_angle_limit!(value::ACTransportTechnology, val) = value.angle_limit = val """Set [`ACTransportTechnology`](@ref) `internal`.""" set_internal!(value::ACTransportTechnology, val) = value.internal = val +"""Set [`ACTransportTechnology`](@ref) `interest_rate`.""" +set_interest_rate!(value::ACTransportTechnology, val) = value.interest_rate = val """Set [`ACTransportTechnology`](@ref) `ext`.""" set_ext!(value::ACTransportTechnology, val) = value.ext = val """Set [`ACTransportTechnology`](@ref) `resistance`.""" @@ -173,3 +179,5 @@ set_existing_line_capacity!(value::ACTransportTechnology, val) = value.existing_ set_wacc!(value::ACTransportTechnology, val) = value.wacc = val """Set [`ACTransportTechnology`](@ref) `line_loss`.""" set_line_loss!(value::ACTransportTechnology, val) = value.line_loss = val +"""Set [`ACTransportTechnology`](@ref) `capital_recovery_period`.""" +set_capital_recovery_period!(value::ACTransportTechnology, val) = value.capital_recovery_period = val diff --git a/src/models/generated/ExistingTransportTechnology.jl b/src/models/generated/ExistingTransportTechnology.jl index bbfcd30..7879291 100644 --- a/src/models/generated/ExistingTransportTechnology.jl +++ b/src/models/generated/ExistingTransportTechnology.jl @@ -11,7 +11,6 @@ This file is auto-generated. Do not edit. start_region::Region available::Bool name::String - capital_recovery_factor::Int64 end_region::Region power_systems_type::String angle_limit::Float64 @@ -25,6 +24,7 @@ This file is auto-generated. Do not edit. existing_line_capacity::Float64 wacc::Float64 line_loss::Float64 + capital_recovery_period::Int64 end @@ -35,7 +35,6 @@ This file is auto-generated. Do not edit. - `start_region::Region`: Start region for transport technology - `available::Bool`: identifies whether the technology is available - `name::String`: Name -- `capital_recovery_factor::Int64`: (default: `30`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. - `end_region::Region`: End region for transport technology - `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling - `angle_limit::Float64`: (default: `0.0`) Votlage angle limit (radians) @@ -49,6 +48,7 @@ This file is auto-generated. Do not edit. - `existing_line_capacity::Float64`: Existing capacity of transport technology (MW) - `wacc::Float64`: (default: `0`) Weighted average cost of capital - `line_loss::Float64`: Transmission loss for each transport technology (%) +- `capital_recovery_period::Int64`: (default: `30`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. """ mutable struct ExistingTransportTechnology{T <: PSY.Device} <: Technology "Base power" @@ -61,8 +61,6 @@ mutable struct ExistingTransportTechnology{T <: PSY.Device} <: Technology available::Bool "Name" name::String - "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion." - capital_recovery_factor::Int64 "End region for transport technology" end_region::Region "maps to a valid PowerSystems.jl for PCM modeling" @@ -89,11 +87,13 @@ mutable struct ExistingTransportTechnology{T <: PSY.Device} <: Technology wacc::Float64 "Transmission loss for each transport technology (%)" line_loss::Float64 + "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion." + capital_recovery_period::Int64 end -function ExistingTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, capital_recovery_factor=30, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, base_year=2020, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device - ExistingTransportTechnology{T}(base_power, capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, base_year, existing_line_capacity, wacc, line_loss, ) +function ExistingTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, base_year=2020, existing_line_capacity, wacc=0, line_loss, capital_recovery_period=30, ) where T <: PSY.Device + ExistingTransportTechnology{T}(base_power, capital_cost, start_region, available, name, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, base_year, existing_line_capacity, wacc, line_loss, capital_recovery_period, ) end """Get [`ExistingTransportTechnology`](@ref) `base_power`.""" @@ -106,8 +106,6 @@ get_start_region(value::ExistingTransportTechnology) = value.start_region get_available(value::ExistingTransportTechnology) = value.available """Get [`ExistingTransportTechnology`](@ref) `name`.""" get_name(value::ExistingTransportTechnology) = value.name -"""Get [`ExistingTransportTechnology`](@ref) `capital_recovery_factor`.""" -get_capital_recovery_factor(value::ExistingTransportTechnology) = value.capital_recovery_factor """Get [`ExistingTransportTechnology`](@ref) `end_region`.""" get_end_region(value::ExistingTransportTechnology) = value.end_region """Get [`ExistingTransportTechnology`](@ref) `power_systems_type`.""" @@ -134,6 +132,8 @@ get_existing_line_capacity(value::ExistingTransportTechnology) = value.existing_ get_wacc(value::ExistingTransportTechnology) = value.wacc """Get [`ExistingTransportTechnology`](@ref) `line_loss`.""" get_line_loss(value::ExistingTransportTechnology) = value.line_loss +"""Get [`ExistingTransportTechnology`](@ref) `capital_recovery_period`.""" +get_capital_recovery_period(value::ExistingTransportTechnology) = value.capital_recovery_period """Set [`ExistingTransportTechnology`](@ref) `base_power`.""" set_base_power!(value::ExistingTransportTechnology, val) = value.base_power = val @@ -145,8 +145,6 @@ set_start_region!(value::ExistingTransportTechnology, val) = value.start_region set_available!(value::ExistingTransportTechnology, val) = value.available = val """Set [`ExistingTransportTechnology`](@ref) `name`.""" set_name!(value::ExistingTransportTechnology, val) = value.name = val -"""Set [`ExistingTransportTechnology`](@ref) `capital_recovery_factor`.""" -set_capital_recovery_factor!(value::ExistingTransportTechnology, val) = value.capital_recovery_factor = val """Set [`ExistingTransportTechnology`](@ref) `end_region`.""" set_end_region!(value::ExistingTransportTechnology, val) = value.end_region = val """Set [`ExistingTransportTechnology`](@ref) `power_systems_type`.""" @@ -173,3 +171,5 @@ set_existing_line_capacity!(value::ExistingTransportTechnology, val) = value.exi set_wacc!(value::ExistingTransportTechnology, val) = value.wacc = val """Set [`ExistingTransportTechnology`](@ref) `line_loss`.""" set_line_loss!(value::ExistingTransportTechnology, val) = value.line_loss = val +"""Set [`ExistingTransportTechnology`](@ref) `capital_recovery_period`.""" +set_capital_recovery_period!(value::ExistingTransportTechnology, val) = value.capital_recovery_period = val diff --git a/src/models/generated/HVDCTransportTechnology.jl b/src/models/generated/HVDCTransportTechnology.jl index b3a9a88..69c8014 100644 --- a/src/models/generated/HVDCTransportTechnology.jl +++ b/src/models/generated/HVDCTransportTechnology.jl @@ -11,11 +11,11 @@ This file is auto-generated. Do not edit. start_region::Region available::Bool name::String - capital_recovery_factor::Int64 end_region::Region power_systems_type::String angle_limit::Float64 internal::InfrastructureSystemsInternal + interest_rate::Float64 ext::Dict resistance::Float64 voltage::Float64 @@ -25,6 +25,7 @@ This file is auto-generated. Do not edit. existing_line_capacity::Float64 wacc::Float64 line_loss::Float64 + capital_recovery_period::Int64 end @@ -35,11 +36,11 @@ This file is auto-generated. Do not edit. - `start_region::Region`: Start region for transport technology - `available::Bool`: identifies whether the technology is available - `name::String`: Name -- `capital_recovery_factor::Int64`: (default: `30`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. - `end_region::Region`: End region for transport technology - `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling - `angle_limit::Float64`: (default: `0.0`) Votlage angle limit (radians) - `internal::InfrastructureSystemsInternal`: (default: `InfrastructureSystemsInternal()`) Internal field +- `interest_rate::Float64`: (default: `0.07`) Interest rate for technology - `ext::Dict`: (default: `Dict()`) Option for providing additional data - `resistance::Float64`: (default: `0.0`) Technology resistance in Ohms - `voltage::Float64`: (default: `0.0`) Technology resistance in Ohms @@ -49,6 +50,7 @@ This file is auto-generated. Do not edit. - `existing_line_capacity::Float64`: Existing capacity of transport technology (MW) - `wacc::Float64`: (default: `0`) Weighted average cost of capital - `line_loss::Float64`: Transmission loss for each transport technology (%) +- `capital_recovery_period::Int64`: (default: `30`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. """ mutable struct HVDCTransportTechnology{T <: PSY.Device} <: Technology "Base power" @@ -61,8 +63,6 @@ mutable struct HVDCTransportTechnology{T <: PSY.Device} <: Technology available::Bool "Name" name::String - "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion." - capital_recovery_factor::Int64 "End region for transport technology" end_region::Region "maps to a valid PowerSystems.jl for PCM modeling" @@ -71,6 +71,8 @@ mutable struct HVDCTransportTechnology{T <: PSY.Device} <: Technology angle_limit::Float64 "Internal field" internal::InfrastructureSystemsInternal + "Interest rate for technology" + interest_rate::Float64 "Option for providing additional data" ext::Dict "Technology resistance in Ohms" @@ -89,11 +91,13 @@ mutable struct HVDCTransportTechnology{T <: PSY.Device} <: Technology wacc::Float64 "Transmission loss for each transport technology (%)" line_loss::Float64 + "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion." + capital_recovery_period::Int64 end -function HVDCTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, capital_recovery_factor=30, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, base_year=2020, existing_line_capacity, wacc=0, line_loss, ) where T <: PSY.Device - HVDCTransportTechnology{T}(base_power, capital_cost, start_region, available, name, capital_recovery_factor, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, base_year, existing_line_capacity, wacc, line_loss, ) +function HVDCTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), interest_rate=0.07, ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, base_year=2020, existing_line_capacity, wacc=0, line_loss, capital_recovery_period=30, ) where T <: PSY.Device + HVDCTransportTechnology{T}(base_power, capital_cost, start_region, available, name, end_region, power_systems_type, angle_limit, internal, interest_rate, ext, resistance, voltage, network_id, maximum_new_capacity, base_year, existing_line_capacity, wacc, line_loss, capital_recovery_period, ) end """Get [`HVDCTransportTechnology`](@ref) `base_power`.""" @@ -106,8 +110,6 @@ get_start_region(value::HVDCTransportTechnology) = value.start_region get_available(value::HVDCTransportTechnology) = value.available """Get [`HVDCTransportTechnology`](@ref) `name`.""" get_name(value::HVDCTransportTechnology) = value.name -"""Get [`HVDCTransportTechnology`](@ref) `capital_recovery_factor`.""" -get_capital_recovery_factor(value::HVDCTransportTechnology) = value.capital_recovery_factor """Get [`HVDCTransportTechnology`](@ref) `end_region`.""" get_end_region(value::HVDCTransportTechnology) = value.end_region """Get [`HVDCTransportTechnology`](@ref) `power_systems_type`.""" @@ -116,6 +118,8 @@ get_power_systems_type(value::HVDCTransportTechnology) = value.power_systems_typ get_angle_limit(value::HVDCTransportTechnology) = value.angle_limit """Get [`HVDCTransportTechnology`](@ref) `internal`.""" get_internal(value::HVDCTransportTechnology) = value.internal +"""Get [`HVDCTransportTechnology`](@ref) `interest_rate`.""" +get_interest_rate(value::HVDCTransportTechnology) = value.interest_rate """Get [`HVDCTransportTechnology`](@ref) `ext`.""" get_ext(value::HVDCTransportTechnology) = value.ext """Get [`HVDCTransportTechnology`](@ref) `resistance`.""" @@ -134,6 +138,8 @@ get_existing_line_capacity(value::HVDCTransportTechnology) = value.existing_line get_wacc(value::HVDCTransportTechnology) = value.wacc """Get [`HVDCTransportTechnology`](@ref) `line_loss`.""" get_line_loss(value::HVDCTransportTechnology) = value.line_loss +"""Get [`HVDCTransportTechnology`](@ref) `capital_recovery_period`.""" +get_capital_recovery_period(value::HVDCTransportTechnology) = value.capital_recovery_period """Set [`HVDCTransportTechnology`](@ref) `base_power`.""" set_base_power!(value::HVDCTransportTechnology, val) = value.base_power = val @@ -145,8 +151,6 @@ set_start_region!(value::HVDCTransportTechnology, val) = value.start_region = va set_available!(value::HVDCTransportTechnology, val) = value.available = val """Set [`HVDCTransportTechnology`](@ref) `name`.""" set_name!(value::HVDCTransportTechnology, val) = value.name = val -"""Set [`HVDCTransportTechnology`](@ref) `capital_recovery_factor`.""" -set_capital_recovery_factor!(value::HVDCTransportTechnology, val) = value.capital_recovery_factor = val """Set [`HVDCTransportTechnology`](@ref) `end_region`.""" set_end_region!(value::HVDCTransportTechnology, val) = value.end_region = val """Set [`HVDCTransportTechnology`](@ref) `power_systems_type`.""" @@ -155,6 +159,8 @@ set_power_systems_type!(value::HVDCTransportTechnology, val) = value.power_syste set_angle_limit!(value::HVDCTransportTechnology, val) = value.angle_limit = val """Set [`HVDCTransportTechnology`](@ref) `internal`.""" set_internal!(value::HVDCTransportTechnology, val) = value.internal = val +"""Set [`HVDCTransportTechnology`](@ref) `interest_rate`.""" +set_interest_rate!(value::HVDCTransportTechnology, val) = value.interest_rate = val """Set [`HVDCTransportTechnology`](@ref) `ext`.""" set_ext!(value::HVDCTransportTechnology, val) = value.ext = val """Set [`HVDCTransportTechnology`](@ref) `resistance`.""" @@ -173,3 +179,5 @@ set_existing_line_capacity!(value::HVDCTransportTechnology, val) = value.existin set_wacc!(value::HVDCTransportTechnology, val) = value.wacc = val """Set [`HVDCTransportTechnology`](@ref) `line_loss`.""" set_line_loss!(value::HVDCTransportTechnology, val) = value.line_loss = val +"""Set [`HVDCTransportTechnology`](@ref) `capital_recovery_period`.""" +set_capital_recovery_period!(value::HVDCTransportTechnology, val) = value.capital_recovery_period = val diff --git a/src/models/generated/StorageTechnology.jl b/src/models/generated/StorageTechnology.jl index fba3379..458fd9c 100644 --- a/src/models/generated/StorageTechnology.jl +++ b/src/models/generated/StorageTechnology.jl @@ -19,7 +19,6 @@ This file is auto-generated. Do not edit. capital_costs_power::PSY.ValueCurve max_duration::Float64 unit_size_power::Float64 - capital_recovery_factor::Int64 id::Int64 min_cap_power::Float64 capital_costs_energy::PSY.ValueCurve @@ -37,12 +36,14 @@ This file is auto-generated. Do not edit. unit_size_energy::Float64 eff_up::Float64 cluster::Int64 + interest_rate::Float64 ext::Dict base_year::Int reg_cost::Float64 min_duration::Float64 max_cap_energy::Float64 reg_max::Float64 + capital_recovery_period::Int64 end @@ -61,7 +62,6 @@ This file is auto-generated. Do not edit. - `capital_costs_power::PSY.ValueCurve`: (default: `LinearCurve(0.0)`) Capital costs for investing in a technology. - `max_duration::Float64`: (default: `1000.0`) Maximum allowable durection for a storage technology - `unit_size_power::Float64`: (default: `0.0`) Used for discrete investment decisions. Size of each unit being built (MW) -- `capital_recovery_factor::Int64`: (default: `30`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs. - `id::Int64`: ID for individual generator - `min_cap_power::Float64`: (default: `0.0`) Minimum required power capacity for a storage technology - `capital_costs_energy::PSY.ValueCurve`: (default: `LinearCurve(0.0)`) Capital costs for investing in a technology. @@ -79,12 +79,14 @@ This file is auto-generated. Do not edit. - `unit_size_energy::Float64`: (default: `0.0`) Used for discrete investment decisions. Size of each unit being built (MW) - `eff_up::Float64`: (default: `1.0`) Efficiency of charging storage - `cluster::Int64`: (default: `1`) Number of the cluster when representing multiple clusters of a given technology in a given region. +- `interest_rate::Float64`: (default: `0.07`) Interest rate for technology - `ext::Dict`: (default: `Dict()`) Option for providing additional data - `base_year::Int`: (default: `2020`) Reference year for technology data - `reg_cost::Float64`: (default: `0.0`) Cost of providing regulation reserves - `min_duration::Float64`: (default: `0.0`) Minimum required durection for a storage technology - `max_cap_energy::Float64`: (default: `1e8`) Maximum allowable installed energy capacity for a storage technology - `reg_max::Float64`: (default: `0.0`) Fraction of nameplate capacity that can committed to provided regulation reserves +- `capital_recovery_period::Int64`: (default: `30`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs. """ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology "Base power" @@ -113,8 +115,6 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology max_duration::Float64 "Used for discrete investment decisions. Size of each unit being built (MW)" unit_size_power::Float64 - "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs." - capital_recovery_factor::Int64 "ID for individual generator" id::Int64 "Minimum required power capacity for a storage technology" @@ -149,6 +149,8 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology eff_up::Float64 "Number of the cluster when representing multiple clusters of a given technology in a given region." cluster::Int64 + "Interest rate for technology" + interest_rate::Float64 "Option for providing additional data" ext::Dict "Reference year for technology data" @@ -161,11 +163,13 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology max_cap_energy::Float64 "Fraction of nameplate capacity that can committed to provided regulation reserves" reg_max::Float64 + "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs." + capital_recovery_period::Int64 end -function StorageTechnology{T}(; base_power, om_costs_energy=StorageCost(), existing_cap_energy=0.0, prime_mover_type=PrimeMovers.OT, lifetime=100, rsv_cost=0.0, available, existing_cap_power=0.0, name, storage_tech, capital_costs_power=LinearCurve(0.0), max_duration=1000.0, unit_size_power=0.0, capital_recovery_factor=30, id, min_cap_power=0.0, capital_costs_energy=LinearCurve(0.0), losses=1.0, eff_down=1.0, rsv_max=0.0, max_cap_power=1e8, power_systems_type, internal=InfrastructureSystemsInternal(), om_costs_power=StorageCost(), balancing_topology, min_cap_energy=0.0, region=nothing, initial_state_of_charge=0.0, unit_size_energy=0.0, eff_up=1.0, cluster=1, ext=Dict(), base_year=2020, reg_cost=0.0, min_duration=0.0, max_cap_energy=1e8, reg_max=0.0, ) where T <: PSY.Storage - StorageTechnology{T}(base_power, om_costs_energy, existing_cap_energy, prime_mover_type, lifetime, rsv_cost, available, existing_cap_power, name, storage_tech, capital_costs_power, max_duration, unit_size_power, capital_recovery_factor, id, min_cap_power, capital_costs_energy, losses, eff_down, rsv_max, max_cap_power, power_systems_type, internal, om_costs_power, balancing_topology, min_cap_energy, region, initial_state_of_charge, unit_size_energy, eff_up, cluster, ext, base_year, reg_cost, min_duration, max_cap_energy, reg_max, ) +function StorageTechnology{T}(; base_power, om_costs_energy=StorageCost(), existing_cap_energy=0.0, prime_mover_type=PrimeMovers.OT, lifetime=100, rsv_cost=0.0, available, existing_cap_power=0.0, name, storage_tech, capital_costs_power=LinearCurve(0.0), max_duration=1000.0, unit_size_power=0.0, id, min_cap_power=0.0, capital_costs_energy=LinearCurve(0.0), losses=1.0, eff_down=1.0, rsv_max=0.0, max_cap_power=1e8, power_systems_type, internal=InfrastructureSystemsInternal(), om_costs_power=StorageCost(), balancing_topology, min_cap_energy=0.0, region=nothing, initial_state_of_charge=0.0, unit_size_energy=0.0, eff_up=1.0, cluster=1, interest_rate=0.07, ext=Dict(), base_year=2020, reg_cost=0.0, min_duration=0.0, max_cap_energy=1e8, reg_max=0.0, capital_recovery_period=30, ) where T <: PSY.Storage + StorageTechnology{T}(base_power, om_costs_energy, existing_cap_energy, prime_mover_type, lifetime, rsv_cost, available, existing_cap_power, name, storage_tech, capital_costs_power, max_duration, unit_size_power, id, min_cap_power, capital_costs_energy, losses, eff_down, rsv_max, max_cap_power, power_systems_type, internal, om_costs_power, balancing_topology, min_cap_energy, region, initial_state_of_charge, unit_size_energy, eff_up, cluster, interest_rate, ext, base_year, reg_cost, min_duration, max_cap_energy, reg_max, capital_recovery_period, ) end """Get [`StorageTechnology`](@ref) `base_power`.""" @@ -194,8 +198,6 @@ get_capital_costs_power(value::StorageTechnology) = value.capital_costs_power get_max_duration(value::StorageTechnology) = value.max_duration """Get [`StorageTechnology`](@ref) `unit_size_power`.""" get_unit_size_power(value::StorageTechnology) = value.unit_size_power -"""Get [`StorageTechnology`](@ref) `capital_recovery_factor`.""" -get_capital_recovery_factor(value::StorageTechnology) = value.capital_recovery_factor """Get [`StorageTechnology`](@ref) `id`.""" get_id(value::StorageTechnology) = value.id """Get [`StorageTechnology`](@ref) `min_cap_power`.""" @@ -230,6 +232,8 @@ get_unit_size_energy(value::StorageTechnology) = value.unit_size_energy get_eff_up(value::StorageTechnology) = value.eff_up """Get [`StorageTechnology`](@ref) `cluster`.""" get_cluster(value::StorageTechnology) = value.cluster +"""Get [`StorageTechnology`](@ref) `interest_rate`.""" +get_interest_rate(value::StorageTechnology) = value.interest_rate """Get [`StorageTechnology`](@ref) `ext`.""" get_ext(value::StorageTechnology) = value.ext """Get [`StorageTechnology`](@ref) `base_year`.""" @@ -242,6 +246,8 @@ get_min_duration(value::StorageTechnology) = value.min_duration get_max_cap_energy(value::StorageTechnology) = value.max_cap_energy """Get [`StorageTechnology`](@ref) `reg_max`.""" get_reg_max(value::StorageTechnology) = value.reg_max +"""Get [`StorageTechnology`](@ref) `capital_recovery_period`.""" +get_capital_recovery_period(value::StorageTechnology) = value.capital_recovery_period """Set [`StorageTechnology`](@ref) `base_power`.""" set_base_power!(value::StorageTechnology, val) = value.base_power = val @@ -269,8 +275,6 @@ set_capital_costs_power!(value::StorageTechnology, val) = value.capital_costs_po set_max_duration!(value::StorageTechnology, val) = value.max_duration = val """Set [`StorageTechnology`](@ref) `unit_size_power`.""" set_unit_size_power!(value::StorageTechnology, val) = value.unit_size_power = val -"""Set [`StorageTechnology`](@ref) `capital_recovery_factor`.""" -set_capital_recovery_factor!(value::StorageTechnology, val) = value.capital_recovery_factor = val """Set [`StorageTechnology`](@ref) `id`.""" set_id!(value::StorageTechnology, val) = value.id = val """Set [`StorageTechnology`](@ref) `min_cap_power`.""" @@ -305,6 +309,8 @@ set_unit_size_energy!(value::StorageTechnology, val) = value.unit_size_energy = set_eff_up!(value::StorageTechnology, val) = value.eff_up = val """Set [`StorageTechnology`](@ref) `cluster`.""" set_cluster!(value::StorageTechnology, val) = value.cluster = val +"""Set [`StorageTechnology`](@ref) `interest_rate`.""" +set_interest_rate!(value::StorageTechnology, val) = value.interest_rate = val """Set [`StorageTechnology`](@ref) `ext`.""" set_ext!(value::StorageTechnology, val) = value.ext = val """Set [`StorageTechnology`](@ref) `base_year`.""" @@ -317,3 +323,5 @@ set_min_duration!(value::StorageTechnology, val) = value.min_duration = val set_max_cap_energy!(value::StorageTechnology, val) = value.max_cap_energy = val """Set [`StorageTechnology`](@ref) `reg_max`.""" set_reg_max!(value::StorageTechnology, val) = value.reg_max = val +"""Set [`StorageTechnology`](@ref) `capital_recovery_period`.""" +set_capital_recovery_period!(value::StorageTechnology, val) = value.capital_recovery_period = val diff --git a/src/models/generated/SupplyTechnology.jl b/src/models/generated/SupplyTechnology.jl index 4a0a707..1ddac94 100644 --- a/src/models/generated/SupplyTechnology.jl +++ b/src/models/generated/SupplyTechnology.jl @@ -21,7 +21,6 @@ This file is auto-generated. Do not edit. cofire_start_min::Union{Nothing, Dict{ThermalFuels, Float64}} name::String ramp_dn_percentage::Float64 - capital_recovery_factor::Int64 id::Int64 down_time::Float64 initial_capacity::Float64 @@ -32,8 +31,9 @@ This file is auto-generated. Do not edit. power_systems_type::String cofire_level_max::Union{Nothing, Dict{ThermalFuels, Float64}} internal::InfrastructureSystemsInternal - ext::Dict + interest_rate::Float64 balancing_topology::String + ext::Dict region::Union{Nothing, Region, Vector{Region}} maximum_capacity::Float64 cluster::Int64 @@ -44,6 +44,7 @@ This file is auto-generated. Do not edit. min_generation_percentage::Float64 start_cost_per_mw::Float64 reg_max::Float64 + capital_recovery_period::Int64 up_time::Float64 end @@ -65,7 +66,6 @@ This file is auto-generated. Do not edit. - `cofire_start_min::Union{Nothing, Dict{ThermalFuels, Float64}}`: (default: `nothing`) Minimum blending level of each fuel during start-up process for multi-fuel generator - `name::String`: The technology name - `ramp_dn_percentage::Float64`: (default: `100.0`) Maximum decrease in output between operation periods. Fraction of total capacity -- `capital_recovery_factor::Int64`: (default: `30`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs. - `id::Int64`: ID for individual generator - `down_time::Float64`: (default: `0.0`) Minimum amount of time a resource has to remain in the shutdown state. - `initial_capacity::Float64`: (default: `0.0`) Pre-existing capacity for a technology @@ -76,8 +76,9 @@ This file is auto-generated. Do not edit. - `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling - `cofire_level_max::Union{Nothing, Dict{ThermalFuels, Float64}}`: (default: `nothing`) Maximum blending level of each fuel during normal generation process for multi-fuel generator - `internal::InfrastructureSystemsInternal`: (default: `InfrastructureSystemsInternal()`) Internal field -- `ext::Dict`: (default: `Dict()`) Option for providing additional data +- `interest_rate::Float64`: (default: `0.07`) Interest rate for technology - `balancing_topology::String`: Set of balancing nodes +- `ext::Dict`: (default: `Dict()`) Option for providing additional data - `region::Union{Nothing, Region, Vector{Region}}`: (default: `nothing`) Zone where tech operates in - `maximum_capacity::Float64`: (default: `Inf`) Maximum allowable installed capacity for a technology - `cluster::Int64`: (default: `1`) Number of the cluster when representing multiple clusters of a given technology in a given region. @@ -88,6 +89,7 @@ This file is auto-generated. Do not edit. - `min_generation_percentage::Float64`: (default: `0.0`) Minimum generation as a fraction of total capacity - `start_cost_per_mw::Float64`: (default: `0.0`) Cost per MW of nameplate capacity to start a generator (/MW per start). - `reg_max::Float64`: (default: `0.0`) Fraction of nameplate capacity that can committed to provided regulation reserves +- `capital_recovery_period::Int64`: (default: `30`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs. - `up_time::Float64`: (default: `0.0`) Minimum amount of time a resource has to stay in the committed state. """ mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology @@ -121,8 +123,6 @@ mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology name::String "Maximum decrease in output between operation periods. Fraction of total capacity" ramp_dn_percentage::Float64 - "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs." - capital_recovery_factor::Int64 "ID for individual generator" id::Int64 "Minimum amount of time a resource has to remain in the shutdown state." @@ -143,10 +143,12 @@ mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology cofire_level_max::Union{Nothing, Dict{ThermalFuels, Float64}} "Internal field" internal::InfrastructureSystemsInternal - "Option for providing additional data" - ext::Dict + "Interest rate for technology" + interest_rate::Float64 "Set of balancing nodes" balancing_topology::String + "Option for providing additional data" + ext::Dict "Zone where tech operates in" region::Union{Nothing, Region, Vector{Region}} "Maximum allowable installed capacity for a technology" @@ -167,13 +169,15 @@ mutable struct SupplyTechnology{T <: PSY.Generator} <: Technology start_cost_per_mw::Float64 "Fraction of nameplate capacity that can committed to provided regulation reserves" reg_max::Float64 + "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs." + capital_recovery_period::Int64 "Minimum amount of time a resource has to stay in the committed state." up_time::Float64 end -function SupplyTechnology{T}(; base_power, heat_rate_mmbtu_per_mwh=0.0, outage_factor=1.0, prime_mover_type=PrimeMovers.OT, minimum_required_capacity=0.0, cofire_level_min=nothing, capital_costs=LinearCurve(0.0), lifetime=100, rsv_cost=0.0, cofire_start_max=nothing, available=True, co2=0.0, cofire_start_min=nothing, name, ramp_dn_percentage=100.0, capital_recovery_factor=30, id, down_time=0.0, initial_capacity=0.0, start_fuel_mmbtu_per_mw=0.0, operation_costs=ThermalGenerationCost(), rsv_max=0.0, fuel=ThermalFuels.OTHER, power_systems_type, cofire_level_max=nothing, internal=InfrastructureSystemsInternal(), ext=Dict(), balancing_topology, region=nothing, maximum_capacity=Inf, cluster=1, ramp_up_percentage=100.0, base_year=2020, unit_size=0.0, reg_cost=0.0, min_generation_percentage=0.0, start_cost_per_mw=0.0, reg_max=0.0, up_time=0.0, ) where T <: PSY.Generator - SupplyTechnology{T}(base_power, heat_rate_mmbtu_per_mwh, outage_factor, prime_mover_type, minimum_required_capacity, cofire_level_min, capital_costs, lifetime, rsv_cost, cofire_start_max, available, co2, cofire_start_min, name, ramp_dn_percentage, capital_recovery_factor, id, down_time, initial_capacity, start_fuel_mmbtu_per_mw, operation_costs, rsv_max, fuel, power_systems_type, cofire_level_max, internal, ext, balancing_topology, region, maximum_capacity, cluster, ramp_up_percentage, base_year, unit_size, reg_cost, min_generation_percentage, start_cost_per_mw, reg_max, up_time, ) +function SupplyTechnology{T}(; base_power, heat_rate_mmbtu_per_mwh=0.0, outage_factor=1.0, prime_mover_type=PrimeMovers.OT, minimum_required_capacity=0.0, cofire_level_min=nothing, capital_costs=LinearCurve(0.0), lifetime=100, rsv_cost=0.0, cofire_start_max=nothing, available=True, co2=0.0, cofire_start_min=nothing, name, ramp_dn_percentage=100.0, id, down_time=0.0, initial_capacity=0.0, start_fuel_mmbtu_per_mw=0.0, operation_costs=ThermalGenerationCost(), rsv_max=0.0, fuel=ThermalFuels.OTHER, power_systems_type, cofire_level_max=nothing, internal=InfrastructureSystemsInternal(), interest_rate=0.07, balancing_topology, ext=Dict(), region=nothing, maximum_capacity=Inf, cluster=1, ramp_up_percentage=100.0, base_year=2020, unit_size=0.0, reg_cost=0.0, min_generation_percentage=0.0, start_cost_per_mw=0.0, reg_max=0.0, capital_recovery_period=30, up_time=0.0, ) where T <: PSY.Generator + SupplyTechnology{T}(base_power, heat_rate_mmbtu_per_mwh, outage_factor, prime_mover_type, minimum_required_capacity, cofire_level_min, capital_costs, lifetime, rsv_cost, cofire_start_max, available, co2, cofire_start_min, name, ramp_dn_percentage, id, down_time, initial_capacity, start_fuel_mmbtu_per_mw, operation_costs, rsv_max, fuel, power_systems_type, cofire_level_max, internal, interest_rate, balancing_topology, ext, region, maximum_capacity, cluster, ramp_up_percentage, base_year, unit_size, reg_cost, min_generation_percentage, start_cost_per_mw, reg_max, capital_recovery_period, up_time, ) end """Get [`SupplyTechnology`](@ref) `base_power`.""" @@ -206,8 +210,6 @@ get_cofire_start_min(value::SupplyTechnology) = value.cofire_start_min get_name(value::SupplyTechnology) = value.name """Get [`SupplyTechnology`](@ref) `ramp_dn_percentage`.""" get_ramp_dn_percentage(value::SupplyTechnology) = value.ramp_dn_percentage -"""Get [`SupplyTechnology`](@ref) `capital_recovery_factor`.""" -get_capital_recovery_factor(value::SupplyTechnology) = value.capital_recovery_factor """Get [`SupplyTechnology`](@ref) `id`.""" get_id(value::SupplyTechnology) = value.id """Get [`SupplyTechnology`](@ref) `down_time`.""" @@ -228,10 +230,12 @@ get_power_systems_type(value::SupplyTechnology) = value.power_systems_type get_cofire_level_max(value::SupplyTechnology) = value.cofire_level_max """Get [`SupplyTechnology`](@ref) `internal`.""" get_internal(value::SupplyTechnology) = value.internal -"""Get [`SupplyTechnology`](@ref) `ext`.""" -get_ext(value::SupplyTechnology) = value.ext +"""Get [`SupplyTechnology`](@ref) `interest_rate`.""" +get_interest_rate(value::SupplyTechnology) = value.interest_rate """Get [`SupplyTechnology`](@ref) `balancing_topology`.""" get_balancing_topology(value::SupplyTechnology) = value.balancing_topology +"""Get [`SupplyTechnology`](@ref) `ext`.""" +get_ext(value::SupplyTechnology) = value.ext """Get [`SupplyTechnology`](@ref) `region`.""" get_region(value::SupplyTechnology) = value.region """Get [`SupplyTechnology`](@ref) `maximum_capacity`.""" @@ -252,6 +256,8 @@ get_min_generation_percentage(value::SupplyTechnology) = value.min_generation_pe get_start_cost_per_mw(value::SupplyTechnology) = value.start_cost_per_mw """Get [`SupplyTechnology`](@ref) `reg_max`.""" get_reg_max(value::SupplyTechnology) = value.reg_max +"""Get [`SupplyTechnology`](@ref) `capital_recovery_period`.""" +get_capital_recovery_period(value::SupplyTechnology) = value.capital_recovery_period """Get [`SupplyTechnology`](@ref) `up_time`.""" get_up_time(value::SupplyTechnology) = value.up_time @@ -285,8 +291,6 @@ set_cofire_start_min!(value::SupplyTechnology, val) = value.cofire_start_min = v set_name!(value::SupplyTechnology, val) = value.name = val """Set [`SupplyTechnology`](@ref) `ramp_dn_percentage`.""" set_ramp_dn_percentage!(value::SupplyTechnology, val) = value.ramp_dn_percentage = val -"""Set [`SupplyTechnology`](@ref) `capital_recovery_factor`.""" -set_capital_recovery_factor!(value::SupplyTechnology, val) = value.capital_recovery_factor = val """Set [`SupplyTechnology`](@ref) `id`.""" set_id!(value::SupplyTechnology, val) = value.id = val """Set [`SupplyTechnology`](@ref) `down_time`.""" @@ -307,10 +311,12 @@ set_power_systems_type!(value::SupplyTechnology, val) = value.power_systems_type set_cofire_level_max!(value::SupplyTechnology, val) = value.cofire_level_max = val """Set [`SupplyTechnology`](@ref) `internal`.""" set_internal!(value::SupplyTechnology, val) = value.internal = val -"""Set [`SupplyTechnology`](@ref) `ext`.""" -set_ext!(value::SupplyTechnology, val) = value.ext = val +"""Set [`SupplyTechnology`](@ref) `interest_rate`.""" +set_interest_rate!(value::SupplyTechnology, val) = value.interest_rate = val """Set [`SupplyTechnology`](@ref) `balancing_topology`.""" set_balancing_topology!(value::SupplyTechnology, val) = value.balancing_topology = val +"""Set [`SupplyTechnology`](@ref) `ext`.""" +set_ext!(value::SupplyTechnology, val) = value.ext = val """Set [`SupplyTechnology`](@ref) `region`.""" set_region!(value::SupplyTechnology, val) = value.region = val """Set [`SupplyTechnology`](@ref) `maximum_capacity`.""" @@ -331,5 +337,7 @@ set_min_generation_percentage!(value::SupplyTechnology, val) = value.min_generat set_start_cost_per_mw!(value::SupplyTechnology, val) = value.start_cost_per_mw = val """Set [`SupplyTechnology`](@ref) `reg_max`.""" set_reg_max!(value::SupplyTechnology, val) = value.reg_max = val +"""Set [`SupplyTechnology`](@ref) `capital_recovery_period`.""" +set_capital_recovery_period!(value::SupplyTechnology, val) = value.capital_recovery_period = val """Set [`SupplyTechnology`](@ref) `up_time`.""" set_up_time!(value::SupplyTechnology, val) = value.up_time = val diff --git a/src/models/generated/includes.jl b/src/models/generated/includes.jl index 924c582..b79da33 100644 --- a/src/models/generated/includes.jl +++ b/src/models/generated/includes.jl @@ -25,7 +25,7 @@ export get_capital_cost export get_capital_costs export get_capital_costs_energy export get_capital_costs_power -export get_capital_recovery_factor +export get_capital_recovery_period export get_cluster export get_co2 export get_co_2_max_mtons @@ -54,6 +54,7 @@ export get_heat_rate_mmbtu_per_mwh export get_id export get_initial_capacity export get_initial_state_of_charge +export get_interest_rate export get_lifetime export get_line_loss export get_losses @@ -117,7 +118,7 @@ export set_capital_cost! export set_capital_costs! export set_capital_costs_energy! export set_capital_costs_power! -export set_capital_recovery_factor! +export set_capital_recovery_period! export set_cluster! export set_co2! export set_co_2_max_mtons! @@ -146,6 +147,7 @@ export set_heat_rate_mmbtu_per_mwh! export set_id! export set_initial_capacity! export set_initial_state_of_charge! +export set_interest_rate! export set_lifetime! export set_line_loss! export set_losses! From db01f2970493d43cd6a9ea015ae6d47431292c83 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Wed, 18 Dec 2024 09:08:07 -0700 Subject: [PATCH 36/40] remove wacc --- src/models/generated/ACTransportTechnology.jl | 12 ++---------- src/models/generated/ExistingTransportTechnology.jl | 12 ++---------- src/models/generated/HVDCTransportTechnology.jl | 12 ++---------- src/models/generated/includes.jl | 2 -- 4 files changed, 6 insertions(+), 32 deletions(-) diff --git a/src/models/generated/ACTransportTechnology.jl b/src/models/generated/ACTransportTechnology.jl index c42ce28..937c63c 100644 --- a/src/models/generated/ACTransportTechnology.jl +++ b/src/models/generated/ACTransportTechnology.jl @@ -23,7 +23,6 @@ This file is auto-generated. Do not edit. maximum_new_capacity::Float64 base_year::Int existing_line_capacity::Float64 - wacc::Float64 line_loss::Float64 capital_recovery_period::Int64 end @@ -48,7 +47,6 @@ This file is auto-generated. Do not edit. - `maximum_new_capacity::Float64`: Maximum capacity that can be added to transmission line (MW) - `base_year::Int`: (default: `2020`) Reference year for technology data - `existing_line_capacity::Float64`: Existing capacity of transport technology (MW) -- `wacc::Float64`: (default: `0`) Weighted average cost of capital - `line_loss::Float64`: Transmission loss for each transport technology (%) - `capital_recovery_period::Int64`: (default: `30`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. """ @@ -87,8 +85,6 @@ mutable struct ACTransportTechnology{T <: PSY.Device} <: Technology base_year::Int "Existing capacity of transport technology (MW)" existing_line_capacity::Float64 - "Weighted average cost of capital" - wacc::Float64 "Transmission loss for each transport technology (%)" line_loss::Float64 "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion." @@ -96,8 +92,8 @@ mutable struct ACTransportTechnology{T <: PSY.Device} <: Technology end -function ACTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), interest_rate=0.07, ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, base_year=2020, existing_line_capacity, wacc=0, line_loss, capital_recovery_period=30, ) where T <: PSY.Device - ACTransportTechnology{T}(base_power, capital_cost, start_region, available, name, end_region, power_systems_type, angle_limit, internal, interest_rate, ext, resistance, voltage, network_id, maximum_new_capacity, base_year, existing_line_capacity, wacc, line_loss, capital_recovery_period, ) +function ACTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), interest_rate=0.07, ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, base_year=2020, existing_line_capacity, line_loss, capital_recovery_period=30, ) where T <: PSY.Device + ACTransportTechnology{T}(base_power, capital_cost, start_region, available, name, end_region, power_systems_type, angle_limit, internal, interest_rate, ext, resistance, voltage, network_id, maximum_new_capacity, base_year, existing_line_capacity, line_loss, capital_recovery_period, ) end """Get [`ACTransportTechnology`](@ref) `base_power`.""" @@ -134,8 +130,6 @@ get_maximum_new_capacity(value::ACTransportTechnology) = value.maximum_new_capac get_base_year(value::ACTransportTechnology) = value.base_year """Get [`ACTransportTechnology`](@ref) `existing_line_capacity`.""" get_existing_line_capacity(value::ACTransportTechnology) = value.existing_line_capacity -"""Get [`ACTransportTechnology`](@ref) `wacc`.""" -get_wacc(value::ACTransportTechnology) = value.wacc """Get [`ACTransportTechnology`](@ref) `line_loss`.""" get_line_loss(value::ACTransportTechnology) = value.line_loss """Get [`ACTransportTechnology`](@ref) `capital_recovery_period`.""" @@ -175,8 +169,6 @@ set_maximum_new_capacity!(value::ACTransportTechnology, val) = value.maximum_new set_base_year!(value::ACTransportTechnology, val) = value.base_year = val """Set [`ACTransportTechnology`](@ref) `existing_line_capacity`.""" set_existing_line_capacity!(value::ACTransportTechnology, val) = value.existing_line_capacity = val -"""Set [`ACTransportTechnology`](@ref) `wacc`.""" -set_wacc!(value::ACTransportTechnology, val) = value.wacc = val """Set [`ACTransportTechnology`](@ref) `line_loss`.""" set_line_loss!(value::ACTransportTechnology, val) = value.line_loss = val """Set [`ACTransportTechnology`](@ref) `capital_recovery_period`.""" diff --git a/src/models/generated/ExistingTransportTechnology.jl b/src/models/generated/ExistingTransportTechnology.jl index 7879291..6b89865 100644 --- a/src/models/generated/ExistingTransportTechnology.jl +++ b/src/models/generated/ExistingTransportTechnology.jl @@ -22,7 +22,6 @@ This file is auto-generated. Do not edit. maximum_new_capacity::Float64 base_year::Int existing_line_capacity::Float64 - wacc::Float64 line_loss::Float64 capital_recovery_period::Int64 end @@ -46,7 +45,6 @@ This file is auto-generated. Do not edit. - `maximum_new_capacity::Float64`: Maximum capacity that can be added to transmission line (MW) - `base_year::Int`: (default: `2020`) Reference year for technology data - `existing_line_capacity::Float64`: Existing capacity of transport technology (MW) -- `wacc::Float64`: (default: `0`) Weighted average cost of capital - `line_loss::Float64`: Transmission loss for each transport technology (%) - `capital_recovery_period::Int64`: (default: `30`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. """ @@ -83,8 +81,6 @@ mutable struct ExistingTransportTechnology{T <: PSY.Device} <: Technology base_year::Int "Existing capacity of transport technology (MW)" existing_line_capacity::Float64 - "Weighted average cost of capital" - wacc::Float64 "Transmission loss for each transport technology (%)" line_loss::Float64 "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion." @@ -92,8 +88,8 @@ mutable struct ExistingTransportTechnology{T <: PSY.Device} <: Technology end -function ExistingTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, base_year=2020, existing_line_capacity, wacc=0, line_loss, capital_recovery_period=30, ) where T <: PSY.Device - ExistingTransportTechnology{T}(base_power, capital_cost, start_region, available, name, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, base_year, existing_line_capacity, wacc, line_loss, capital_recovery_period, ) +function ExistingTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, base_year=2020, existing_line_capacity, line_loss, capital_recovery_period=30, ) where T <: PSY.Device + ExistingTransportTechnology{T}(base_power, capital_cost, start_region, available, name, end_region, power_systems_type, angle_limit, internal, ext, resistance, voltage, network_id, maximum_new_capacity, base_year, existing_line_capacity, line_loss, capital_recovery_period, ) end """Get [`ExistingTransportTechnology`](@ref) `base_power`.""" @@ -128,8 +124,6 @@ get_maximum_new_capacity(value::ExistingTransportTechnology) = value.maximum_new get_base_year(value::ExistingTransportTechnology) = value.base_year """Get [`ExistingTransportTechnology`](@ref) `existing_line_capacity`.""" get_existing_line_capacity(value::ExistingTransportTechnology) = value.existing_line_capacity -"""Get [`ExistingTransportTechnology`](@ref) `wacc`.""" -get_wacc(value::ExistingTransportTechnology) = value.wacc """Get [`ExistingTransportTechnology`](@ref) `line_loss`.""" get_line_loss(value::ExistingTransportTechnology) = value.line_loss """Get [`ExistingTransportTechnology`](@ref) `capital_recovery_period`.""" @@ -167,8 +161,6 @@ set_maximum_new_capacity!(value::ExistingTransportTechnology, val) = value.maxim set_base_year!(value::ExistingTransportTechnology, val) = value.base_year = val """Set [`ExistingTransportTechnology`](@ref) `existing_line_capacity`.""" set_existing_line_capacity!(value::ExistingTransportTechnology, val) = value.existing_line_capacity = val -"""Set [`ExistingTransportTechnology`](@ref) `wacc`.""" -set_wacc!(value::ExistingTransportTechnology, val) = value.wacc = val """Set [`ExistingTransportTechnology`](@ref) `line_loss`.""" set_line_loss!(value::ExistingTransportTechnology, val) = value.line_loss = val """Set [`ExistingTransportTechnology`](@ref) `capital_recovery_period`.""" diff --git a/src/models/generated/HVDCTransportTechnology.jl b/src/models/generated/HVDCTransportTechnology.jl index 69c8014..fe98e3b 100644 --- a/src/models/generated/HVDCTransportTechnology.jl +++ b/src/models/generated/HVDCTransportTechnology.jl @@ -23,7 +23,6 @@ This file is auto-generated. Do not edit. maximum_new_capacity::Float64 base_year::Int existing_line_capacity::Float64 - wacc::Float64 line_loss::Float64 capital_recovery_period::Int64 end @@ -48,7 +47,6 @@ This file is auto-generated. Do not edit. - `maximum_new_capacity::Float64`: Maximum capacity that can be added to transmission line (MW) - `base_year::Int`: (default: `2020`) Reference year for technology data - `existing_line_capacity::Float64`: Existing capacity of transport technology (MW) -- `wacc::Float64`: (default: `0`) Weighted average cost of capital - `line_loss::Float64`: Transmission loss for each transport technology (%) - `capital_recovery_period::Int64`: (default: `30`) Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion. """ @@ -87,8 +85,6 @@ mutable struct HVDCTransportTechnology{T <: PSY.Device} <: Technology base_year::Int "Existing capacity of transport technology (MW)" existing_line_capacity::Float64 - "Weighted average cost of capital" - wacc::Float64 "Transmission loss for each transport technology (%)" line_loss::Float64 "Capital recovery period (in years) used for determining overnight capital costs from annualized investment costs for network transmission line expansion." @@ -96,8 +92,8 @@ mutable struct HVDCTransportTechnology{T <: PSY.Device} <: Technology end -function HVDCTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), interest_rate=0.07, ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, base_year=2020, existing_line_capacity, wacc=0, line_loss, capital_recovery_period=30, ) where T <: PSY.Device - HVDCTransportTechnology{T}(base_power, capital_cost, start_region, available, name, end_region, power_systems_type, angle_limit, internal, interest_rate, ext, resistance, voltage, network_id, maximum_new_capacity, base_year, existing_line_capacity, wacc, line_loss, capital_recovery_period, ) +function HVDCTransportTechnology{T}(; base_power, capital_cost, start_region, available, name, end_region, power_systems_type, angle_limit=0.0, internal=InfrastructureSystemsInternal(), interest_rate=0.07, ext=Dict(), resistance=0.0, voltage=0.0, network_id, maximum_new_capacity, base_year=2020, existing_line_capacity, line_loss, capital_recovery_period=30, ) where T <: PSY.Device + HVDCTransportTechnology{T}(base_power, capital_cost, start_region, available, name, end_region, power_systems_type, angle_limit, internal, interest_rate, ext, resistance, voltage, network_id, maximum_new_capacity, base_year, existing_line_capacity, line_loss, capital_recovery_period, ) end """Get [`HVDCTransportTechnology`](@ref) `base_power`.""" @@ -134,8 +130,6 @@ get_maximum_new_capacity(value::HVDCTransportTechnology) = value.maximum_new_cap get_base_year(value::HVDCTransportTechnology) = value.base_year """Get [`HVDCTransportTechnology`](@ref) `existing_line_capacity`.""" get_existing_line_capacity(value::HVDCTransportTechnology) = value.existing_line_capacity -"""Get [`HVDCTransportTechnology`](@ref) `wacc`.""" -get_wacc(value::HVDCTransportTechnology) = value.wacc """Get [`HVDCTransportTechnology`](@ref) `line_loss`.""" get_line_loss(value::HVDCTransportTechnology) = value.line_loss """Get [`HVDCTransportTechnology`](@ref) `capital_recovery_period`.""" @@ -175,8 +169,6 @@ set_maximum_new_capacity!(value::HVDCTransportTechnology, val) = value.maximum_n set_base_year!(value::HVDCTransportTechnology, val) = value.base_year = val """Set [`HVDCTransportTechnology`](@ref) `existing_line_capacity`.""" set_existing_line_capacity!(value::HVDCTransportTechnology, val) = value.existing_line_capacity = val -"""Set [`HVDCTransportTechnology`](@ref) `wacc`.""" -set_wacc!(value::HVDCTransportTechnology, val) = value.wacc = val """Set [`HVDCTransportTechnology`](@ref) `line_loss`.""" set_line_loss!(value::HVDCTransportTechnology, val) = value.line_loss = val """Set [`HVDCTransportTechnology`](@ref) `capital_recovery_period`.""" diff --git a/src/models/generated/includes.jl b/src/models/generated/includes.jl index b79da33..e32f925 100644 --- a/src/models/generated/includes.jl +++ b/src/models/generated/includes.jl @@ -108,7 +108,6 @@ export get_up_time export get_var_cost_per_mwh export get_voll export get_voltage -export get_wacc export set_angle_limit! export set_available! export set_balancing_topology! @@ -201,4 +200,3 @@ export set_up_time! export set_var_cost_per_mwh! export set_voll! export set_voltage! -export set_wacc! From 2be61d80956434202eb5a4f61a89c5a169ca9921 Mon Sep 17 00:00:00 2001 From: prao7 Date: Mon, 30 Dec 2024 13:07:38 -0700 Subject: [PATCH 37/40] finished parser --- src/generate_structs.jl | 206 +++++++++++++++++++++++++++++++++------- 1 file changed, 170 insertions(+), 36 deletions(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index e3c3b30..c510a73 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -297,23 +297,115 @@ function parse_timestamps_and_values(json_str::String) return timestamps, values end +function parse_timestamps_and_values(df::DataFrame) + # Initialize arrays to store timestamps and values + timestamps = String[] + values = Float64[] + type = "" + + # Check if the timestamps are within the hours of the day + is_within_hours = all(row -> parse(Int, split(row["timestamp"], "-")[end]) in 1:24, eachrow(df)) + + if is_within_hours + type = "Real Time" + # Iterate over each row in the DataFrame + for row in eachrow(df) + # Append the timestamp to the timestamps array + push!(timestamps, row["timestamp"]) + + # Append the value to the values array + push!(values, row["value"]) + end + else + type = "Forecast" + # Create a dictionary to store daily values + daily_values = Dict{String, Vector{Float64}}() + + # Iterate over each row in the DataFrame + for row in eachrow(df) + # Extract the date part of the timestamp + date_part = join(split(row["timestamp"], "-")[1:3], "-") + + # Initialize the daily values array if not already present + if !haskey(daily_values, date_part) + daily_values[date_part] = Float64[] + end + + # Append the value to the daily values array + push!(daily_values[date_part], row["value"]) + end + + # Calculate the average values for each day and create 24-hour profiles + for (date, vals) in daily_values + avg_value = sum(vals) / length(vals) + for hour in 1:24 + push!(timestamps, "$date-$hour") + push!(values, avg_value) + end + end + end + + # Parse timestamps into DateTime objects + parsed_timestamps = DateTime.(timestamps, "yyyy-m-d-H") + + # Sort the parsed timestamps and values + sorted_indices = sortperm(parsed_timestamps) + sorted_timestamps = parsed_timestamps[sorted_indices] + sorted_values = values[sorted_indices] + + return sorted_timestamps, sorted_values, type +end + function parse_json_to_arrays(json_str::String) - # Parse the JSON string into a Julia object - data = JSON3.read(json_str) + # Replace invalid JSON values + cleaned_str = replace(json_str, "NaN" => "null") + + # Parse the cleaned JSON string into a Julia object + data = JSON3.read(cleaned_str) # Initialize array to store x and y values xy_values = [] + # Initialize previous values + prev_to_x = 0.0 + prev_to_y = 0.0 + # Iterate over each dictionary in the parsed JSON data for item in data - # Append the x values to x_values array as vector of named tuples - push!(xy_values, IS.XY_COORDS((Float64(item["from_x"]), Float64(item["from_y"])))) - push!(xy_values, IS.XY_COORDS((Float64(item["to_x"]), Float64(item["to_y"])))) + # Handle from_x and from_y replacements + from_x = isnothing(item["from_x"]) ? prev_to_x : Float64(item["from_x"]) + from_y = isnothing(item["from_y"]) ? prev_to_y : Float64(item["from_y"]) + + # Handle to_x and to_y replacements + to_x = isnothing(item["to_x"]) ? prev_to_x : Float64(item["to_x"]) + to_y = isnothing(item["to_y"]) ? prev_to_y : Float64(item["to_y"]) + + # Append corrected values to the array + push!(xy_values, IS.XY_COORDS((from_x, from_y))) + push!(xy_values, IS.XY_COORDS((to_x, to_y))) + + # Update previous values + prev_to_x = to_x + prev_to_y = to_y end return unique(xy_values) end + +function parse_heatrate_to_array(json_str::String) + xy_vector = parse_json_to_arrays(json_str) + + # Validation: Check if there are at least two distinct x-coordinates + if length(unique(getfield.(xy_vector, :x))) < 2 + return 0.0 + end + + # If valid, return the InputOutputCurve + return InputOutputCurve(function_data=PiecewiseLinearData(points=xy_vector)) +end + + function dataframe_to_structs(df_dict::Dict) #Initialize Portfolio @@ -327,14 +419,17 @@ function dataframe_to_structs(df_dict::Dict) end #Populate SupplyTechnology structs from database (new builds) topologies = df_dict["balancing_topologies"] - supply_curves = filter("entity_type" => contains("supply_technologies"), df_dict["attributes"]) + supply_curves_full = filter("entity_type" => contains("supply_technologies"), df_dict["attributes"]) + supply_curves = filter("name" => contains("supply"), supply_curves_full) + + # TODO: Add fields for reinforcement distances + reinforcement_distances = filter("name" => contains("reinforcement"), supply_curves_full) for row_pw in eachrow(supply_curves) # Extract supply curves and IDs eaid = row_pw["entity_attribute_id"] supply_curve = row_pw["value"] supply_curve = decode(supply_curve, "UTF-8") - supply_curve_parsed = parse_json_to_arrays(supply_curve) id = eaid @@ -345,6 +440,8 @@ function dataframe_to_structs(df_dict::Dict) :, ] + # @show eaid, row_pw, supply_curve, topologies[topologies.name .== row[!, "balancing_topology"][1], "area"][1] + supply_curve_parsed = parse_json_to_arrays(supply_curve) #extract area if !isempty(row) area = topologies[topologies.name .== row[!, "balancing_topology"][1], "area"][1] @@ -412,27 +509,31 @@ function dataframe_to_structs(df_dict::Dict) # This will return all rows where entity_id matches any value in the tech_id vector tech_id = row["unit_id"] - result = isempty(filter(row -> row[:entity_id] == tech_id, df_dict["attributes"])) ? 0 : filter(row -> row[:entity_id] == tech_id, df_dict["attributes"]) - - # Extract the blob from the heat rate data - #TODO: Fix this please - if result != 0 - heat_rate_unparsed = row["value"] - heat_rate_piecewise_lin = parse_json_to_arrays(heat_rate_unparsed) + result_all = isempty(filter(row -> row[:entity_id] == tech_id && row[:entity_type] == "generation_units", df_dict["attributes"])) ? 0 : filter(row -> row[:entity_id] == tech_id && row[:entity_type] == "generation_units", df_dict["attributes"]) + result = filter(row -> contains(row[:name], "Heat Rate"), result_all) + # Check if result exists and contains the expected field + if result != 0 + if !isempty(result[!, :value]) + first_value = result[!, :value][1] + # Ensure it's decoded properly + heat_rate_unparsed = decode(first_value, "UTF-8") + heat_rate_piecewise_lin = parse_heatrate_to_array(heat_rate_unparsed) + else + @warn "Result value field is empty" + heat_rate_piecewise_lin = 0.0 + end else + @warn "Result DataFrame is empty or zero" heat_rate_piecewise_lin = 0.0 end - #heat_rate_piecewise_lin = 0.0 - if row["fuel_type"] == "Solar" || row["fuel_type"] == "Wind" - # Put in time series for the solar and Wind - eaid = row["unit_id"] - ts_index = filter("entity_id" => isequal(eaid), df_dict["entities"])["entity_id"] - ts = filter("entity_id" => isequal(ts_index), df_dict["time_series"]) - # TODO: Need to figure out how to parse the timestamp and values and add to the time series - end + co2_data = filter(row -> contains(row[:name], "CO2"), result_all) + co2_value = isempty(co2_data) ? 0.0 : Float64(co2_data[!, "value"][1]) + + op_data = filter(row -> row[:unit_id] == tech_id, df_dict["operational_data"]) + variable_om = op_data[!, "vom_cost"][1] + - @show heat_rate_piecewise_lin parametric = map_prime_mover_to_parametric(row["prime_mover"]) t = SupplyTechnology{parametric}(; # Data pulled from DB @@ -448,24 +549,25 @@ function dataframe_to_structs(df_dict::Dict) # Data we should have but dont currently operation_costs=ThermalGenerationCost( - variable=CostCurve(LinearCurve(0.0)), - fixed=result[occursin.("FOM", result[!, :name]), :value][1], + variable=CostCurve(LinearCurve(variable_om)), + fixed=op_data[!, "fom_cost"][1], start_up=0.0, shut_down=0.0, ), - start_fuel_mmbtu_per_mw=2.0, - start_cost_per_mw=result[occursin.("Startup Cost", result[!, :name]), :value][1], - up_time=result[occursin.("Uptime", result[!, :name]), :value][1], - down_time=result[occursin.("Downtime", result[!, :name]), :value][1], + start_fuel_mmbtu_per_mw=op_data[!, "startup_fuel_mmbtu_per_mw"][1], + start_cost_per_mw=op_data[!, "startup_cost"][1], + up_time=op_data[!, "uptime"][1], + down_time=op_data[!, "downtime"][1], heat_rate_mmbtu_per_mwh=heat_rate_piecewise_lin, - co2=length(result[occursin.("CO2", result[!, :name]), :value]) > 0 ? - coalesce(result[occursin.("CO2", result[!, :name]), :value][1], 0.0) : 0.0, + co2=co2_value, + + ## TODO: Need to add ramping capabilities to the schema ramp_dn_percentage=0.64, ramp_up_percentage=0.64, #Placeholder or default values (modeling assumptions) available=true, - minimum_required_capacity=result[occursin.("Minimum Stable", result[!, :name]), :value][1], + minimum_required_capacity=op_data[!, "min_stable_level"][1], min_generation_percentage=0.0, maximum_capacity=1e8, power_systems_type=string(parametric), @@ -475,6 +577,37 @@ function dataframe_to_structs(df_dict::Dict) #new_build = 0#0 for existing builds ) add_technology!(p, t) + if row["fuel_type"] == "Solar" || row["fuel_type"] == "Wind" + # Put in time series for the solar and Wind + eaid = row["unit_id"] + ts_index = filter("entity_id" => isequal(eaid), df_dict["entities"])[!, "entity_id"] + if length(ts_index) == 0 + continue + else + for time_series in ts_index + ts = filter("entity_id" => isequal(time_series), df_dict["time_series"]) + # TODO: Remove this hacky fix once database has been corrected to have unique timestamps + # ts = unique(ts,:timestamp) + timestamps, values, type = parse_timestamps_and_values(ts) + # dates = DateTime.(timestamps, "yyyy-m-d-H") + time_series_array = TimeArray(timestamps, values) + if type == "Forecast" + ts = SingleTimeSeries(string(eaid), time_series_array) + IS.add_time_series!(p.data, t, ts) + # TODO: Remove once we have decided real time data handling + break + elseif type == "Real Time" + # TODO: For now, skipping this. But need to add later for real-time data + # ts = SingleTimeSeries(string(time_series), time_series_array) + # IS.add_time_series!(p.data, t, ts) + end + # ts = SingleTimeSeries(string(time_series), time_series_array) + # IS.add_time_series!(p.data, t, ts) + + end + @warn "Only day ahead added for unit_id: $eaid" + end + end end # Get storage units @@ -510,8 +643,8 @@ function dataframe_to_structs(df_dict::Dict) start_up=0.0, shut_down=0.0, ), - eff_up=0.92, - eff_down=0.92, + eff_up=row["charging_efficiency"], + eff_down=row["discharge_efficiency"], storage_tech=StorageTech.LIB, #Default or placeholder values @@ -534,10 +667,11 @@ function dataframe_to_structs(df_dict::Dict) for row in eachrow(df_dict["demand_requirements"]) #start in time_series eaid = row["entity_attribute_id"] - ts_index = filter("entity_id" => isequal(eaid), df_dict["entities"])["entity_id"] + # ts_index = filter("entity_id" => isequal(eaid), df_dict["entities"])[!, "entity_id"] + ts_index = filter(row -> row["entity_id"] == eaid && row["entity_type"] == "demand_requirements", df_dict["entities"])[!, "entity_id"] # Collect all rows in the time_series table that match the entity_id - ts = filter("entity_id" => isequal(ts_index), df_dict["time_series"]) + ts = filter("entity_id" => isequal(ts_index[1]), df_dict["time_series"]) ts_parsed = collect(ts[:, :value]) # Parsing the timestamps into Dates From d1d69775c2ab0588f959befa43cb9f011cb7b1e1 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Thu, 2 Jan 2025 10:23:33 -0700 Subject: [PATCH 38/40] remove duplicate field --- src/models/generated/StorageTechnology.jl | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/models/generated/StorageTechnology.jl b/src/models/generated/StorageTechnology.jl index e87162a..17b71dc 100644 --- a/src/models/generated/StorageTechnology.jl +++ b/src/models/generated/StorageTechnology.jl @@ -54,7 +54,6 @@ This file is auto-generated. Do not edit. - `zone::Union{Nothing, Zone}`: Zone number - `prime_mover_type::PrimeMovers`: (default: `PrimeMovers.OT`) Prime mover for generator - `existing_cap_energy::Float64`: (default: `0.0`) Pre-existing energy capacity for a technology (MWh) -- `prime_mover_type::PrimeMovers`: (default: `PrimeMovers.OT`) Prime mover for generator - `lifetime::Int`: (default: `100`) Maximum number of years a technology can be active once installed - `rsv_cost::Float64`: (default: `0.0`) Cost of providing upwards spinning or contingency reserves - `available::Bool`: identifies whether the technology is available @@ -101,8 +100,6 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology prime_mover_type::PrimeMovers "Pre-existing energy capacity for a technology (MWh)" existing_cap_energy::Float64 - "Prime mover for generator" - prime_mover_type::PrimeMovers "Maximum number of years a technology can be active once installed" lifetime::Int "Cost of providing upwards spinning or contingency reserves" From fe3fb41901baec498520b007ed228d6367cef904 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Thu, 2 Jan 2025 11:16:00 -0700 Subject: [PATCH 39/40] fixed errors caused by merge --- src/generate_structs.jl | 21 +++++++++++---------- src/models/generated/DemandRequirement.jl | 4 ---- src/models/generated/StorageTechnology.jl | 11 ++++------- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index 94e38af..a9442ad 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -409,7 +409,7 @@ end function dataframe_to_structs(df_dict::Dict) #Initialize Portfolio - p = Portfolio(0.07) + p = Portfolio(0.07, 0.05, 2025) #initialize Zone structs zones = [] @@ -460,12 +460,12 @@ function dataframe_to_structs(df_dict::Dict) t = SupplyTechnology{parametric}(; #Data pulled from DB name=string(row[!, "technology_id"][1]), - gen_ID=row[!, "technology_id"][1], + id=row[!, "technology_id"][1], capital_costs=InputOutputCurve(PiecewiseLinearData(supply_curve_parsed)), balancing_topology=string(row[!, "balancing_topology"][1]), prime_mover_type=map_prime_mover(row[!, "prime_mover"][1]), fuel=row[!, "fuel_type"][1], - zone=zones[area_int], + region=zones[area_int], #Problem ones, need to write functions to extract base_power=100.0, @@ -538,12 +538,12 @@ function dataframe_to_structs(df_dict::Dict) t = SupplyTechnology{parametric}(; # Data pulled from DB name=row["name"], - gen_ID=row["unit_id"], + id=row["unit_id"], capital_costs=LinearCurve(0.0), #just assume zero since pre-existing? balancing_topology=string(row["balancing_topology"]), prime_mover_type=map_prime_mover(row["prime_mover"]), fuel=row["fuel_type"], - zone=zones[area_int], + region=zones[area_int], base_power=row["base_power"], initial_capacity=row["rating"], @@ -622,7 +622,7 @@ function dataframe_to_structs(df_dict::Dict) name=row["name"], base_power=row["base_power"], # Natural Units id=row["storage_unit_id"], - zone=zones[area_int], + region=zones[area_int], prime_mover_type=map_prime_mover(row["prime_mover"]), balancing_topology=row["balancing_topology"], existing_cap_power=row["rating"], @@ -689,7 +689,7 @@ function dataframe_to_structs(df_dict::Dict) d = DemandRequirement{ElectricLoad}( #Data pulled from DB name=string(row["entity_attribute_id"]), - zone=zones[area_int],#parse(Int64, row["area"]), + region=zones[area_int],#parse(Int64, row["area"]), #Placeholder/default values available=true, @@ -723,12 +723,13 @@ function dataframe_to_structs(df_dict::Dict) end end - tx = TransportTechnology{Branch}(; + tx = ExistingTransportTechnology{Branch}(; name=string(rownumber(row)), network_id = rownumber(row), + base_power = 100.0, available=true, - start_region=parse(Int64, row["area_from"]), - end_region=parse(Int64, row["area_to"]), + start_region=zones[parse(Int64, row["area_from"])], + end_region=zones[parse(Int64, row["area_to"])], maximum_new_capacity=row["max_flow_from"], existing_line_capacity=existing_capacity, diff --git a/src/models/generated/DemandRequirement.jl b/src/models/generated/DemandRequirement.jl index d28c21e..f835ddd 100644 --- a/src/models/generated/DemandRequirement.jl +++ b/src/models/generated/DemandRequirement.jl @@ -7,7 +7,6 @@ This file is auto-generated. Do not edit. """ mutable struct DemandRequirement{T <: PSY.StaticInjection} <: Technology name::String - zone::Union{Nothing, Zone} power_systems_type::String internal::InfrastructureSystemsInternal ext::Dict @@ -20,7 +19,6 @@ This file is auto-generated. Do not edit. # Arguments - `name::String`: The technology name -- `zone::Union{Nothing, Zone}`: Zone Number - `power_systems_type::String`: maps to a valid PowerSystems.jl for PCM modeling - `internal::InfrastructureSystemsInternal`: (default: `InfrastructureSystemsInternal()`) Internal field - `ext::Dict`: (default: `Dict()`) Option for providing additional data @@ -31,8 +29,6 @@ This file is auto-generated. Do not edit. mutable struct DemandRequirement{T <: PSY.StaticInjection} <: Technology "The technology name" name::String - "Zone Number" - zone::Union{Nothing, Zone} "maps to a valid PowerSystems.jl for PCM modeling" power_systems_type::String "Internal field" diff --git a/src/models/generated/StorageTechnology.jl b/src/models/generated/StorageTechnology.jl index 17b71dc..458fd9c 100644 --- a/src/models/generated/StorageTechnology.jl +++ b/src/models/generated/StorageTechnology.jl @@ -8,7 +8,7 @@ This file is auto-generated. Do not edit. mutable struct StorageTechnology{T <: PSY.Storage} <: Technology base_power::Float64 om_costs_energy::PSY.OperationalCost - zone::Union{Nothing, Zone} + existing_cap_energy::Float64 prime_mover_type::PrimeMovers lifetime::Int rsv_cost::Float64 @@ -51,9 +51,8 @@ This file is auto-generated. Do not edit. # Arguments - `base_power::Float64`: Base power - `om_costs_energy::PSY.OperationalCost`: (default: `StorageCost()`) Fixed and variable O&M costs for a technology -- `zone::Union{Nothing, Zone}`: Zone number -- `prime_mover_type::PrimeMovers`: (default: `PrimeMovers.OT`) Prime mover for generator - `existing_cap_energy::Float64`: (default: `0.0`) Pre-existing energy capacity for a technology (MWh) +- `prime_mover_type::PrimeMovers`: (default: `PrimeMovers.OT`) Prime mover for generator - `lifetime::Int`: (default: `100`) Maximum number of years a technology can be active once installed - `rsv_cost::Float64`: (default: `0.0`) Cost of providing upwards spinning or contingency reserves - `available::Bool`: identifies whether the technology is available @@ -94,12 +93,10 @@ mutable struct StorageTechnology{T <: PSY.Storage} <: Technology base_power::Float64 "Fixed and variable O&M costs for a technology" om_costs_energy::PSY.OperationalCost - "Zone number" - zone::Union{Nothing, Zone} - "Prime mover for generator" - prime_mover_type::PrimeMovers "Pre-existing energy capacity for a technology (MWh)" existing_cap_energy::Float64 + "Prime mover for generator" + prime_mover_type::PrimeMovers "Maximum number of years a technology can be active once installed" lifetime::Int "Cost of providing upwards spinning or contingency reserves" From b57a847c84568bbaa9f5d7eb7141ea860b686e20 Mon Sep 17 00:00:00 2001 From: Jerry Potts Date: Thu, 2 Jan 2025 11:18:15 -0700 Subject: [PATCH 40/40] formatter --- src/generate_structs.jl | 64 +++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 21 deletions(-) diff --git a/src/generate_structs.jl b/src/generate_structs.jl index a9442ad..3c6f713 100644 --- a/src/generate_structs.jl +++ b/src/generate_structs.jl @@ -304,7 +304,8 @@ function parse_timestamps_and_values(df::DataFrame) type = "" # Check if the timestamps are within the hours of the day - is_within_hours = all(row -> parse(Int, split(row["timestamp"], "-")[end]) in 1:24, eachrow(df)) + is_within_hours = + all(row -> parse(Int, split(row["timestamp"], "-")[end]) in 1:24, eachrow(df)) if is_within_hours type = "Real Time" @@ -392,20 +393,18 @@ function parse_json_to_arrays(json_str::String) return unique(xy_values) end - function parse_heatrate_to_array(json_str::String) xy_vector = parse_json_to_arrays(json_str) - + # Validation: Check if there are at least two distinct x-coordinates if length(unique(getfield.(xy_vector, :x))) < 2 return 0.0 end - + # If valid, return the InputOutputCurve return InputOutputCurve(function_data=PiecewiseLinearData(points=xy_vector)) end - function dataframe_to_structs(df_dict::Dict) #Initialize Portfolio @@ -414,16 +413,18 @@ function dataframe_to_structs(df_dict::Dict) #initialize Zone structs zones = [] for row_zone in eachrow(df_dict["areas"]) - z = Zone(name = string("zone_", row_zone["name"]), id=parse(Int64, row_zone["name"])) + z = Zone(name=string("zone_", row_zone["name"]), id=parse(Int64, row_zone["name"])) push!(zones, z) end #Populate SupplyTechnology structs from database (new builds) topologies = df_dict["balancing_topologies"] - supply_curves_full = filter("entity_type" => contains("supply_technologies"), df_dict["attributes"]) + supply_curves_full = + filter("entity_type" => contains("supply_technologies"), df_dict["attributes"]) supply_curves = filter("name" => contains("supply"), supply_curves_full) # TODO: Add fields for reinforcement distances - reinforcement_distances = filter("name" => contains("reinforcement"), supply_curves_full) + reinforcement_distances = + filter("name" => contains("reinforcement"), supply_curves_full) for row_pw in eachrow(supply_curves) # Extract supply curves and IDs @@ -444,10 +445,11 @@ function dataframe_to_structs(df_dict::Dict) supply_curve_parsed = parse_json_to_arrays(supply_curve) #extract area if !isempty(row) - area = topologies[topologies.name .== row[!, "balancing_topology"][1], "area"][1] + area = + topologies[topologies.name .== row[!, "balancing_topology"][1], "area"][1] area_int = parse(Int64, area) - - else + + else continue end #extract supply curve, does every supply_technology have a supply curve? @@ -509,10 +511,23 @@ function dataframe_to_structs(df_dict::Dict) # This will return all rows where entity_id matches any value in the tech_id vector tech_id = row["unit_id"] - result_all = isempty(filter(row -> row[:entity_id] == tech_id && row[:entity_type] == "generation_units", df_dict["attributes"])) ? 0 : filter(row -> row[:entity_id] == tech_id && row[:entity_type] == "generation_units", df_dict["attributes"]) + result_all = + isempty( + filter( + row -> + row[:entity_id] == tech_id && + row[:entity_type] == "generation_units", + df_dict["attributes"], + ), + ) ? 0 : + filter( + row -> + row[:entity_id] == tech_id && row[:entity_type] == "generation_units", + df_dict["attributes"], + ) result = filter(row -> contains(row[:name], "Heat Rate"), result_all) # Check if result exists and contains the expected field - if result != 0 + if result != 0 if !isempty(result[!, :value]) first_value = result[!, :value][1] # Ensure it's decoded properly @@ -531,8 +546,7 @@ function dataframe_to_structs(df_dict::Dict) co2_value = isempty(co2_data) ? 0.0 : Float64(co2_data[!, "value"][1]) op_data = filter(row -> row[:unit_id] == tech_id, df_dict["operational_data"]) - variable_om = op_data[!, "vom_cost"][1] - + variable_om = op_data[!, "vom_cost"][1] parametric = map_prime_mover_to_parametric(row["prime_mover"]) t = SupplyTechnology{parametric}(; @@ -560,7 +574,7 @@ function dataframe_to_structs(df_dict::Dict) down_time=op_data[!, "downtime"][1], heat_rate_mmbtu_per_mwh=heat_rate_piecewise_lin, co2=co2_value, - + ## TODO: Need to add ramping capabilities to the schema ramp_dn_percentage=0.64, ramp_up_percentage=0.64, @@ -580,7 +594,8 @@ function dataframe_to_structs(df_dict::Dict) if row["fuel_type"] == "Solar" || row["fuel_type"] == "Wind" # Put in time series for the solar and Wind eaid = row["unit_id"] - ts_index = filter("entity_id" => isequal(eaid), df_dict["entities"])[!, "entity_id"] + ts_index = + filter("entity_id" => isequal(eaid), df_dict["entities"])[!, "entity_id"] if length(ts_index) == 0 continue else @@ -668,7 +683,14 @@ function dataframe_to_structs(df_dict::Dict) #start in time_series eaid = row["entity_attribute_id"] # ts_index = filter("entity_id" => isequal(eaid), df_dict["entities"])[!, "entity_id"] - ts_index = filter(row -> row["entity_id"] == eaid && row["entity_type"] == "demand_requirements", df_dict["entities"])[!, "entity_id"] + ts_index = filter( + row -> + row["entity_id"] == eaid && row["entity_type"] == "demand_requirements", + df_dict["entities"], + )[ + !, + "entity_id", + ] # Collect all rows in the time_series table that match the entity_id ts = filter("entity_id" => isequal(ts_index[1]), df_dict["time_series"]) @@ -676,7 +698,7 @@ function dataframe_to_structs(df_dict::Dict) # Parsing the timestamps into Dates timestamps = DateTime.(ts[!, :timestamp], "yyyy-m-d-H") - + dates = timestamps[1]:Hour(1):timestamps[end] demand = ts_parsed demand_array = TimeArray(dates, demand) @@ -725,8 +747,8 @@ function dataframe_to_structs(df_dict::Dict) tx = ExistingTransportTechnology{Branch}(; name=string(rownumber(row)), - network_id = rownumber(row), - base_power = 100.0, + network_id=rownumber(row), + base_power=100.0, available=true, start_region=zones[parse(Int64, row["area_from"])], end_region=zones[parse(Int64, row["area_to"])],