필터 지우기
필터 지우기

How to use a variant sink depending on its input

조회 수: 1 (최근 30일)
Bicheng Guo
Bicheng Guo 2018년 12월 13일
편집: Bicheng Guo 2018년 12월 15일
I have a s-function and it has 6 outputs, the next step is to check is there a negtive in 6 outputs. If there is one negtive, the simulation should be stop. If there is not, the 6 outputs should be passed to next s-function to continue simulating. In this case, I choose a variant sink, one of the output connects to stop block and another connects to next s-function to continue simulating. The thing is how can I use variant sink depending on its input rather than a pre-defined varable.
The pic shows how I use the variant sink, but it has an error saying that both the h and y (two of the outputs of s-funtion) are not defined.
Thank you very much!

채택된 답변

Fangjun Jiang
Fangjun Jiang 2018년 12월 13일
I think the "Variant Sink" block is un-necessary. If you want to stop the simulation when any of the output goes nagative, then you need to feed (or with some pre-process first) the output to the Stop block all the time. So the Stop block is constantly checking the value and stop the simulation when the condition is met. At the same time, also feed the output to the next s-function.
  댓글 수: 6
Bicheng Guo
Bicheng Guo 2018년 12월 14일
편집: Bicheng Guo 2018년 12월 14일
Here is the whole logic, the turbine`s 6 outputs containing a negtive will lead to the next controller a complex. I have tried a check for conplex at controller, but it will leads to turibine a complex too. So I choose a variant to active only one route, either to pass variables or stop.
Still many thanks
Bicheng Guo
Bicheng Guo 2018년 12월 14일
편집: Bicheng Guo 2018년 12월 15일
Hi, I have solve this problem in Matlab rather than Simulink.
I use an ode45 to solve the turbine and control derivates, and ode45 has a Option. I can define an event in this option. When a complex event occurs, the ode45 can be stopped immediately。
Thank you very much for answering my problems!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Model, Block, and Port Callbacks에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by