Using a Fixed Delay in an If Then Else Statement

Use this forum to post Vensim related questions.
Post Reply
Gem
Junior Member
Posts: 14
Joined: Thu Mar 30, 2006 9:34 am

Using a Fixed Delay in an If Then Else Statement

Post 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
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Post 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)
Gem
Junior Member
Posts: 14
Joined: Thu Mar 30, 2006 9:34 am

Post by Gem »

Thanks very much for your quick reply!
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post 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.
Post Reply