How can I calculate the total number of entities in queueing network in simulink?
Show older comments
Hi, I have a model that include 2 sets of queue+server, total 4 blocks. I want to limit the number of entities in ALL the system meaning in all the queues and servers. I have tried to use an adder to sum the #n ports from the 4 blocks but it doesn't work because only one of the adder ports is active each time.
It's a very simple requirment but i can't get it done. Thanks, Moti
4 Comments
Rick Rosson
on 15 Sep 2012
Which release are you using?
Ryan G
on 17 Sep 2012
What do you mean by 'only one of the adder ports is active each time'
If you take a summing junction, set the 'List of signs' to '++++' and put 4 #n ports into it this should work.
mo
on 17 Sep 2012
mo
on 30 Sep 2012
Answers (1)
Ryan G
on 17 Sep 2012
0 votes
I put something together that may emulate your situation. It sounds like you have entities incoming that you cannot stop to the system but want to reject them if the TOTAL system is full.
On the entity path you want to control put output switch and select 'from signal port p. Compare the output of the sum to whatever the system limit is and connect that to port p. Note that the indexing here is 1-based. On on port youll connect as you already have letting entities enter, on the other you'll put a sink and 'toss' the entities (you can keep track of what you toss in the sink block)
Based on your description this sounds like it may work. However, there seems to be some confusion somewhere else as well. When you say adder, you mean the sum block correct? At every time step what you see in the scope would be accurate for that step, there should not be different blocks triggering at different steps unless you set it up that way.
One thing if this still is giving you trouble is you can upload a pic of a simple model that shows this to a site like imgur and post it here.
8 Comments
Ryan G
on 18 Sep 2012
Thanks I'll take a look. Based on initial observation I believe you correctly interpreted my solution.
Ryan G
on 18 Sep 2012
I think your solution should work but I can't try it out since I currently only have 12b on my PC and really don't want to revert right now. However, my solution did work. Do the following on the model you already have linked.
Ryan G
on 18 Sep 2012
Using the original m-file (system capacity 5) I replaced the discrete event signal to workspace with a simple simulink to workspace block. This will eliminate the need to post-process for data alignment later. The workspace blocks you have in there now are good when you want to save memory by only recording data when the simevents block is active.
Now, that being said I ran the following lines of code to obtain an overlay of the 4 elements summed up on top of the final outcome.
x1 = get(result,'simout');
x2 = get(result,'simout1');
x3 = get(result,'simout2');
x4 = get(result,'simout3');
data123 = x1.Data+x2.Data+x3.Data+x4.Data;
finals = get(result,'finaldat') %i renamed this when i put in the new workspace block
plot(data123)
hold on
plot(finals.Data,'-.r')
And this is the result
mo
on 18 Sep 2012
Ryan G
on 19 Sep 2012
Half of the signals were just 0's and 1's (I forget which you can see that in this link from earlier)
The other signals worked for me in my setup, simply replacing Data in my script with signals.values showed correct results. Unfortunately I cannot upload the model.
mo
on 19 Sep 2012
Categories
Find more on Discrete-Event Simulation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!