libFAUDES

Sections

Index

faudes::SimConditionAttribute Class Reference
[Simulation Condition Attributes]

#include <sp_simconditionset.h>

Inherits faudes::AttributeVoid.

List of all members.


Detailed Description

Attribute for a simulation condition.

In order to extract statistical data from a simulation by a LoggingExecutor or some derived class, so called simulation conditions are defined. At any instance of time, a condition is satisfied or dissatisfied. Statistical data can then be requested regarding the period and duration of each condition. Currently, two types of conditions are available:

A Condition may be flagged as a break condition to halt simulation when satisfied. A condition may be enabled for tracking or not.

The class SimConditionAttribute summarizes all data to represent faudes simulation conditions. It also holds some state of the condition wrt execution and provides an interface for sampling. The latter may be seperated to a different class in a future revision. The class SimConditionAttribute does, however, not implement any test whether or not a condition is satisfied. This is done by the LoggingExecutor.

As a faudes attribute, conditions can be referenced by names the via std faudes container TaNameSet. For token io, a ParallelExecutor should be provided as context to access symbolic state names. The file format of a set of events equipped with condition attributes is illustrated by the below example to monitor some performance aspects of one simple machine:

 <Conditions>

 % monitor when the machine is idle
 "IdleCond"      
 <StateCondition>
 <StateSet> "idle" </StateSet>
 </StateCondition>

 % halt simulation  when the machine is down
 % however, the condition is disabled
 "DownCond"      
 +Break+     
 +Disabled+     
 <StateCondition>
 <StateSet> "down" </StateSet>
 </StateCondition>

 % monitor how long the prozessing one work piece takes
 "OperationCond"     
 <EventCondition>
 <StartEvents>  "alpha" </StartEvents>
 <StopEvents>   "beta"  </StopEvents>
 </EventCondition>

 </Conditions>

Definition at line 137 of file sp_simconditionset.h.


Public Types

typedef std::vector< StateSet >
::iterator 
Iterator
 Convenience typedef.
typedef std::vector< StateSet >
::const_iterator 
CIterator

Public Member Functions

virtual SimConditionAttributeNew (void) const
 Construct on heap.
virtual SimConditionAttributeCopy (void) const
 Construct on heap.
virtual const
SimConditionAttribute
Cast (const Type *pOther) const
 Cast other object to this type.
virtual SimConditionAttributeAssign (const Type &rSrc)
 Assign configuration data from other object.
virtual bool Equal (const Type &rOther) const
 Test equality of configuration data.
virtual SimConditionAttributeoperator= (const SimConditionAttribute &rSrc)
virtual bool operator== (const SimConditionAttribute &rOther) const
virtual bool operator!= (const SimConditionAttribute &rOther) const
 SimConditionAttribute (void)
 Default constructor.
 SimConditionAttribute (const SimConditionAttribute &rOther)
 Copy constructor.
virtual bool IsDefault (void) const
 Test for default value.
bool IsStateCondition (void) const
 Test for state condition.
bool IsEventCondition (void) const
 Test for event condition.
bool IsBreakCondition (void) const
 Test for break condition.
bool IsEnabled (void) const
 Test whether condition is enabled.
void StateCondition (const SimStateConditionAttribute &rStateConditionAttribute)
 Set state condition attribute.
void EventCondition (const SimEventConditionAttribute &rEventConditionAttribute)
 Set event condition attribute.
void BreakCondition (bool on)
 Set break flag.
void Enabled (bool on)
 Set enabled flag.
const SimEventConditionAttributeEventCondition (void) const
 Get event condition.
const SimStateConditionAttributeStateCondition (void) const
 Get state condition.
void Reset (void)
 Reset conditions execution state.
bool Satisfied (void) const
 Test whether the condition is currently satisfied.
void Satisfied (bool on, tpTime::Type now)
 Set the condition to be satisfied.

Public Attributes

SampledDensityFunction mSamplesPeriod
 Sampled period, at which this condition becomes satisfied.
SampledDensityFunction mSamplesDuration
 Sampled durations, for which this condition remains satisfied.

