Welcome to OMEGAlpes’ documentation!¶
Introduction to OMEGAlpes¶
OMEGAlpes stands for Generation of Optimization Models As Linear Programming for Energy Systems. It aims to be an energy systems modelling tool for linear optimisation (LP, MILP). It is currently based on the LP modeler PuLP.
It is an Open Source project located on GitLab at OMEGAlpes Gitlab An associated web interface is available at OMEGAlpes interface to help generate scripts
Contents¶
OMEGAlpes Installation¶
Install OMEGAlpes¶
Do not hesitate to listen to a really nice music to be sure… … it’s going to work!
Python 3.6.0¶
Please use Python 3.6.0 for the project interpreter: Python 3.6
pip install omegalpes¶
Please install OMEGAlpes Lib with pip using on of the following the command prompt:
If you are admin on Windows or working on a virtual environment:
pip install omegalpesIf you want a local installation or you are not admin:
pip install --user omegalpesIf you are admin on Linux:
sudo pip install omegalpes
Then, you can download (or clone) the OMEGAlpes Examples folder (repository) at : OMEGAlpes Examples Make shure that the name of the examples folder is: “omegalpes_examples”.
Launch the examples (with Pycharm for instance) to understand how the OMEGAlpes Lib works. Remember that the examples are presented at : OMEGAlpes Examples Documentation
Enjoy your time using OMEGAlpes !
Other installation requirements¶
If the music was enough catchy, the following libraries should be already installed. If not, increase the volume and install the following libraries with the help below.
- PuLP >= 2.1
PuLP is an LP modeler written in python. PuLP can generate MPS or LP files and call GLPK, COIN CLP/CBC, CPLEX, and GUROBI to solve linear problems : PuLP
- Matplotlib >= 2.2.2
Matplotlib is a Python 2D plotting library : Matplotlib
- Numpy >= 1.14.2
NumPy is the fundamental package needed for scientific computing with Python. Numpy
- Pandas >= 0.22.0
Pandas is a Python package providing fast, flexible, and expressive data structures designed to make working with “relational” or “labeled” data both easy and intuitive. Pandas
— Command lover —
pip install <library_name>==versionIf required, the command to upgrade the library is
pip install --upgrade <library_name>— Pycharm lover —
Install automatically the library using pip with Pycharm on “File”, “settings…”, “Project Interpreter”, “+”, and choosing the required library
Install OMEGAlpes as a developer¶
Installation as a developer and local branch creation¶
Absolute silence, keep calm and stay focus… you can do it! :https://www.youtube.com/watch?v=g4mHPeMGTJM
Create a new folder in the suitable path, name it as you wish for instance : OMEGAlpes
Clone the OMEGAlpes library repository
— Command lover —
git clone https://gricad-gitlab.univ-grenoble-alpes.fr/omegalpes/omegalpes.git
— Pycharm lover —
Open PycharmOn the Pycharm window, click on “Check out from version control” then choose “Git”.A “clone repository” window open.Copy the following link into the URL corresponding area:Copy the path of the new folder created just before.Test if the connection to the git works and if it works click on “Clone”.Once OMEGAlpes is cloned, you must be able to see the full OMEGAlpes library on Pycharm or on another development environment.If the connection does not work and if you are working with local protected network, please try again with the wifi.
First, choose or change your project interpreter
— Pycharm lover —
Click on the yellow warning link or go to “File”, “settings…”, “Project Interpreter”
You can:
- either select the “Python 3.6” project interpreter but you may change the version of some library that you could use for another application.
- either create a virtual environment in order to avoid this problem (recommended).
Click on the star wheel near the project interpreter box.Click on “add…”.Select “New environment” if it not selected.The location is pre-filled, if not fill it with the path of the folder as folder_path/venvSelect “Python 3.6” as your base interpreterThen click on “Ok”
4. You can install the library on developing mode using the following command in command prompt once your are located it on the former folder. If you are calling OMEGAlpes library in another project, the following command enables you to refer to the OMEGAlpes library you are developing:
python setup.py develop
If it is not already done, install the library requirements.
— Command lover —
pip install <library_name>
If required, the command to upgrade the library is
pip install --upgrade <library_name>
— Pycharm lover —
You should still have a yellow warning. You can:
- install automatically the libraries clicking on the yellow bar.
- install automatically the library using pip with Pycharm on “File”, “settings…”, “Project Interpreter”, “+”, and choose the required library as indicated in the Library Installation Requirements part.
Finally, you can create your own local development branch.
— Command lover —
git branch <branch_name>
— Pycharm lover —
By default you are on a local branch named master.Click on “Git: master” located on the bottom write of PycharmSelect “+ New Branch”Name the branch as you convenience for instance “dev_your_name”Do not forget to “rebase” regularly to update your version of the library.
— Command lover —
git rebase origin
— Pycharm lover —
To do so, click on your branch name on the bottom write of the Pycharm window select “Origin/master” and click on “Rebase current onto selected”
If you want to have access to examples and study cases, download (or clone) the OMEGAlpes Examples folder (repository) from : OMEGAlpes Examples . Make shure that the name of the examples folder is: “omegalpes_examples”. Remember that the examples are presented at : OMEGAlpes Examples Documentation
Enjoy your time developing OMEGAlpes!
OMEGAlpes Structure¶
The models are bases on general, energy and actor classes. The structure of the library is described on the following class diagram:
The energy units are detailed in the energy package
energy package¶
The energy package gathers the energy units, poles and nodes modules:
The energy units inherit from the EnergyUnit
object which
itself inherit from the Unit
object.
Energy_units module¶
This module defines the energy units of OMEGAlpes. The production, consumption and storage unit will inherit from it.
The energy_units module defines the basic attributes and methods of an energy unit in OMEGAlpes.
- The class EnergyUnit includes the following attributes and quantities:
- time: instance of TimeUnit describing the studied time period.
- energy_type: energy type of the energy unit (see energy.energy_types)
- p: instantaneous power of the energy unit (kW)
- e_tot: total energy either consumed or produced by the energy unit on
the studied time period during the time period (kWh) - u: binary describing if the unit is operating (1) or not (0) at t (i.e. delivering or consuming power) - poles: energy poles of the energy unit (see energy.io.poles)
EnergyUnit parameters can be used to add energy constraints or new attributes calculation to the energy unit, such as e_max or starting_cost.
This module also includes the classes: - FixedEnergyUnit: energy unit with a fixed power profile
- VariableEnergyUnit: energy unit with a variable power profile
- SquareEnergyUnit: energy unit with a defined square power profile,
inheriting from VariableEnergyUnit.
- ShiftableEnergyUnit: energy unit with a power profile that can be time
shifted, inheriting from VariableEnergyUnit.
- TriangleEnergyUnit: energy unit with a defined triangular power profile,
inheriting from VariableEnergyUnit.
- SawtoothEnergyUnit: energy unit with a defined sawtooth power profile,
inheriting from VariableEnergyUnit.
- SeveralEnergyUnit: Energy unit based on a fixed power curve enabling to
multiply several times (nb_unit) the same power curve.
- AssemblyUnit: an assembly unit has at least a production unit and a
consumption unit and is using one or several energy types. It can also integrate reversible energy units. It inherits from OptObject and it is the parent class of ConversionUnit and ReversibleUnit.
-
class
omegalpes.energy.units.energy_units.
AssemblyUnit
(time, name, prod_units=None, cons_units=None, rev_units=None, verbose=True)[source]¶ Bases:
omegalpes.general.optimisation.core.OptObject
Description
Simple Assembly unit: assembly units has at least a production unit and a consumption unit and is using one or several energy types. It can also integrate reversible energy units. It inherits from OptObject and it is the parent class of ConversionUnit and ReversibleUnit.Attributes
- time: TimeUnit describing the studied time period
- prod_units: list of the production units in the assembly unit.
- cons_units: list of the consumption units in the assembly unit.
- rev_units: list of the reversible units in the assembly unit.
- poles: dictionary of the poles of the assembly unit
-
class
omegalpes.energy.units.energy_units.
EnergyUnit
(time, name, flow_direction='in', p=None, p_min=-10000.0, p_max=10000.0, e_min=None, e_max=None, starting_cost=None, operating_cost=None, min_time_on=None, min_time_off=None, max_ramp_up=None, max_ramp_down=None, co2_out=None, availability_hours=None, energy_type=None, no_warn=True, verbose=True)[source]¶ Bases:
omegalpes.general.optimisation.core.OptObject
Description
Module dedicated to the parent class (EnergyUnit) of :
- production units
- consumption units
- storage units
-
add_energy_limits_on_time_period
(e_min=0, e_max=None, start='YYYY-MM-DD HH:MM:SS', end='YYYY-MM-DD HH:MM:SS', period_index=None)[source]¶ Add an energy limit during a defined time period
Parameters: - e_min – Minimal energy set during the time period (int or float)
- e_max – Maximal energy set during the time period (int or float)
- start – Date of start of the time period YYYY-MM-DD HH:MM:SS ( str)
- end – Date of end of the time period YYYY-MM-DD HH:MM:SS (str)
-
add_operating_time_range
(operating_time_range: [[<class 'str'>, <class 'str'>]])[source]¶ Add a range of hours during which the energy unit can be operated. The final time should be greater than the initial time within a time range, except when the final time is ‘00:00’.
example: set_operating_time_range([[‘10:00’, ‘12:00’], [‘14:00’, ‘17:00’]])
Parameters: operating_time_range – list of lists of strings in the format HH:MM [[first hour operating: str, hour to stop (not operating): str], [second hour operating: str, hour to stop (not operating): str], etc]
NB: the previous version of add_operating_time_range (deprecated since version 0.3.1) had integers instead of str hours as parameters, do not forget to update it if needed !
-
minimize_co2_emissions
(weight=1, pareto=False)[source]¶ Objective to minimize the co2 emissions of the energy unit
Parameters: - weight – Weight coefficient for the objective
- pareto – if True, OMEGAlpes calculates a pareto front based on this objective (two objectives needed)
-
minimize_costs
(weight=1, pareto=False)[source]¶ Objective to minimize the costs (starting and operating costs)
Parameters: - weight – Weight coefficient for the objective
- pareto – if True, OMEGAlpes calculates a pareto front based on this objective (two objectives needed)
-
minimize_energy
(weight=1, pareto=False)[source]¶ Objective to minimize the energy of the energy unit
Parameters: - weight – Weight coefficient for the objective
- pareto – if True, OMEGAlpes calculates a pareto front based on this objective (two objectives needed)
-
minimize_exergy
(energy_unit=None, weight=1, pareto=False)[source]¶ Alternate objective of exergy optimization that may be interesting in some cases.
Parameters: - weight – Weight coefficient for the objective
- pareto – if True, OMEGAlpes calculates a pareto front based on this objective (two objectives needed)
-
minimize_exergy_destruction
(weight=1, pareto=False)[source]¶ This is the main objective of any exergetic optimization.
Parameters: - weight – Weight coefficient for the objective
- pareto – if True, OMEGAlpes calculates a pareto front based on this objective (two objectives needed)
-
minimize_operating_cost
(weight=1, pareto=False)[source]¶ Objective to minimize the operating costs
Parameters: - weight – Weight coefficient for the objective
- pareto – if True, OMEGAlpes calculates a pareto front based on this objective (two objectives needed)
-
minimize_starting_cost
(weight=1, pareto=False)[source]¶ Objective to minimize the starting costs
Parameters: - weight – Weight coefficient for the objective
- pareto – if True, OMEGAlpes calculates a pareto front based on this objective (two objectives needed)
-
minimize_time_of_use
(weight=1, pareto=False)[source]¶ Objective to minimize the time of running of the energy unit
Parameters: - weight – Weight coefficient for the objective
- pareto – if True, OMEGAlpes calculates a pareto front based on this objective (two objectives needed)
-
set_operating_time_range
(operating_time_range: [[<class 'str'>, <class 'str'>]])[source]¶ DEPRECATED: the name of the function changed to add_operating_time_range for code consistency, please use this function !
Add a range of hours during which the energy unit can be operated. The final time should be greater than the initial time within a time range, except when the final time is ‘00:00’.
example: set_operating_time_range([[‘10:00’, ‘12:00’], [‘14:00’, ‘17:00’]])
Parameters: operating_time_range – list of lists of strings in the format HH:MM [[first hour operating: str, hour to stop (not operating): str], [second hour operating: str, hour to stop (not operating): str], etc]
-
class
omegalpes.energy.units.energy_units.
FixedEnergyUnit
(time, name: str, p: list, flow_direction='in', starting_cost=None, operating_cost=None, co2_out=None, energy_type=None, verbose=True)[source]¶ Bases:
omegalpes.energy.units.energy_units.EnergyUnit
Description
Energy unit with a fixed power profile.Attributes
- p : instantaneous power known by advance (kW)
- energy_type : type of energy (‘Electrical’, ‘Heat’, …)
-
class
omegalpes.energy.units.energy_units.
SawtoothEnergyUnit
(time, name, flow_direction, p_peak, p_low, alpha_peak, t_triangle, t_sawtooth, mandatory=True, starting_cost=None, operating_cost=None, co2_out=None, energy_type=None, verbose=True)[source]¶ Bases:
omegalpes.energy.units.energy_units.ShiftableEnergyUnit
-
class
omegalpes.energy.units.energy_units.
SeveralEnergyUnit
(time, name, fixed_power, p_min=1e-05, p_max=100000.0, imaginary=False, e_min=None, e_max=None, nb_unit_min=0, nb_unit_max=None, flow_direction='in', starting_cost=None, operating_cost=None, max_ramp_up=None, max_ramp_down=None, co2_out=None, energy_type=None, verbose=True, no_warn=True)[source]¶ Bases:
omegalpes.energy.units.energy_units.VariableEnergyUnit
Description
Energy unit based on a fixed power curve enabling to multiply several times (nb_unit) the same power curve.
Be careful, if imaginary == True, the solution may be imaginary as nb_unit can be continuous. The accurate number of the power unit should be calculated later
Attributes
- fixed_power : fixed power curve
-
class
omegalpes.energy.units.energy_units.
ShiftableEnergyUnit
(time, name: str, flow_direction, power_values: list, mandatory=True, co2_out=None, starting_cost=None, operating_cost=None, energy_type=None, verbose=True)[source]¶ Bases:
omegalpes.energy.units.energy_units.VariableEnergyUnit
Description
EnergyUnit with shiftable power profile.Attributes
- power_values : power profile to shift (kW)
- mandatory : indicates if the power is mandatory (True) or not (False)
- starting_cost : cost of the starting of the EnergyUnit
- operating_cost : cost of the operation (€/kW)
- energy_type : type of energy (‘Electrical’, ‘Heat’, …)
-
class
omegalpes.energy.units.energy_units.
SquareEnergyUnit
(time, name, p_square, n_square, t_between_sq, t_square=1, flow_direction='in', starting_cost=None, operating_cost=None, co2_out=None, energy_type=None, verbose=True, no_warn=True)[source]¶ Bases:
omegalpes.energy.units.energy_units.VariableEnergyUnit
-
class
omegalpes.energy.units.energy_units.
TriangleEnergyUnit
(time, name, flow_direction, p_peak, alpha_peak, t_triangle: list, mandatory=True, starting_cost=None, operating_cost=None, co2_out=None, energy_type=None, verbose=True)[source]¶ Bases:
omegalpes.energy.units.energy_units.ShiftableEnergyUnit
-
class
omegalpes.energy.units.energy_units.
VariableEnergyUnit
(time, name, flow_direction='in', p_min=-10000.0, p_max=10000.0, e_min=None, e_max=None, starting_cost=None, operating_cost=None, min_time_on=None, min_time_off=None, max_ramp_up=None, max_ramp_down=None, co2_out=None, availability_hours=None, energy_type=None, verbose=True, no_warn=True)[source]¶
Consumption_units module¶
This module defines the consumption units
The consumption_units module defines various classes of consumption units, from generic to specific ones.
- It includes :
ConsumptionUnit : simple consumption unit. It inherits from EnergyUnit, its power flow direction is always ‘in’.
3 Objectives are also available :
- minimize consumption,
- maximize consumption,
- minimize consumption costs.
FixedConsumptionUnit : consumption with a fixed load profile. It inherits from ConsumptionUnit.
VariableConsumptionUnit : consumption unit allowing for a variation of power between p_min et p_max. It inherits from ConsumptionUnit.
- And also :
- SeveralConsumptionUnit: Consumption unit based on a fixed consumption curve enabling to multiply several times (nb_unit) the same consumption profile
- SeveralImaginaryConsumptionUnit: Consumption unit based on a fixed consumption curve enabling to multiply several times (nb_unit) the same consumption profile. Be careful, the solution may be imaginary as nb_unit can be continuous. The accurate number of the Consumption units should be calculated later
- SquareConsumptionUnit: Consumption unit with a fixed value and fixed duration.
- ShiftableConsumptionUnit: Consumption unit with shiftable consumption profile.
-
class
omegalpes.energy.units.consumption_units.
ConsumptionUnit
(time, name, p=None, p_min=1e-05, p_max=100000.0, e_min=None, e_max=None, co2_out=None, starting_cost=None, consumption_cost=None, min_time_on=None, min_time_off=None, max_ramp_up=None, max_ramp_down=None, availability_hours=None, energy_type=None, verbose=True)[source]¶ Bases:
omegalpes.energy.units.energy_units.EnergyUnit
Description
Simple Consumption unit. The parameters and attributes are described in EnergyUnit parent class. Here, consumption_cost is the cost associated to the energy consumption of the unit (€/kWh).-
maximize_consumption
(weight=1, pareto=False)[source]¶ Parameters: - weight – Weight coefficient for the objective
- pareto – if True, OMEGAlpes calculates a pareto front based on this objective (two objectives needed)
-
-
class
omegalpes.energy.units.consumption_units.
FixedConsumptionUnit
(time, name, p: list = None, co2_out=None, starting_cost=None, operating_cost=None, energy_type=None, verbose=True)[source]¶ Bases:
omegalpes.energy.units.energy_units.FixedEnergyUnit
,omegalpes.energy.units.consumption_units.ConsumptionUnit
Description
Consumption unit with a fixed consumption profile.Attributes
- p : instantaneous power demand known in advance (kW)
- energy_type : type of energy (‘Electrical’, ‘Heat’, …)
- consumption_cost : cost associated to the energy consumption
-
class
omegalpes.energy.units.consumption_units.
SeveralConsumptionUnit
(time, name, fixed_cons, imaginary=False, p_min=1e-05, p_max=100000.0, e_min=None, e_max=None, nb_unit_min=0, nb_unit_max=None, co2_out=None, starting_cost=None, operating_cost=None, max_ramp_up=None, max_ramp_down=None, energy_type=None, verbose=True, no_warn=True)[source]¶ Bases:
omegalpes.energy.units.consumption_units.VariableConsumptionUnit
,omegalpes.energy.units.energy_units.SeveralEnergyUnit
Description
Consumption unit based on a fixed consumption curve enabling to multiply several times (nb_unit) the same consumption curve.Attributes
- fixed_cons : fixed consumption curve
-
class
omegalpes.energy.units.consumption_units.
ShiftableConsumptionUnit
(time, name: str, power_values, mandatory=True, co2_out=None, starting_cost=None, operating_cost=None, energy_type=None, verbose=True)[source]¶ Bases:
omegalpes.energy.units.energy_units.ShiftableEnergyUnit
,omegalpes.energy.units.consumption_units.VariableConsumptionUnit
Description
Consumption unit with shiftable consumption profile.Attributes
- power_values : consumption profile to shift (kW)
- mandatory : indicates if the consumption is mandatory (True) or not
(False) * starting_cost : cost of the starting of the consumption * operating_cost : cost of the operation (€/kW) * energy_type : type of energy (‘Electrical’, ‘Heat’, …)
-
class
omegalpes.energy.units.consumption_units.
SquareConsumptionUnit
(time, name, p_square, duration, n_square, t_between_sq, co2_out=None, starting_cost=None, operating_cost=None, energy_type=None, verbose=True, no_warn=False)[source]¶ Bases:
omegalpes.energy.units.energy_units.SquareEnergyUnit
,omegalpes.energy.units.consumption_units.VariableConsumptionUnit
Description
Consumption unit with a fixed value and fixed duration.Only the time of beginning can be modifiedOperation can be mandatory or notAttributes
- p : instantaneous power consumption (kW)
- duration : duration of the power delivery (hours)
- mandatory : indicates if the power delivery is mandatory or not
- energy_type : type of energy (‘Electrical’, ‘Heat’, …)
- consumption_cost : cost associated to the energy consumption
-
class
omegalpes.energy.units.consumption_units.
VariableConsumptionUnit
(time, name, p_min=1e-05, p_max=100000.0, e_min=None, e_max=None, co2_out=None, starting_cost=None, operating_cost=None, min_time_on=None, min_time_off=None, max_ramp_up=None, max_ramp_down=None, energy_type=None, verbose=True, no_warn=True)[source]¶ Bases:
omegalpes.energy.units.energy_units.VariableEnergyUnit
,omegalpes.energy.units.consumption_units.ConsumptionUnit
Description
Consumption unit with a variation of power between p_min et p_max.Attributes
- p_max : maximal instantaneous power consumption (kW)
- p_min : minimal instantaneous power consumption (kW)
- energy_type : type of energy (‘Electrical’, ‘Heat’, …)
Production_units module¶
This module defines the production units
The production_units module defines various kinds of production units with associated attributes and methods.
- It includes :
ProductionUnit : simple production unit inheriting from EnergyUnit and with an outer flow direction. The outside co2 emissions, the starting cost, the operating cost, the minimal operating time, the minimal non-operating time, the maximal increasing ramp and the maximal decreasing ramp can be filled.
Objectives are also available :
- minimize starting cost, operating cost, total cost
- minimize production, co2_emissions, time of use
- maximize production
FixedProductionUnit : Production unit with a fixed production profile.
VariableProductionUnit : Production unit with a variation of power between p_min et p_max.
- And also :
- SeveralProductionUnit: Production unit based on a fixed production curve enabling to multiply several times (nb_unit) the same production curve
- SeveralImaginaryProductionUnit: Production unit based on a fixed production curve enabling to multiply several times (nb_unit) the same production curve. Be careful, the solution may be imaginary as nb_unit can be continuous. The accurate number of the production unit should be calculated later
- SquareProductionUnit: Production unit with a fixed value and fixed duration.
- ShiftableProductionUnit: Production unit with shiftable production profile.
-
class
omegalpes.energy.units.production_units.
FixedProductionUnit
(time, name: str, p: list = None, co2_out=None, particle_emission=None, starting_cost=None, operating_cost=None, energy_type=None, rr_energy=False, verbose=True)[source]¶ Bases:
omegalpes.energy.units.energy_units.FixedEnergyUnit
,omegalpes.energy.units.production_units.ProductionUnit
Description
Production unit with a fixed production profile.Attributes
- p : instantaneous power production known by advance (kW)
- energy_type : type of energy (‘Electrical’, ‘Heat’, …)
-
class
omegalpes.energy.units.production_units.
ProductionUnit
(time, name, p=None, p_min=1e-05, p_max=100000.0, e_min=None, e_max=None, co2_out=None, particle_emission=None, starting_cost=None, operating_cost=None, min_time_on=None, min_time_off=None, max_ramp_up=None, max_ramp_down=None, availability_hours=None, energy_type=None, rr_energy=False, verbose=True, no_warn=True)[source]¶ Bases:
omegalpes.energy.units.energy_units.EnergyUnit
Description
Simple Production unit. The parameters and attributes are described in EnergyUnit parent class.
-
class
omegalpes.energy.units.production_units.
SeveralProductionUnit
(time, name, fixed_prod, imaginary=False, p_min=1e-05, p_max=100000.0, e_min=None, e_max=None, nb_unit_min=0, nb_unit_max=None, co2_out=None, particle_emission=None, starting_cost=None, operating_cost=None, max_ramp_up=None, max_ramp_down=None, energy_type=None, rr_energy=False, verbose=True, no_warn=True)[source]¶ Bases:
omegalpes.energy.units.production_units.VariableProductionUnit
,omegalpes.energy.units.energy_units.SeveralEnergyUnit
Description
Production unit based on a fixed production curve enabling to multiply several times (nb_unit) the same production curve. nb_unit is an integer variable.Attributes
- fixed_prod : fixed production curve
-
class
omegalpes.energy.units.production_units.
ShiftableProductionUnit
(time, name: str, power_values, mandatory=True, co2_out=None, particle_emission=None, starting_cost=None, operating_cost=None, energy_type=None, rr_energy=False, verbose=True)[source]¶ Bases:
omegalpes.energy.units.energy_units.ShiftableEnergyUnit
,omegalpes.energy.units.production_units.VariableProductionUnit
Description
Production unit with shiftable production profile.Attributes
- power_values : production profile to shift (kW)
- mandatory : indicates if the production is mandatory : True or not : False
- starting_cost : cost of the starting of the production
- operating_cost : cost of the operation (€/kW)
- energy_type : type of energy (‘Electrical’, ‘Heat’, …)
-
class
omegalpes.energy.units.production_units.
SquareProductionUnit
(time, name, p_square, duration, n_square, t_between_sq, co2_out=None, particle_emission=None, starting_cost=None, operating_cost=None, energy_type=None, rr_energy=False, verbose=True, no_warn=True)[source]¶ Bases:
omegalpes.energy.units.energy_units.SquareEnergyUnit
,omegalpes.energy.units.production_units.VariableProductionUnit
Description
Production unit with a fixed value and fixed duration.Only the time of beginning can be modified.Operation can be mandatory or not.Attributes
- p : instantaneous power production (kW)
- duration : duration of the power delivery (hours)
- mandatory : indicates if the power delivery is mandatory or not
- energy_type : type of energy (‘Electrical’, ‘Heat’, …)
-
class
omegalpes.energy.units.production_units.
VariableProductionUnit
(time, name, p_min=1e-05, p_max=100000.0, e_min=None, e_max=None, co2_out=None, particle_emission=None, starting_cost=None, operating_cost=None, min_time_on=None, min_time_off=None, max_ramp_up=None, max_ramp_down=None, energy_type=None, rr_energy=False, verbose=True, no_warn=True)[source]¶ Bases:
omegalpes.energy.units.energy_units.VariableEnergyUnit
,omegalpes.energy.units.production_units.ProductionUnit
Description
Production unit with a variation of power between p_min et p_max.Attributes
- p_max : maximal instantaneous power production (kW)
- p_min : minimal instantaneous power production (kW)
- energy_type : type of energy (‘Electrical’, ‘Heat’, …)
Conversion_units module¶
This module defines the conversion units, inheriting from AssemblyUnits
The conversion_units module defines various classes of conversion units, from generic to specific ones.
- It includes :
- ConversionUnit : simple conversion unit. It inherits from AssemblyUnit.
- ElectricalToThermalConversionUnit : Electrical to thermal Conversion unit with an electricity consumption and a thermal production linked by and electrical to thermal ratio. It inherits from ConversionUnit
- HeatPump : Simple Heat Pump with an electricity consumption, a heat production and a heat consumption. It has a theoretical coefficient of performance COP and inherits from ConversionUnit.
-
class
omegalpes.energy.units.conversion_units.
ConversionUnit
(time, name, prod_units=None, cons_units=None, rev_units=None, verbose=True)[source]¶ Bases:
omegalpes.energy.units.energy_units.AssemblyUnit
Description
Simple Conversion unit, inheriting from AssemblyUnitAttributes
- time : TimeUnit describing the studied time period
- prod_units : list of the production units
- cons_units : list of the consumption units
- poles : dictionary of the poles of the conversion unit
-
class
omegalpes.energy.units.conversion_units.
ElectricalConversionUnit
(time, name, pmin_in_elec=1e-05, pmax_in_elec=100000.0, p_in_elec=None, pmin_out_elec=1e-05, pmax_out_elec=100000.0, p_out_elec=None, elec_to_elec_ratio=1)[source]¶ Bases:
omegalpes.energy.units.conversion_units.ConversionUnit
Description
Electrical Conversion unit with an electricity consumption and an electricity productionAttributes
- elec_production_unit : electricity production unit (electrical output)
- elec_consumption_unit : electricity consumption unit (electrical input)
- conversion : Definition Dynamic Constraint linking the electrical
input to the electrical output through the elec_to_elec ratio
-
class
omegalpes.energy.units.conversion_units.
ElectricalToThermalConversionUnit
(time, name, pmin_in_elec=1e-05, pmax_in_elec=100000.0, p_in_elec=None, pmin_out_therm=1e-05, pmax_out_therm=100000.0, p_out_therm=None, elec_to_therm_ratio=1, verbose=True)[source]¶ Bases:
omegalpes.energy.units.conversion_units.ConversionUnit
Description
Electrical to thermal Conversion unit with an electricity consumption and a thermal productionAttributes
- thermal_production_unit : thermal production unit (thermal output)
- elec_consumption_unit : electricity consumption unit (electrical input)
- conversion : Definition Dynamic Constraint linking the electrical
- input to
- the thermal output through the electrical to thermal ratio
-
class
omegalpes.energy.units.conversion_units.
HeatPump
(time, name, pmin_in_elec=1e-05, pmax_in_elec=100000.0, p_in_elec=None, pmin_in_therm=1e-05, pmax_in_therm=100000.0, p_in_therm=None, pmin_out_therm=1e-05, pmax_out_therm=100000.0, p_out_therm=None, cop=3, losses=0)[source]¶ Bases:
omegalpes.energy.units.conversion_units.ConversionUnit
Description
Simple Heat Pump with an electricity consumption, a thermal production and a thermal consumption. It has a theoretical coefficient of performance COP and inherits from ConversionUnit.Attributes
- thermal_production_unit : thermal production unit (condenser)
- elec_consumption_unit : electricity consumption unit (electrical input)
- thermal_consumption_unit : heay consumption unit (evaporator)
- COP : Quantity describing the coefficient of performance of the heat pump
- conversion : Definition Dynamic Constraint linking the electrical
input to the thermal output through the electrical to thermal ratio * power_flow : Definition Dynamic constraint linking the thermal output to the electrical and thermal inputs in relation to the losses.
-
class
omegalpes.energy.units.conversion_units.
ReversibleConversionUnit
(time, name, pmin_up=1e-05, pmax_up=100000.0, pmin_down=1e-05, pmax_down=100000.0, up2down_eff=1, down2up_eff=1, energy_type_up=None, energy_type_down=None, verbose=True)[source]¶ Bases:
omegalpes.energy.units.conversion_units.ConversionUnit
Description
Reversible Conversion unit with two reversible units, one for each side of the conversion unit. Theses sides will be called upstream and downstream.Attributes
- rev_unit_upstream: reversible unit upstream
- rev_unit_downstream: reversible unit downstream
- conversion_up2down: Definition Dynamic Constraint linking the
consumption of the upstream reversible unit to the production of the downstream reversible unit through the up2down_eff * conversion_down2up: Definition Dynamic Constraint linking the consumption of the downstream reversible unit to the production of the upstream reversible unit through the down2up_eff
Storage_units module¶
This module defines the storage units
The storage_units module defines various kinds of storage units with associated attributes and methods, from simple to specific ones.
- It includes :
- StorageUnit : simple storage unit inheriting from EnergyUnit, with storage specific attributes. It includes the objective “minimize capacity”.
- Thermocline storage : a thermal storage that need to cycle (i.e. reach SOC_max) every period of Tcycle
-
class
omegalpes.energy.units.storage_units.
StorageUnit
(time, name, pc_min=1e-05, pc_max=100000.0, pd_min=1e-05, pd_max=100000.0, capacity=None, e_0=None, e_f=None, soc_min=0, soc_max=1, eff_c=1, eff_d=1, self_disch=0, self_disch_t=0, ef_is_e0=False, cycles=None, energy_type=None, e_min=None, e_max=None)[source]¶ Bases:
omegalpes.energy.units.energy_units.VariableEnergyUnit
Description
Simple Storage unitAttributes
- capacity (Quantity): maximal energy that can be stored [kWh]
- e (Quantity): energy at time t in the storage [kWh]
- set_soc_min (TechnicalDynamicConstraint): constraining the energy to be above the value : soc_min*capacity
- set_soc_max (TechnicalDynamicConstraint): constraining the energy to be below the value : soc_max*capacity
- pc (Quantity) : charging power [kW]
- pd (Quantity) : discharging power [kW]
- uc (Quantity) : binary variable describing the charge of the storage unit : 0 : Not charging & 1 : charging
- calc_e (DefinitionDynamicConstraint) : energy calculation at time t ; relation power/energy
- calc_p (DefinitionDynamicConstraint) : power calculation at time t ;
- power
- flow equals charging power minus discharging power
- on_off_stor (DefinitionDynamicConstraint) : making u[t] matching with storage modes (on/off)
- def_max_charging (DefinitionDynamicConstraint) : defining the max charging power, avoiding charging and discharging at the same time
- def_max_discharging (DefinitionDynamicConstraint) : defining the max discharging power, avoiding charging and discharging at the same time
- def_min_charging (DefinitionDynamicConstraint) : defining the min charging power, avoiding charging and discharging at the same time
- def_min_discharging (DefinitionDynamicConstraint) : defining the min discharging power, avoiding charging and discharging at the same time
- set_e_0 (ActorConstraint) : set the energy state for t=0
- e_f (Quantity) : energy in the storage at the end of the time horizon, i.e. after the last time step [kWh]
- e_f_min (TechnicalConstraint) : e_f value is constrained above soc_min*capacity
- e_f_max (TechnicalConstraint) : e_f value is constrained below soc_max*capacity
- set_e_f (ActorConstraint) : when e_f is given, it is set in the same way the energy is, but after the last time step
- calc_e_f (DefinitionConstraint) : when e_f is not given, it is calculated in the same way the energy is, but after the last time step
- ef_is_e0 (TechnicalConstraint) : Imposing ef=e0 on the time period.
- cycles (TechnicalDynamicConstraint) : setting a cycle constraint e[t] = e[t+cycles/dt]
-
class
omegalpes.energy.units.storage_units.
ThermoclineStorage
(time, name, pc_min=1e-05, pc_max=100000.0, pd_min=1e-05, pd_max=100000.0, capacity=None, e_0=None, e_f=None, soc_min=0, soc_max=1, eff_c=1, eff_d=1, self_disch=0, e_min=None, e_max=None, Tcycl=120, ef_is_e0=False)[source]¶ Bases:
omegalpes.energy.units.storage_units.StorageUnit
Description
Class ThermoclineStorage : class defining a thermocline heat storage, inheriting from StorageUnit.Attributes
- is_soc_max (Quantity) : indicating if the storage is fully charged 0:No 1:Yes
- def_is_soc_max_inf (DynamicConstraint) : setting the right value for is_soc_max
- def_is_soc_max_sup (DynamicConstraint) : setting the right value for is_soc_max
- force_soc_max (TechnicalDynamicConstraint) : The energy has to be at least once at its maximal value during the period Tcycl.
Reversible_units module¶
This module defines the reversible units
The reversible_units module defines various kinds of reversible units with associated attributes and methods, from simple to specific ones, inheriting from AssemblyUnit.
- It includes :
- ReversibleUnit : simple reversible unit with only one consumption and
one production units. It can both produce and consume energy but not at the same time.
-
class
omegalpes.energy.units.reversible_units.
ReversibleUnit
(time, name, pmin_cons=1e-05, pmax_cons=100000.0, p_cons=None, pmin_prod=1e-05, pmax_prod=100000.0, p_prod=None, energy_type_prod=None, energy_type_cons=None, verbose=True)[source]¶ Bases:
omegalpes.energy.units.energy_units.AssemblyUnit
Description
Simple Reversible unit inheriting from AssemblyUnit. It is made of a consumption unit and a production unit that can both operate but not at the same time (reversible constraint).Attributes
- production_unit (ProductionUnit)
- consumption_unit (ConsumptionUnit)
- def_rev (DefinitionDynamicConstraint): definition of the reversible
constraint * def_rev_c (DefinitionDynamicConstraint): definition of the reversible constraint in the case where only the consumption is fixed * def_rev_p (DefinitionDynamicConstraint): definition of the reversible constraint in the case where only the production is fixed
Energy_nodes module¶
This module defines the energy nodes that will allow energy transmission between the various energy units and conversion units
The energy_node module includes the EnergyNode class for energy transmission between production, consumption, conversion and storage. Defining several energy nodes and exporting/importing energy between them can also allow for a better demarcation of the energy system.
-
class
omegalpes.energy.energy_nodes.
EnergyNode
(time, name, energy_type=None, operator=None)[source]¶ Bases:
omegalpes.general.optimisation.core.OptObject
This class defines an energy node.
-
add_pole
(pole: omegalpes.energy.io.poles.Epole) → None[source]¶ Add an energy pole to the poles_list
Parameters: pole – Epole
-
connect_units
(*units)[source]¶ Connecting all EnergyUnit to the EnergyNode
Parameters: units (EnergyUnit) – EnergyUnits connected to the EnergyNode
-
create_export
(node, export_min, export_max)[source]¶ Create the export from the EnergyNode (self) to the EnergyNode (node)
Parameters: - node – EnergyNode to whom power can be exported
- export_min – Minimal value of exported power when there is export
- export_max – Maximal value of exported power when there is export
Returns: Quantity that defines the power exported
-
export_to_node
(node, export_min=1e-05, export_max=100000.0)[source]¶ Add an export of power from the node to another node
Parameters: - node – EnergyNode to whom power can be exported
- export_min – Minimal value of exported power when there is export
- export_max – Maximal value of exported power when there is export
-
get_connected_energy_units
¶ Return the list of connected EnergyUnits in the EnergyNode
-
get_exports
¶ Return the list of exports to the EnergyNode
-
get_flows
¶ Get all the power flows of the energy node :rtype: list :return: list of power flows
-
get_imports
¶ Return the list of imports to the EnergyNode
-
get_input_poles
¶
-
get_output_poles
¶
-
get_poles
¶ Return the list of energy poles in the EnergyNode
-
Thermal Building module¶
This module enables to model buildings as thermal loads
-
class
omegalpes.energy.buildings.thermal.
HeatingLoad
(time, name, tz, p_max=10000000000000.0, T_set=19, temp_margin=1, no_cooling=True)[source]¶ Bases:
omegalpes.energy.units.consumption_units.VariableConsumptionUnit
-
class
omegalpes.energy.buildings.thermal.
RCNetwork_1
(time, name, T_ext, theta_ec, theta_em, T_int_min=0, T_int_max=50, theta_ea=None, theta_c=None, theta_m=None, h_ea=0, h_ac=0, h_ec=0, h_mc=0, h_em=0, c_m=0, f_im=None, f_r_l=0.7, f_r_p=0.5, f_r_a=0.2, f_sa=0.1, f_sm=None, f_sc=None, f_ic=None, f_hc_cv=None, U_wall=0.2, U_win=1.2, U_roof=0.2, e_wall=0.9, e_win=0.9, e_roof=0.9, a_wall=0.6, a_roof=0.6, A_wall=None, A_win=None, A_roof=None, owner=None)[source]¶
-
class
omegalpes.energy.buildings.thermal.
ThermalZone
(rc_network, phi_i_a, phi_i_l, phi_i_p, I_sol_av, Fsh_win, T_mean, T_dew, sky_cover=1, T_ext=None, hvac_prop=None)[source]¶
-
class
omegalpes.energy.buildings.thermal.
ZEA_RCNetwork_1
(time, name, T_ext, A_f, A_win, Aext_v, A_roof, footprint, U_win, U_wall, U_roof, U_base, floors, e_wall=0.9, e_win=0.9, e_roof=0.9, a_wall=0.6, a_roof=0.6, construction='heavy', height_bg=0, perimeter=0, f_hc_cv=1, void=0, hvac_prop=None, T_int_min=0, T_int_max=50, owner=None)[source]¶
-
omegalpes.energy.buildings.thermal.
calc_Htr_op
(Aop_bel, Aop_sup, footprint, U_base, U_wall, U_roof)[source]¶
-
omegalpes.energy.buildings.thermal.
calc_I_rad_linearization_coef
(Tdry, Tdew, Tlin, sky_cover=1)[source]¶ Parameters: - T_dry – Dry bulb temperature in Celsius
- T_dew – Dew point temperature in Celsius
- sky_cover –
Returns: list(A), list(B):
-
omegalpes.energy.buildings.thermal.
calc_I_sol
(I_sol_average, Aop_sup, Aroof, Awin, a_wall, a_roof, U_wall, U_roof, Fsh_win)[source]¶ Parameters: - I_sol_average – W/m2
- Aop_sup – Opaque wall areas above ground (excluding voids and windows) [m2]
- Aroof – Roof area [m2]
- Awin – Windows area [m2]
- a_wall – Absorption coefficient of the walls [0..1]
- a_roof – Absorption coefficeint of the roof [0..1]
- U_wall –
- U_roof –
- Fsh_win – Shading factor for windows
Returns: I_sol [kW]
-
omegalpes.energy.buildings.thermal.
calc_T_sky
(T_dry, T_dew, sky_cover=1)[source]¶ Parameters: - T_dry – Dry bulb temperature in Celsius
- T_dew – Dew point temperature in Celsius
- sky_cover – Sky cover
-
omegalpes.energy.buildings.thermal.
calc_skytemp
(Tdrybulb, Tdewpoint, N=1)[source]¶ - Copyright 2014, Architecture and Building Systems - ETH Zurich
Parameters: - Tdrybulb – Drybuld temperature [°C]
- Tdewpoint – Dewpoint temperature [°C]
- N – Sky cover
Returns: Sky temperature in °C
-
omegalpes.energy.buildings.thermal.
get_Cm_Af
(construction)[source]¶ - Description code Cm_Af Light construction T1 110000 Medium construction T2 165000 Heavy construction T3 300000
-
omegalpes.energy.buildings.thermal.
lookup_effective_mass_area_factor
(cm)[source]¶ Look up the factor to multiply the conditioned floor area by to get the effective mass area by building construction type. This is used for the calculation of the effective mass area “Am” in get_prop_RC_model. Standard values can be found in the Annex G of ISO EN13790
param: cm: The internal heat capacity per unit of area [J/m2]. return: Effective mass area factor (0, 2.5 or 3.2 depending on cm value).
Exergy module¶
This module contains the exergy assessment routines of OMEGALPES. This module:
- Determines inlet, outlet or contained exergy of, respectively, any ConsumptionUnit, ProductionUnit or StorageUnit.
2) Determines exergy destruction within any EnergyUnit. 2) Recognizes Electrical and Thermal energy. 3) Can calculate exergy for a single unit or for a list of units. 4) Can proceed with only one temperature value or with a list of temperatures.
4.1. Formulates exergy for one single EnergyUnit and temperature. 4.2. Formulates timely exergy if one single EnergyUnit and a list of
temperatures is provided.
- 4.3. Formulates exergy for each unit within a list of EnergyUnits if only
- one temperature is provided.
- 4.4. Formulates timely exergy for each unit within a list of EnergyUnits if
- a list of temperatures is provided.
The exergy-related classes defined in this module are not physical units. They are virtual units attached to their energetic counterparts. Consequently, the exergy and exergy destruction calculated in this module are attached to the EnergyUnit as a Quantity at the moment of calculating it.
Copyright 2018 G2Elab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
class
omegalpes.energy.exergy.
ElectricalExergy
(energy_unit: omegalpes.energy.units.energy_units.EnergyUnit)[source]¶
-
class
omegalpes.energy.exergy.
ExergyDestruction
(energy_unit=None, exergy_eff=1, temp_ref=20, temp_heat=None)[source]¶
Poles module¶
This module defines inputs and outputs of as poles
- The poles module includes :
- FlowPole : this class defines a pole with a directed flow (in or out)
- EPole : this class define an energy pole
-
class
omegalpes.energy.io.poles.
Epole
(p, direction, energy_type=None)[source]¶ Bases:
omegalpes.energy.io.poles.FlowPole
Description
Definition of an energetic pole, power and power flow direction convention ‘in’ or ‘out’
The actor classes enables to build the energy model considering pre-defined stakeholders’ constraints and objectives
actor package¶
The actor modelling is based on a main actor class defined on the actor module. Then, the actors are divided in two categories: the “operator actors” who operates energy units and the “regulator actors” who unable to create regulation constraints.
Actor module¶
This modules define the basic Actor object
Few methods are available:
- add_external_constraint
- add_external_dynamic_constraint
- add_objective
-
class
omegalpes.actor.actor.
Actor
(name, no_warn=True, verbose=True)[source]¶ Bases:
omegalpes.general.optimisation.core.OptObject
Description
Actor class is the basic class to model an actor. The basic actor is defined by its name and description. An actor is then defined by its constraints and objectives.Attributes
- description : description as an Actor OptObject
-
add_actor_constraint
(cst_name, exp)[source]¶ Enable to add an external constraint linked with an actor
Parameters: - cst_name – name of the constraint
- exp – expression of the constraint
-
add_actor_dynamic_constraint
(cst_name, exp_t, t_range='for t in time.I')[source]¶ Enable to add an external dynamic constraint linked with an actor. A dynamic constraint changes over time
Parameters: - cst_name – name of the constraint
- exp – expression of the constraint depending on the time
- t_range – expression of time for the constraint
Operator_actors module¶
This module defines the operator_actor and its scope of responsibility
-
class
omegalpes.actor.operator_actors.operator_actors.
OperatorActor
(name, operated_unit_type_tuple, operated_unit_list=None, operated_node_list=None, verbose=True)[source]¶ Bases:
omegalpes.actor.actor.Actor
Description
OperatorActor class inherits from the the basic class Actor. It enables one to model an actor who operates energy units which is part of its scope of responsibility. An operator actor has objectives and constraints which are linked to the energy units he operates.Attributes
- name : name of the actor
- operated_unit_list: list of the energy units operated by the actor or more precisely in its scope of responsibility
Consumer_actors module¶
This module describes the Consumer actor
Few objectives and constraints are available.
- Objectives :
- maximize_consumption
- minimize_consumption
- minimize_co2_consumption
- minimize_consumption_costs
- Constraints :
- energy_consumption_minimum
- energy_consumption_maximum
- power_consumption_minimum
- power_consumption_maximum
-
class
omegalpes.actor.operator_actors.consumer_actors.
Consumer
(name, operated_unit_list, operated_node_list=None, verbose=True)[source]¶ Bases:
omegalpes.actor.operator_actors.operator_actors.OperatorActor
Description
Consumer class inherits from the the class OperatorActor. It enables one to model a consumer actor.-
add_energy_consumption_maximum
(max_e_tot, cst_operated_unit_list=None)[source]¶ To create the actor constraint of a maximum of energy consumption.
Parameters: - max_e_tot – Maximum of the total energy consumption over the study period
- cst_operated_unit_list – List of units on which the constraint will be applied. Might be empty.
-
add_energy_consumption_minimum
(min_e_tot, cst_operated_unit_list=None)[source]¶ To create the actor constraint of a minimum of energy consumption.
Parameters: - min_e_tot – Minimum of the total energy consumption over the study period
- cst_operated_unit_list – List of units on which the constraint will be applied. Might be empty.
-
add_power_consumption_by_unit_maximum
(max_p, time, cst_operated_unit_list=None)[source]¶ To create the actor constraint of a maximum of power consumption for each unit.
Parameters: - max_p – Maximum of the power consumption. May be an int, float or a list with the size of the period study
- time – period of the study
- cst_operated_unit_list – List of units on which the constraint will be applied. Might be empty.
-
add_power_consumption_by_unit_minimum
(min_p, time, cst_operated_unit_list=None)[source]¶ To create the actor constraint of a minimum of power consumption for each unit.
Parameters: - min_p – Minimum of the power consumption. May be an int, float or a list with the size of the period study
- time – period of the study
- cst_operated_unit_list – List of units on which the constraint will be applied. Might be empty.
-
add_power_consumption_total_maximum
(max_p, time, cst_operated_unit_list=None)[source]¶ To create the actor constraint of a maximum of power consumption.
Parameters: - max_p – Minimum of the power consumption. May be an int, float or a list with the size of the period study
- time – period of the study
- cst_operated_unit_list – List of units on which the constraint will be applied. Might be empty.
-
add_power_consumption_total_minimum
(min_p, time, cst_operated_unit_list=None)[source]¶ To create the constraint of a minimum of power consumption considering all the units.
Parameters: - min_p – Minimum of the power consumption. May be an int, float or a list with the size of the period study
- time – period of the study
- cst_operated_unit_list – List of units on which the constraint will be applied. Might be empty.
-
maximize_consumption
(obj_operated_unit_list=None, weight=1, pareto=False)[source]¶ To create the objective in order to maximize the consumption of the consumer’s units (all or part of them).
Parameters: - obj_operated_unit_list – List of units on which the objective will be applied. Might be empty
- weight – Weight coefficient for the objective
- pareto – if True, OMEGAlpes calculates a pareto front based on this objective (two objectives needed)
-
minimize_co2_consumption
(obj_operated_unit_list=None, weight=1, pareto=False)[source]¶ To create the objective in order to minimize the co2 emissions due to the consumer’s units (all or part of them).
Parameters: - obj_operated_unit_list – List of units on which the objective will be applied. Might be empty
- weight – Weight coefficient for the objective
- pareto – if True, OMEGAlpes calculates a pareto front based on this objective (two objectives needed)
-
minimize_consumption
(obj_operated_unit_list=None, weight=1, pareto=False)[source]¶ To create the objective in order to minimize the consumption of the consumer’s units (all or part of them).
Parameters: - obj_operated_unit_list – List of units on which the objective will be applied. Might be empty
- weight – Weight coefficient for the objective
- pareto – if True, OMEGAlpes calculates a pareto front based on this objective (two objectives needed)
-
minimize_consumption_cost
(obj_operated_unit_list=None, weight=1, pareto=False)[source]¶ To create the objective in order to minimize the expenses due to the consumer’s units (all or part of them).
Parameters: - obj_operated_unit_list – List of units on which the objective will be applied. Might be empty
- weight – Weight coefficient for the objective
- pareto – if True, OMEGAlpes calculates a pareto front based on this objective (two objectives needed)
-
Producer_actors module¶
This module describes the Producer actor
Few objectives and constraints are available.
- Objectives :
- maximize_production
- minimize_production
- minimize_time_of_use
- minimize_co2_emissions
- minimize_costs
- minimize_operating_cost
- minimize_starting_cost
- Constraints :
- energy_production_minimum
- energy_production_maximum
- power_production_minimum
- power_production_maximum
-
class
omegalpes.actor.operator_actors.producer_actors.
Producer
(name, operated_unit_list, operated_node_list=None, verbose=True)[source]¶ Bases:
omegalpes.actor.operator_actors.operator_actors.OperatorActor
Description
Producer class inherits from the the class OperatorActor. It enables one to model an energy producer actor.-
add_energy_production_maximum
(max_e_tot, cst_operated_unit_list=None)[source]¶ To create the actor constraint of a maximum of energy production.
Parameters: - max_e_tot – Maximum of the total energy production over the period of the study
- cst_operated_unit_list – List of units on which the constraint will be applied. Might be empty.
-
add_energy_production_minimum
(min_e_tot, cst_operated_unit_list=None)[source]¶ To create the actor constraint of a minimum of energy production.
Parameters: - min_e_tot – Minimum of the total energy production over the period of the study
- cst_operated_unit_list – List of units on which the constraint will be applied. Might be empty.
-
add_power_production_by_unit_maximum
(max_p, time, cst_operated_unit_list=None)[source]¶ To create the actor constraint of a maximum of power production for each unit.
Parameters: - max_p – Maximum of the power production. May be an int, float or a list with the size of the period study
- time – period of the study
- cst_operated_unit_list – List of units on which the constraint will be applied. Might be empty.
-
add_power_production_by_unit_minimum
(min_p, time, cst_operated_unit_list=None)[source]¶ To create the actor constraint of a minimum of power production for each unit.
Parameters: - min_p – Minimum of the power production. May be an int, float or a list with the size of the period study
- time – period of the study
- cst_operated_unit_list – List of units on which the constraint will be applied. Might be empty.
-
add_power_production_total_maximum
(max_p, time, cst_operated_unit_list=None)[source]¶ To create the actor constraint of a maximum of power production.
Parameters: - max_p – Minimum of the power production. May be an int, float or a list with the size of the period study
- time – period of the study
- cst_operated_unit_list – List of units on which the constraint will be applied. Might be empty.
-
add_power_production_total_minimum
(min_p, time, cst_operated_unit_list=None)[source]¶ To create the constraint of a minimum of power production considering all the units.
Parameters: - min_p – Minimum of the power production. May be an int, float or a list with the size of the period study
- time – period of the study
- cst_operated_unit_list – List of units on which the constraint will be applied. Might be empty.
-
add_temporary_stop
(time, start='YYYY-MM-DD HH:MM:SS', end='YYYY-MM-DD HH:MM:SS', period_index=None, cst_production_unit_list=None)[source]¶ To create the actor constraint giving the possibility to stop the production during a period.
Parameters: - start – start of the stop period
- end – end of the stop period
- period_index – period index for the stop period, to use instead of start and end
- cst_production_unit_list – List of units on which the constraint will be applied. Might be empty.
-
maximize_production
(obj_operated_unit_list=None, weight=1, pareto=False)[source]¶ To create the objective in order to maximize the production of the producer’s units (all or part of them).
Parameters: - obj_operated_unit_list – List of units on which the objective will be applied. Might be empty.
- weight – Weight coefficient for the objective
-
minimize_co2_emissions
(obj_operated_unit_list=None, weight=1, pareto=False)[source]¶ To create the objective in order to minimize the co2 emissions of the producer’s units (all or part of them). based on the quantity “co2_emission”
Parameters: - obj_operated_unit_list – list of the operated energy units on which the objective will be applied
- weight – weight of the objective
- pareto – if True, OMEGAlpes calculates a pareto front based on this objective (two objectives needed)
-
minimize_costs
(obj_operated_unit_list=None, weight=1, pareto=False)[source]¶ To create the objective in order to minimize the cost of the producer’s units (all or part of them).
Parameters: - obj_operated_unit_list – list of the operated energy units on which the objective will be applied
- weight – weight of the objective
- pareto – if True, OMEGAlpes calculates a pareto front based on this objective (two objectives needed)
-
minimize_operating_cost
(obj_operated_unit_list=None, weight=1, pareto=False)[source]¶ To create the objective in order to minimize the operating costs of the producer’s units (all or part of them).
Parameters: - obj_operated_unit_list – list of the operated energy units on which the objective will be applied
- weight – weight of the objective
- pareto – if True, OMEGAlpes calculates a pareto front based on this objective (two objectives needed)
-
minimize_production
(obj_operated_unit_list=None, weight=1, pareto=False)[source]¶ To create the objective in order to minimize the production of the producer’s units (all or part of them).
Parameters: - obj_operated_unit_list – List of units on which the objective will be applied. Might be empty.
- weight – Weight coefficient for the objective
- pareto – if True, OMEGAlpes calculates a pareto front based on this objective (two objectives needed)
-
minimize_starting_cost
(obj_operated_unit_list=None, weight=1, pareto=False)[source]¶ To create the objective in order to minimize the starting costs of the producer’s units (all or part of them).
Parameters: - obj_operated_unit_list – list of the operated energy units on which the objective will be applied
- weight – weight of the objective
- pareto – if True, OMEGAlpes calculates a pareto front based on this objective (two objectives needed)
-
minimize_time_of_use
(obj_operated_unit_list=None, weight=1, pareto=False)[source]¶ To create the objective in order to minimize the time of use of the producer’s units (all or part of them).
Parameters: - obj_operated_unit_list – List of units on which the objective will be applied. Might be empty.
- weight – Weight coefficient for the objective
- pareto – if True, OMEGAlpes calculates a pareto front based on this objective (two objectives needed)
-
power_consumption_maximum
(max_p, time, cst_operated_unit_list=None)[source]¶ - DEPRECATED: please use
add_power_production_total_maximum or
add_power_production_by_units_maximum instead
To create the actor constraint of a maximum of power consumption.
Parameters: - max_p – Maximum of the power consumption. May be an int, float or a list with the size of the period study
- time – period of the study
- cst_operated_unit_list – List of units on which the constraint will be applied. Might be empty.
-
power_consumption_minimum
(min_p, time, cst_operated_unit_list=None)[source]¶ - DEPRECATED: please use
add_power_production_total_minimum or
add_power_production_by_units_minimum instead
To create the actor constraint of a minimum of power consumption.
Parameters: - min_p – Minimum of the power consumption. May be an int, float or a list with the size of the period study
- time – period of the study
- cst_operated_unit_list – List of units on which the constraint will be applied. Might be empty.
-
Regulator_actors module¶
This module defines the operator_actor and its scope of responsibility
- One constraint is available :
- co2_emission_maximum
-
class
omegalpes.actor.regulator_actors.regulator_actors.
LocalAuthorities
(name)[source]¶ Bases:
omegalpes.actor.regulator_actors.regulator_actors.RegulatorActor
Description
LocalAuthorities class inherits from the basic class RegulatorActor. It focuses on local Authorities constraints
-
class
omegalpes.actor.regulator_actors.regulator_actors.
RegulatorActor
(name, verbose=True)[source]¶ Bases:
omegalpes.actor.actor.Actor
Description
RegulatorActor class inherits from the the basic class Actor. It enables one to model an actor who can add constraints on all energy units of the study case.Attributes
- name : name of the actor
-
add_co2_emission_maximum
(time, co2_max, cst_production_list)[source]¶ To create the actor constraint of a maximum of CO2 emission.
Parameters: - co2_max – Maximum of the CO2 emission. May be an int, float or a list with the size of the period study
- time – period of the study
- cst_production_list – List of production units on which the
constraint will be applied.
-
add_particles_emission_maximum
(time, particle_max, cst_production_list)[source]¶ To create the actor constraint of a maximum of CO2 emission.
Parameters: - particle_max – Maximum of the particle emission. May be an int, float or a list with the size of the period study
- time – period of the study
- cst_production_list – List of production units on which the
constraint will be applied.
-
class
omegalpes.actor.regulator_actors.regulator_actors.
StateAuthorities
(name)[source]¶ Bases:
omegalpes.actor.regulator_actors.regulator_actors.RegulatorActor
Description
StateAuthorities class inherits from the basic class RegulatorActor. It focuses on local Authorities constraints
The general classes helps to build the units, the model and to plot the results
general package¶
Please, have a look to the following general modules
Firstly, the main modules to build an energy optimisation model are presented :
Elements module¶
This module includes the optimization elements (quantities, constraints and objectives) formulated in LP or MILP
Quantity : related to the decision variable or parameter
Constraint : related to the optimization problem constraints 4 categories of constraints :
- Constraint: to define a constraint object
- DefinitionConstraint: to calculate and define quantities or for physical
constraints - TechnicalConstraint: linked with technical constraints - ActorConstraint: constraint decided by the actors 2 types of constraints: - Constraints : basic constraint - DynamicConstraint: basic constraint depending on the time
Objective : related to the objective function
-
class
omegalpes.general.optimisation.elements.
ActorConstraint
(exp, name='ActCST0', description='', active=True, parent=None)[source]¶ Bases:
omegalpes.general.optimisation.elements.Constraint
Description
Defining a category of constraint: ActorConstraint (see: DynamicConstraint, TechnicalConstraint) To model a constraint which is due to actor decisions. Must be different from Definition and Technical constraints. This kind of constraint is mainly a negotiable constraint.
example: to have a minimal level of energy consumption over a period. Constraint : min_energy
-
class
omegalpes.general.optimisation.elements.
ActorDynamicConstraint
(exp_t, t_range='for t in time.I', name='ActDynCST0', active=True, description='Actor and dynamic constraint', parent=None)[source]¶ Bases:
omegalpes.general.optimisation.elements.DynamicConstraint
,omegalpes.general.optimisation.elements.ActorConstraint
Description
Defining a category of constraint: ActorDynamicConstraint (see: DynamicConstraint, ActorConstraint) Must be different from Definition and Technical constraints. This kind of constraint is mainly a negotiable constraint.
example: to operate an energy unit only on defined periods. Constraint: daily_dynamic_constraint
-
class
omegalpes.general.optimisation.elements.
Constraint
(exp, name='CST0', description='', active=True, parent=None)[source]¶ Bases:
object
Description
Class that defines a constraint objectAttributes
- name: name of the constraint
- description: a description of the constraint
- active: False = non-active constraint; True = active constraint
- exp: (str) : expression of the constraint
- parent: (unit) : this constraint belongs to this unit
Note
Make sure that all the modifications on Constraints are made before adding the unit to the Model (OptimisationModel.addUnit()).
-
class
omegalpes.general.optimisation.elements.
DailyDynamicConstraint
(exp_t, time, init_time: str = '00:00', final_time: str = '23:00', name='daily_dynamic_constraint', description='daily dynamic constraint', active=True, parent=None)[source]¶ Bases:
omegalpes.general.optimisation.elements.ActorDynamicConstraint
Description
Class that defines a daily dynamic constraint for a time range
Ex: Constraint applying between 7am and 10:30pm
ex_cst = DailyDynamicConstraint(exp_t, time, init_h=”7:00”, final_h=”10:30”, name=’ex_cst’)
Attributes
- name (str) : name of the constraint
- exp_t (str) : expression of the constraint
- init_time (str) : starting time of the constraint in the format:
“HH:MM”, consistent with the dt value. - final_time (str) : ending time of the constraint in the format: “HH:MM”, consistent with the dt value. - description (str) : description of the constraint - active (bool) : defines if the constraint is active or not - parent (OptObject) : parent of the constraint
-
class
omegalpes.general.optimisation.elements.
DefinitionConstraint
(exp, name='DefCST0', description='Constraint for definitions', active=True, parent=None)[source]¶ Bases:
omegalpes.general.optimisation.elements.Constraint
Description
Defining a category of constraint: DefinitionConstraint for imposed mathematical relation constraints, which may be physical. They are used to calculate and define quantities, or to reprensent physical phenomenon. Must be different from Technical and Actor constraints. This kind of constraint is by nature non-negotiable
Definition constraint: added to the model to calculate a quantity or define it considering an other.
example: the definition of e_tot: calc_e_tot (e_tot = LpSum(e))Physical constraint: to model a constraint which is linked to the physics.
example: not implemented yet, see DefinitionDynamicConstraint
-
class
omegalpes.general.optimisation.elements.
DefinitionDynamicConstraint
(exp_t, t_range='for t in time.I', name='DefDynCST0', description='dynamic constraint for definition', active=True, parent=None)[source]¶ Bases:
omegalpes.general.optimisation.elements.DynamicConstraint
,omegalpes.general.optimisation.elements.DefinitionConstraint
Description
Defining a category of constraint: DefinitionDynamicConstraint on the time. (see: DynamicConstraint, DefinitionConstraint) Must be different from Technical and Actor constraints. This kind of constraint is by nature non-negotiable
DefinitionDynamicConstraint: to calculate a quantity or define it considering an other quantity and depending on the time.
example: the definition of a capacity def_capacity (energy[t] <= capacity at each time step t)- Physical constraint: to model physical constraints.
- example: the power balance in an Energy node: power_balance
(LpSum(p_production_unit[t] for the set of production units connected to the energy node) = LpSum(p_consumption_unit[t] for the consumption units connected to the energy node at each time step t)
-
class
omegalpes.general.optimisation.elements.
DynamicConstraint
(exp_t, t_range='for t in time.I', name='DCST0', description='dynamic constraint', active=True, parent=None)[source]¶ Bases:
omegalpes.general.optimisation.elements.Constraint
Description
Class that defines a constraint depending on the time. NB : Mandatory for PuLP
-
class
omegalpes.general.optimisation.elements.
ExtDynConstraint
(exp_t, t_range='for t in time.I', name='EDCST0', active=True, description='Non-physical and dynamic constraint', parent=None)[source]¶ Bases:
omegalpes.general.optimisation.elements.DynamicConstraint
,omegalpes.general.optimisation.elements.ExternalConstraint
Description
DEPRECATED: please use ActorDynamicConstraintDefining a constraint both external and dynamic (see: DynamicConstraint, ExternalConstraint)
-
class
omegalpes.general.optimisation.elements.
ExternalConstraint
(exp, name='ExCST0', description='', active=True, parent=None)[source]¶ Bases:
omegalpes.general.optimisation.elements.Constraint
Description
DEPRECATED: please use ActorConstraint- Defining a special type of constraint: the external constraint
- This constraint does not translate a physical constraint
- This constraint defines an external constraint, which could be relaxed
-
class
omegalpes.general.optimisation.elements.
HourlyDynamicConstraint
(exp_t, time, init_h: int = 0, final_h: int = 24, name='HDCST0', description='hourly dynamic constraint', active=True, parent=None)[source]¶ Bases:
omegalpes.general.optimisation.elements.ActorDynamicConstraint
Description
DEPRECATED: please use DailyDynamicConstraintClass that defines an dynamic contraint for a time range
Ex: Constraint applying between 7am and 10pm
ex_cst = HourlyDynamicConstraint(exp_t, time, init_h=7, final_h=22, name=’ex_cst’)
Attributes
- name (str) : name of the constraint
- exp_t (str) : expression of the constraint
- init_h (int) : hour of beginning of the constraint [0-23]
- final_h (int) : hour of end of the constraint [1-24]
- description (str) : description of the constraint
- active (bool) : defines if the constraint is active or not
- parent (OptObject) : parent of the constraint
-
class
omegalpes.general.optimisation.elements.
Objective
(exp, name='OBJ0', description='', active=True, weight=1, unit='s.u.', pareto=False, parent=None)[source]¶ Bases:
object
Description
Class that defines an optimisation objectiveAttributes
- name (str) :
- exp (str) :
- description (str) :
- active (bool) :
- weight (float) : weighted factor of the objective
- parent (unit)
- unit (str) : unit of the cost expression
- pareto (str) : if True, OMEGAlpes calculates a pareto front based on
- this objective (two objectives needed)
Methods
- _add_objectives_list()
- _add_pareto_objectives_list()
Note
Make sure that all the modifications on Objectives are made before adding the unit to the OptimisationModel, otherwise, it won’t be taken into account
-
class
omegalpes.general.optimisation.elements.
Quantity
(name='var0', opt=True, unit='s.u', vlen=None, value=None, description='', vtype='Continuous', lb=None, ub=None, parent=None)[source]¶ Bases:
object
Description
Class that defines what is a quantity. A quantity can wether be a decision variable or a parameter, depending on the opt parameterAttributes
name (str) : the name of the quantity
description (str) : a description of the meaning of the quantity
vtype (PuLP) : the variable type, depending on PuLP
- LpBinary (binary variable)
- LpInteger (integer variable)
- LpContinuous (continuous variable)
vlen (int) : size of the variable
unit (str) : unit of the quantity
opt (binary)
- True: this is an optimization variable
- False: this is a constant - a parameter
value (float, list, dict) : value (unused if opt=True)
ub, lb : upper and lower bounds
parent (OptObject) : the quantity belongs to this unit
Note
Make sure that all the modifications on Quantity are made before adding the unit to the Model
-
class
omegalpes.general.optimisation.elements.
TechnicalConstraint
(exp, name='TechCST0', description='Technical constraint', active=True, parent=None)[source]¶ Bases:
omegalpes.general.optimisation.elements.Constraint
Description
Defining a category of constraint: TechnicalConstraint. To model a constraint which is linked to technical issues Must be different from Definition and Actor constraints. This kind of constraint is mainly a negotiable constraint.
example: not implemented yet, see TechnicalDynamicConstraints
-
class
omegalpes.general.optimisation.elements.
TechnicalDynamicConstraint
(exp_t, t_range='for t in time.I', name='TechCST0', active=True, description='Technical and dynamic constraint', parent=None)[source]¶ Bases:
omegalpes.general.optimisation.elements.DynamicConstraint
,omegalpes.general.optimisation.elements.TechnicalConstraint
Description
Defining a category of constraint: TechnicalDynamicConstraint depending on the time. (see: DynamicConstraint, TechnicalConstraint) Must be different from Definition and Actor constraints. This kind of constraint is mainly a negotiable constraint.
example: an energy unit may not be able to stop in one time step, but several. The power decreases as a ramp shape: set_max_ramp_down
Core module¶
This module define the main Core object on which the energy units and actors will be based
-
class
omegalpes.general.optimisation.core.
OptObject
(name='U0', description='Optimization object', verbose=True)[source]¶ Bases:
object
Description
OptObject class is used as an “abstract class”, i.e. it defines some general attributes and methods but doesn’t contain variable, constraint nor objective. In the OMEGAlpes package, all the subsystem models are represented by a unit. A model is then generated adding OptObject to it. Variable, objective and constraints declarations are usually done using the __init__ method of the OptObject class.Attributes
- name
- description
- _quantities_list : list of the quanitities of the OptObject (active or not)
- _constraints_list : list of the constraints of the OptObject(active or not)
- _technical_constraints_list : list of the constraints of the OptObject (active or not)
- _objectives_list : list of the objectives of the OptObject (active or not)
Methods
- __str__: defines the
- __repr__: defines the unit with its name
- get_constraints_list
- get_constraints_name_list
- get_external_constraints_list
- get_external_constraints_name_list
- get_objectives_list
- get_objectives_name_list
- get_quantities_list
- get_quantities_name_list
- deactivate_optobject_external_constraints
Note
The OptObject class shouldn’t be instantiated in a python script, except if you want to create your own model from the beginning. In this case, one should consider creating a new class NewModel(OptObject).
-
deactivate_optobject_external_constraints
(ext_cst_name_list=None)[source]¶ Enable to remove an external constraint linked with an OptObject
Parameters: ext_cst_name_list – list of external constraint that would be removed
-
get_actor_constraints_list
()[source]¶ Get the technical constraints associated with the unit as a dictionary shape [‘constraint_name’ , constraint]
-
get_actor_constraints_name_list
()[source]¶ Get the names of the external constraints associated with the unit
-
get_constraints_list
()[source]¶ Get the constraints associated with the unit as a dictionary shape [‘constraint_name’ , constraint]
-
get_objectives_list
()[source]¶ Get objectives associated with the unit as a dictionary shape [‘objective_name’ , objective]
-
get_quantities_list
()[source]¶ Get the quantities associated with the unit as a dictionary shape [‘quantity_name’ , quantity]
Time module¶
This module creates the Time object
-
class
omegalpes.general.time.
TimeUnit
(start='01/01/2018', end=None, periods=None, dt=1, verbose=True)[source]¶ Bases:
object
Description
Class defining the studied time period.Attributes
- DATES : dated list of simulation steps
- DT : delta t between values in hours (int or float), i.e. 1/6 will be 10 minutes.
- LEN : number of simulation steps (length of DATES)
- I : index of time ([0 : LEN])
-
get_date_for_index
(index)[source]¶ Getting a date for a given index
Parameters: index – int value for the index of the wanted dated, between 0 and LEN (it must be in the studied period)
-
get_days
¶ Getting days for the studied period
Return all_days: list of days of the studied period
-
get_index_for_date
(date='YYYY-MM-DD HH:MM:SS')[source]¶ Getting the index associated with a date
Parameters: date – date the index of is wanted. Format YYYY-MM-DD HH:MM:SS, must be within the studied period and consistent with the timestep value
-
get_index_for_date_range
(starting_date='YYYY-MM-DD HH:MM:SS', end=None, periods=None)[source]¶ Getting a list of index for a date range
Parameters: - starting_date – starting date of the wanted index
- end – ending date of the wanted index
- periods – number of periods from the starting_date of the wanted index
Return index_list: list of indexes for the given dates
Model module¶
This module enables to fill the optimization model and formulate it in LP or MILP based on the package PuLP (LpProblem)
-
class
omegalpes.general.optimisation.model.
OptimisationModel
(time, name='optimisation_model')[source]¶ Bases:
pulp.pulp.LpProblem
Description
This class includes the optimization model formulated in LP or MILP based on the package PuLP (LpProblem)-
add_nodes
(*nodes)[source]¶ Add nodes and all connected units to the model Check that the time is the same for the model and all the units
Parameters: nodes – EnergyNode
-
add_nodes_and_actors
(*nodes_or_actors)[source]¶ Add nodes, actors and all connected units to the model Check that the time is the same for the model and all the units
Parameters: nodes_or_actors – EnergyNode or Actor type
-
solve_and_update
(solver: pulp.apis.core.LpSolver = None, find_infeasible_cst_set=False, pareto_step=0.1) → None[source]¶ Solves the optimization model and updates all variables values.
Parameters: - solver (LpSolver) – Optimization solver
- pareto_step – if there are pareto objectives, you can change the step to calculate the pareto front
-
-
omegalpes.general.optimisation.model.
check_if_unit_could_have_parent
(unit)[source]¶ Checks if the unit has an associated parent
Parameters: unit – unit which parents will be checked
-
omegalpes.general.optimisation.model.
compute_gurobi_IIS
(gurobi_exe_path='C:\\gurobi810\\win64\\bin', opt_model=None, MPS_model=None)[source]¶ Identifies the constraints in a .ilp file
Parameters: - gurobi_exe_path – Path to the gurobi solver “gurobi_cl.exe”
- opt_model – OptimisationModel to whom compute IIS
- MPS_model – name of the mps model
Then, utils methods are developped and are presented in the following module:
Input Data module¶
This module includes the following utils for input data management
- It contains the following methods:
- select_csv_file_between_dates() : select data in a .csv file between two dates
- read_enedis_data_csv_file() : select and rearrange the data in a .csv file of Enedis (the French Distribion System Operator company), possibly between two dates
-
omegalpes.general.utils.input_data.
read_enedis_data_csv_file
(file_path=None, start=None, end=None)[source]¶ Rearrange the Enedis data in cvs file in oder to have a Dataframe of the following form
DD MM YYYY HH:00 ; a DD MM YYYY HH:30 ; b …
Parameters: - file_path – path of the file to rearrange
- start – DD MM YYYY HH:00 : first date which should be considered
- end – DD MM YYYY HH:00 : last date which should be considered
Returns: df_list: the data as a list
-
omegalpes.general.utils.input_data.
resample_data
(input_list=None, dt_origin=1.0, dt_final=1.0, fill_config='ffill', pick_config='mean')[source]¶ Changing data set in a dt_origin time step into data set in a dt_final time step :param input_list: list to be resample (list or dict) :param dt_origin: the time step of the input dataset (in hours) :param dt_final: the wanted time step for the output dataset (in hours) :param fill_config: choose the configuration of filling when dt_origin > dt_final by default: ffil, keeping the same data over the time steps other way: interpolate, taking into account the time steps) :param pick_config: choose the configuration of picking when dt_origin < dt_final by default: “mean” which determines the mean value of the time steps to be reduced :return: output_list: resampled list (pandas Series)
-
omegalpes.general.utils.input_data.
select_csv_file_between_dates
(file_path=None, start='DD/MM/YYYY HH:MM', end='DD/MM/YYYY HH:MM', v_cols=[], sep=';')[source]¶ Select data in a .csv file between two dates
Parameters: - file_path – path of the file to rearrange
- start – DD MM YYYY HH:00 : first date which should be considered
- end – DD MM YYYY HH:00 : last date which should be considered
- v_cols – columns which should be considered
Returns: df: a dataframe considering the dates
Output Data module¶
This module includes the following utils for output data management
- It contains the following methods:
- save_energy_flows() : Save the optimisation results in a .csv file
-
omegalpes.general.utils.output_data.
save_energy_flows
(*nodes, file_name=None, sep='\t', decimal_sep='.')[source]¶ Save the optimisation results in a .csv file
Parameters: - nodes – list of the nodes from which should be collected the data
- file_name – name of the file to save the data
- sep – separator for the data
- decimal_sep – separator dor the decimals of the data
Plots module¶
This module includes the following display utils:
- plot_node_energetic_flows() : enables one to plot the energy flows through an EnergyNode
- plot_energy_mix() : enables one to plot the energy flows connected to a node
- plot_pareto2D() : enables one to plot a pareto front based on two quantities
- plot_quantity() : enables one to plot easily a Quantity
- plot_quantity_bar() : enables one to plot easily a Quantity as a bar
- sum_quantities_in_quantity() : enables one to to plot several quantities in one once the optimisation is done
-
omegalpes.general.utils.plots.
plot_node_energetic_flows
(node)[source]¶ Description
This function allows to plot the energy flows through an EnergyNode
The display is realized :
- with histograms for production and storage flow
- with dashed curve for consumption flow
Parameters: node – EnergyNode
-
omegalpes.general.utils.plots.
plot_pareto2D
(model, quantity_1, quantity_2, title=None)[source]¶ Description
Plot a Pareto front for two quantities. Before using it, you should have added in your model two objectives with the pareto parameter activated (pareto=True)
Paramters
Parameters: - model –
- quantity_1 – the first quantity for the pareto front
- quantity_2 – the second quantity for the pareto front
- title –
-
omegalpes.general.utils.plots.
plot_quantity
(time, quantity, fig=None, ax=None, color=None, label=None, title=None)[source]¶ Description
Function that plots a OMEGAlpes.general.optimisation.elements.QuantityParameters
- time: TimeUnit for the studied horizon as defined in general.time
- quantity: OMEGAlpes.general.optimisation.elements.Quantity
- fig: Figure as defined in matplotlib.pyplot.Figure
- ax: axes as defined in matplotlib.pyplot.Axes
- color: color of the plot
- label: label for the quantity
- title: title of the plot
Returns
- arg1 the matplotlib.pyplot.Figure handle object
- arg2 the matplotlib.pyplot.Axes handle object
- arg3 the matplotlib.pyplot.Line2D handle object
-
omegalpes.general.utils.plots.
plot_quantity_bar
(time, quantity, fig=None, ax=None, color=None, label=None, title=None)[source]¶ Description
Function that plots a OMEGALPES.general.optimisation.elements.Quantity as a barAttributes
- quantity is the OMEGALPES.general.optimisation.elements.Quantity
- fig could be None, a matplotlib.pyplot.Figure or Axes for multiple plots
Returns
- arg1 the matplotlib.pyplot.Figure handle object
- arg2 the matplotlib.pyplot.Axes handle object
- arg3 the matplotlib.pyplot.Line2D handle object
-
omegalpes.general.utils.plots.
sum_quantities_in_quantity
(quantities_list=[], tot_quantity_name='sum_quantity')[source]¶ Description
Function that creates a new quantity gathering several values of quantities Should be used in order to plot several quantities in one once the optimisation is doneAttributes
- quantities : a list of Quantities (OMEGALPES.general.optimisation.elements.Quantity)
- tot_quantity_name : string : name of the new quantity
Returns
- tot_quantity : the new quantity created and filled
Maths module¶
This module includes the following maths utils
- It contains the following methods:
- def_abs_value() : Define easily absolute value for quantity
-
omegalpes.general.utils.maths.
def_abs_value
(quantity, q_min, q_max)[source]¶ Parameters: - quantity – Quantity whose absolute value is wanted
- q_min – Minimal value of the quantity (negative value)
- q_max – Maximal value of the quantity (positive value)
Returns: A new Quantity whose values equal absolute values of the initial Quantity
OMEGAlpes Graphical Representation¶
The energy systems developed in OMEGAlpes are describes following a specified graph representation.
Energy Unit representation¶
The energy units are describes as rectangles as presented just below. The graph is adapted considering if the unit is a variable or a fixed energy unit.
A colour may be added to specify the carrier of the energy unit like gas (yellow), thermal (red), electricity (blue).
Conversion units use the former representation inside a green box as multi-carrier energy units. Have a look to the representation for ElectricalToHeat and HeatPump energy units
Reversible units are represented as single units for simplicity purpose, even if they do include a production unit and a consumption unit like conversion units. The power flows of the production and consumption units in the reversible unit are represented with double arrows, while storage units’ power flow is represented with a single arrow with a double head. Finally, reversible conversion units are represented based on the former graphical representations.
Representing all the energy unit¶
In order to link the energy units, energy nodes and arrows should be used. It is possible to highlight the variable which may be optimised by the system or which is interesting for the user.
Finally, constraints and objectives can be added on the model with the following representation
Please, have a look to the examples to see if applications of this graphical representation OMEGAlpes Examples Documentation
Note
This graph representation is not used yet as a graphical user interface but we hope that it will be in the near future.
What’s new in the latest versions¶
The new version of OMEGAlpes v0.4.0 is available! The release is from 5th of January 2021.
What’s new in version 0.4.0¶
Version available since 05 01 2021
Bug fixed¶
- PuLP library version changed from >=1.6.10 to 2.1: changed imports in general.optimisation.model, as well as requirements.txt, setup.py and associated docs.
New functionalities¶
Energy¶
- e_max and e_min parameters now add technical constraints (set_e_min and set_e_max) when set to a value.
- e_tot upper bound is now set as the p_max value times the number of hours over the studied time period. The lower bound is either set to 0, or minus the upper bound if the unit is a storage unit.
- the add methods put in place with parameters are now _add methods.
- set_e_max constraint changed to set_e_max_period (respectively e_min)
- add imaginary parameter in SeveralConsumptionUnit
- add new parameters : particle_emission (quantity) and rr_energy (True/False renewable and recovery energy unit)
- add imaginary parameter in SeveralProductionUnit
- add get_input_poles and get_output_poles
General¶
- add lpfics (Linear Programming : Find Incompatible Constraint Sets) to
help finding incompatible constraint sets in OMEGAlpes projects
- add plot_2D_pareto method
Actors¶
Update the Actor structure - move Prosumer class into prosumer_actors.py - move Supplier class into supplier_actors.py
- create a ProjectDeveloper class as a new type of actor
- add grid_operator_actors.py
- add prosumer_actors.py
- add supplier_actors.py
- use add_power_consumption_total_minimum or add_power_consumption_by_unit_minimum instead of add_power_consumption_minimum
- use add_power_consumption_total_maximum or add_power_consumption_by_unit_maximum instead of add_power_consumption_maximum
- use add_power_production_total_minimum or add_power_production_by_unit_minimum instead of add_power_production_minimum
- use add_power_production_total_maximum or add_power_production_by_unit_maximum instead of add_power_production_maximum
- add add_temporary_stop
Deprecated¶
- the name of the function set_operating_time_range changed to add_operating_time_range for code consistency. set_operating_time_range is now deprecated.
Energy¶
- delete SeveralImaginaryConsumptionUnit (use imaginary parameter in SeveralConsumptionUnit instead)
- delete SeveralImaginaryProductionUnit (use imaginary parameter in SeveralProductionUnit instead)
Actors¶
- add_power_consumption_minimum (replaced by add_power_consumption_total_minimum)
- add_power_consumption_maximum (replaced by add_power_consumption_total_maximum)
- add_power_production_minimum (replaced by add_power_production_total_minimum)
- add_power_production_maximum (replaced by add_power_production_total_minimum)
Contributors¶
Lou Morriet, Sacha Hodencq
Information about the latest versions¶
What’s new in version 0.3.1¶
Version available since 13th March 2020
Bug fixed¶
- Change remaining pmin and pmax parameters into p_min and p_max of EnergyUnits in conversion units
- Add verbose parameter set to False in general/utils/input_data/resample_data() Timeunit
- Change expected type of *units in connect_units() from list to EnergyUnit
New functionalities¶
- Add verbose parameter added to TimeUnit in order to be able not to print the studied time period.
Add three classes to make a distinction between different kind of constraints: DefinitionConstraint, TechnicalConstraints and ActorConstraint. Considering the DynamicConstraints, three other classes have been created:
- DefinitionDynamicConstraint,
- TechnicalDynamicConstraints, and
- ActorDynamicConstraint.
Contributors¶
Lou Morriet, Sacha Hodencq
What’s new in version 0.3.0¶
Version available since 18th February 2020
Bug fixed¶
- Change pmin and pmax parameters of VariableEnergyUnits and its derivatives (SeveralEnergyUnit, VariableConsumptionUnit, SeveralConsumptionUnit, VariableProductionUnit, SeveralProductionUnit) into p_min and p_max
New Functionalities¶
- EnergyUnit has “minimize_exergy_destruction” and “minimize_exergy” objectives
- FixedEnergyUnit takes into account Dataframe for power values
- ElectricalConversionUnit created in conversion_units
- ReversibleUnit created in a dedicated package in the energy.units folder. ReversibleUnit is a new type of energy unit that can both produce or consume energy, but not at the same time.
- AssemblyUnits created in the energy_units package as an assembly of one or several production, consumption and/or reversible unit. It is the parent class of both conversion units and reversible units.
- AssemblyUnit has “minimize_exergy_destruction” objective
- ReversibleConversionUnit created in conversion units, enabling reversible power flows (i.e. an electrical transformer). It is an AssemblyUnit of two reversible units, one qualified as upward and another downward.
- StorageUnit has a new attribute self_disch_t
- Exergy module created. Integration of the exergy approach in OMEGAlpes. With the code of this branch, OMEGAlpes will be able to quantify thermal and electrical exergy, as well as the destroyed exergy within any production, consumption, storage or conversion unit.
- HourlyDynamicConstraint deprecated and changed into DailyDynamicConstraint, now used in set_operating_hours() (that replaced add_operating_hours() )
- Titles as parameters in plot_quantities()
- Add function get_value() to get int or list
- Add get_value_with_dates() to get a dataframe
- Add resample_data() to change the time step for a data set
Deprecated¶
- Deprecate add_operating_time_range() in class EnergyUnit
- Deprecate HourlyDynamicConstraint in module Elements
Contributors¶
Lou Morriet, Sacha Hodencq, Mathieu Brugeron, Jaume Fito
OMEGAlpes Examples¶
Please click on the following link to have a look to OMEGAlpes examples and study cases: OMEGAlpes Examples Documentation
Acknowledgments¶
Vincent Reinbold - Library For Linear Modeling of Energetic Systems : https://github.com/ReinboldV
Mathieu Brugeron
This work has been partially supported by the CDP Eco-SESA receiving fund from the French National Research Agency in the framework of the “Investissements d’avenir” program (ANR-15-IDEX-02) and the VALOCAL project (CNRS Interdisciplinary Mission and INSIS)