Description Usage Arguments Details See Also Examples
Call a simulation function made by make.expt_functions
.
1 2 3 |
sim_fx |
An |
input_object |
An |
In the CAB
package, closures are used to run simulations. These closures are created by make.expt_functions
. To run one of these functions, arguments are needed for the parameters that are not currently fixed during a condition. These arguments are contained in the input monitor (see class.sim_input
). The do.element
function finds the necessary arguments from the input monitor and calls the specified function.
make.expt_functions
For getting arguments for sim_fx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Following from ?model.COR
my_COR = make.COR( DOR_ctrl, emission_ctrl, dep_ctrl, initial_ctrl, schedule_ctrl, termination_ctrl, food_duration_ctrl, my_inputs )
# Use the first condition
i = 1
conditions = get.model_conditions( my_COR, i )
expt_functions = make.sim_functions( conditions, my_COR )
# Extract the DOR function
DOR = expt_functions$DOR_control
# Make an input monitor
make.input_monitor( my_COR, 20 )
# Put some values in
access.input_monitor( "rft_time", 1, 10 )
access.input_monitor( "resp_time", 1:5, c(1, 4, 5, 6,10 ) )
access.input_monitor( "reserve", 1, 0 )
do.sim_fx( DOR, input_monitor )
# 0.99 0.96 0.95 0.94 0.90
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.