changing the simulation time in simulink through script

9 ビュー (過去 30 日間)
Arun Badigannavar
Arun Badigannavar 2012 年 12 月 11 日
コメント済み: David 2014 年 6 月 5 日
I am controlling my simulink models through MATLAB Script ,and am updating stop time through script,,,The problem here am getting is if i change any parameters value of the simulink while simulink is running,,the simulation calculation is con sidering the changed values from the initial step of the simulation,,,but rather i want my simulation to consider the new parameter value value from the step i chanf=ged while simulation is running
  9 件のコメント
Vishal Rane
Vishal Rane 2012 年 12 月 11 日
I guess this is want Arun is trying to say:
He wants to and is able to update certain parameters while the simulation is in progress, suppose at T=500.
But the simulation result indicates that Simulink ran the entire simulation based on the updated parameters only, while he expected both the previous (T=0 to 500) and the updated parameters (T=500 to end) to have a bearing on the result.
Arun Badigannavar
Arun Badigannavar 2012 年 12 月 11 日
Yes both Mr Walter and Mr Vishal are right,,,do u have any idea?

サインインしてコメントする。

採用された回答

TAB
TAB 2012 年 12 月 11 日
編集済み: TAB 2012 年 12 月 11 日
I am not sure how you are managing to change the simulation time during simulation.
But for your parameter value problem :
Simulink evaluates all the parameters values before the start of simulation. See first step of Model compilation.
If you change any parameter during simulation, simulink will not notice it. To tell the simulink to re-calculate the parameters/interfaces, you have to give update command.
After you change the parameter value from scrip, give command
set_param('YourModel', 'SimulationCommand', 'update')
  5 件のコメント
TAB
TAB 2012 年 12 月 11 日
編集済み: TAB 2012 年 12 月 11 日
for i=1:1:inf
set_param('course_speed_position','StopTime', sprintf('%d',i));
set_param('course_speed_position1','StopTime',sprintf('%d',i));
simOut = sim('model1.mdl');
simOut1 = sim('model2.mdl');
end
This loop will run forever and will never return. Then how will you run other command to pause the model, update parameter etc ???
David
David 2014 年 6 月 5 日
For more on changing parameters, see Tunable Parameters Documentation

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by