Is it possible to run simulation of a model in parts while checking for certain conditions after a particular time?

조회 수: 2 (최근 30일)
I am trying to simulate a model from a set of generated data consisting of repeated data set in sequence to emulate a real situation. However I want to check a condition after the simulation of each data set to switch between the subsystems. Is it possible to do so without using m file?
Thanks in advance.

답변 (1개)

Rishabh Gupta
Rishabh Gupta 2018년 9월 24일
Hi Suvrat,
To switch between the subsystem based on some condition, you could use "IF- Block" and "If Action Subsystem".
Please refer to the below documentations of both the blocks to understand how to define the condition in "If Block" and how to switch between the subsystems.
I would suggest to use "MATLAB function block" in case of "IF-Block", if the conditions that needs to be checked are complex.
  댓글 수: 2
Suvrat Ramasubramanian
Suvrat Ramasubramanian 2018년 9월 24일
Hi Rishabh,
Thank you for the response. I am currently using IF-Block to switch between the subsystems. However, the condition that I am checking is the mean error after one entire simulation run. This requires summing the error for the whole duration. For this I am currently using an m-file. But is it possible to compute the mean within the subsystem?
Thanks.
Rishabh Gupta
Rishabh Gupta 2018년 9월 25일
According to the use case you mentioned, it might be possible.
I am not sure how exactly is your model designed but, if it is possible to use a sum block to sum up the error while simulation, then you can use the sum block output at the end of one dataset simulation and apply appropriate condition in IF block to switch between subsystems

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

카테고리

Help CenterFile Exchange에서 Subsystems에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by