Page 1 of 1

Using a Fixed Delay in an If Then Else Statement

Posted: Fri May 05, 2006 1:23 pm
by Gem
Hi there,

I am trying to write a delay so the delay only takes place if there is something in the stock to delay.

I have a pulse train sending the data into the model and these are delayed by a fixed time before they go into the "In Maintenance Post Spares" box.

The delay statement that I'm having trouble with currently reads:
IF THEN ELSE( In Maintenance Post Spares>=1, DELAY FIXED( Spares from MS Delay, Delay Times, 0), 0)

Where "In Maintenance Post Spares" is my stock and "Spares from MS Delay" is my flow and "Delay Times" is the time I want to delay by.

The error message that I get is:
Only expressions separated by commas are valid in this context.

Is there an easier way to do this or am I doing something wrong? I have attched my model, it may help!

Any help would be much appreciated.

Thanks,
Gemma

Posted: Fri May 05, 2006 1:59 pm
by Administrator
You need to create an aux variable to contain the delay expression. DELAY FIXED can only appear by itself in an equation.

Spares from MS Delay delayed = DELAY FIXED( Spares from MS Delay, Delay Times, 0)

Then

IF THEN ELSE( In Maintenance Post Spares>=1,
Spares from MS Delay delayed
, 0)

Posted: Fri May 05, 2006 2:03 pm
by Gem
Thanks very much for your quick reply!

Posted: Fri May 05, 2006 9:10 pm
by bob@vensim.com
be careful - material is not being conserved here. If "Spares from MS Delay" is not used that part is effectively discarded.