File Exchange

image thumbnail

Hybrid AC/DC microgrid (HMG) test system simulation

version 1.0.5 (2.76 MB) by L. Ortiz
In this model, a Microgrid test system based on the 14-busbar IEEE distribution system is proposed.


Updated 12 Feb 2020

View License

This AC/DC HMG has two AC voltage distribution levels (the primary level is 13,8 kV and the secondary level is 220 V) and one DC distribution level (300V). The AC MG operates at a frequency of 60 Hz.
This test system simulation includes:
• One diesel generator,
• Two photovoltaic (PV) systems,
• Two battery energy storage system,
• Various linear and non-linear loads.

Cite As

Ortiz, Leony, et al. “Hybrid AC/DC Microgrid Test System Simulation: Grid-Connected Mode.” Heliyon, vol. 5, no. 12, Elsevier BV, Dec. 2019, p. e02862, doi:10.1016/j.heliyon.2019.e02862.

View more styles

L. Ortiz (2020). Hybrid AC/DC microgrid (HMG) test system simulation (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (27)

Asif Rashid

Sir L.Ortiz,

I am currently trying to download and install any of the matlab version as recommended by you. If you have its backup then please also upload if possible. your model is very helpful for my research . Thankyou Sir

L. Ortiz

Hello, dear Asif
Possibly, the cause of your problem is the version of Matlab you are using. I recommend a new version: R2017, R2018 or R2019.

Asif Rashid

I am using 2014b version of MATLAB. is that might be the cause of problem. please guide me

Excellent work!!! Very useful tool.

Gao Yang

The model has really been useful on an application and research I am currently developing, Thank you so much

Alex Aguila


L. Ortiz

Dear Diego,

The model presented in this paper is a Hybrid Microgrid (HMG) composed of different types of distributed generation sources and energy storage systems. Additionally, other types such as EV, CHP, wind generation among others will be included in future research. With this in mind, you can design and test on this model a virtual power plant (VPP) using a centralized control system that brings together all the microgeneration so that they operate together. Additionally, you would also be able to intertwine multiple sources that are interconnected in a smaller area such as MG 1, MG 2 or DC MG.

Very interesting tool for microgrids simulation; is it possible to apply the model for electrical power systems that contained virtual power plants?

Ramon Perez

This model fully presents the components of a microgrid. I recommend its use for different studies in electrical systems, including fault diagnosis, load flows, voltage profile studies, among others.

Alex Aguila

Excellent tool. A very detailed and very comprehensive study case. The results are very clear and explanatory.

Es una buena herramienta para la simulación de Micro-redes

L. Ortiz

I have mentioned before that all the variables can be found in the "DATA ACQUISITION" block. This block exports the variables V, I, THD, and others to the workspace. Then, you must plot the variables of interest.
In order for you to have the graphics contained in this paper, I will update the zip file including the graphic.m file, this one here will run automatically at the end of the simulation of the slx file.
I hope this helps.

The shared model is going to be helpful for future application in microgrids. In my major field of control, this can be applied in novel control strategies in distributed generation.


Dear, Dr. Leony
how got the results of (Fig. 9, fig.11, fig,13(a,b,c), fig. 15, fig 17, fig, 20) ??

Grear work!!! Very helpfull. Thanks for joining it with us

L. Ortiz

Hi, Dear Bilal
What are the values of maximum and minimum of m file (image 1)?
- The paper shows two scenarios (Max and min demands at 30%).
In the m file for Max Demand is number 1.
For Min demand is number 2 or any other, then put 30 to simulate 30% of the demand.
- How got the results of table 8 and table 9 ( image2, image 3 )?
you can find the power flow results running the model at about 0.35 sec, and then plot the variables that are generated in the workspace. The data is exported to Matlab in the "Model_14Bus_Microgrid_R2018/DATA ADQUISITION" block (In this block are all the variables of the paper).
Additionally, you can manually find those values in each small (green) block next to each bus.
- How got the results of Fig. 8 (image 4)?
You can generate the demand curve by plotting the variable "P_demand", this variable is located in the m file.

P_nom_gen = (6.034e+05*3 + 2.303e+05*3 + 2.326e05 *3 + 1.446e04*3 + 1.0007e03 *3*2)/1e6;
P_demand = [0.37 0.33 0.3 0.35 0.46 0.52 0.58 0.65 0.77 0.89 1 0.96 0.91 0.84 0.72 0.79 0.72 0.81 0.94 0.85 0.73 0.62 0.49 0.41]*P_nom_gen;
plot(P_demand); grid minor;


Hi, Dear Dr. Leony
what are the values of maximum and minimum of m file (image 1)?
how got the results of table 8 and table 9 ( image2, image 3 )?
how got the results of Fig. 8 (image 4)?



Details in graphics


+ Demand.m function


+ R2018b
+ Graphics.m





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