Hello all.
I have a question that might very well be simple to answer (I'm fairly new to Vensim, so am learning as I go along). From what I understand of the Random functions, they give a random number every time interval (in my model this is set to 1 hour). However, what I want is to have a pulse of 1 every X hours (where X is a random number between 5 and 7 say). Could somebody please tell me how I do this?
Thanks.
Periodic Random Numbers
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
The following will do this (and work in any Vensim):
output = IF THEN ELSE(Time > next time,pulse size,0)
next time = INTEG(IF THEN ELSE(Time > next time,
INTEGER(RANDOM UNIFORM(4,7.99999,0)),0)/TIME STEP,
6)
you could also other random distributions and SAMPLE IF TRUE for next time (actually there are lots of ways to do the same thing).
output = IF THEN ELSE(Time > next time,pulse size,0)
next time = INTEG(IF THEN ELSE(Time > next time,
INTEGER(RANDOM UNIFORM(4,7.99999,0)),0)/TIME STEP,
6)
you could also other random distributions and SAMPLE IF TRUE for next time (actually there are lots of ways to do the same thing).