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

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)
 Constructor.
void setSamplingInstant (int samplingInstant)
 Function to set the current time instant.
 ~RealtimeActuator ()
 Destructor.

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.
ControlClipboard_cb
 Instance of a control sequence manager object.
Cycle_cycle
 stores the pointer the the discrete realtime clock
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. 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,
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
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.

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

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

Parameters:
samplingInstantCurrent time instant