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:
[legend]
Collaboration diagram for yane::NetworkedControl::Actuator:
[legend]

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)
 Constructor.
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 ()
 Destuctor.

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.
ControlClipboard_cb
 Instance of a control sequence manager object.
yane::Utils::DebugClient_debugclient
 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.
yane::Model::Model_model
 Instance of the plant model.
void * _ptr
 Custom pointer passed to the callback function.
int _seq
 Current time instant, to be set externally.
yane::Utils::StatisticsClientIntCounter_stat_appliedseq
 Statistics collector for applied sequences.
yane::Utils::StatisticsClientIntCounter_stat_bridgedseq
 Statistics collector for bridged sequences.
yane::Utils::StatisticsClientIntCounter_stat_bufferunderrun
 Statistics collector for buffer underruns.
bool _stat_collect
 If true, the actuator will collect statistical data.
yane::Utils::StatisticsClientIntCounter_stat_duplicateseq
 Statistics collector for duplicated sequences.
yane::Utils::StatisticsClientIntCounter_stat_inconsistentseq
 Statistics collector for inconsistent sequences.
yane::Utils::StatisticsClientIntCounter_stat_invalidatedseq
 Statistics collector for invalidated sequences.
yane::Utils::StatisticsClientIntCounter_stat_missingseq
 Statistics collector for missing sequences.
yane::Utils::StatisticsClientIntCounter_stat_outdatedseq
 Statistics collector for outdated sequences.
yane::Utils::StatisticsClientIntCounter_stat_recvseq
 Statistics collector for received sequences.
yane::Utils::StatisticsClientIntCounter_stat_senterror
 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,
T_RESPONSEFUNC  func = 0,
void *  ptr = 0,
yane::Utils::DebugMaster dm = 0,
yane::Utils::StatisticsMaster sm = 0 
)

Constructor

Parameters:
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.

Parameters:
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.

Parameters:
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]
Parameters:
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.

Parameters:
samplingInstantCurrent time instant