MATLAB Answers

How to decide time step of a Simulink model contains different sub-models with different time step

21 views (last 30 days)
ameen
ameen on 28 Apr 2015
Commented: ameen on 4 May 2015
If i have different sub-models with different time steps, the global simulation time of the overall model should be defined by the largest or the smallest time step of the used sub-blocks ? why ?

Answers (1)

Sriram Narayanan
Sriram Narayanan on 4 May 2015
I understand that you would like to decide the time step of a Simulink model that references multiple models running at different rates.
It is not clear when you mentioned "global simulation time". Please note that if multiple models are referenced by the same base model, each of these models must run at the same rate as the base model or an integer multiple of the base sample rate.
You can take a look at an example model obtained by entering the following command in MATLAB and observe how three referenced models inherit different sample times from the 3 pulse generator blocks. (0.1, 0.5 and 1 sec) The 3 sample rates of the 3 sub-models are integer multiple of the base sample time 0.1 seconds which is defined in configuration parameters.
>> sldemo_mdlref_basic
Please note that the referenced models should be at the same or integer multiple value because Simulink solver computes the output of each block in a simulink model at the end of each major time step (defined by the sample time). The base model should have access to the output computed by the referenced model before the base model computes its output, therefore, the referenced model should run at the same rate as the base model or an integer multiple.
  1 Comment
ameen
ameen on 4 May 2015
Thank you for your kind reply and i am sorry if i am not clear. My submodels have different response time because of its physical nature not related to Simulink.
Of course all submodels will have the same sample rate but my question was about deciding which sample rate of the submodels should be the overall or global time step or sample rate ? The largest or smallest ?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!