Page 1 of 1

Counting the number of pulses

Posted: Thu Dec 07, 2006 5:28 pm
by Gem
Hi there,

I think I'm asking a fairly simple thing here, but I can't think how to actually do it in Vensim.

I would like to count the number of pulses that I have in a period, so say in 24 hours I may have had 5 pulses of 3 hours long. If I add this as a level, it gives me the wrong result - I need it to return 5. Any way that I can do this?

Many thanks,

Gemma

Posted: Thu Dec 07, 2006 9:31 pm
by bob@vensim.com
I don't know what is pulsing - but this discussion has happened before. If it is just 1 variable that is on or off using something like)

total upward change count = INTEG(IF THEN ELSE(value > old value,1,0),0)
old value = INTEG((value - old value)/TIME STEP,value)

Bob Eberlien

Posted: Fri Dec 08, 2006 11:38 am
by Gem
Thanks Bob, I'll try that.

Gemma