Reality Check Functions RC COMPARE('runname',var,mult[,start[,duration]]) RC COMPARE CHECK('runname',var,grace,mult[,start[,duration]]) RC DECAY(basis,decaytime[,start[,duration]]) RC DECAY CHECK(grace,basis,decaytime[,start[,duration]]) RC GROW(basis,growrate[,start[,duration]]) RC GROW CHECK(grace,basis,growrate[,start[,duration]]) RC RAMP(basis,mult,ramptime[,start[,duration]]) RC RAMP CHECK(grace,basis,mult,ramptime[,start[,duration]]) RC STEP(basis,mult[,start[,duration]]) RC STEP CHECK(grace,basis,mult[,start[,duration]]) |
Scroll Prev Top Next More |
The RC and RC CHECK functions all work in the same manner. Each keeps a variable at its normally generated model value until a specified time, and then defines a new trajectory. The RC functions are used in test inputs (in :THE CONDITION: part of a Reality Check) and the RC CHECK functions are used in the consequence (:IMPLIES:) portion of a Reality Check . Each of the functions allows you to specify the time at which the change to a new trajectory should occur, or use the value of the model variable RC START TIME to begin the test. Normally RC START TIME is a constant that is set to a time shortly after the beginning of the simulation. If RC START TIME is not present in the model the trajectory changes are made at time INITIAL TIME + TIME STEP. The User Guide, Chapter 14 contains more information on Reality Check.
Restrictions:The RC functions can not be used outside of Reality Check equations. They are valid only for comparison to a variable and must be used in the form:
rc example |
:THE CONDITION: var1 = RC STEP(var1,0) |
:IMPLIES: var2 <= RC STEP CHECK(shorft grace,var2,0) |
Note that each of the RC functions has two optional arguments start and duration. start is the time at which the trajectory change takes place, and duration the length of time the trajectory remains changed. If duration is missing the trajectory change will continue to the end of the simulation. If start is missing the trajectory change will start at RC START TIME as described above.
The following arguments are common to all, or almost all, the functions:
basis is the value against which the trajectory change will take place and will be multiplied by mult when the trajectory change begins. basis can be an expression, though normally it will just be the name of the variable on the left hand side of the comparison operator as it is in the above example. The value that basis takes on at RC START TIME is used to perform the trajectory changes (except for the RC COMPARE functions).
grace is the amount of time that can pass before the RC...STEP function actually begins checking for compliance. This makes it easy to specify that an effect takes place after a delay. Note that the value of basis is frozen at RC START TIME so that RC STEP CHECK(5,inventory,.3,5) and RC STEP CHECK(0,inventory,.3,10) have quite different meanings.
mult determines the amount that basis will be multiplied by to get the new value. This can be an expression, though in many cases it will just be a number such as 0 or 2. Unlike basis, the current value of mult is used at all times and thus can provide arbitrary time profiles.
RC COMPARE( 'runname', var, mult [,start[,duration]])
RC COMPARE CHECK( 'runname', var, grace, mult [,start[,duration]])
compares the values of a variable from a different run - normally a base case. var replaces basis and can only be a variable name, not an expression. 'runname' is a single quoted literal or a string variable that names the run against which the comparison will be made. The COMPARE functions useful for Constraints that say things like if we raise our price sales will be smaller than they would have been.
RC DECAY( basis, decaytime [,start[,duration]])
RC DECAY CHECK( grace, basis, decaytime [,start[,duration]])
forces an exponential decay to zero with a time constant decaytime. This function is useful when you want to make sure something goes to zero, but you don't care if it does so as an exponential decay and therefore would technically never actually get to zero.
RC GROW(basis, growrate [,start[,duration]])
RC GROW CHECK(grace, basis, growrate [,start[,duration]])
forces exponential growth at growrate. This is useful for making sure variables grow sufficiently fast.
RC RAMP(basis , mult , ramptime [,start[,duration]])
RC RAMP CHECK(grace, basis, mult, ramptime [,start[,duration]])
force a ramp to basis*mult over ramptime. This is a more continuous change than RC STEP and is useful for checking to see that variables make monotone adjustments to a new value. The value of the RC RAMP functions after RC START TIME is basis*(mult*(Time-RC START TIME)/ramptime + (1-(Time-RC START TIME)/ramptime)) until RC START TIME + ramptime when it just takes on the value basis*mult.
RC STEP(basis, mult [,start[,duration]])
RC STEP CHECK(grace, basis, mult [,start[,duration]])
forces a step to a new trajectory at RC START TIME. A step is a strongly disruptive shock to a system and has, therefore, been the most commonly used. Step changes are abrupt and will often cause formulations that are not completely robust to fail. The idiomatic way to use the RC STEP function is:
var = RC STEP(var,.5)
This causes the variable to jump to 50% of its value at RC STEP TIME and then remain constant. Note that mult may be time varying, but that basis is evaluated only at the step time (more precisely one TIME STEP prior to the step time). The idiomatic way to use the RC STEP CHECK function is:
no pop no production :THE CONDITION: |
population = RC STEP(population,0) :IMPLIES: |
production <= RC STEP CHECK(1,production,0) |
This would drop population to 0 at RC STEP TIME and then check that production goes to zero 1 year (assuming the model is in years) thereafter.
Units: The RC functions are not part of units checking.