The Microgrids.m package allows simulating the energetic operation of an isolated microgrid, returning economic and operation indicators.
Repository structure:
- engine folder: all the application-independant code
- application folder: one Microgrid project example, to be adapted by the user to its own application case
Running the example scripts in the application
folder (or any other) requires having the engine
folder in the Matlab search path. For convenience, this is done a the beginning of each main_*.m
script by calling addpath
, but this can be removed once/if it's already done.
Microgrids.m
can model a microgrid project consisting of:
- One load (described by a time series)
- One dispatchable generator (e.g. Diesel or hydrogen-powered)
- One energy storage (battery)
- One non-dispatchable solar source also modeled from a time series (wind not yet supported)
The energy dispatch at each instant of the simulated operation is a simple “load following” rule-based control. The load is power in priority from the dispatchable sources, then the battery, and only using the dispatchable generator as a last recourse.
Microgrids.m
is part of the Microgrids.X project
which provides sibling packages in other languages (e.g. in Python)
to better serve the need of different users.
Compared to Python and Julia packages, the Matlab version Microgrids.m
is a bit behind.
For example, it cannot (yet) simulate multiple non-dispatchable sources (e.g wind AND solar power).
See the application folder for an example which walks through:
- the data structure to describe a Microgrid project:
define_mg.m
function - simulate the micgrid and display the results:
main_sim.m
script which callssim_mg
function - optimize the sizing:
main_optim.m
script (and variantsmain_optim_*.m
)
The code is meant to run both on Matlab and Octave, under Windows and Linux.
The bash script Matlab_code_check.sh can search for some incompatible code patterns.
For simulating a Microgrid project, either Matlab or Octave can be be used. However, for optimization, which requires evaluating many sizings, Matlab is preferable because Octave is about 400× slower to run the simulator. This translates in the same relative difference for optimization, but amplified by the number of iterations. Simply said, a sizing optimization using 1000 iterations should take:
- about 0.5 s with Matlab → allows quick trial and error, iterative changes...
- about 200 s with Octave → can only be run a few times a day
People who want high performance and an open source toolchain should look at the Julia sibling package Microgrids.jl).
Writing cost factors in an Excel table with xlswrite
requires Matlab.
Also, the multiobjective sizing optimizations currently require Matlab (muliobjective optimization algorithm to be found for Octave).
The development of Microgrids.jl (sibling package in Julia) was first led by Evelise de Godoy Antunes. She was financed in part by the Coordenação de Aperfeiçoamento de Pessoal de Nı́vel Superior - Brasil (CAPES) – Finance Code 001, by Conselho Nacional de Desenvolvimento Cientı́fico e Tecnológico - Brasil (CNPq) and by the grant “Accélérer le dimensionnement des systèmes énergétiques avec la différentiation automatique” from GdR SEEDS (CNRS, France).