YANE-Framework 1.1.0
Public Member Functions | Protected Member Functions | Protected Attributes

yane::NetworkedControl::Actuator Class Reference

Implementation of the actuator sided control sequence manager. More...

Inheritance diagram for yane::NetworkedControl::Actuator:
Collaboration diagram for yane::NetworkedControl::Actuator:

List of all members.

Public Member Functions

 Actuator (yane::Model::Model *model, int horizon, T_RESPONSEFUNC func=0, void *ptr=0, yane::Utils::DebugMaster *dm=0, yane::Utils::StatisticsMaster *sm=0)
virtual void enterPacket (void *packet, double *data)
 Passes a new control sequence packet to the actuator.
virtual void getCurrentControl (double *control)
 Offers the current validated control based on entered control sequences.
void setSamplingInstant (int samplingInstant)
 Function to set the current time instant.
 ~Actuator ()

Protected Member Functions

virtual void proceedError (int seq, int preseq)
 Triggers an error message by calling the callback function.

Protected Attributes

T_RESPONSEFUNC _actuatorfunction
 Pointer to the error callback function.
 Instance of a control sequence manager object.
 Instance of a debugging client.
double * _defaultu
 Emergency fallback control to handle the case of buffer running empty.
int _dimu
 Dimension of the control variable.
int _horizon
 Length of the control sequences.
 Instance of the plant model.
void * _ptr
 Custom pointer passed to the callback function.
int _seq
 Current time instant, to be set externally.
 Statistics collector for applied sequences.
 Statistics collector for bridged sequences.
 Statistics collector for buffer underruns.
bool _stat_collect
 If true, the actuator will collect statistical data.
 Statistics collector for duplicated sequences.
 Statistics collector for inconsistent sequences.
 Statistics collector for invalidated sequences.
 Statistics collector for missing sequences.
 Statistics collector for outdated sequences.
 Statistics collector for received sequences.
 Statistics collector for sent error messages.
double * _u
 Temporary memory for control storage.
int _u_seq
 Time instant of the last implemented control sequence.

Detailed Description

This class can be used to simulate a physical hardware controller. Its purpose is to transmit control sequences from a controller to a plant.

The user has to pass control sequences which are computed for a certain time instance. The object chooses the control vector corresponding to the objects internal time instant and provides error-packets for the controller if necessary.

Constructor & Destructor Documentation

LIB_EXPORT yane::NetworkedControl::Actuator::Actuator ( yane::Model::Model model,
int  horizon,
void *  ptr = 0,
yane::Utils::DebugMaster dm = 0,
yane::Utils::StatisticsMaster sm = 0 


modelPointer to the class yane:Model::Model object of the controlled system, used to acquire information about dimensions
horizonLength of the control sequences sent by the predictive controller
funcOptional pointer to the error packet callback function. The actuator will not generate error messages, if NULL has been passed.
ptrOptional custom pointer passed to the callback function for user defined data
dmOptional pointer to a class yane::Utils::Debugmaster object
smOptional pointer to a class yane::Utils::StatisticsMaster object

Member Function Documentation

LIB_EXPORT void yane::NetworkedControl::Actuator::enterPacket ( void *  packet,
double *  data 
) [virtual]

The packet has to be prediction consistently generated by an object of class yane::NetworkedControl::Controller. If the packet is too old, contains invalid data or has already been added, it will be ignored.

packetPointer to a structure of type yane::IOInterface::OUTPUTPACKET generated by a class yane::NetworkedControl::Controller object
dataPointer of a complete control sequence of the length (horizon) defined when the executing class yane::NetworkedControl::Actuator object was created.

Reimplemented in yane::NetworkedControl::RealtimeActuator.

LIB_EXPORT void yane::NetworkedControl::Actuator::getCurrentControl ( double *  control) [virtual]

During the call of this function validation checks will be executed and the error callback function will be called if necessary.

controlPointer of a double array that contains the current control on return

Reimplemented in yane::NetworkedControl::RealtimeActuator.

LIB_EXPORT void yane::NetworkedControl::Actuator::proceedError ( int  seq,
int  preseq 
) [protected, virtual]
seqTime instant of the erroneous sequence
preseqTime instant of the last validated sequence

Reimplemented in yane::NetworkedControl::RealtimeActuator.

LIB_EXPORT void yane::NetworkedControl::Actuator::setSamplingInstant ( int  samplingInstant)

Function to set the current time instant. This function is only used in a deterministic setting, realtime settings require the algorithm to determine the current time instant by itself.

samplingInstantCurrent time instant