do.sim_fx: Call a simulation function

Description Usage Arguments Details See Also Examples

Description

Call a simulation function made by make.expt_functions.

Usage

1
2
3
do.sim_fx(sim_fx, input_object)

do.sim_fx( sim_fx, input_object )

Arguments

sim_fx

An element_fx_closure object made by make.expt_functions.

input_object

An sim_input object.

Details

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.

See Also

make.expt_functions For getting arguments for sim_fx

Examples

 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

Don-Li/CAB_original documentation built on May 6, 2019, 2:53 p.m.