How to use torque and speed data for a certain time period from an excel sheet in a PMSG in Simulink?

2 ビュー (過去 30 日間)
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.

回答 (1 件)

Divyanshu
Divyanshu 2023 年 8 月 22 日
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:

カテゴリ

Help Center および File ExchangeSources についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by