フィルターのクリア

Simulate model several times

1 回表示 (過去 30 日間)
mwer
mwer 2017 年 1 月 25 日
編集済み: avleed 2017 年 1 月 30 日
I have a Simulink model consisting of 2 model parts. Assuming the simulation time is from 1 to 100s. The first model part calculates a value needed for the second model part. The thing is that the calculation of this value is completed after 100s, but is needed in the second model part at time 1s.
My question is if there is a possibility to simulate my first model part from 1 to 100s to calculate this specific value needed for my second model part and then run the second model part from 1 to 100s. So simulating those two model parts consecutively. I need to do this continuously: simulate model part 1 from 1-100s, then simulate model part 2 from 1-100s, then simulate model part 1 from 101-200s, then simulate model part 2 from 101-200s and so on.
Thanks
  2 件のコメント
mwer
mwer 2017 年 1 月 27 日
no one?
Sruthi Geetha
Sruthi Geetha 2017 年 1 月 30 日
The value from the first model part is calculated only after 100s. So you need to simulate the first model part for 100s. The second model part takes the value from first model part after 100s. So it needs to be simulated for the next 100s, ie., 101-200s. You cannot go back in time and simulate the second model part for 1-100s. You can have two Enabled Subsystems and a Timer block and give the conditions for the Enabled Subsystem in such a way that when time<=100s, enable the first subsystem and 100<time<200, enable the second subsystem and so on.

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

回答 (1 件)

avleed
avleed 2017 年 1 月 30 日
編集済み: avleed 2017 年 1 月 30 日
Set up a "to workspace" block in your first model and in the configurations, there is an option to record only the last x values - here put in a 1 to select only the last value.
Similarly, set up a from workspace block in your second model and set it up as the same name as the variable you are exporting from the first model.
Then use a small .m script
options = simset('SrcWorkspace','base');
sim('model1',[],options) % Run model 1
sim('model2',[],options) % Run model 2

カテゴリ

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