Most of the time, we rely on the traditional power grid as our main energy source. But when massive blackouts occur, organizations and communities need to rely on power systems that are secure and flexible.
Moreover, renewable energy sources like wind, photovoltaic power plants and others do not provide constant power output and they are dependent on the weather, causing power fluctuation in the power grids.
Microgrids — which operate as part of the traditional grid or independently — are an ingenious solution that can lead to fewer blackouts, greater cost savings, and less dependence on fossil fuels.
What are we creating in this application?
In this application, we will show how to open and run a defined set of microgrid configurations with several specific control strategies equipped with dynamic optimization. It consists of Modelica models, Jupyter notebooks and web applications.
You will learn how to:
- Install all application parts
- Run optimization models
- Run Jupyter notebooks
This version is intended for the cloud or on-premise version of Modelon Impact.
This guide explains how to install a custom function to your Modelon Impact Workspace and how to run the optimization examples with either Jupyter Notebook or said custom function.
This Tutorial assumes a valid license for the MA57 solver. If this license is not available, you may switch to the MUMPS solver. See here
- Add Optimize Microgrid custom function by opening the ThermalPower library in Impact and downloading
- Open JupyterLab from the ⋮⋮⋮ button (Apps) on the top right to upload the downloaded file to
("~" refers to your home folder)
This can be done by dragging the file from your "Downloads" folder to the File Browser pane in JupyterLab.
- Restart the Modelon Impact server by signing off and on from ModelonImpact
.py file needs to be on the top level. If
.py files are in a subfolder (e.g. impact/custom_function/custom_functions) then Modelon Impact won’t find them.
To run our JupyterNotebook optimization notebooks, install the "Optimize Microgrid" custom function as described here and make sure that it runs.
Installing and running the Jupyter Notebook requires a minimum of familiarity with Python.
Microgrid optimization notebook can be found in the ThermalPower library in Impact at
Upload it to any location in your home folder by opening JupyterLab from the ⋮⋮⋮ button (Apps) on the top right and dragging the file to the file browser within Jupyter Lab (left pane)
Microgrid-Optimization.ipynbin the JupyterLab app
Navigate to the section "4.1. Workspace name and dependencies" and change the workspace name to the name of your actual workspace, by changing the line
ws='Test2208' # workspace name
Click the ⏩ button to execute all code cells in that notebook
The Microgrid library includes several example models placed within
ThermalPower.MicroGrid.Examples. The whole package includes detailed documentation and description explaining
the background, purpose and results of the specific examples.
Click here to find out, how to access the library documentation.
The optimization models can be run using below approach:
Make sure you followed the steps to install the custom functions explained here
Create a new workspace "MicrogridTutorial".
Duplicate ThermalPower.MicroGrid.Examples.Simulation.EconomicDispatch model into your workspace.
Go to Experimentation mode and select the custom function Optimize Microgrid**.
Run the simulation.
Modelon provides a commercial "ma57" solver on a trial basis to interested customers.
If you do not have the "ma57" license, you may fail to run the Microgrid examples in TPL 1.24. In that case, change to the open source "mumps" solver by disabling the
use_ma57 setting in the Modelica optimizer model. (see screenshot below)