class.control: Control objects

Description Usage Slots Built-in classes of control objects show methods for the built-in control objkects Make a control object from 'elemental' objects Set a custom control object show methods for custom control objects See Also Examples

Description

Objects from the control class contain objects of a particular type of 'elemental' class as well as their associated parameters. For example, we may have a control class for DOR objects. This control class would contain all the DOR objects that we wish to use in our simulation as well as all of the parameters that we wish to use. The control class objects are associated with their elemental objects. For example, the control object for the DOR class would be a DOR_control object. Hence, this document details the generic properties of control classes.

Usage

1
2
3
4
5
6
7
helper.show.control(fx, params)

make.control(elemental_objs, parameter_lists)

set.custom_control(elemental_class_name, make.print_method = T)

remove.show.custom_control(object_name)

Slots

fx

A list of elemental objects of the same type.

params

A list of parameters.

type

Set to 'control'.

Built-in classes of control objects

This is a list of the built-in control objects.

DOR_control

For DOR objects, class.DOR

dep_control

For dep objects, class.dep

emission_control

For emission objects, class.emission

initial_reserve_control

For initial_reserve objects, class.initial_reserve

stimulus_control

For stimulus objects, class.stimulus

termination_control

For termination objects, class.termination

show methods for the built-in control objkects

This is a list of show methods for the built-in control objects:

show.DOR_control

For DOR objects, class.DOR

show.dep_control

For dep objects, class.dep

show.emission_control

For emission objects, class.emission

show.initial_reserve_control

For initial_reserve objects, class.initial_reserve

show.stimulus_control

For stimulus objects, class.stimulus

show.termination_control

For termination objects, class.termination

Each of these methods have a corresponding remove.show.X function. If a show method is removed, it may be reinstated with the code above.

Make a control object from 'elemental' objects

To create a control object from a list of 'elemental' objects:

  1. Make sure that the type of control object that you want to make has been defined. If the type of control object that you wish to make has not been defined, see the following section for how to define a custom type of control object.

  2. Use the make.control function

Usage

make.control( elemental_objs, parameter_lists )

Arguments

elemental_objs

Either a list of elemental objects of the same class or a single elemental object

parameter_lists

A list of parameter lists for the function contained in the elemental objects. All parameters must be strings that have been previously specified as input. The parameter list need not be named. Unnamed parameters are set up in the order that they appear. Alternatively, one may specify which elemental object each parameter list belongs to. See example.

Value

Returns a control object.

Set a custom control object

To set a custom control object:

Usage

set.custom_control( elemental_class_name, make.print_method )

Arguments

elemental_class_name

A character string giving the name of an elemental class. See class.custom_elemental for setting and making custom elemental classes/objects.

make.print_method

A logical specifying whether or not to make a show method for printing the control object. Defaults to T.

Value

Sets a control class If there were no errors, a message will be printed stating that the control class has been set. Note that the control object that is set will have the name "X_control", where "X" is the name of the elemental object.

show methods for custom control objects

Whenever a custom control object is set up, the default is that an associated show method is also defined. This show method can be removed by using the function remove.show.custom_control( object_name ).

See Also

set.custom_elemental For setting up custom elemental classes to make custom control objects.

e_show For the show methods.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#Make some 'DOR' objects:
linear_DOR = make.DOR( DOR_fx = linear_DOR_fx, name = "linear_DOR" )
exponential_DOR = make.DOR( DOR_fx = exponential_DOR_fx, name = "exponential_DOR" )

#Make parameter lists for each 'DOR' object.
#linear_DOR_fx has the parameters: 'max', 'scale', 'resp_times', 'rft_times', 'reserve_value'.
#The parameters 'max' and 'scale' are fixed within each simulation while the other parameters are inputs that change within each simulation. Hence, we put the name of the input that we want to use for these parameters.
linear_DOR_params = list( scale = 100, max = c(1, 0.5), resp_times = "resp_time", rft_times = "rft_time", reserve_value = "reserve" )
#Apply the same logic to the exponential DOR parameters:
#If we do not name the parameters in the list, they are applied in the order that they are specified.
exponential_DOR_params = list( 100, 1, "resp_time", "rft_time", "reserve" )

#Combine the parameter lists:
#If the lists are not named, they are specified in the order that they appear.
DOR_params = list( linear_DOR = linear_DOR_params, exponential_DOR_params )
#Put the DOR objects into a list:
DOR_list = list( linear_DOR, exponential_DOR )

#Make the control object
DOR_ctrl = make.control( DOR_list, DOR_params )
#If we only have one DOR object, we can directly specify them in the make.control() function without putting them inside another list.

#To make a custom control object
#Assume that you already have an elemental class, 'test' and and you want to make a 'test_control' object.
#This will define a 'test_control' class.
test_ctrl = set.custom_control( "test" )
#Then you use "make.control()" as shown above.

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