필터 지우기
필터 지우기

How to create a variant sink condition depending on the input

조회 수: 3 (최근 30일)
Emily
Emily 2017년 3월 12일
댓글: Bicheng Guo 2018년 12월 13일
I would like for my Simulink signal to follow one route if it is negative, and another if it is positive. I am using a variant sink block in order to achieve this, but how can I make it dependent on the input rather than a predefined value in the workspace? I have tried using a To Workspace block, but this only creates the value after the simulation, meaning it can't be used in the variant sink. The input is coming from a step block that is manually changed depending on the desired simulation. Thanks in advance.

채택된 답변

Gillian Rosen
Gillian Rosen 2017년 3월 14일
Hi Emily, 
I understand that you would like to find a variant sink block that changes condition depending on a signal input, instead of a workspace variable. 
One option that could work for you is to use a Manual Variant Sink block. You mentioned that you are manually changing the input to the Variant Sink depending on the desired simulation; with a Manual Variant Sink, you could manually change the path at this time as well. See the documentation for this block for more information: 
Another option for you could be to use a Switch block instead of a Variant Sink. With this method, you would connect your Step input to both paths, and at the end of the paths, place a Switch block that determines which path to follow. The control input for the Switch block can be some property of your Step input. See the documentation for examples and more information: 
  댓글 수: 1
Bicheng Guo
Bicheng Guo 2018년 12월 13일
Hi, I have the same problem.
I have a s-function and it has 6 outputs, the next step is to determing is there a negtive in 6 outputs. If there is one negtive, the simulation should be stop. In this case, I choose a variant sink, one of the output connects to stop block and another connects to next s-functino to continue simulating. The thing is how can I use variant sink depending on its input?
I don`t choose a switch because it has only one output so i can`t connect it to two direction.
Thank you very much!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Variant Inline Components에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by