Skip to content

Commit

Permalink
Update INFORMS, have IEEE and DE Case Running and ready for public br…
Browse files Browse the repository at this point in the history
…anch
  • Loading branch information
richard-weinhold committed Oct 20, 2019
1 parent 5292a06 commit 8153cd0
Show file tree
Hide file tree
Showing 33 changed files with 330 additions and 975 deletions.
14 changes: 14 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Copyright (c) 2018: Richard Weinhold & Robert Mieth.

The Pomato Python module and its adjacent software (i.e. code written in programming languages other than Python which the Python module utilizes) as well as provided documentation is licensed under the **[LGPL]** version 3:

[LGPL]: http://www.gnu.org/licenses/lgpl-3.0.txt

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License,
Version 3, as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Pomato release notes
========================


Version 0.1.0 (Future, 2018)
-------------------------------

* Initial release
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
POMATO - Power Market Tool
============================

[![Build Status](https://travis-ci.org/robert-mieth/pomato.svg?branch=master)](https://travis-ci.org/robert-mieth/pomato)
[![Coverage Status](https://coveralls.io/repos/github/robert-mieth/pomato/badge.svg?branch=master)](https://coveralls.io/github/robert-mieth/pomato?branch=master)
[![Documentation Status](https://readthedocs.org/projects/pomato/badge/?version=latest)](http://pomato.readthedocs.io/en/latest/?badge=latest)

Overview
--------

The idea of Pomato is to provide an easy to use tool that inhibits all the power system engineering that is necessary for comprehensive analyses of the modern power market. It is more flexible and powerful than studies in Excel but sets aside the unnecessary detail of engineering software like Integral or PowerFactory.

Pomato currently includes:

* Data
* Supports Excel Data
* Supports MatPowerCase Data

* Grid
* Fast network representation with recalculated network constraints
* Including n-1 security constrained dispatch

* Various options for market representation
* Nodal or Zonal optimization
* Including Electricity-Heat Coupling

* GUI
* Powerful Interactive Plotting
* Possible Map-Layouts
* Soon to come: GUI based input data handling

Requirements
------------

Pomato is (until now) a console tool mainly written in python and therefore requires *Python 3*.
Its optimization kernel uses Julia. Julia needs to be installed and added to your system environment (it needs to be callable via console) manually. Pomato requires *Julia 0.6.2* or higher. Download the Julia Command line version from the [Julia-Website](https://julialang.org/).


Installation
------------

After you have installed Python and Julia in the correct versions (see above), use the `setup.py` file to install pomato. Example command in console:

```
python setup.py install
```

For a quick start to Pomato check out the [DOCS](http://pomato.readthedocs.io/en/latest/) and the `run_pomato_simple_example.py` script. *Note*: In the first run, Julia will install all the necessary packages. This might take a couple of minutes depending on your machine and your internet connection.





4 changes: 2 additions & 2 deletions code_gms/dataimport.gms
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ mc_heat(p) = plant_data(p,"mc_heat");
eta(p) = plant_data(p, "eta");
g_max(p) = plant_data(p, "g_max");
h_max(p) = plant_data(p, "h_max");
es_cap(es) = plant_data(es, "storage_capacity");
hs_cap(hs) = plant_data(hs, "storage_capacity");
es_cap(es)$(card(es) > 0) = plant_data(es, "storage_capacity");
hs_cap(hs)$(card(hs) > 0) = plant_data(hs, "storage_capacity");

chp(p) = No;
chp(p)$((g_max(p) > 0) and (h_max(p) > 0)) = Yes;
Expand Down
118 changes: 59 additions & 59 deletions code_gms/market_tool_project.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ Squeeze=1
SqTrail0=0
Order=3,1,2
Decim=7
PlaneRownr=1
PlaneRownr=-1
PlaneFilter1=Marginal

[GDXDISP: Gen_Max_H Equ 2]
Expand Down Expand Up @@ -1929,16 +1929,6 @@ Order=1,2,3
Decim=7
PlaneRownr=-1

[GDXDISP: cbco_data Par 2]
PlaneDim=1
RowDim=1
Squeeze=1
SqTrail0=0
Order=2,1
Decim=7
PlaneRownr=-1
PlaneFilter1=ram

[GDXDISP: dclines_data Par 2]
PlaneDim=0
RowDim=1
Expand Down Expand Up @@ -2159,7 +2149,7 @@ Squeeze=1
SqTrail0=0
Order=3,1,2
Decim=7
PlaneRownr=1
PlaneRownr=-1
PlaneFilter1=Upper

[GDXDISP: CON_CBCO_zonal_p Equ 2]
Expand Down Expand Up @@ -2205,7 +2195,7 @@ Squeeze=1
SqTrail0=0
Order=3,1,2
Decim=7
PlaneRownr=1
PlaneRownr=-1
PlaneFilter1=Upper

[GDXDISP: INFEAS_H_POS Var 2]
Expand Down Expand Up @@ -2635,57 +2625,67 @@ Order=4,1,2,3
Decim=7
PlaneRownr=-1

[GDXDISP: cbco_data Par 2]
PlaneDim=0
RowDim=1
Squeeze=1
SqTrail0=0
Order=1,2
Decim=7
PlaneRownr=-1

[RP:DATAIMPORT]
1=-gdx asd --data_type=zonal
2=-gdx asd --data_type=nodal
3=-gdx asd --data_type=none
4=-gdx asd
5=
6=-wdir=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato --rdir=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\data_temp\gms_files\results\2208_1144 --model_type=nodal --infeas_el_nodal=True --infeas_lines=False --infeas_heat=True --infeasibility_bound=100000 lo=
7=--data_folder="C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\data_temp\gms_files\data" -gdx asd
8=--data_folder="C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\data_temp\gms_files\data"
9=--model_type="zonal" -gdx asd
10=--model_type="nodal" -gdx asd
11=--model_type = zonal -gdx asd
12=--model_type = zonal
13=--model_type = "zonal"
14=--model_type == "zonal"

[OPENWINDOW_1]
MAXIM=0
TOP=-6
LEFT=353
TOP=0
LEFT=0
HEIGHT=816
WIDTH=1164
WIDTH=1465

[RP:MODEL]
1=--wdir=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato -gdx asd
2=--wdir=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato --gdx asd
3=--wdir=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato
4=
5=--wdir=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato --rdir=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\data_temp\gms_files\results\2208_1144 --model_type=nodal --infeas_el_nodal=True --infeas_lines=False --infeas_heat=True --infeasibility_bound=100000 lo
6=-wdir=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato --rdir=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\data_temp\gms_files\results\2208_1144 --model_type=nodal --infeas_el_nodal=True --infeas_lines=False --infeas_heat=True --infeasibility_bound=100000 lo=
7=--wdir="C:\Users\riw\tubCloud\Uni\Market_Tool\pomato" --rdir="00_00" --infeas=25
8=--wdir="C:\Users\riw\tubCloud\Uni\Market_Tool\pomato" --rdir="00_00" --infeas=100
9=--wdir="C:\Users\riw\tubCloud\Uni\Market_Tool\pomato" --rdir="00_00"
10=--wdir="C:\Users\riw\tubCloud\Uni\Market_Tool\pomato"
11=--model_type="zonal" --folder="maiken_DETwo_w6" -gdx asd
12=--model_type="zonal" --folder="maiken_DEOne_w6" -gdx asd
13=--model_type="zonal" --folder="maiken_DETwo_w24" -gdx asd
14=--model_type="zonal" --folder="maiken_DET_w24" -gdx asd
15=--model_type="zonal" --folder="maiken_DEOne_w24" -gdx asd
16=--model_type="zonal" --folder="maiken_DEoNE_w"$" -gdx asd
17=--model_type="zonal" --folder="asd" -gdx asd
18=--model_type="zonal" -gdx asd
19=--model_type="nodal" -gdx asd
20=--model_type="zonal"

[RP:DATAIMPORT]
1=-gdx asd --data_type=nodal
2=-gdx asd --data_type=none
3=-gdx asd
4=
5=-wdir=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato --rdir=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\data_temp\gms_files\results\2208_1144 --model_type=nodal --infeas_el_nodal=True --infeas_lines=False --infeas_heat=True --infeasibility_bound=100000 lo=
6=--data_folder="C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\data_temp\gms_files\data" -gdx asd
7=--data_folder="C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\data_temp\gms_files\data"
8=--model_type="zonal" -gdx asd
9=--model_type="nodal" -gdx asd
10=--model_type = zonal -gdx asd
11=--model_type = zonal
12=--model_type = "zonal"
13=--model_type == "zonal"
1=--wdir=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato -gdx asd --model_type=cbco_zonal
2=--wdir=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato -gdx asd
3=--wdir=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato --gdx asd
4=--wdir=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato
5=
6=--wdir=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato --rdir=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\data_temp\gms_files\results\2208_1144 --model_type=nodal --infeas_el_nodal=True --infeas_lines=False --infeas_heat=True --infeasibility_bound=100000 lo
7=-wdir=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato --rdir=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\data_temp\gms_files\results\2208_1144 --model_type=nodal --infeas_el_nodal=True --infeas_lines=False --infeas_heat=True --infeasibility_bound=100000 lo=
8=--wdir="C:\Users\riw\tubCloud\Uni\Market_Tool\pomato" --rdir="00_00" --infeas=25
9=--wdir="C:\Users\riw\tubCloud\Uni\Market_Tool\pomato" --rdir="00_00" --infeas=100
10=--wdir="C:\Users\riw\tubCloud\Uni\Market_Tool\pomato" --rdir="00_00"
11=--wdir="C:\Users\riw\tubCloud\Uni\Market_Tool\pomato"
12=--model_type="zonal" --folder="maiken_DETwo_w6" -gdx asd
13=--model_type="zonal" --folder="maiken_DEOne_w6" -gdx asd
14=--model_type="zonal" --folder="maiken_DETwo_w24" -gdx asd
15=--model_type="zonal" --folder="maiken_DET_w24" -gdx asd
16=--model_type="zonal" --folder="maiken_DEOne_w24" -gdx asd
17=--model_type="zonal" --folder="maiken_DEoNE_w"$" -gdx asd
18=--model_type="zonal" --folder="asd" -gdx asd
19=--model_type="zonal" -gdx asd
20=--model_type="nodal" -gdx asd

[MRUFILES]
1=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\data_temp\gms_files\data\dataset.gdx
2=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\code_gms\model.gms
3=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\code_gms\dataimport.lst
1=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\data_temp\gms_files\results\1610_2147\result.gdx
2=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\data_temp\gms_files\results\1610_2144\result.gdx
3=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\code_gms\model.gms
4=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\code_gms\dataimport.gms
5=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\data_temp\gms_files\results\0410_1626\result.gdx
6=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\code_gms\Untitled_1.gms
7=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\code_gms\asd.gdx
8=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\data_temp\gms_files\results\0110_2152\result.gdx
9=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\data_temp\gms_files\results\0210_1852\result.gdx
5=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\code_gms\asd.gdx
6=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\data_temp\gms_files\data\dataset.gdx
7=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\data_temp\gms_files\results\1310_1632\result.gdx
8=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\data_temp\gms_files\results\1310_1613\result.gdx
9=C:\Users\riw\tubCloud\Uni\Market_Tool\pomato\code_gms\dataimport.lst
12 changes: 7 additions & 5 deletions code_gms/model.gms
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ Obj.. COST =e= COST_G + COST_H

DEF_Cost_G.. COST_G =e= sum((t,p), G(t,p)* mc_el(p));
DEF_COST_H.. COST_H =e= sum((t,p), H(t,p) * mc_heat(p));
DEF_COST_INEAS_EL.. COST_INEAS_EL =e= sum((t,n), (INFEAS_EL_N_POS(t,n) + INFEAS_EL_N_NEG(t,n))*1E4);
DEF_COST_INEAS_EL.. COST_INEAS_EL =e= sum((t,n), (INFEAS_EL_N_POS(t,n) + INFEAS_EL_N_NEG(t,n))*1E2);
DEF_COST_INEAS_H.. COST_INEAS_H =e= sum((t,ha), (INFEAS_H_POS(t,ha) + INFEAS_H_NEG(t,ha))*1E4);
DEF_COST_INEAS_LINES.. COST_INEAS_LINES =e= sum((t,cb), INFEAS_LINES(t,cb)*1E4);
DEF_COST_EX.. COST_EX =E= sum((t,z,zz), EX(t,z,zz)*0.1);
Expand Down Expand Up @@ -326,9 +326,9 @@ CON_CBCO_zonal_p(t,cb).. sum(z, sum(zz, EX(t,zz,z) - EX(t,z,zz))*ptdf(cb
CON_CBCO_zonal_n(t,cb).. sum(z, sum(zz, EX(t,zz,z) - EX(t,z,zz))*ptdf(cb,z)) =g= -ram(cb) - INFEAS_LINES(t,cb)
;

*set cwe(z) /DE, NL, BE, FR/;
*CON_NEX_u(t, cwe).. sum(zz, EX(t,cwe,zz) - EX(t,zz,cwe)) =L= net_position(t, cwe) + 0.2*abs(net_position(t, cwe));
*CON_NEX_l(t, cwe).. sum(zz, EX(t,cwe,zz) - EX(t,zz,cwe)) =g= net_position(t, cwe) - 0.2*abs(net_position(t, cwe));
set cwe(z) /DE, NL, BE, FR/;
CON_NEX_u(t, cwe).. sum(zz, EX(t,cwe,zz) - EX(t,zz,cwe)) =L= net_position(t, cwe) + 0.2*abs(net_position(t, cwe));
CON_NEX_l(t, cwe).. sum(zz, EX(t,cwe,zz) - EX(t,zz,cwe)) =g= net_position(t, cwe) - 0.2*abs(net_position(t, cwe));


Model Base_Model
Expand Down Expand Up @@ -385,6 +385,8 @@ CON_Slack
/;
Model model_nodal
/Base_Model
CON_NEX_l
CON_NEX_u
*CON_NTC
CON_CBCO_nodal_p
CON_CBCO_nodal_n
Expand All @@ -394,7 +396,7 @@ Model model_cbco_zonal
/Base_Model
CON_NTC
CON_CBCO_zonal_p
CON_CBCO_zonal_n
*CON_CBCO_zonal_n
CON_Slack
/;

Expand Down
28 changes: 13 additions & 15 deletions code_jl/cbco_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function build_model(dim::Int, A::Array{Float64}, b::Vector{Float64}, x_bounds::
@variable(model, x[i=1:dim])
end
@constraint(model, A * x .<= b)
@constraint(model, sum(x[i] for i in 1:dim) == 0)
return model
end

Expand Down Expand Up @@ -103,8 +104,7 @@ function main(A::Array{Float64}, b::Vector{Float64}, m::Vector{Int},
@info("Starting Algorithm with I of size: $(length(I))")
@info("and with m of size: $(length(m))")
# Set-up
# Make counter to print out progress and make backups
# every number of steps
# Make counter to print out progress every number of steps
steps = 100
to_check = length(m)
stepsize = round(to_check/steps)
Expand Down Expand Up @@ -132,14 +132,15 @@ function main(A::Array{Float64}, b::Vector{Float64}, m::Vector{Int},
# if not, remove constraint from m
m = setdiff(m, k)
end
# print progress
# print progress at specified when size(m) hit certain threasholds
if length(m) in save_points
percentage = Int(100 - 100/steps*findfirst(x -> x==length(m), save_points))
progress_bar = repeat("#", Int(round(percentage/5)))*repeat(" ", Int(round((100-percentage)/5)))
timestamp = Dates.format(now(), "dd.mm - HH:MM:SS")
report = "- Size of I $(length(I)) - Found Redudnant $(to_check - length(I) - length(m)) - Remaining $(length(m)) - "
report = "- Size of I $(length(I)) - Found Redundant $(to_check - length(I) - length(m)) - Remaining $(length(m)) - "
@info(progress_bar*string(percentage)*"%"*report*timestamp)
end
## Conclude when m is empty
if length(m) == 0
break
end
Expand All @@ -153,7 +154,6 @@ function save_to_file(Indices, filename::String)
CSV.write(wdir*"/data_temp/julia_files/cbco_data/"*filename*".csv",
DataFrame(constraints = Indices.-1))
@info("done! ")

end

function read_data(file_suffix::String)
Expand All @@ -165,30 +165,28 @@ function read_data(file_suffix::String)
b_data = CSV.read(wdir*"/data_temp/julia_files/cbco_data/b_"*file_suffix*".csv",
delim=',', header=false, types=Dict(1=>Float64))

# Create Array A and Vector b from DataFrame
A = hcat([A_data[:, i] for i in 1:size(A_data, 2)]...)
b = b_data[:,1]

x_bounds = CSV.read(wdir*"/data_temp/julia_files/cbco_data/x_bounds_"*file_suffix*".csv",
delim=',', header=false, types=Dict(1=>Float64))

if size(x_bounds, 2) > 0
x_bounds = x_bounds[:,1]
else
x_bounds = Array{Float64, 1}()
end
# Read X Bounds or set as empty Vector
x_bounds = size(x_bounds, 2) > 0 ? x_bounds[:,1] : Array{Float64, 1}()
# x_bounds = Array{Float64, 1}()

# I data contrains previsouly identified non-redundant indices
I_data = CSV.read(wdir*"/data_temp/julia_files/cbco_data/I_"*file_suffix*".csv",
delim=',', types=Dict(1=>Int))
if size(I_data, 2) > 0
I = I_data[:, 1].+1
end
I = size(I_data, 2) > 0 ? I_data[:,1] : Array{Int, 1}()

return A, b, x_bounds, I
end

function run(file_suffix::String)
A, b, x_bounds, I = read_data(file_suffix)

m = collect(1:length(b))
@info("Preprocessing...")
@info("Removing duplicate rows...")
Expand All @@ -199,8 +197,8 @@ function run(file_suffix::String)
condition_zero = vcat([!all(A[i, :] .== 0) for i in 1:length(b)])
m = m[condition_unique .& condition_zero]
@info("Removed $(length(b) - length(m)) rows in preprocessing!")
# Interior point z = zero
z = zeros(size(A, 2))

I = union(I)
m = setdiff(m, I)
I_result = main(A, b, m, I, x_bounds, z)
Expand Down
1 change: 1 addition & 0 deletions code_jl/main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ end


println("Initialized")

Loading

0 comments on commit 8153cd0

Please sign in to comment.