Protected Member Functions

SimConditionAttributeDoAssign (const SimConditionAttribute &rSrcAttr)
 Assignment method.
bool DoEqual (const SimConditionAttribute &rAttr) const
 Equality method.
virtual void DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 Reads the attribute from TokenReader, see AttributeVoid for public wrappers.
virtual void DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Writes the attribute to TokenWriter, see AttributeVoid for public wrappers.

Protected Attributes

bool mEventCondition
 Indicate precense of a event condition.
bool mStateCondition
 Indicate precense of a state condition.
bool mBreakCondition
 Indicate that we halt simulation when this condition is satisfied.
bool mEnabled
 Indicate that this condition should be considere at all.
SimEventConditionAttribute mEventConditionAttribute
 Event based condition data.
SimStateConditionAttribute mStateConditionAttribute
 State based condition data.
bool mSatisfied
 Condotion state: recorded as satisfied.
tpTime::Type mActivationTime
 Condition state: when last satisfied became true.

Member Typedef Documentation

typedef std::vector<StateSet>::iterator faudes::SimConditionAttribute::Iterator

Convenience typedef.

Definition at line 144 of file sp_simconditionset.h.

typedef std::vector<StateSet>::const_iterator faudes::SimConditionAttribute::CIterator

Definition at line 145 of file sp_simconditionset.h.


Constructor & Destructor Documentation

faudes::SimConditionAttribute::SimConditionAttribute ( void   ) 

Default constructor.

Constructs a SimConditionAttribute of with no type ie neither state condition nor event condition.

Definition at line 34 of file sp_simconditionset.cpp.

faudes::SimConditionAttribute::SimConditionAttribute ( const SimConditionAttribute rOther  ) 

Copy constructor.

with no type ie neither state condition nor event condition.

Definition at line 46 of file sp_simconditionset.cpp.


Member Function Documentation

SimConditionAttribute * faudes::SimConditionAttribute::New ( void   )  const [virtual]

Construct on heap.

Technically not a constructor, this function creates an object with the same type Type. New() is defined as a virtual function and derived classes are meant to re-implement with the appropiate constructor. This can be done via the provided macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION. As with new, it is the callers reponsabilty to delete the object when no longer needed.

Returns:
Pointer to new Type object

Reimplemented from faudes::AttributeVoid.

Definition at line 30 of file sp_simconditionset.cpp.

SimConditionAttribute * faudes::SimConditionAttribute::Copy ( void   )  const [virtual]

Construct on heap.

Technically not a constructor, this function creates an object with the same type Type and the same configuration. Copy() is defined as a virtual function and derived classes are meant to re-implement with the appropiate copy constructor. This can be done via the provided macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION. As with new, it is the callers reponsabilty to delete the object when no longer needed.

Returns:
Pointer to new Type object

Reimplemented from faudes::AttributeVoid.

Definition at line 30 of file sp_simconditionset.cpp.

const SimConditionAttribute * faudes::SimConditionAttribute::Cast ( const Type pOther  )  const [virtual]

Cast other object to this type.

Enables the run-time interface to test whether pObject is derived from this object. This feature is used e.g. in the faudes container classes to test attributes. Derived classes must reimplement this function using the appropriate dynamic cast.

Re-implementation can be done via the convenience macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION.

Returns:
Typed pointer object

Reimplemented from faudes::AttributeVoid.

Definition at line 30 of file sp_simconditionset.cpp.

SimConditionAttribute & faudes::SimConditionAttribute::Assign ( const Type rSrc  )  [virtual]

Assign configuration data from other object.

Derived classes should reimplement this method to first try to cast the source to the respective class. If successful, the protected function DoAssign is invoked to perform the actual assignment. If the cast fails, the Assign method of the parent class is called. Thus, faudes objects are up- and downcatsted for assignment, maintaining as much of the source data as digestable by the destination object. On the downside, there is no sensible typechecking at compile-time.

Re-implementation can be done via the convenience macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION.

Parameters:
rSrc Source to copy from
Returns:
Reference to this object.

