How to use torque and speed data for a certain time period from an excel sheet in a PMSG in Simulink?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
In the following simulink model, PMSG is taking constant speed value, and this model is converting mechanical power into AC power, then DC voltage and current. However, I have some real torque and speed data for a certain time in an excel file collected from a hydrokinetic test site. Instant of the constant block, which one can I use to import data from excel and then apply to the PMSG to see how the electrical power (DC voltage and current) vary over a certain time? Or is there any other procedure to do this? Thanks in advance.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1453212/image.jpeg)
0 Commenti
Risposte (1)
Divyanshu
il 22 Ago 2023
Hi Kawsar,
One possible workaround to make use of excel sheet values for simulation is by updating the ‘Constant’ block value iteratively using ‘set_param’ function of MATLAB.
Here is a sample script for this workaround:
sampleTable = readtable("Book2.xlsx");
tableSize = size(sampleTable);
for i=1:tableSize(1)
block = find_system('demoModel/Constant');
set_param(block{1},'Value',string(sampleTable.Speed(i)))
pause(1);
end
In the above script excel sheet has just one column ‘Speed’ which you can modify, and update based on the scenario.
For further details about different functions used in the script refer the following documentations:
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!