YoungFaithful / CapacityExpansion.jl

Capacity Expansion Problem Formulation for Julia

Home Page:https://youngfaithful.github.io/CapacityExpansion.jl/stable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Storage="simple", but no hydrogen

holgerteichgraeber opened this issue · comments

@YoungFaithful If I want to run a CEP for CA14, what is the simplest way to only run it with a battery, and not consider hydrogen storage. Can I delete the hydrogen entries from techs.yml, or what is the best way to accomplish this?

I think that is one way. Alternatively you could use:

techs=cep_data.techs

#Chosse the newtech
newtech=occursin.("h2", axes(techs, "tech")).==false

#Define the new tech
newtechs=OptVariable(techs.data[newtech], axes(techs, "tech")[newtech]; axes_names=techs.axes_names)

#Create a new OptDataCEP
cep_data=OptDataCEP(cep_data.region, cep_data.costs, newtechs, cep_data.nodes, cep_data.lines)

Thank you, I'll try what you proposed, that sounds neat.

For option one, would I also need to delete it out of the csv files or is taking it out of yml enough?

It must still get variable namings from the csv I assume when using the alternative way you suggested: I get an out of bounds error.

ERROR: LoadError: BoundsError: attempt to access 10-element Array{OptDataCEPTech,1} at index [11]
Stacktrace:
 [1] getindex at ./array.jl:729 [inlined]
 [2] getindex(::OptVariable{OptDataCEPTech,1,Tuple{Array{Any,1}},Tuple{Dict{Any,Int64}}}, ::String) at /home/hteich/.julia/dev/CapacityExpansion/src/utils/optvariable.jl:217
 [3] setup_opt_set_tech!(::Dict{String,Dict{String,Array}}, ::OptDataCEP, ::Dict{String,Any}) at /home/hteich/.julia/dev/CapacityExpansion/src/optim_problems/set.jl:16
 [4] setup_opt_set(::ClustData, ::OptDataCEP, ::Dict{String,Any}) at /home/hteich/.julia/dev/CapacityExpansion/src/optim_problems/set.jl:181
 [5] setup_opt_basic(::ClustData, ::OptDataCEP, ::Dict{String,Any}, ::DataType, ::Dict{Symbol,Any}) at /home/hteich/.julia/dev/CapacityExpansion/src/optim_problems/opt.jl:19
 [6] run_opt(::ClustData, ::OptDataCEP, ::Dict{String,Any}, ::DataType) at /home/hteich/.julia/dev/CapacityExpansion/src/optim_problems/run_opt.jl:17
 [7] #run_opt#20(::String, ::String, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Dict{String,Number}, ::Dict{String,Number}, ::Dict{String,Number}, ::Dict{String,Array}, ::Dict{Symbol,Int64}, ::Bool, ::Dict{Symbol,Any}, ::Int64, ::Dict{String,Any}, ::typeof(run_opt), ::ClustData, ::OptDataCEP, ::DataType) at /home/hteich/.julia/dev/CapacityExpansion/src/optim_problems/run_opt.jl:194
 [8] (::getfield(CapacityExpansion, Symbol("#kw##run_opt")))(::NamedTuple{(:limit_emission, :storage_type, :conversion, :optimizer_config, :descriptor),Tuple{Dict{String,Number},String,Bool,Dict{Symbol,Any},String}}, ::typeof(run_opt), ::ClustData, ::OptDataCEP, ::DataType) at ./none:0
 [9] #run_clust_extr#4(::Array{SimpleExtremeValueDescr,1}, ::Float64, ::String, ::String, ::String, ::Type, ::Base.Iterators.Pairs{Symbol,Any,NTuple{5,Symbol},NamedTuple{(:limit_emission, :storage_type, :conversion, :optimizer_config, :descriptor),Tuple{Dict{String,Number},String,Bool,Dict{Symbol,Any},String}}}, ::Function, ::ClustData, ::OptDataCEP, ::SlackExtremeValue) at /data/cees/hteich/ClustAnalysis/utils/iterative_extremes.jl:102
 [10] (::getfield(Main, Symbol("#kw##run_clust_extr")))(::NamedTuple{(:rep_mod_method, :limit_emission, :storage_type, :conversion, :optimizer, :optimizer_config, :descriptor),Tuple{String,Dict{String,Number},String,Bool,DataType,Dict{Symbol,Any},String}}, ::typeof(run_clust_extr), ::ClustData, ::OptDataCEP, ::SlackExtremeValue) at ./none:0
 [11] top-level scope at /data/cees/hteich/ClustAnalysis/scripts/IterativeExtremes/iterativeExtremes6_nohydrogen.jl:44 [inlined]
 [12] top-level scope at ./none:0
 [13] include at ./boot.jl:326 [inlined]
 [14] include_relative(::Module, ::String) at ./loading.jl:1038
 [15] include(::Module, ::String) at ./sysimg.jl:29
 [16] exec_options(::Base.JLOptions) at ./client.jl:267
 [17] _start() at ./client.jl:436
in expression starting at /data/cees/hteich/ClustAnalysis/scripts/IterativeExtremes/iterativeExtremes6_nohydrogen.jl:24

I think that is one way. Alternatively you could use:

techs=cep_data.techs

#Chosse the newtech
newtech=occursin.("h2", axes(techs, "tech")).==false

#Define the new tech
newtechs=OptVariable(techs.data[newtech], axes(techs, "tech")[newtech]; axes_names=techs.axes_names)

#Create a new OptDataCEP
cep_data=OptDataCEP(cep_data.region, cep_data.costs, newtechs, cep_data.nodes, cep_data.lines)

There was a [newtech] missing in my implementation...