Reimplemented from faudes::AttributeVoid.

Definition at line 30 of file sp_simconditionset.cpp.

bool faudes::SimConditionAttribute::Equal ( const Type rOther  )  const [virtual]

Test equality of configuration data.

Derived classes should reimplement this method to return true if both actual types and configuration data match. The object name is not consired in the test.

This method calls the virtual method DoEqual(). Re-implementation can be done via the convenience macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION.

Parameters:
rOther Other objevt to compare with.
Returns:
True on match.

Reimplemented from faudes::AttributeVoid.

Definition at line 30 of file sp_simconditionset.cpp.

SimConditionAttribute & faudes::SimConditionAttribute::operator= ( const SimConditionAttribute rSrc  )  [virtual]

Definition at line 30 of file sp_simconditionset.cpp.

bool faudes::SimConditionAttribute::operator== ( const SimConditionAttribute rOther  )  const [virtual]

Definition at line 30 of file sp_simconditionset.cpp.

bool faudes::SimConditionAttribute::operator!= ( const SimConditionAttribute rOther  )  const [virtual]

Definition at line 30 of file sp_simconditionset.cpp.

virtual bool faudes::SimConditionAttribute::IsDefault ( void   )  const [inline, virtual]

Test for default value.

Returns:
True, if this attribute has its default value

Reimplemented from faudes::AttributeVoid.

Definition at line 165 of file sp_simconditionset.h.

bool faudes::SimConditionAttribute::IsStateCondition ( void   )  const [inline]

Test for state condition.

Returns:
True, if this attribute defines a state condition

Definition at line 175 of file sp_simconditionset.h.

bool faudes::SimConditionAttribute::IsEventCondition ( void   )  const [inline]

Test for event condition.

Returns:
True, if this attribute defines an event condition

Definition at line 183 of file sp_simconditionset.h.

bool faudes::SimConditionAttribute::IsBreakCondition ( void   )  const [inline]

Test for break condition.

Returns:
True, if this condition halts simulation.

Definition at line 191 of file sp_simconditionset.h.

bool faudes::SimConditionAttribute::IsEnabled ( void   )  const [inline]

Test whether condition is enabled.

Returns:
True, if this condition is monitored during simulation.

Definition at line 199 of file sp_simconditionset.h.

void faudes::SimConditionAttribute::StateCondition ( const SimStateConditionAttribute rStateConditionAttribute  )  [inline]

Set state condition attribute.

Define this attribute to represent the specified state condition.

Parameters:
rStateConditionAttribute Define state condition

Definition at line 208 of file sp_simconditionset.h.

void faudes::SimConditionAttribute::EventCondition ( const SimEventConditionAttribute rEventConditionAttribute  )  [inline]

Set event condition attribute.

Define this attribute to represent the specified event condition.

Parameters:
rEventConditionAttribute Define event condition

Definition at line 221 of file sp_simconditionset.h.

void faudes::SimConditionAttribute::BreakCondition ( bool  on  )  [inline]

Set break flag.

Parameters:
on True, to indicate that this condition halts simulation.

Definition at line 230 of file sp_simconditionset.h.

void faudes::SimConditionAttribute::Enabled ( bool  on  )  [inline]

Set enabled flag.

Parameters:
on True, to indicate that this condition is to be monitored during simulation.

Definition at line 238 of file sp_simconditionset.h.

const SimEventConditionAttribute& faudes::SimConditionAttribute::EventCondition ( void   )  const [inline]

Get event condition.

Note that the attribute can only return meaningful data if it actually is an event condition.

Returns:
Defining data of this attribute's event condition.

Definition at line 248 of file sp_simconditionset.h.

const SimStateConditionAttribute& faudes::SimConditionAttribute::StateCondition ( void   )  const [inline]

Get state condition.

Note that the attribute can only return meaningful data if it actually is an state condition.

Returns:
Defining data of this attribute's state condition.

Definition at line 258 of file sp_simconditionset.h.

void faudes::SimConditionAttribute::Reset ( void   )  [inline]

Reset conditions execution state.

