variant sink declaring variables
Show older comments
Hello,
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
Christine
2 Comments
Christine
on 13 Jun 2019
Debasish Samal
on 13 Jun 2019
Edited: Debasish Samal
on 13 Jun 2019
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?
Answers (2)
Christine
on 13 Jun 2019
0 votes
Debasish Samal
on 13 Jun 2019
0 votes
One thing you can try here is using 2 switches. Set the threshold value in both switches and supply the inputs accordingly.

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 Comments
Christine
on 13 Jun 2019
Debasish Samal
on 26 Jun 2019
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:
Thanks
Debasish
Categories
Find more on Variant Inline Components in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!