Beruflich Dokumente
Kultur Dokumente
4. Research developments
6. Tutorial
5. Working with the Teaching version
Overview
The student version of the model (MicroGridsPy-Teaching) is a simplified version of the
core multi year model.
In this version only LP formulation is allowed: all code lines related to other formulations
have been removed for simplicity and for having a lighter source-code.
Latest release is v.3.7, but most applications currently run on v.3.6 and may have minor
compatibility issues.
Anaconda “is a free and open source distribution of the Python and R programming
languages for data science and machine learning related applications […] that aims to
simplify package management and deployment” (Wikipedia)
[https://repo.continuum.io/archive/] - Anaconda3-5.2.0-Windows-x86_64.exe
5. Working with the Teaching version
Basic Python instruments
Optimisation problems in Python are commonly implemented within the Pyomo library.
Pyomo is used to formulate the optimisation problem within a Python environment, but
the actual problem resolution relies on external solvers. Pyomo-compatible solvers
include:
― Gurobi (commercial)
― CBC (free)
― GLPK (free)
The first is an-order-of-magnitude faster than the two freeware alternatives, and it can be
downloaded and installed with a Polimi license.
Gurobi is the solver that is by default selected within MicroGridsPy-Teaching code and
that is recommended.
5. Working with the Teaching version
Basic Python instruments
ACTIVATING YOUR GUROBI ACADEMIC LICENSE
5. Working with the Teaching version
Basic Python instruments
INSTALLING PYTHON PACKAGES
https://github.com/SESAM-Polimi/MicroGridsPy-Teaching
5. Working with the Teaching version
Download and installation
Decompress the downloaded archive and get the following:
4. Research developments
6. Tutorial
6. Tutorial
MicroGridsPy-Teaching example exercise
Defining the inputs: data_MY.dat file
Project parameters:
param: Years := 5;
...
...
Param: Lost_Load_Probability := 0
param: Renewable_Nominal_Capacity :=
1 1000 [W]
2 1000; [W]
param: Renewable_Inverter_Efficiency :=
1 0.96
2 1;
param: Renewable_Investment_Cost :=
1 2 [USD/W]
2 3.3; [USD/W]
param: Renewable_Operation_Maintenance_Cost :=
1 0.02 [% of investment]
2 0.02; [% of investment]
6. Tutorial
MicroGridsPy-Teaching example exercise
Defining the inputs: data_MY.dat file
param: Maximum_Battery_Discharge_Time := 4;
param: Maximum_Battery_Charge_Time := 4;
VRES timeseries: the hourly power output obtainable from different power sources must
be independently assessed, if needed.
Renewable penetration and Battery independency are two parameters that the user can
play with:
If 0, the model does not take them into account
If other than 0, they become additional constraints for the model resolution
6. Tutorial
MicroGridsPy-Teaching example exercise
Analysing the results – Default case
6. Tutorial
MicroGridsPy-Teaching example exercise
Analysing the results – High VRES penetration case
6. Tutorial
MicroGridsPy-Teaching example exercise
Analysing the results – Increased Battery Independence case
6. Tutorial
MicroGridsPy-Teaching example exercise
Plotting results
Default: Timeseries
Alternative: Average
(e.g. weekly, monthly)