필터 지우기
필터 지우기

How to transfer output data from one simulation to another as its initial condition

조회 수: 1 (최근 30일)
I have two Simulations A and B in seperate files. I would want A to run from seconds 0-100 and produce output X. B should be running from seconds 100-200 and uses X as its initial conditions at time 100. Is there any way to achieve this sort of behaviour ?
Thanks in advance for any help!
  댓글 수: 5
Nikolas Haimerl
Nikolas Haimerl 2019년 9월 6일
I do not know how to let A finish and then take the end value and use it to start B. Right now B runs at the exact same time as A and therefore not taking the final value from A as initial condition but the value at which time step the system is currently at. Meaning if the current time is Z, A's output is Y which is different to the final output X. B is then taking Y as its initial condition only to rerun with the ouput of A produced at time Z+1.
This does not give me any usable result since the B is rerun multiple times and at the same time as A.
The ideal szenario would be for A to run from 0-100 finish and output X and then start B at 100 take X as initial condition and run from time 100 to 200
Fangjun Jiang
Fangjun Jiang 2019년 9월 6일
"then start B at 100 take X as initial condition"?
X is taken for its value to assign to some states in system B?
or, X is feeded into system B as the inputs of system B?

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

채택된 답변

Roshni Garnayak
Roshni Garnayak 2019년 9월 13일
You can try using “Model Callbacks” for implementing this.
  • Set the simulation time for the first model as 100 seconds.
  • Use the CloseFcn or StopFcn callback for saving the output of the first model after the simulation stops.
  • Include an In1 block or a From Workspace block in the second model to collect the output of first model. You can also use InitFcn callback to achieve the same.
For details about setting “Model Callbacks, refer to the following link:
You can also look at the following link to know about callbacks for customized model behavior:

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by