Queue Attributes
Queue Attributes
Hi there,
I got a question:
Is it possible to access to the attributes of the current outflow of a queue?
Lets say I am modeling an waiting serving process in a bank.
The queue consists of people waiting to be served and the attribute is the peoples height.
I know the average height of the arriving people.
But I also want to know the heights of the people exiting the queue.
Is that possible?
I was thinking that it should be possible based on formuals, because I know the actual average height of people in the queue, the number of people in the queue, the number of new arriving people and and their average height.
Based on this and the actual "outflow" of people from the queue it should be possible to calculate their average height.
PS: I dont know the age of the oldest person.
Maybe somebody of you got an idea.
Thanks and regards
Mattes
I got a question:
Is it possible to access to the attributes of the current outflow of a queue?
Lets say I am modeling an waiting serving process in a bank.
The queue consists of people waiting to be served and the attribute is the peoples height.
I know the average height of the arriving people.
But I also want to know the heights of the people exiting the queue.
Is that possible?
I was thinking that it should be possible based on formuals, because I know the actual average height of people in the queue, the number of people in the queue, the number of new arriving people and and their average height.
Based on this and the actual "outflow" of people from the queue it should be possible to calculate their average height.
PS: I dont know the age of the oldest person.
Maybe somebody of you got an idea.
Thanks and regards
Mattes
Let me try to give you the formula on which I tried to solve this problem:
"N" is the number of people
"H" is the average height in the queue
"TH" is the sum of heights of the people in the queue
Suffix "in" means inflow
Suffix "out" means outflow of the respective item
H(t+dt) = TH(t+dt)/N(t+dt)=[TH(t)+inTH(t+dt)-outTH(t+dt)]/[N(t+dt)] (1)
TH(t)=H(t)*N(t) (2)
outTH(t+dt)=outH(t+dt)*outN(t+dt) (3) (same as for "in")
We search for "outH(t+dt)"
outH(t+dt) = outTH(t+dt)/outN(t+dt) (4)
In (4) we don't know outTH(t+dt).
Putting (1) in (4)
outTH(t+dt) = -H(t+dt)*[N(t+dt)+TH(t)+inTH(t+dt) (5)
Like (3) inTH(t+dt) can be determined as:
inTH(t+dt) = inH(t+dt)*inN(t+dt) (6)
Putting (6) and (2) in (5) we get:
outTH(t+dt) = -H(t+dt)*N(t+dt)+H(t)*N(t) - inH(t+dt)*inN(t+dt) (7)
or
outH(t+dt) = [-H(t+dt)*N(t+dt)+H(t)*N(t) - inH(t+dt)*inN(t+dt)]/inN(t+dt) (7)
In the last equation we are able to measure all of the variables.
But still I get weired results.
By the way, e.g. N(t) I get using a "DELAY FIXED" with delay time "TIME STEP".
Does anybody know where the failure is?
As a hint:
inT(t) mean the amount which is flowing in in this time step -> like the flow times TIME STEP
[Edited on 10-8-2010 by Mattes_01]
"N" is the number of people
"H" is the average height in the queue
"TH" is the sum of heights of the people in the queue
Suffix "in" means inflow
Suffix "out" means outflow of the respective item
H(t+dt) = TH(t+dt)/N(t+dt)=[TH(t)+inTH(t+dt)-outTH(t+dt)]/[N(t+dt)] (1)
TH(t)=H(t)*N(t) (2)
outTH(t+dt)=outH(t+dt)*outN(t+dt) (3) (same as for "in")
We search for "outH(t+dt)"
outH(t+dt) = outTH(t+dt)/outN(t+dt) (4)
In (4) we don't know outTH(t+dt).
Putting (1) in (4)
outTH(t+dt) = -H(t+dt)*[N(t+dt)+TH(t)+inTH(t+dt) (5)
Like (3) inTH(t+dt) can be determined as:
inTH(t+dt) = inH(t+dt)*inN(t+dt) (6)
Putting (6) and (2) in (5) we get:
outTH(t+dt) = -H(t+dt)*N(t+dt)+H(t)*N(t) - inH(t+dt)*inN(t+dt) (7)
or
outH(t+dt) = [-H(t+dt)*N(t+dt)+H(t)*N(t) - inH(t+dt)*inN(t+dt)]/inN(t+dt) (7)
In the last equation we are able to measure all of the variables.
But still I get weired results.
By the way, e.g. N(t) I get using a "DELAY FIXED" with delay time "TIME STEP".
Does anybody know where the failure is?
As a hint:
inT(t) mean the amount which is flowing in in this time step -> like the flow times TIME STEP
[Edited on 10-8-2010 by Mattes_01]
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
You should look at the Coflow - see either Business Dynamics or the molecules for a description of this. This assumes mixing (erlang delay distribution, not FIFO).
If you are using FIFO queue then use QUEUE FIFO ATTRIB. The alternative is to use a cascaded sequence of levels and the SHIFT IF TRUE function (or have 1 level for each time step and just use a regular aging chain).
[Edited on 2010-10-8 by bob@vensim.com]
If you are using FIFO queue then use QUEUE FIFO ATTRIB. The alternative is to use a cascaded sequence of levels and the SHIFT IF TRUE function (or have 1 level for each time step and just use a regular aging chain).
[Edited on 2010-10-8 by bob@vensim.com]
Yes you are right, I could model it with a coflow. But the problem is the queue. I mean when using a delay with no capacity contraint there is no problem at all.
But how do I model a queue with a coflow?
This coflow also should have something like a FIFO QUEUE, but I dont think this is possible, isn't it?
I thought when using a queue with attributes it should be possible to access to the attributes of the actual outflowing material by using the above calculation.
And I dont want to use a cascade sequence, because this may constrain my process. The queue can grow infinitely without loosing the specifications.
I am not sure weather this cascade sequence will be able to model this. Do you know if this cascaded sequence is mentioned in the manuals of Vensim or Business Dynamics?
Thanks and regards
EDIT:
I think the problem above is that the flows have to be of the last time steps. That mean for the accounting equation to be true it has to be:
TH(t+dt)=TH(t)+in(t)-out(t).
This should fix the problem theroetically. I will report if it is working.
[Edited on 10-8-2010 by Mattes_01]
But how do I model a queue with a coflow?
This coflow also should have something like a FIFO QUEUE, but I dont think this is possible, isn't it?
I thought when using a queue with attributes it should be possible to access to the attributes of the actual outflowing material by using the above calculation.
And I dont want to use a cascade sequence, because this may constrain my process. The queue can grow infinitely without loosing the specifications.
I am not sure weather this cascade sequence will be able to model this. Do you know if this cascaded sequence is mentioned in the manuals of Vensim or Business Dynamics?
Thanks and regards
EDIT:
I think the problem above is that the flows have to be of the last time steps. That mean for the accounting equation to be true it has to be:
TH(t+dt)=TH(t)+in(t)-out(t).
This should fix the problem theroetically. I will report if it is working.
[Edited on 10-8-2010 by Mattes_01]
Hi there,
I tested the approach above but somhow it is not working. I dunno why not.
I think the above structure will calculate the actual output attribute.
When I delay this attributes/attribute-flows like the process will delay the material exiting the queue the output will not correspond with what I expect.
Does anybody have an idea why?
I mean all that seems to be reaonable. But it doesn't work.
Or shall I give you an example that you can see a simple model?
I tested the approach above but somhow it is not working. I dunno why not.
I think the above structure will calculate the actual output attribute.
When I delay this attributes/attribute-flows like the process will delay the material exiting the queue the output will not correspond with what I expect.
Does anybody have an idea why?
I mean all that seems to be reaonable. But it doesn't work.
Or shall I give you an example that you can see a simple model?
Queue attributes
Hi
You can bypass queuing functions by using subscripts where each variable subscripted representing the value of the element, the time it was introduced in the queue and eventually an attribute. You will then have full control on the queuing process and probably not need any coflow, being able to sum each variable in the queue. You need to set the size of the subscript to the maximum element possible in the queue and then shift the array each time an element is getting out of the queue or set the size to the number of elements entering the queue during the whole simulation, avoiding the shifting.
When studying Powersim some years ago, I noticed the lack of queuing functions and the proposition to use instead subscripted variables.
Regards.
JJ
[Edited on 9-10-2010 by LAUJJL]
[Edited on 9-10-2010 by LAUJJL]
You can bypass queuing functions by using subscripts where each variable subscripted representing the value of the element, the time it was introduced in the queue and eventually an attribute. You will then have full control on the queuing process and probably not need any coflow, being able to sum each variable in the queue. You need to set the size of the subscript to the maximum element possible in the queue and then shift the array each time an element is getting out of the queue or set the size to the number of elements entering the queue during the whole simulation, avoiding the shifting.
When studying Powersim some years ago, I noticed the lack of queuing functions and the proposition to use instead subscripted variables.
Regards.
JJ
[Edited on 9-10-2010 by LAUJJL]
[Edited on 9-10-2010 by LAUJJL]
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
If you have a FIFO queue there is no continuous solution to tracking attributes. If you do this as difference equations you will need to have a cascade of N levels where N=total delay time/TIME STEP so that each level has a delay time of 1 TIME STEP. This is basically what the QUEUE FIFO does. The equations
level = QUEUE FIFO ATTRIB(input,output,...
attrib of output = QUEUE ATTRIB AVERAGE(level,outflow*TIME STEP)
It is messy to set up the queue, so going for the subscript approach may be easier.
level = QUEUE FIFO ATTRIB(input,output,...
attrib of output = QUEUE ATTRIB AVERAGE(level,outflow*TIME STEP)
It is messy to set up the queue, so going for the subscript approach may be easier.
queue attributes
Hi
There has already been a thread on the subject with a model replacing a queue with subscritps.
See:
http://www.ventanasystems.co.uk/forum/v ... php?t=3972
Regards.
JJ
There has already been a thread on the subject with a model replacing a queue with subscritps.
See:
http://www.ventanasystems.co.uk/forum/v ... php?t=3972
Regards.
JJ
OK, I did a mistake above:
The mentioned average attribute output I will get using the calculation above will be of the time "t", so of the last time step and not of the actual time step.
So this approach cannot be used.
I also did some investigation on your model, JJ, thanks for that.
But as far as I understand that I will need a level for each possible time step in the queue, so if everything goes wrong I will need infinity levels.
And, I am not sure about tha, but it seem not to be possible to split elements. I mean all elements which flow in to the queue in one time step cannot be split up. (such that half of the elemts leave the queue and the rest remains).
I attached a simple model, that you can see what I am trying to describe or calculate:
As said the problem is that this output attribute is from the last time step.
Is there any trick by which I can calculate this more precisely?
[Edited on 10-11-2010 by Mattes_01]
The mentioned average attribute output I will get using the calculation above will be of the time "t", so of the last time step and not of the actual time step.
So this approach cannot be used.
I also did some investigation on your model, JJ, thanks for that.
But as far as I understand that I will need a level for each possible time step in the queue, so if everything goes wrong I will need infinity levels.
And, I am not sure about tha, but it seem not to be possible to split elements. I mean all elements which flow in to the queue in one time step cannot be split up. (such that half of the elemts leave the queue and the rest remains).
I attached a simple model, that you can see what I am trying to describe or calculate:
As said the problem is that this output attribute is from the last time step.
Is there any trick by which I can calculate this more precisely?
[Edited on 10-11-2010 by Mattes_01]
- Attachments
-
- Test output attribute.mdl
- (4.46 KiB) Downloaded 632 times
Yes you are right.
Let me try to describe it:
Lets say we are having one machine.
This machine produces identical materials but for two (actually it can be more) different customers.
When I fill my process I will just sum the actual orders of both customers and put them batched together into the process.
The process consits of a queue in the beginning for the orders awaiting to be put into the machine (or the process).
When the process is finishing (just the material put into the process [put into the process from the queue] delayed by a certain delay function) I will have to fugure out which fraction belongs to customer A and which fraction belongs to customer B.
If there wouldn't be a queue, this is very easy, but because there is the queue (a FIFO queue), which always just fills up the process until the process-carrying-capacity is reached, I do not know which fraction of the materials put into the process belongs to which customer.
Therefore I wanted to calculate the attribute of the outflowing material to know the actual proces-start-fraction.
I hope you understood what I am trying to model.
Just imagine I put every order, which is arriving, into WIP (consisting of the queue and the actual process[e.g. a machine]) and the queue is buffering and controling, that the carrying capacity of the process is not excessed.
Best regards and thanks a lot.
Mattes
Let me try to describe it:
Lets say we are having one machine.
This machine produces identical materials but for two (actually it can be more) different customers.
When I fill my process I will just sum the actual orders of both customers and put them batched together into the process.
The process consits of a queue in the beginning for the orders awaiting to be put into the machine (or the process).
When the process is finishing (just the material put into the process [put into the process from the queue] delayed by a certain delay function) I will have to fugure out which fraction belongs to customer A and which fraction belongs to customer B.
If there wouldn't be a queue, this is very easy, but because there is the queue (a FIFO queue), which always just fills up the process until the process-carrying-capacity is reached, I do not know which fraction of the materials put into the process belongs to which customer.
Therefore I wanted to calculate the attribute of the outflowing material to know the actual proces-start-fraction.
I hope you understood what I am trying to model.
Just imagine I put every order, which is arriving, into WIP (consisting of the queue and the actual process[e.g. a machine]) and the queue is buffering and controling, that the carrying capacity of the process is not excessed.
Best regards and thanks a lot.
Mattes
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
Good advice from JJ. The way to do this is to set up a subscript for each customer, and track everything in parallel. What is in process is determined by summing across all of the customers. To determine which customers parts get started you will need some allocation logic - the ALLOCATE AVAILABLE functions can be used for this, or you can define something simpler.
queue attibutes
Hi
In the meantime, I have built a model that could represent your problem as stated in the model you joined, but does not correspond necessarily to your last description.
It introduces each person one by one in a discreet manner in a queue built with arrays.
The time unit is set to one day and the time step is set to 1 day too. It takes roughly the same constants from your model, so that you compare the inputs and outputs from the queue in both models.
Every day, a new person is coming to the bank or not and the subscripted variables are updated accordingly. Each subscript correspond to a day.
You can verify by looking at the level ‘arriving people cumulated’, that the formula describing the stochastic arriving people is correct.
The time to serve a person is a constant and set to 3 days or three time steps. It could be too an exogenous stochastic variable too. The height of the person is set the same way as in your model, but could be too stochastic.
Every time a person is nearly finished being served, the array is updated and the value of the variable is set negative, so that one knows that this person has been once served.
You can calculate about anything with this method, as all the discreet history of each person is saved.
Example is given with the average height of the people in the queue, or the average of the last elements in the queue (not the last persons, but this can be calculated too).
Regards.
JJ
In the meantime, I have built a model that could represent your problem as stated in the model you joined, but does not correspond necessarily to your last description.
It introduces each person one by one in a discreet manner in a queue built with arrays.
The time unit is set to one day and the time step is set to 1 day too. It takes roughly the same constants from your model, so that you compare the inputs and outputs from the queue in both models.
Every day, a new person is coming to the bank or not and the subscripted variables are updated accordingly. Each subscript correspond to a day.
You can verify by looking at the level ‘arriving people cumulated’, that the formula describing the stochastic arriving people is correct.
The time to serve a person is a constant and set to 3 days or three time steps. It could be too an exogenous stochastic variable too. The height of the person is set the same way as in your model, but could be too stochastic.
Every time a person is nearly finished being served, the array is updated and the value of the variable is set negative, so that one knows that this person has been once served.
You can calculate about anything with this method, as all the discreet history of each person is saved.
Example is given with the average height of the people in the queue, or the average of the last elements in the queue (not the last persons, but this can be calculated too).
Regards.
JJ
- Attachments
-
- Test_output_attribute2.mdl
- (16.17 KiB) Downloaded 770 times
queue attributes
Hi
Here is another version of the model that takes into account your last definition. Each order comes from one customer, generated randomly and has a random number of material grouped into one order.
I did it quickly, and there maybe some error in it, better to verify it.
Regards.
JJ
Here is another version of the model that takes into account your last definition. Each order comes from one customer, generated randomly and has a random number of material grouped into one order.
I did it quickly, and there maybe some error in it, better to verify it.
Regards.
JJ
- Attachments
-
- Test_output_attribute3.mdl
- (18.21 KiB) Downloaded 743 times