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

조회 수: 28(최근 30일)
ameen 2015년 4월 28일
댓글: ameen 2015년 5월 4일
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 ?

댓글을 달려면 로그인하십시오.

### 답변(1개)

Sriram Narayanan 2015년 5월 4일
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표시숨기기 없음
ameen 2015년 5월 4일
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 ?

댓글을 달려면 로그인하십시오.

### Community Treasure Hunt

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

Start Hunting!