Initialising delays

Use this forum to post Vensim related questions.
Post Reply
tangent
Member
Posts: 22
Joined: Wed Jun 25, 2008 7:07 am

Initialising delays

Post by tangent »

As part of a drug treatment model, I am trying to prison sentences. That is, there is a stock of current prisoners and a delay function is needed to control their outflow. Prison sentence durations are right skewed (large number of short sentences, small number of much longer sentences).

In practice, the inflow to the prisoner stock is reasonably constant. As such, despite the varying sentence lengths, the outflow is also pretty constant despite the skewed durations. Thus, my initial thought was to just model as a constant (with some random variation). However, this does not map well to the conceptual view of the world. Thus, I am likely to use DELAY PROFILE.

I can make this delay function do what I want and it seems to behave sensibly if mean delay changes. However, I cannot work out how to initialise it. That is, at the start, there is some number of existing prisoners that need to be released.

I have attached an example that has 0 inflow so the only outflow comes from the initialisation. The stock quickly falls below 0. What am I doing wrong?

thanks, Jen
Attachments
DelayProfile.mdl
(2.81 KiB) Downloaded 266 times
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

initialising delays

Post by LAUJJL »

Hi

In your model the outflow is depending from the inflow with a delay and from the initial stock. So the initial stock will go out immediately and will not go out smoothly as it happens in the reality.
If you use that kind of structure, the only way to do is to intialize the stock initial to 0 and start the simulation at a time equal to the present time minus the maximum time spent by a current prisonner in the jail. All the prisoners will be then represented in the stock at the present time with the proper age.
If you are not accustomed to the use of delays, it may be a better idea to have three stock of prisoners, with short, medium and long sentences and use for them a normal fixed delay. Bu you will probably still be obliged to start the simulation sooner.
But you will be better able to understand how the model works.
Delay profile is a sophisticated function that needs a good practice of delays.
If you want absolutely to initialize your stock, you may use the queue fifo that is able to initialize the stock with a determined profile, but you will still be obliged to use three stocks.
Regards.
JJ
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

The main issue is that the initial value in this function is the initial outflow - not the initial amount in the stock - that is why there is a units check error. When the equation is changed to

DELAY PROFILE( DelayShape, ToStock, TargetMean, InitAmount/TargetMean, 0)

the behavior is more sensible, though there is still a problem with the level going negative - i will try to take a closer look at that on Monday.
tangent
Member
Posts: 22
Joined: Wed Jun 25, 2008 7:07 am

Post by tangent »

Thank you both. It is now much more sensible. cheers, Jen
Post Reply