Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for master #3

Merged
merged 3 commits into from
Apr 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ 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:
- stage: "Testing"
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:
Expand Down
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
1,937 changes: 1,862 additions & 75 deletions docs/src/assets/preparing_clust_data_load.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions docs/src/csv_structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`|
Expand Down
17 changes: 13 additions & 4 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
7 changes: 3 additions & 4 deletions docs/src/opt_cep.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,17 @@ 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
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"])
```
2 changes: 1 addition & 1 deletion docs/src/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
20 changes: 14 additions & 6 deletions src/utils/datastructs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down