diff --git a/.travis.yml b/.travis.yml index a8259d0..546f88c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ jobs: julia: 1.0 os: linux script: - - julia --project=docs/ -e ' using Pkg; Pkg.add(PackageSpec(url="https://github.com/holgerteichgraeber/ClustForOpt.jl", rev="dev"))' + - julia --project=docs/ -e ' using Pkg; Pkg.add(PackageSpec(url="https://github.com/holgerteichgraeber/ClustForOpt.jl"))' - julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' - julia --project=docs/ docs/make.jl after_success: @@ -25,7 +25,7 @@ jobs: julia: 1.0 os: linux script: - - julia --project=test/ -e ' using Pkg; Pkg.add(PackageSpec(url="https://github.com/holgerteichgraeber/ClustForOpt.jl", rev="dev"))' + - julia --project=test/ -e ' using Pkg; Pkg.add(PackageSpec(url="https://github.com/holgerteichgraeber/ClustForOpt.jl"))' - julia --project=test/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' - julia --project=test/ test/cep.jl after_success: diff --git a/README.md b/README.md index 31c3b26..f7eead1 100644 --- a/README.md +++ b/README.md @@ -30,14 +30,22 @@ This package is developed by Elias Kuepper [@YoungFaithful](https://github.com/y ## Installation This package runs under julia v1.0 and higher. -Install using: +First install the dependencies: +- `JuMP.jl` - for the modeling environment +- `StatsKit.jl` - for handling of `.csv`-Files +- `JLD2` - for saving your result data +- `FileIO` - for file accessing +- `ClustForOpt.jl` - for time-series data ```julia -] -add https://github.com/YoungFaithful/CEP.jl.git +using Pkg +Pkg.add(["JuMP","StatsKit","JLD2","FileIO"]) +Pkg.add(PackageSpec(url="https://github.com/holgerteichgraeber/ClustForOpt.jl")) +``` +Second install `CEP.jl`: +```julia +Pkg.add(PackageSpec(url="https://github.com/YoungFaithful/CEP.jl.git")) ``` -where `]` opens the julia package manager. - ## Example Workflow ```julia using CEP diff --git a/docs/make.jl b/docs/make.jl index c78e26f..abb78b0 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -22,4 +22,4 @@ makedocs(sitename="CEP.jl", "assets/preparing_clust_data_load", "assets/preparing_clust_data_agg"]) -deploydocs(repo = "github.com/YoungFaithful/CEP.jl.git", devbranch = "dev") +deploydocs(repo = "github.com/YoungFaithful/CEP.jl.git") diff --git a/docs/src/assets/preparing_clust_data_load.svg b/docs/src/assets/preparing_clust_data_load.svg index fc635cf..278d5ee 100644 --- a/docs/src/assets/preparing_clust_data_load.svg +++ b/docs/src/assets/preparing_clust_data_load.svg @@ -1,151 +1,1938 @@ - + - - + - - + - - - - - - - - - - - - - - - - - - - - - - - + 5 - + 10 - + 15 - + 20 - + 0.0 - -0.1 + +0.2 - -0.2 + +0.4 - -0.3 + +0.6 - -0.4 - - -0.5 - - + Time [h] - + Solar availability factor [%] - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - diff --git a/docs/src/csv_structure.md b/docs/src/csv_structure.md index 45528d1..e7c0764 100644 --- a/docs/src/csv_structure.md +++ b/docs/src/csv_structure.md @@ -47,10 +47,14 @@ The package provides data for: ### techs.csv !!! note + The currently supported `categ` are + - `generation`: For generation technologies that are either dispatchable (`none` in column `time_series`) or non-dispatchable (`time_series_name` in column `time_series`) + - `transmission`: For transmission technologies that have no capacity (`CAP`) per `node`, but capacities (`TRANS`) per `line` + - `storage_e`,`storage_in`,`storage_out`: For storage technology. A storage technology has always three components - - `storage_e`: The energy part of the storage device [MWh] - - `storage_in`: The power part for charging the storage device [MW] - - `storage_out`: The power part for discharging the storage device [MW] + - `[storage-name]_e`: The energy part of the storage device [MWh] + - `[storage-name]_in`: The power part for charging the storage device [MW] + - `[storage-name]_out`: The power part for discharging the storage device [MW] If e.g. in a lithium-ion battery the `storage_in` should be the same as `storage_out`, just set the `cap` costs in `costs.csv` of either `storage_in` or `storage_out` to zero. This will add a constraint to bind their capacities. |`tech`|`categ`|`sector`|`fuel`|`eff`|`max_gradient`|`time_series`|`lifetime`|`financial_lifetime`|`discount_rate`| diff --git a/docs/src/index.md b/docs/src/index.md index 14b37ee..b6c4608 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -30,10 +30,19 @@ This package is developed by Elias Kuepper [@YoungFaithful](https://github.com/y ## Installation This package runs under julia v1.0 and higher. -Install using: +First install the dependencies: +- `JuMP.jl` - for the modeling environment +- `StatsKit.jl` - for handling of `.csv`-Files +- `JLD2` - for saving your result data +- `FileIO` - for file accessing +- `ClustForOpt.jl` - for time-series data ```julia -] -add https://github.com/YoungFaithful/CEP.jl.git +using Pkg +Pkg.add(["JuMP","StatsKit","JLD2","FileIO"]) +Pkg.add(PackageSpec(url="https://github.com/holgerteichgraeber/ClustForOpt.jl")) +``` +Second install `CEP.jl`: +```julia +Pkg.add(PackageSpec(url="https://github.com/YoungFaithful/CEP.jl.git")) ``` -where `]` opens the julia package manager. diff --git a/docs/src/opt_cep.md b/docs/src/opt_cep.md index a74fba8..0c6c8e1 100644 --- a/docs/src/opt_cep.md +++ b/docs/src/opt_cep.md @@ -91,7 +91,7 @@ OptResult The model tracks how it is setup and which equations are used. This can help you to understand the models exact configuration without looking up the source code. The information of the model setup can be checked out the following way: -```@setup optinfo +```@setup 3 using CEP using Clp optimizer=Clp.Optimizer @@ -99,10 +99,9 @@ state="GER_1" years=[2016] ts_input_data = load_timeseries_data_provided(state;T=24, years=years) cep_data = load_cep_data_provided(state) -## CLUSTERING ## ts_clust_data = run_clust(ts_input_data;method="kmeans",representation="centroid",n_init=10,n_clust=5).best_results ``` -```@example optinfo +```@example 3 result = run_opt(ts_clust_data,cep_data,optimizer;descriptor="Model Name") -result.opt_info["model"] +println.(result.opt_info["model"]) ``` diff --git a/docs/src/workflow.md b/docs/src/workflow.md index 93be2cc..947b667 100644 --- a/docs/src/workflow.md +++ b/docs/src/workflow.md @@ -6,7 +6,7 @@ The workflow for this package can be broken down to: ## Data Preparation The CEP needs two types of data - Time series data in the type `ClustData` - [Preparing ClustData](@ref) -- Cost, node, (line), and technology data in the type `OptDataCEP` - [Preparing OptDataCE](@ref) +- Cost, node, (line), and technology data in the type `OptDataCEP` - [Preparing OptDataCEP](@ref) They are kept separate as just the time series dependent data is used to determine representative periods (clustering). ![Plot](assets/workflow.svg) diff --git a/src/utils/datastructs.jl b/src/utils/datastructs.jl index 18e8a5c..a7e28e9 100644 --- a/src/utils/datastructs.jl +++ b/src/utils/datastructs.jl @@ -28,7 +28,15 @@ struct OptVariable{T,N,Ax,L<:NTuple{N,Dict}} <: AbstractArray{T,N} type::String end -"OptResult" +""" + OptResult{status::Symbol,objective::Float64,variables::Dict{String,Any},sets::Dict{String,Array},opt_config::Dict{String,Any},opt_info::Dict{String,Any}} +- `status`: Symbol about the solution status of the model in normal cases `:OPTIMAL` +- `objective`: Value of the objective function +- `variables`: Dictionary with each OptVariable as an entry +- `sets`: Dictionary with each set as an entry +- `opt_config`: The configuration of the model setup - for more detail see tye `run_opt` documentation that sets the `opt_config` up +- `opt_info`: Holds information about the model. E.g. `opt_info["model"]` contains the exact equations used in the model. +""" struct OptResult status::Symbol objective::Float64 @@ -40,11 +48,11 @@ end """ OptDataCEP{region::String, costs::OptVariable, techs::OptVariable, nodes::OptVariable, lines::OptVariabl} <: OptData --`region::String` name of state or region data belongs to --`costs::OptVariable` costs[tech,node,year,account,impact] - Number --`techs::OptVariable` techs[tech] - OptDataCEPTech --`nodes::OptVariable` nodes[tech, node] - OptDataCEPNode --`lines::OptVarible` lines[tech, line] - OptDataCEPLine +- `region::String`: name of state or region data belongs to +- `costs::OptVariable`: costs[tech,node,year,account,impact] - Number +- `techs::OptVariable`: techs[tech] - OptDataCEPTech +- `nodes::OptVariable`: nodes[tech, node] - OptDataCEPNode +- `lines::OptVarible`: lines[tech, line] - OptDataCEPLine instead of USD you can also use your favorite currency like EUR """ struct OptDataCEP <: OptData diff --git a/src/utils/utils.jl b/src/utils/utils.jl index 4d899c8..74e53aa 100644 --- a/src/utils/utils.jl +++ b/src/utils/utils.jl @@ -121,7 +121,7 @@ function get_cep_variable_set(scenario::Scenario, end """ - get_cep_design_variables(opt_result::OptResult; capacity_factors::Dict{String,Number}=Dict{String,Number}()) + get_cep_design_variables(opt_result::OptResult) Returns all design variables in this opt_result matching the type "dv" Additionally you can add capacity factors, which scale the design variables by multiplying it with the value in the Dict """