How can I add my own electrical supply data to the PEMElectrolysisSystem simulation?
Show older comments
I have on my workspace my own data of voltage and current that I would like to use as an Electrical Supply for the Electrolyzer. The data is type: double, size: 934906 x 1. I would like to understand how do I use my data and connect it in the Simulink model? I have tried using the 'From Workspace' block after adjusting my data to be in 'timeseries' class, but with no success. I would like to understand what class should my data be in, what block to use and where to connect my inputed data?
Thanks in advance!
Answers (1)
Shivam Gothi
on 28 Jan 2025
As per my understanding, you are trying to utilise the voltage data stored in the workspace, to power the "Electrolyser" block.
There are different ways to load data from the base workspace using the "From Workspace" block. They are documented in a very well manner in the below attached documentation:
As you have tried with "timeseries" format, I will also follow the similiar approach. I am suggesting one of the methods which you may find usefull to load data from workspace.
In order to demonstrate the method, I have defined the voltage vector having 934906 elements in it. This is a simple sine wave.
%Define the time vector for demo
sampleTime = 0.01;
numSteps = 934906;
time = sampleTime*(0:numSteps-1);
time = time';
%define the Voltage vector for demo
voltage = 100*sin(2*pi/3000*time);
%form the time series data
simin = timeseries(voltage,time);
In order to illustrate the use of "From workspace" block, I have created a blank simulink model with an "electrolyser" block. as shown below:

The waveforms recorded in the scope is:

The blocks added from the library browser are:
PS-Simulink converter: https://www.mathworks.com/help/simscape/ref/pssimulinkconverter.html
Simulink-PS converter: https://www.mathworks.com/help/simscape/ref/simulinkpsconverter.html
Controlled voltage source: https://www.mathworks.com/help/releases/R2024b/simscape/ref/controlledvoltagesource.html
You can do the similiar thing for loading electrical current data from workspace. For that purpose, you can use Controlled current source: https://www.mathworks.com/help/sps/powersys/ref/controlledcurrentsource.html
I hope you find this usefull !
3 Comments
Raz
on 31 Jan 2025
Raz
on 4 Feb 2025
Shivam Gothi
on 7 Feb 2025
Edited: Shivam Gothi
on 7 Feb 2025
I also got a value of "zero" at the output of "mdotH2". As I have not used the block "Electrolyser" before, I will not be able to give any suggestions, but referring to the shipped example, might help you to understand the system better.
Categories
Find more on Specialized Power 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!