How to use a number vector in MATLAB as an input to the battery in SIMULINK?

1 次查看(过去 30 天)
Hey everyone,
I want to use my data from MATLAB, which is a table of numbers, as input to a simulation in Simulink.
The numbers that I want to use are the hourly generated electricity. But they are just in form of numbers (double)
and I don't know how to convert it to a voltage to use it as input to the battery.
Do I need to convert in at all? If yes, HOW?
If no, what do I need to do?
Thanks

回答(1 个)

Dinesh
Dinesh 2023-3-9
Hi Sahar.
Let's say you have a MATLAB table called "hourly_electricity" that contains the hourly generated electricity values where each row represents an hour and each column represents a day.
Firstly, to load a MATLAB table into Simulink, drag a "From Workspace" block from the Simulink Library browser into the Simulink model. Double-click on it to open its dialog box and set the "Data" field to "hourly_electricity". Now the MATLAB table is successfully loaded into the Simulink model.
Assuming that the values in the table are in kilwatts (kW), use the "Multiply" block to convert it into watts by connecting the output of the "From Workspace" block to it and setting its "Gain" field to "1000". This will multiply the kW values by 1000 to convert into watts.
Now, to calculate the voltage, a "Divide" block can be used.
The formula to calculate voltage is
voltage (V) = power (W) / current (A)
The output of the "Multiply" block is to be connected to the first input of this "Divide" block. The second input is the current value which can be 10A (if the battery can accept current upto 10A) for example. A constant block with value 10 can be used as the second input to this "Divide" block.
Now the output of the "Divide" block has the "Voltage" which can be used as an input to your battery model.

类别

Help CenterFile Exchange 中查找有关 Energy Storage 的更多信息

标签

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by