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

get_cep_slack_variables error

holgerteichgraeber opened this issue · comments

region = "CA_14"
ts_input_data = load_timeseries_data_provided(region)
cep_data = load_cep_data_provided(region)
optimizer=Clp.Optimizer
ts_clust_result = run_clust(ts_input_data; method="kmeans", representation="centroid", n_init=5, n_clust=5)
ts_clust_data = ts_clust_result.clust_data
test_result = run_opt(ts_clust_data,cep_data,optimizer;descriptor="Test",transmission = true,infrastructure = Dict{String,Array}("existing"=>["demand","transmission"], "limit"=>["transmission"]),  limit_emission=Dict{String,Number}("CO2/electricity"=>1000));
test_result.variables["TRANS"]
get_cep_slack_variables(test_result)
type OptResult has no field descriptor

Stacktrace:
 [1] getproperty(::Any, ::Symbol) at ./sysimg.jl:18
 [2] macro expansion at ./logging.jl:319 [inlined]
 [3] get_cep_variables(::OptResult, ::String) at /home/holger/.julia/dev/CapacityExpansion/src/utils/utils.jl:54
 [4] get_cep_slack_variables(::OptResult) at /home/holger/.julia/dev/CapacityExpansion/src/utils/utils.jl:38
 [5] top-level scope at In[13]:1

This seems to be an error in get_cep_variables() in utils.jl, potentially here:

 if isempty(variables)
     throw(@error("$variable_type-Variable not provided in $(opt_result.descriptor)"))

Any thoughts on what happened? / was there a change in the most recent dev branch that we have to accomodate here?

There are two things:

  • There are no Slack variables in the result, because neither lost_load_cost nor lost_emission_cost are included and no SLACK variables are setup
  • The error message itself was trying to enter an outdated field. (I fixed that in a new commit)

Great, thank you!