variant sink declaring variables

조회 수: 1(최근 30일)
Christine 2019년 6월 13일
댓글: Debasish Samal 2019년 6월 26일
I don't know if I am at the right place for this question; just tell me if that is not the case.
My problem is : I would like to use a variant sink in the following situation:
  • from a block, let's call it A, comes a temperature T
  • according to the value of T, I want the signal to go to block B or block C: if T > T1 then go to block B else go to block C
first of all, is it ok to use a variant sink? since I will have a lot of situations of this kind in my model, I thought it could be a good way to proceed (I also want tha block B is not activated if signal is going to block C etc...)
I have tried to understand how virtual sink works; read pages and pages of the simulink help but I haven't found how I could simply define the variant V in the workspace.
where/how do I define it?
If I click on the variant sink block, I can write the condition "V ==1" etc...but WHERE do I declare/define this V?
Should I read part of chapter 8 or read chapter 11 of the User Guide? but it seems to be for variant system (chapter 11)...I just want to use the block. It seemed to be a simple way to proceed but the help is really confusing to me.
Any help would be really nice !!!
Thank you
  댓글 수: 2
Debasish Samal
Debasish Samal 2019년 6월 13일
What should be the input to block C when the signal is going to block B (when block B is active) or do you want to comment out the inactive blocks entirely like a variant sink does?

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


Christine 2019년 6월 13일
Hello Samal,
Thank you for your reply
So, block A is a Heat Exchanger and one of its outputs is a temperature T.
Out of A, I test this T with a block "compare to constant" to see if it is less or greater than a temperature T_ref;
  • if T > T_ref, then T should go to block B (A storage) and C should be inactive
  • if T <= T_ref T should go to block C (Boiler) and B should be inactive

Debasish Samal
Debasish Samal 2019년 6월 13일
One thing you can try here is using 2 switches. Set the threshold value in both switches and supply the inputs accordingly.Example.PNG
For example in the above image I have taken sine wave as the input signal. A constant as a garbage value which is fed to the inactive block. T is compared with the threshold that you define and it routes the signal accordingly.
If this doesnot solve your problem I would suggest you to explore more blocks in signal routing section in the block library of simulink that might be used in your case.
  댓글 수: 2
Debasish Samal
Debasish Samal 2019년 6월 26일
Hi Christine,
I assume it is too late on my part but I was working on a project and it reminded me of your case. A better solution for your problem can be using a enabled subsystem where you can use the temperature T as the signal. You can hold or reset the output with the enabled subsystem.
Please find some examples here:

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



Community Treasure Hunt

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

Start Hunting!

Translated by