How can I calculate the total number of entities in queueing network in simulink?

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

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.
Rick, I'm using R2010a.
Ryan, All the 4 #n ports are connected to the adder, but if there is signal in one of the ports, the other 3 ports are 'zero' in the sum, meaning it is like electric circuit where the signals are not always there. That is why i tried to connect a data latch but it did not work.
Thanks.

Sign in to comment.

Answers (1)

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

My model is similar to what you described except the fact i used enable gate instead of output switch. I will try to model your suggestion but i'm afraid the same technical mistake with the sum block will happen.
This is my current model: http://imgur.com/AQP3P
This is the model offered by you: http://imgur.com/QkaBg But it does not work because of data type mismatches.
Just run the main program to run the model.
Thanks I'll take a look. Based on initial observation I believe you correctly interpreted my solution.
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.
First of all, your solution is working. But is it working properly? Are the numbers correct? As you can see in run_sim_client.m I took the 4 #n ports in the END of the simulation and normalize them to discrete values for time between 1 and the simulation time. Then i summed the 4 vectors and get the yt5 vector. This vector is NOT equal to the vector i get from the system_costumers variable so i'm in dilema. What do you think about it?
Even without my normalization function you can see the data is different between the two methods:
For example check the point t=2
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
I switched my blocks as you said, but i don't hava 'Data' field in the structures in my workspace and my signals.values field is only ones and zeroes. Can you attach your model?
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.
Yes, because i defined only one server. But the other 2 signals also give me 0's and 1's. Can you send it to my mail? moti_ne@yahoo.com I will appreciate it very much.

Sign in to comment.

Categories

Find more on Discrete-Event Simulation in Help Center and File Exchange

Asked:

mo
on 15 Sep 2012

Community Treasure Hunt

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

Start Hunting!