accessing random numbers, in sequence.

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

accessing random numbers, in sequence.

Post by Gem »

Hello.

I was wondering if somebody could help me with a little problem. I have set up a variable number process (called 'variable 1'). I then have another process (called 'cummulative') which is the cummulative of a non-linear graph (therefore 'cumulative' is also non linear). What I want to do, is sample the 'cumulative' graph every 'variable 1' step. For instance, if 'variable 1' was 2,4,1,2,6,8,5,7,6,9,1,3,7,3,6 etc and 'cumulative 1' was 23,25,27,29,32,32,33,31,39,45 etc, then the 'sample' would look like:
0 1 0 1 1 0 0 1 etc.

Hope this is clear.

Thanks a lot for your help.

Gem
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

I can't understand what you want.
Gem
Junior Member
Posts: 14
Joined: Thu Mar 30, 2006 9:34 am

Post by Gem »

Hello Bob - sorry I didn't make my problem clearer.

I have a non linear cummulative graph. The time period is 0-100 hours. After 100 hours, the graph reaches 75 on the Y axis (number of widgets).

Now, what I want to do is randomly sample that graph. So, say for instance the random generator gives me the values 1, 6, 4, 10, 11 - then what I need to do is have a spike when random widgets (the y axis on the cummulative graph) reaches 1, 7, 11, 21, 32.

Hope this is a little more clearer Bob.

Thankyou for the taking the time to help.

Gem
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

You can use:


spike = new target - old target
old target = INTEG(spike/TIME STEP,init old target)
new target = MAX(old target,cummulative lookup(random variable))

You may need to go for something more complicated depending on the disrete/continuous conceptualization of your model.
Gem
Junior Member
Posts: 14
Joined: Thu Mar 30, 2006 9:34 am

Post by Gem »

Thanks again Bob.

However....................when I run the model I get an error as follows:

old target: simultaneous initial value equations involving: old target
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

You need to set "init old target" to a constant - or perhaps you just missed the "init" in front of that.
Post Reply