File Exchange

image thumbnail

Systems-Level Microgrid Simulation from Simple One-Line Diagram

version (12.8 MB) by Jonathan LeSage
Example simple Microgrid with library of PQ-based Renewables and Diesel GenSets.


Updated 15 May 2018

View License

This example is used in the "Microgrid System Development and Analysis" Video Series. This particular example is used in "Part 3: Using Simscape Power Systems to Simulate Microgrids":
Simscape Power Systems can be used to schematically represent a one-line microgrid diagram using blocks that represent different distributed energy resources (DERs). The DERs in this example include renewables, such as solar, a diesel GenSet, and an energy storage system (ESS).

Using the simple microgrid, you see how desktop simulation can be used to subject the distribution system with residential load changes or unintentional islanding of the microgrid. The included slides detail other common workflows for systems-level microgrid simulation. Using Simulink Real-time, this simple microgrid can quickly be migrated to a real-time machine for hardware-in-the-loop testing.

Cite As

Jonathan LeSage (2021). Systems-Level Microgrid Simulation from Simple One-Line Diagram (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (23)

jorge manel

Hi Jonathan!

Im using MatLab R2016a, is it possible for you to send me an older version of this to

Thank you in advance !!

Ali Alramadhan

Rinaldi Sabirin

Thank you so much, it is really big help


Hello, I am using some blocks from the example microgrid library and not getting good results. For example when I use wind turbine block, I get only negative output power output from the wind turbine at a constant speed of 8 m/s.


how can i know codes written in detail?

nivedita Singh

Hey Jonathan, first of all, thank you so much for this simulation model.
Can you share your own Simulink library created because it would be great help for me to understand the controlling part of every system you created as I am facing lots of problems while creating a model.

ghizlene ghizou

Meme Young

kapil gandhi

can you please export to matlab 2017a version and mail me ?

Gao Yang

Murillo Vargas

xinjue junping

Anto JosephRaj

Akash Menon

Hi Jonathan! Great models and good work!

I had a quick question- when I try to use the PQ model and EMT model battery storage system the controller time step is a variable called 'Ts_Control'

But this doesn't seem to be defined- any idea why? Is there something missing or do I have to define a variable for is?
Looking forward to haring from you!


For Latest Simulation Projects,Please Contact


Kim Hinders

krishna chaitanya

Elutunji Buraimoh

Cesar Negri

Ihechiluru Anya

MATLAB Release Compatibility
Created with R2017b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!