File Exchange

image thumbnail

DC Microgrid Demo

version 1.0.0 (960 KB) by Chunpeng LI
This will show the fundamentals of DC microgrid control integrating distributed generators and converters.


Updated 26 Oct 2018

View License

The model includes: local slack bus, PV system, batteries, and DC loads.
Local slack bus uses a simplified VSC converter connected with the AC grid.
(A detailed VSC+AC grid model decreases the running speed, if you want a detail model, please contact me.)
PV system uses a standard PV model + a boost converter.
Battery uses a standard Li-ion battery model + a dual-active-bridge converter.
Demands are connected through buck converters.
The voltage on the DC bus is controlled by the grid-interconnected VSC, "Local slack bus".

You can play with the swiches on the bus, and the control in the components to see the power flow.

Cite As

Chunpeng LI (2020). DC Microgrid Demo (, MATLAB Central File Exchange. Retrieved .

Li, Chunpeng, et al. “Metrology Requirements of State-of-the-Art Protection Schemes for DC Microgrids.” The Journal of Engineering, vol. 2018, no. 15, Institution of Engineering and Technology (IET), Oct. 2018, pp. 987–92, doi:10.1049/joe.2018.0254.

View more styles

Comments and Ratings (29)

Jack chalk

I have a question and I will be grateful if you lead me
how can I simulate fault on this or generally on any dc microgrid in MatLab?


I have been trying to learn more about DC microgrids for one of my power electronics courses.Is there a paperwork related to this model, since I am having trouble understanding it. If yes, can you please mail it to

lucky zeng

Thank you for the upload,
I actually need a detailed VSC+AC grid model.If so please send it to me sander, it would help me alot!
Kind regards

lucky zeng

Oleg Belyi

Thanks for uploading!

Analyzing your model "DC microgrid"
and found in it a problem with the functioning of the battery:
- the charge level graph is not displayed correctly
- after three charge / discharge cycles, the battery stops functioning.

Did you encounter these problems with the model?
In the description for the model, you wrote that you can send a more detailed model, can you see it somewhere?

Sincerely, Oleg Belyi.

Oleg Belyi

Thank you for the upload, I actually need a DC microgrid with a DC-link, do you have that model? if yes please email it to me at
Thank you so much

Majesty Qiu

Hello C. Li

Thank you for sharing this model.
Do you have any related paperwork for this model?
If so please send it to me, it would help me alot!

Kind regards

Gao Yang

Sairy Sairy

Shuren Wang

jakey bush

mantap broooo

Amine Salhi

Thank you for the upload, I actually need a dual active bridge connected to a battery and an a DC-link, do you have that model ? if yes please email it to me at
Thank you so much

Jinwook Kim

David Kaija

Ilber Puci

Chunpeng LI

Thanks for Five Stars! I'll keep hard working and share more of my models.

Alex Bol

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