Connect and use more simulink models downloaded from MathWorks
27 views (last 30 days)
Show older comments
Dear all,
I'm a engineering bachelor student that as a thesis project needs to create a model of a PEM Electrolyzer with:
- Renewable sources as energy input, so I was thinking about using Solar Panels and Wind Turbine;
- Output that converts produced hydrogen into mechanical energy, like a gas turbine (so I would like to use a cycle with gas e.g. methane blended in differente percentages with hydrogen).
Given that I never used neither MatLab nor Simulink-Simscape, I was wondering if:
- I can combine models downladed from MathWorks, in particular I found these that I would like to use: https://it.mathworks.com/help/simscape/ug/pem-electrolysis-system.html (Electrolyzer), https://it.mathworks.com/matlabcentral/fileexchange/46410-hybrid-photovoltaic-and-wind-power-system?s_tid=ta_fx_results (hybrid EV-wind system), https://it.mathworks.com/help/simscape/ug/brayton-cycle-gas-turbine-with-custom-components.html (gas turbine);
- is it possible to combine the linked systems and how. Furhtermore ,do I have to write a lot of code in MatLab for this purpose?
- is possible to create a GUI where I can set easily parameters for the simulation and show data and graphical analysis. Is it possible to create a GUI that sets parameters in an already existing model? If yes, are there any tutorial about it?
Thank you very much for your help. I am glad to answer If you need further explanations about my project.
0 Comments
Answers (2)
Malay Agarwal
on 18 Mar 2025
Please take a look at Model References, which can be used to create a model which references other models. The following resource has more information on Model References: https://www.mathworks.com/help/simulink/model-reference.html
You can create GUIs to change simulation parameters using App Designer. The following resource has information on how to create an App Designer app for a Simulink model which can be used to control the simulation and tune it's parameters: https://www.mathworks.com/help/simulink/ug/create-app-for-simulink-model.html
Please refer to the documentation of App Designer for more information: https://www.mathworks.com/help/matlab/ref/appdesigner.html
Hope this helps!
0 Comments
Adit
on 14 Aug 2025 at 11:30
Hi MATTEO,
I went through your question and understood that you want to combine different Simulink and Simscape models and create a GUI for simulation control and visualization. To achieve this, follow the steps below:
1. Combining Simulink/Simscape Models:
Yes, you can combine different models downloaded from MathWorks documentation or File Exchange (like PEM Electrolyzer, Hybrid PV-Wind, Gas Turbine).
Steps to combine:
- Open and run each model separately to understand its inputs/outputs and parameters.
- Ensure that the models use compatible units (e.g., Watts, Volts) and connection types (Simulink signals vs. Simscape physical signals).
- Use Model Reference blocks (refer to the MathWorks documentation https://www.mathworks.com/help/simulink/model-reference.html) to include one model inside another, or copy the required blocks into a new model and use Subsystems (refer to the MathWorks documentation https://www.mathworks.com/help/simulink/ug/creating-subsystems.html) for organization.
- Connect the models using appropriate connectors:
- For Simulink signals, use normal lines.
- For Simscape, use the physical connection lines and, if needed, Simulink-PS Converter (https://www.mathworks.com/help/simscape/ref/simulinkpsconverter.html) or PS-Simulink Converter (https://www.mathworks.com/help/simscape/ref/pssimulinkconverter.html) blocks.
- Refer to the following MathWorks documentation for more details:https://www.mathworks.com/help/simscape/ug/connecting-simscape-diagrams-to-simulink-sources-and-scopes.html
- You may need to adjust some parameters or add interface blocks to ensure proper integration.
- Test each combined part step by step to make sure everything works as expected.
Coding requirement: Most of the work in Simulink is graphical; you only need minimal MATLAB code for automation or custom calculations.
2. Creating a GUI for Simulation Control and Visualization
You can create a GUI (Graphical User Interface) to set parameters and visualize results using MATLAB’s App Designer (refer to the MathWorks documentation https://www.mathworks.com/help/matlab/app-designer.html).
How to proceed:
- App Designer lets you add sliders, buttons, dropdowns, and plots to your GUI.
- Link GUI controls to your Simulink model using MATLAB commands like set_param, get_param, and sim. For a step-by-step guide, see the following documentation: https://www.mathworks.com/help/simulink/ug/create-app-for-simulink-model.html
- The GUI can set simulation parameters, start/stop the model, and display results graphically or in tables.
- You can build a GUI for any existing Simulink model as long as you know the names of the parameters you want to control.
Check out the interactive tutorials on Simulink Onramp (https://matlabacademy.mathworks.com/details/simulink-onramp/simulink) and Simscape Onramp (https://matlabacademy.mathworks.com/details/simscape-onramp/simscape) for hands-on learning.
Hope this helps!
0 Comments
See Also
Categories
Find more on Electrical Systems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!