The execution state of a condition consists of all data accumulated during simulation eg statistical data and whether or not the condition is currently satisfied. The execution state resides in the attribute for pragmatic reasons only.

Definition at line 266 of file sp_simconditionset.h.

bool faudes::SimConditionAttribute::Satisfied ( void   )  const [inline]

Test whether the condition is currently satisfied.

This is part of the condition execution state.

Returns:
True, if the conditions is considered satisfied

Definition at line 276 of file sp_simconditionset.h.

void faudes::SimConditionAttribute::Satisfied ( bool  on,
tpTime::Type  now 
)

Set the condition to be satisfied.

This is part of the condition execution state. Since it is the executor that determines whether a condition is satisfied, and since the condition state resides in the attribute, the executor is meant to notify state changes.

Parameters:
on True, if the conditions is considered satisfied
now Time at which the state change occures

Definition at line 259 of file sp_simconditionset.cpp.

SimConditionAttribute & faudes::SimConditionAttribute::DoAssign ( const SimConditionAttribute rSrcAttr  )  [protected]

Assignment method.

Parameters:
rSrcAttr Source to assign from

Definition at line 58 of file sp_simconditionset.cpp.

bool faudes::SimConditionAttribute::DoEqual ( const SimConditionAttribute rAttr  )  const [protected]

Equality method.

Parameters:
rAttr Source to compare with

Definition at line 78 of file sp_simconditionset.cpp.

void faudes::SimConditionAttribute::DoRead ( TokenReader rTr,
const std::string &  rLabel = "",
const Type pContext = 0 
) [protected, virtual]

Reads the attribute from TokenReader, see AttributeVoid for public wrappers.

If the current token indicates a condition section, the method reads the condition data from that section. Else it does nothing. Exceptions may only be thrown on invalid data within the condition section. The label argiment is ignored, we use hardcoded labled "EventCondition" and "StateCondition" to figure the type of condition. When a ParallelExecutor is provided as context, it is used to interpret symbolc state names of a state condition.

Parameters:
rTr TokenReader to read from
rLabel Section to read
pContext Read context to provide contextual information
Exceptions:
Exception 
  • IO error (id 1)

Reimplemented from faudes::AttributeVoid.

Definition at line 142 of file sp_simconditionset.cpp.

void faudes::SimConditionAttribute::DoWrite ( TokenWriter rTw,
const std::string &  rLabel = "",
const Type pContext = 0 
) const [protected, virtual]

Writes the attribute to TokenWriter, see AttributeVoid for public wrappers.

Writes a condition section to include data on state- or event-condition. The label argument is ignored, we use hardcoded keywords "EventCondition" and StateCondition". When a ParallelExecutor is provided as context, it state conditions are written with symbolic state names.

Parameters:
rTw TokenWriter to write to
rLabel Section to write
pContext Read context to provide contextual information
Exceptions:
Exception 
  • IO error (id 2)

Reimplemented from faudes::AttributeVoid.

Definition at line 94 of file sp_simconditionset.cpp.


Member Data Documentation

Sampled period, at which this condition becomes satisfied.

Definition at line 295 of file sp_simconditionset.h.

Sampled durations, for which this condition remains satisfied.

Definition at line 300 of file sp_simconditionset.h.

Indicate precense of a event condition.

Definition at line 305 of file sp_simconditionset.h.

Indicate precense of a state condition.

Definition at line 308 of file sp_simconditionset.h.

Indicate that we halt simulation when this condition is satisfied.

Definition at line 311 of file sp_simconditionset.h.

Indicate that this condition should be considere at all.

Definition at line 314 of file sp_simconditionset.h.

Event based condition data.

Definition at line 317 of file sp_simconditionset.h.

State based condition data.

Definition at line 320 of file sp_simconditionset.h.

Condotion state: recorded as satisfied.

Definition at line 323 of file sp_simconditionset.h.

Condition state: when last satisfied became true.

Definition at line 326 of file sp_simconditionset.h.


The documentation for this class was generated from the following files:

libFAUDES 2.14g --- 2009-12-3 --- c++ source docu by doxygen 1.5.6