Wrong use of the random function

Use this forum to post Vensim related questions.
Post Reply
nesheim
Junior Member
Posts: 14
Joined: Mon Apr 30, 2018 12:12 pm
Vensim version: PLE

Wrong use of the random function

Post by nesheim »

Hi

I am struggling with using the Random Normal function. I have a case of random breakdowns, and I want these random breakdowns to last between 0.25 and 72 hours (in the accumulated box named "total maintenance hours"). So I type in "AccCorrectiveM1*RANDOM NORMAL(0.25, 72, 8, 1, 0)" (Accumulated corrective maintenance events).
I get an unexpected result in total amount of maintenance hours. See "Capture8.PNG" in the attachements.
If I remove the RANDOM NORMAL I get the type of graph that I want (only growing, never decreasing) See "Capture9.PNG" in the attachements.

I could use some help on how to properly use the random function. I need it to give a positive number between 0.25 and 72 for each AccCorrectiveM1 event.

Thanks
Attachments
System Design Part_1 EL_M_1.mdl
(6.58 KiB) Downloaded 179 times
Capture9.PNG
Capture9.PNG (9.92 KiB) Viewed 1491 times
Capture8.PNG
Capture8.PNG (17.35 KiB) Viewed 1491 times
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Wrong use of the random function

Post by tomfid »

It's a little hard to follow your question - the model doesn't correspond with your description.

I see:

Code: Select all

Corrective Maintenance El Motor 1=IF THEN ELSE(Electric motor 1 reliability
                  <=0,RANDOM NORMAL(5,10,8,1,1),0)
Units: **undefined**

**************************************************************
This will always yield a positive random number (or 0).

Code: Select all

AccCorrectiveM1=INTEG(IF THEN ELSE(Corrective Maintenance El Motor 1>0,1,0)
                  ,0)
Units: **undefined**

**************************************************************
This will accumulate the positive random draws, and therefore always increase as desired. However, it's dimensionally inconsistent. To count discrete events, divide by TIME STEP in the INTEG; otherwise your model only works if TIME STEP = 1. Defining units is not just eye candy; it's an essential good practice.

Note that if you use RANDOM NORMAL(0.25, 72, 8, 1, 0), values near 0.25 or 72 will never happen. A 72-hour event would be 64 standard deviations from the mean - you'd have to run your model for the age of the universe for that to happen. Some other distribution (lognormal?) might be more appropriate here.
Post Reply