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

yane::NetworkedControl::RealtimeActuator Class Reference

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

Inheritance diagram for yane::NetworkedControl::RealtimeActuator:
Collaboration diagram for yane::NetworkedControl::RealtimeActuator:

List of all members.

Public Member Functions

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

Protected Member Functions

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.
 stores the pointer the the discrete realtime clock
 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. It offers realtime controls computed by a predictive controller and automatically stores and sorts the transmitted control sequences.

The user has to pass computed control sequences to an instance of this class. The object automatically chooses the current control vector and provides error packets dedicated to the predictive controller if necessary. The object needs an instance of a discrete realtime clock to identify the current cycle.

Constructor & Destructor Documentation

LIB_EXPORT yane::NetworkedControl::RealtimeActuator::RealtimeActuator ( yane::Model::Model model,
Cycle cycle,
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
cyclePointer to an object of a discrete realtime clock.
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::RealtimeActuator::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 from yane::NetworkedControl::Actuator.

LIB_EXPORT void yane::NetworkedControl::RealtimeActuator::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 from yane::NetworkedControl::Actuator.

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

Reimplemented from yane::NetworkedControl::Actuator.

LIB_EXPORT void yane::NetworkedControl::Actuator::setSamplingInstant ( int  samplingInstant) [inherited]

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