Skip to content

Commit

Permalink
Merge branch 'dev' into clustresult
Browse files Browse the repository at this point in the history
  • Loading branch information
holgerteichgraeber committed Jun 25, 2019
2 parents 2287538 + fafbf1b commit aae2f84
Show file tree
Hide file tree
Showing 15 changed files with 80,164 additions and 80,111 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
[compat]
julia = "^1.0"
JuMP = "^0.19"
ClustForOpt = "^0.4.0"
ClustForOpt = "^0.4.0"
2 changes: 1 addition & 1 deletion data/CA_1/nodes.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node,region,infrastruct,lat,lon,|,pv,wind,coal,oil,gas,bat_e,bat_in,bat_out,h2_e,h2_in,h2_out,trans
california,CA,ex,36.782142,-119.415653,|,9857,5741,101,539,45321,115,98,98,0,0,0,0
california,CA,lim,36.782142,-119.415653,|,1000000,1000000,100000,100000,100000,1000000,1000000,100000,100000000,1000000,1000000,0
california,CA,lim,36.782142,-119.415653,|,1000000,1000000,100000,100000,100000,1000000,1000000,100000,10000000000,1000000,1000000,0
159,913 changes: 79,961 additions & 79,952 deletions data/CA_14/TS/solar.csv

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions data/CA_14/TS/wind.csv
Original file line number Diff line number Diff line change
Expand Up @@ -157799,3 +157799,12 @@ Time,year,CCT,CVA,ECA,ELU,FRE,LAX,NCT,NVA,PAC,SDG
2017-12-31T13:00:00.0,2017,0.001,0,0,0.062,0.004,0,0,0.001,0.003,0.006
2017-12-31T14:00:00.0,2017,0.001,0,0,0.044,0.001,0,0,0.005,0.005,0.001
2017-12-31T15:00:00.0,2017,0.004,0.002,0,0.046,0,0.001,0.001,0.008,0.007,0
2017-12-31T15:00:00.1,2017,0.004,0.002,0,0.046,0,0.001,0.001,0.008,0.007,0
2017-12-31T15:00:00.2,2017,0.004,0.002,0,0.046,0,0.001,0.001,0.008,0.007,0
2017-12-31T15:00:00.3,2017,0.004,0.002,0,0.046,0,0.001,0.001,0.008,0.007,0
2017-12-31T15:00:00.4,2017,0.004,0.002,0,0.046,0,0.001,0.001,0.008,0.007,0
2017-12-31T15:00:00.5,2017,0.004,0.002,0,0.046,0,0.001,0.001,0.008,0.007,0
2017-12-31T15:00:00.6,2017,0.004,0.002,0,0.046,0,0.001,0.001,0.008,0.007,0
2017-12-31T15:00:00.7,2017,0.004,0.002,0,0.046,0,0.001,0.001,0.008,0.007,0
2017-12-31T15:00:00.8,2017,0.004,0.002,0,0.046,0,0.001,0.001,0.008,0.007,0
2017-12-31T15:00:00.9,2017,0.004,0.002,0,0.046,0,0.001,0.001,0.008,0.007,0
11 changes: 0 additions & 11 deletions data/CA_14/lines.csv
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,3 @@ trans,line09,ELU,LAX,0,0,0,50000,AC_OHL,0,195,0
trans,line11,ELU,SDG,0,0,0,50000,AC_OHL,0,166,0
trans,line14,FRE,LAX,0,0,0,50000,AC_OHL,0,253,0
trans,line20,NVA,PAC,0,0,0,50000,AC_OHL,0,53,0
trans,line24,CVA,CCT,0,0,0,50000,AC_OHL,0,151,0
trans,line25,FRE,CCT,0,0,0,50000,AC_OHL,0,145,0
trans,line26,NCT,CCT,0,0,0,50000,AC_OHL,0,276,0
trans,line27,FRE,CVA,0,0,0,50000,AC_OHL,0,217,0
trans,line28,NCT,CVA,0,0,0,50000,AC_OHL,0,144,0
trans,line29,NVA,CVA,0,0,0,50000,AC_OHL,0,301,0
trans,line31,LAX,ECA,0,0,0,50000,AC_OHL,0,200,0
trans,line32,LAX,ELU,0,0,0,50000,AC_OHL,0,195,0
trans,line34,SDG,ELU,0,0,0,50000,AC_OHL,0,166,0
trans,line37,LAX,FRE,0,0,0,50000,AC_OHL,0,253,0
trans,line43,PAC,NVA,0,0,0,50000,AC_OHL,0,53,0
2 changes: 1 addition & 1 deletion data/GER_1/nodes.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node,infrastruct,region,lat,lon,|,pv,wind,coal,gas,oil,bat_e,bat_in,bat_out,h2_e,h2_in,h2_out,trans
germany,ex,GER,51.167261,10.450738,|,32312,31827,45027,22370,7004,0,0,0,0,0,0,0
germany,lim,GER,51.167261,10.450738,|,1000000,1000000,100000,100000,100000,1000000,1000000,1000000,100000000,1000000,1000000,0
germany,lim,GER,51.167261,10.450738,|,1000000,1000000,100000,100000,100000,1000000,1000000,1000000,10000000000,1000000,1000000,0
84 changes: 34 additions & 50 deletions data/GER_18/lines.csv
Original file line number Diff line number Diff line change
@@ -1,50 +1,34 @@
tech,line,node_start,node_end,reactance,resistance,power_ex,power_lim,circuits,voltage,length
trans,line01,dena82,dena21,20.2299517565562,3.79273739773027,980,20000,2,220,56.3996082216464
trans,line02,dena73,dena72,17.3587322505912,3.31193949260616,4640,20000,8,380,86.1792595211399
trans,line03,dena74,dena72,10.4766408334095,1.92088495919161,10720,20000,15,380,70.5192079395777
trans,line04,dena72,dena74,22.3686858038644,2.15240057411274,4380,20000,5,380,70.5192079395777
trans,line05,dena24,dena74,17.965,1.579,1700,20000,1,380,150.383429129294
trans,line06,dena41,dena75,35.4306888374502,4.64986542169338,3170,20000,4,380,98.5286716246685
trans,line07,dena42,dena75,47.414017276818,8.89002761317848,980,20000,2,220,174.836538426568
trans,line08,dena41,dena42,43.7390205945984,3.68160904482917,7780,20000,9,380,98.9745547225983
trans,line09,dena75,dena41,9.70311209285303,1.81926268823201,980,20000,2,220,98.5286716246685
trans,line10,dena72,dena71,29.4138848989525,3.76199758648431,3890,20000,3,380,112.59581586592
trans,line11,dena73,dena71,29.1197644222776,2.97318205188128,3890,20000,3,380,72.0743279567595
trans,line12,dena24,dena73,15.2797393918452,1.34251867872591,3400,20000,3,380,123.496604867472
trans,line13,dena73,dena24,28.509,2.505,1700,20000,1,380,123.496604867472
trans,line14,dena73,dena23,13.4779603699143,2.11807751677852,2680,20000,4,380,137.958908669182
trans,line15,dena23,dena24,13.9687422793905,1.30713541666667,3890,20000,4,380,177.043375932064
trans,line16,dena75,dena74,33.6966360458801,4.86181115972794,7780,20000,7,380,141.069363090717
trans,line17,dena42,dena41,33.8436117742113,6.57720634595701,2680,20000,5,380,98.9745547225983
trans,line18,dena42,dena76,13.7393222420755,2.49499696452286,6570,20000,7,380,117.310118346994
trans,line19,dena24,dena75,7.3378248734437,0.645052918287938,3400,20000,2,380,166.575081601869
trans,line20,dena25,dena24,32.5092389564063,2.85664031154118,3400,20000,2,380,169.940713652263
trans,line21,dena25,dena41,32.0804781005936,2.81919409882688,3400,20000,2,380,162.327362847087
trans,line22,dena25,dena26,37.2176533518822,6.47124037773644,4380,20000,6,380,176.002010231868
trans,line23,dena84,dena81,47.2643645649944,4.47708686501483,7290,20000,5,380,204.411556166445
trans,line24,dena84,dena83,49.1456082842536,8.45201221327039,6570,20000,6,380,134.779537078581
trans,line25,dena83,dena24,35.5878130705928,3.12728315346625,3400,20000,2,380,168.749219796611
trans,line26,dena83,dena84,32.2624866760755,3.94849233820083,3890,20000,4,380,134.779537078581
trans,line27,dena21,dena82,21.4227762518762,3.85473413464978,3170,20000,6,380,56.3996082216464
trans,line28,dena23,dena71,26.162,2.299,1700,20000,1,380,143.919129549812
trans,line29,dena22,dena71,34.834,3.061,1700,20000,1,380,112.186861990058
trans,line30,dena25,dena83,18.58,1.633,1700,20000,2,380,148.61169254208
trans,line31,dena71,dena22,15.5556512166115,1.36701170446233,3400,20000,2,380,112.186861990058
trans,line32,dena22,dena23,28.6643878393724,2.83507098491571,2190,20000,3,380,147.113012834363
trans,line33,dena23,dena22,43.296,3.805,1700,20000,1,380,147.113012834363
trans,line34,dena75,dena42,36.898,3.243,1700,20000,2,380,174.836538426568
trans,line35,dena72,dena73,16.1678661387106,2.95584211784391,4380,20000,6,380,86.1792595211399
trans,line36,dena23,dena82,9.415,0.827,1700,20000,2,380,142.738036629431
trans,line37,dena82,dena22,9.483,0.833,1700,20000,2,380,117.972165893574
trans,line38,dena76,dena26,16.563,1.456,1700,20000,2,380,112.390408578244
trans,line39,dena23,dena81,16.154,1.42,1700,20000,2,380,213.535406192872
trans,line40,dena82,dena81,28.829,2.533,1700,20000,2,380,194.657038105352
trans,line41,dena83,dena81,39.32,3.455,1700,20000,2,380,240.575127609884
trans,line42,dena21,dena22,18.91,1.662,1700,20000,2,380,139.051989244102
trans,line43,dena24,dena25,11.822,2.217,490,20000,2,220,169.940713652263
trans,line44,dena23,dena73,20.3761597244645,3.82079107475965,980,20000,2,220,137.958908669182
trans,line45,dena71,dena73,23.686,4.441,490,20000,1,220,72.0743279567595
trans,line46,dena74,dena73,20.765,3.893,490,20000,2,220,127.922707868721
trans,line47,dena22,dena82,9.602,1.8,490,20000,2,220,117.972165893574
trans,line48,dena26,dena25,29.578,5.546,490,20000,2,220,176.002010231868
trans,line49,dena74,dena24,12.519,1.1,1700,20000,1,380,150.383429129294
tech,line,node_start,node_end,reactance,resistance,power_ex,power_lim,circuits,voltage,length,lat_start,lon_start,lat_end,lon_end
trans,line01,dena21,dena82,21.04,3.833,4150,50000,8,380,56.4,54.11,9.92,53.61,10.04
trans,line02,dena72,dena73,16.87,3.183,9020,50000,14,380,86.18,51.44,6.96,51.72,8.13
trans,line03,dena72,dena74,15.36,1.998,15100,50000,20,380,70.52,51.44,6.96,50.81,7
trans,line04,dena24,dena74,15.73,1.382,3400,50000,2,380,150.38,50.81,9.14,50.81,7
trans,line05,dena41,dena75,31.98,4.183,4150,50000,6,380,98.53,49.15,8.86,49.62,7.7
trans,line06,dena42,dena75,44.36,7.98,2680,50000,4,380,174.84,48.27,8.91,49.62,7.7
trans,line07,dena41,dena42,41.18,4.815,10460,50000,14,380,98.97,49.15,8.86,48.27,8.91
trans,line08,dena71,dena72,29.41,3.762,3890,50000,3,380,112.6,52.33,7.77,51.44,6.96
trans,line09,dena71,dena73,27.86,3.475,4380,50000,4,380,72.07,52.33,7.77,51.72,8.13
trans,line10,dena24,dena73,21.84,1.919,5100,50000,4,380,123.5,50.81,9.14,51.72,8.13
trans,line11,dena23,dena73,16.81,3.036,3660,50000,6,380,137.96,52.33,9.88,51.72,8.13
trans,line12,dena23,dena24,13.97,1.307,3890,50000,4,380,177.04,52.33,9.88,50.81,9.14
trans,line13,dena74,dena75,33.7,4.862,7780,50000,7,380,141.07,50.81,7,49.62,7.7
trans,line14,dena42,dena76,13.74,2.495,6570,50000,7,380,117.31,48.27,8.91,48.19,10.49
trans,line15,dena24,dena75,7.34,0.645,3400,50000,2,380,166.58,50.81,9.14,49.62,7.7
trans,line16,dena24,dena25,28.44,2.637,3890,50000,4,380,169.94,50.81,9.14,49.77,10.9
trans,line17,dena25,dena41,32.08,2.819,3400,50000,2,380,162.33,49.77,10.9,49.15,8.86
trans,line18,dena25,dena26,35.92,6.278,4870,50000,8,380,176,49.77,10.9,48.35,11.99
trans,line19,dena81,dena84,47.26,4.477,7290,50000,5,380,204.41,53.05,12.82,51.25,13.42
trans,line20,dena83,dena84,44.7,7.454,10460,50000,10,380,134.78,51.04,11.52,51.25,13.42
trans,line21,dena24,dena83,35.59,3.127,3400,50000,2,380,168.75,50.81,9.14,51.04,11.52
trans,line22,dena23,dena71,26.16,2.299,1700,50000,1,380,143.92,52.33,9.88,52.33,7.77
trans,line23,dena22,dena71,25.74,2.262,5100,50000,3,380,112.19,53.27,8.35,52.33,7.77
trans,line24,dena25,dena83,18.58,1.633,1700,50000,2,380,148.61,49.77,10.9,51.04,11.52
trans,line25,dena22,dena23,35.57,3.226,3890,50000,4,380,147.11,53.27,8.35,52.33,9.88
trans,line26,dena23,dena82,9.42,0.827,1700,50000,2,380,142.74,52.33,9.88,53.61,10.04
trans,line27,dena22,dena82,9.54,1.494,2190,50000,4,380,117.97,53.27,8.35,53.61,10.04
trans,line28,dena26,dena76,16.56,1.456,1700,50000,2,380,112.39,48.35,11.99,48.19,10.49
trans,line29,dena23,dena81,16.15,1.42,1700,50000,2,380,213.54,52.33,9.88,53.05,12.82
trans,line30,dena81,dena82,28.83,2.533,1700,50000,2,380,194.66,53.05,12.82,53.61,10.04
trans,line31,dena81,dena83,39.32,3.455,1700,50000,2,380,240.58,53.05,12.82,51.04,11.52
trans,line32,dena21,dena22,18.91,1.662,1700,50000,2,380,139.05,54.11,9.92,53.27,8.35
trans,line33,dena73,dena74,20.77,3.893,490,50000,2,220,127.92,51.72,8.13,50.81,7
28 changes: 28 additions & 0 deletions docs/src/opt_cep.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,34 @@ Pkg.add("Clp")
using Clp
optimizer=Clp.Optimizer
```

## Scaling
The package features the scaling of variables and equations. Scaling variables, which are used in the numerical model, to `0.01 ≤ x ≤ 100` and scaling equations to `3⋅x = 1` instead of `3000⋅x = 1000` improves the shape of the optimization space and significantly reduces the computational time used to solve the numerical model.

The values are only scaled within the numerical model formulation, where we call the variable `VAR`, but the values are unscaled in the solution, which we call `real-VAR`. The following logic is used to scale the variables:
`real-VAR [EUR, USD, MW, or MWh] = scale[:VAR] ⋅ VAR`
` 0.01 ≤ VAR ≤ 100`
`⇔ 0.01 ≤ real-VAR / scale[:VAR] ≤ 100`

The equations are scaled with the scaling parameter of the first variable, which is `scale[:COST]` in the following example:
` scale[:COST]⋅COST = 10⋅scale[:CAP]⋅CAP`
`⇔ COST = 10⋅(scale[:CAP]/scale[:COST])⋅CAP`

### Change scaling parameters
Changing the scaling parameters is useful if the data you use represents a much smaller or bigger energy system than the ones representing Germany and California provided in this package Determine the right scaling parameters by checking the real-values of COST, CAP, GEN... (real-VAR) in a solution using your data. Select the scaling parameters to match the following:
`0.01 ≤ real-VAR / scale[:VAR] ≤ 100`
Create a dictionary with the new scaling parameters for EACH variable and include it as the optional `scale` input to overwrite the default scale in `run_opt`:
```julia
scale=Dict{Symbol,Int}(:COST => 1e9, :CAP => 1e3, :GEN => 1e3, :SLACK => 1e3, :INTRASTOR => 1e3, :INTERSTOR => 1e6, :FLOW => 1e3, :TRANS =>1e3, :LL => 1e6, :LE => 1e9)
scale_result = run_opt(ts_clust_data,cep_data,optimizer;scale=scale)
```

### Adding another variable
- Extend the default `scale`-dictionary in the `src/optim_problems/run_opt`-file to include the new variable as well.
- Include the new variable in the problem formulation in the `src/optim_problems/opt_cep`-file. Reformulate the equations by dividing them by the scaling parameter of the first variable, which is `scale[:COST]` in the following example:
` scale[:COST]⋅COST = 10⋅scale[:CAP]⋅CAP + 100`
`⇔ COST = 10⋅(scale[:CAP]/scale[:COST])⋅CAP + 100/scale[:COST]`

## Opt Result - A closer look
```@docs
OptResult
Expand Down
12 changes: 10 additions & 2 deletions examples/workflow_example_cep.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
using CapacityExpansion
using Clp
## LOAD DATA ##
state="GER_18" # or "GER_18" or "CA_1" or "TX_1"
years=[2015] #2016 works for GER_1 and CA_1, GER_1 can also be used with 2006 to 2016 and, GER_18 is 2015 TX_1 is 2008
state="GER_1" # or "GER_18" or "CA_1" or "TX_1"
years=[2016] #2016 works for GER_1 and CA_1, GER_1 can also be used with 2006 to 2016 and, GER_18 is 2015 TX_1 is 2008
# laod ts-data
ts_input_data = load_timeseries_data_provided(state;T=24, years=years) #CEP
# load cep-data
Expand Down Expand Up @@ -50,3 +50,11 @@ design_variables=get_cep_design_variables(design_result)

# Use the design variable results for the operational run
operation_result = run_opt(ts_input_data,cep_data,design_result.opt_config,design_variables,optimizer;lost_el_load_cost=1e6,lost_CO2_emission_cost=700)

# Change scaling parameters
# Changing the scaling parameters is useful if the data you use represents a much smaller or bigger energy system than the ones representing Germany and California provided in this package
# Determine the right scaling parameters by checking the "real" values of COST, CAP, GEN... (real-VAR) in a solution using your data. Select the scaling parameters to match the following:
# 0.01 ≤ VAR ≤ 100, real-VAR = scale[:VAR] ⋅ VAR
# ⇔ 0.01 ≤ real-VAR / scale[:VAR] ≤ 100
scale=Dict{Symbol,Int}(:COST => 1e9, :CAP => 1e3, :GEN => 1e3, :SLACK => 1e3, :INTRASTOR => 1e3, :INTERSTOR => 1e6, :FLOW => 1e3, :TRANS =>1e3, :LL => 1e6, :LE => 1e9)
co2_result = run_opt(ts_clust_data.best_results,cep_data,optimizer;scale=scale, co2_limit=50)
Loading

0 comments on commit aae2f84

Please sign in to comment.