How to use torque and speed data for a certain time period from an excel sheet in a PMSG in Simulink?
4 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Divyanshu
on 22 Aug 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 Comments
See Also
Categories
Find more on Sources 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!