Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
Sahar Emadabadi
Sahar Emadabadi le 2 Mar 2023
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

Réponses (1)

Dinesh
Dinesh le 9 Mar 2023
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.

Catégories

En savoir plus sur Energy Storage dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by