variant sink declaring variables

1 view (last 30 days)
Christine
Christine on 13 Jun 2019
Commented: Debasish Samal on 26 Jun 2019
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
Christine on 13 Jun 2019
I think my problem can't be solved with Virtual Sinks, the Variant V is a constant value that cannot change with time, is it right?
Christine
Debasish Samal
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?

Sign in to comment.

Answers (2)

Christine
Christine on 13 Jun 2019
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
Christine

Debasish Samal
Debasish Samal on 13 Jun 2019
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 Comments
Christine
Christine on 13 Jun 2019
I have modelled with if/elsif blocks and it seems ok; not so "elegant" but results seem to have sense.
The only thing that I don't like much is that, when T is going for example through B instead of C, time is still running in C...is there a way to "stop" time into a subsytem when not "active" ? This is another kind of question I know. I haven't done a lot of models into Simulink and time gestion is a mistery for me.
Debasish Samal
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

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!