
Creation and adding of a controller in a supervisor
Source:R/CreateController.R
CreateController.Rd
Creation and adding of a controller in a supervisor
Arguments
- supervisor
Supervisor
object, see CreateSupervisor- ctrl.id
character id of the controller (see Details)
- Y
character location of the controlled and/or measured variables in the model.
- U
character location of the command variables in the model.
- FUN
function controller logic which calculates
U
fromY
(see Details)
Value
a Controller
object which is a list with the following items:
id
character: the controller identifierU
matrix: the list of controls for command variables with each column being the location of the variables and the rows being the values of the variable for the current time steps (empty by default)Unames
character: location of the command variablesY
matrix: the lists of controls for controlled variables with each column being the location of the variables and the rows being the values of the variable for the current time steps (empty by default)Ynames
character: location of the controlled variablesFUN
function: controller logic which calculatesU
fromY
Details
The ctrl.id
is a unique id for finding the controller in the supervisor.
If a controller with the same id already exists, it is overwritten by this new one.
FUN
should be a function with one numeric parameter.
This parameter will receive the measured values of at Y
locations as input
for the previous time step and returns calculated U
. These U
will then be applied
at their location for the current time step of calculation of the model.
See RunModel.Supervisor and vignettes for examples of use.