Detailed Description

Attribute for an event in the context of simulation.

When simulating one or more generators, at each instance of time there will be one or more transitions enabled. In order resolve this non-determinism in a defined way, each event may be equipped with either one of the following properties.

Note that the SimEventAttribute just holds the data to define the properties, a semantic implementation is in faudes::ProposingExecutor. The current implementation also stores simulation state data (ie evaluations of random variables), but this is likely to change in a future revision.

As a faudes attribute, SimEventAttribute provides token io and is prepared for the use in the context of a faudes container. The file format of a set of events equipped with simulation attributes is illustrated by the below example for the simulation of a simple machine:

<SimEvents>
% machine start: prioritised event with priority 100
"alpha"
<Priority> 100 </Priority>
% machine finsh: gauss distributed event with mue=10 and sigma=5, relative to guard
"beta"
<Stochastic> +Trigger+ +Gauss+ <Parameter> 10 5 </Parameter> </Stochastic>
% break down: gauss distributed event with mue=20 and sigma=5, relative to enabled time
"mue"
<Stochastic> +Delay+ +Gauss+ <Parameter> 20 5 </Parameter> </Stochastic>
% machine repair: prioritised event with priority 100
"lambda"
<Priority> 100 </Priority>
</SimEvents>
const SimStochasticEventAttribute & Stochastic(void) const
Get stochastic attribute.
const SimPriorityEventAttribute & Priority(void) const
Get priority attribute.

Definition at line 149 of file sp_simeventset.h.

#include <sp_simeventset.h>

Public Member Functions

 SimEventAttribute (void)
 Default constructor. More...
 
 SimEventAttribute (const SimEventAttribute &rSrc)
 Copy constructor. More...
 
virtual bool IsDefault (void) const
 Test for default value. More...
 
bool IsStochastic (void) const
 Test for stochastic property. More...
 
bool IsPriority (void) const
 Test for priority property. More...
 
void Stochastic (const SimStochasticEventAttribute &rStochasticAttribute)
 Set stochastic behaviour. More...
 
void Priority (const SimPriorityEventAttribute &rPriorityAttribute)
 Set priority behaviour. More...
 
const SimPriorityEventAttributePriority (void) const
 Get priority attribute. More...
 
const SimStochasticEventAttributeStochastic (void) const
 Get stochastic attribute. More...
 
std::string Str (void) const
 Debug string, incl state. More...
 
- Public Member Functions inherited from faudes::AttributeCFlags
 AttributeCFlags (void)
 Default constructor. More...
 
virtual ~AttributeCFlags (void)
 Destructor. More...
 
void SetControllable (void)
 Set controllable flag. More...
 
void ClrControllable (void)
 Clear controllable flag. More...
 
bool Controllable (void) const
 Query controllablility. More...
 
void SetObservable (void)
 Set observable flag. More...
 
void ClrObservable (void)
 Clear observable flag. More...
 
bool Observable (void) const
 Query observablility. More...
 
void SetForcible (void)
 Set forcible flag. More...
 
void ClrForcible (void)
 Clear forcible flag. More...
 
bool Forcible (void) const
 Query forcibility. More...
 
void SetHighlevel (void)
 Set abstraction flag. More...
 
void SetLowlevel (void)
 Clear abstraction flag. More...
 
bool Highlevel (void) const
 Query abstaction flag. More...
 
bool Lowlevel (void) const
 Query abstaction flag. More...
 
- Public Member Functions inherited from faudes::AttributeFlags
 AttributeFlags (void)
 Default constructor. More...
 
 AttributeFlags (const AttributeFlags &rOther)
 Copy constructor. More...
 
virtual ~AttributeFlags (void)
 Destructor. More...
 
bool Test (fType mask) const
 Test a flag. More...
 
bool TestAll (fType mask) const
 Test multible flags, combine by "and". More...
 
bool TestSome (fType mask) const
 Test multible flags, combine by "or". More...
 
bool TestNone (fType mask) const
 Test multible flags, combine by "not or". More...
 
void Set (fType mask)
 Set multiple flags. More...
 
void Clr (fType mask)
 Clear multiple flags. More...
 
- Public Member Functions inherited from faudes::AttributeVoid
 AttributeVoid (void)
 Constructor. More...
 
 AttributeVoid (const AttributeVoid &rSrcAttr)
 Copy Constructor. More...
 
virtual ~AttributeVoid (void)
 Destructor. More...
 
virtual void SetDefault (void)
 Set to default value. More...
 
virtual void Clear (void)
 Synonym for SetDefault to match std interface. More...
 
- Public Member Functions inherited from faudes::Type
 Type (void)
 Constructor. More...
 
 Type (const Type &rType)
 Copy constructor. More...
 
virtual ~Type (void)
 Destructor. More...
 
virtual TypeNew (void) const
 Construct on heap. More...
 
virtual TypeCopy (void) const
 Construct on heap. More...
 
virtual const TypeCast (const Type *pOther) const
 Cast other object to this type. More...
 
virtual TypeAssign (const Type &rSrc)
 Assign configuration data from other object. More...
 
virtual Typeoperator= (const Type &rSrc)
 Assign configurationdata from other object. More...
 
virtual bool Equal (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual bool operator== (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual bool operator!= (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual void Name (const std::string &rName)
 Set the objects's name. More...
 
virtual const std::string & Name (void) const
 Get objects's name. More...
 
virtual const std::string & TypeName (void) const
 Get objects's type name. More...
 
void Write (const Type *pContext=0) const
 Write configuration data to console. More...
 
void Write (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0, std::ios::openmode openmode=std::ios::out|std::ios::trunc) const
 Write configuration data to a file. More...
 
void Write (const std::string &pFileName, std::ios::openmode openmode) const
 Write configuration data to a file. More...
 
void Write (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to TokenWriter. More...
 
virtual void XWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to an XML file. More...
 
void XWrite (const Type *pContext=0) const
 Write configuration data in XML format to concole Note: this write function uses the virtual function DoXWrite(), to be reimplemented by derived classes. More...
 
void XWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data in XML format to TokenWriter. More...
 
std::string ToString (const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to a string. More...
 
std::string ToText (const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to a formated string. More...
 
void DWrite (const Type *pContext=0) const
 Write configuration data to console, debugging format. More...
 
void DWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0, std::ios::openmode openmode=std::ios::out|std::ios::trunc) const
 Write configuration data to a file, debugging format. More...
 
void DWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data in debug format to TokenWriter. More...
 
void SWrite (TokenWriter &rTw) const
 Write statistics comment to TokenWriter. More...
 
void SWrite (void) const
 Write statistics comment to console. More...
 
std::string ToSText (void) const
 Write statistics to a string. More...
 
void Read (const std::string &rFileName, const std::string &rLabel="", const Type *pContext=0)
 Read configuration data from file with label specified. More...
 
void FromString (const std::string &rString, const std::string &rLabel="", const Type *pContext=0)
 Read configuration data from a string. More...
 
void Read (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 Read configuration data from TokenReader with label sepcified. More...
 

Public Attributes

Time::Type mScheduledFor
 Next scheduled occurence of this event relative to current time. More...
 
Time::Type mExpiresAt
 Time at which the recent schedule expires. More...
 
Time::Type mDelayFor
 Amount of time to defer the event. More...
 
TimeInterval mReferenceInterval
 Time domain on which the recent schedule was computed. More...
 
- Public Attributes inherited from faudes::AttributeFlags
fType mFlags
 Flags (public access for convenience)
More...
 

Protected Member Functions

void DoAssign (const SimEventAttribute &rSrcAttr)
 Assignment method. More...
 
bool DoEqual (const SimEventAttribute &rOther) const
 Test equality. More...
 
virtual void DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 Reads the attribute from TokenReader, see AttributeVoid for public wrappers. More...
 
virtual void DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Writes the attribute to TokenWriter, see AttributeVoid for public wrappers. More...
 
- Protected Member Functions inherited from faudes::AttributeCFlags
void DoAssign (const AttributeCFlags &rSrcAttr)
 Assignment method. More...
 
bool DoEqual (const AttributeCFlags &rOther) const
 Test equality of configuration data. More...
 
virtual void DoXWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Writes attribute to TokenWriter (XML format), see AttributeVoid for public wrappers. More...
 
- Protected Member Functions inherited from faudes::AttributeFlags
void DoAssign (const AttributeFlags &rSrcAttr)
 Assignment method. More...
 
bool DoEqual (const AttributeFlags &rOther) const
 Test equality of configuration data. More...
 
- Protected Member Functions inherited from faudes::AttributeVoid
void DoAssign (const AttributeVoid &rSrcAttr)
 Assign attribute members. More...
 
bool DoEqual (const AttributeVoid &rOther) const
 Test equality of configuration data. More...
 
virtual void DoDWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Actual write method to write the attribute to a TokenWriter. More...
 
- Protected Member Functions inherited from faudes::Type
void DoAssign (const Type &rSrc)
 Assign configuration data from other object. More...
 
bool DoEqual (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual void DoSWrite (TokenWriter &rTw) const
 Write statistical data as a comment to TokenWriter. More...
 
virtual const TypeDefinitionTypeDefinitionp (void) const
 Get objects's type definition. More...
 
virtual Token XBeginTag (const std::string &rLabel="", const std::string &rFallbackLabel="") const
 

Protected Attributes

bool mStochastic
 Indicate precense of stochastic behaviour. More...
 
bool mPriority
 Indicate precense of priority property. More...
 
SimPriorityEventAttribute mPriorityAttribute
 Priority definition data
More...
 
SimStochasticEventAttribute mStochasticAttribute
 Stochastic definition data
More...
 

Additional Inherited Members

- Static Public Member Functions inherited from faudes::AttributeVoid
static void Skip (TokenReader &rTr)
 Skip attribute tokens. More...
 
- Static Public Attributes inherited from faudes::AttributeCFlags
static const fType mControllableFlag =0x01
 
static const fType mObservableFlag =0x02
 
static const fType mForcibleFlag =0x04
 
static const fType mAbstractionFlag =0x08
 
- Static Public Attributes inherited from faudes::AttributeFlags
static const fType mDefFlags =0x0
 

Constructor & Destructor Documentation

◆ SimEventAttribute() [1/2]

faudes::SimEventAttribute::SimEventAttribute ( void  )
inline

Default constructor.

Construct a SimEventAttribute with priority 0.

Definition at line 159 of file sp_simeventset.h.

◆ SimEventAttribute() [2/2]

faudes::SimEventAttribute::SimEventAttribute ( const SimEventAttribute rSrc)
inline

Copy constructor.

Definition at line 165 of file sp_simeventset.h.

Member Function Documentation

◆ DoAssign()

void faudes::SimEventAttribute::DoAssign ( const SimEventAttribute rSrcAttr)
protected

Assignment method.

Parameters
rSrcAttrSource to assign from

Definition at line 19 of file sp_simeventset.cpp.

◆ DoEqual()

bool faudes::SimEventAttribute::DoEqual ( const SimEventAttribute rOther) const
protected

Test equality.

Parameters
rOtherAttribute to compare with
Returns
True/False

Definition at line 36 of file sp_simeventset.cpp.

◆ DoRead()

void faudes::SimEventAttribute::DoRead ( TokenReader rTr,
const std::string &  rLabel = "",
const Type pContext = 0 
)
protectedvirtual

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

If the current token indicates a simulation event section, the method reads all consecutive simulation attributes. Else it does nothing. Exceptions may only be thrown on invalid data within the section. The label argument is ignored, we use hardcoded keywords for the four attributes. The context argument is ignored.

Parameters
rTrTokenReader to read from
rLabelSection to read
pContextRead context to provide contextual information
Exceptions
Exception
  • IO error (id 1)

Reimplemented from faudes::AttributeCFlags.

Definition at line 84 of file sp_simeventset.cpp.

◆ DoWrite()

void faudes::SimEventAttribute::DoWrite ( TokenWriter rTw,
const std::string &  rLabel = "",
const Type pContext = 0 
) const
protectedvirtual

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

Writes all present simulation event attributes to include the defining data. The label argument is ignored, we use hardcoded keywords. The context argument is ignored.

Parameters
rTwTokenWriter to write to
rLabelSection to write
pContextRead context to provide contextual information
Exceptions
Exception
  • IO error (id 2)

Reimplemented from faudes::AttributeCFlags.

Definition at line 50 of file sp_simeventset.cpp.

◆ IsDefault()

virtual bool faudes::SimEventAttribute::IsDefault ( void  ) const
inlinevirtual

Test for default value.

Returns
True, if this attribute has its default value

Reimplemented from faudes::AttributeCFlags.

Definition at line 174 of file sp_simeventset.h.

◆ IsPriority()

bool faudes::SimEventAttribute::IsPriority ( void  ) const
inline

Test for priority property.

Returns
True, if this attribute defines priority behaviour

Definition at line 191 of file sp_simeventset.h.

◆ IsStochastic()

bool faudes::SimEventAttribute::IsStochastic ( void  ) const
inline

Test for stochastic property.

Returns
True, if this attribute defines stochastic behaviour

Definition at line 183 of file sp_simeventset.h.

◆ Priority() [1/2]

void faudes::SimEventAttribute::Priority ( const SimPriorityEventAttribute rPriorityAttribute)
inline

Set priority behaviour.

Define this attribute to indicate execution with the specified priority.

Parameters
rPriorityAttributeDefine stochastic behaviour

Definition at line 211 of file sp_simeventset.h.

◆ Priority() [2/2]

const SimPriorityEventAttribute& faudes::SimEventAttribute::Priority ( void  ) const
inline

Get priority attribute.

Note that the return value is only meaningful if the attribute actually is a priority attribute.

Returns
Defining data of this attribute's priority behaviour

Definition at line 223 of file sp_simeventset.h.

◆ Stochastic() [1/2]

void faudes::SimEventAttribute::Stochastic ( const SimStochasticEventAttribute rStochasticAttribute)
inline

Set stochastic behaviour.

Define this attribute to indicate the specified stochastic bahaviour.

Parameters
rStochasticAttributeDefine stochastic behaviour

Definition at line 200 of file sp_simeventset.h.

◆ Stochastic() [2/2]

const SimStochasticEventAttribute& faudes::SimEventAttribute::Stochastic ( void  ) const
inline

Get stochastic attribute.

Note that the return value is only meaningful if the attribute defines stochastic behaviour.

Returns
Defining data of this attribute's stochastic behaviour

Definition at line 233 of file sp_simeventset.h.

◆ Str()

std::string faudes::SimEventAttribute::Str ( void  ) const

Debug string, incl state.

Definition at line 206 of file sp_simeventset.cpp.

Member Data Documentation

◆ mDelayFor

Time::Type faudes::SimEventAttribute::mDelayFor

Amount of time to defer the event.

This is part of the execution state. It is used for events of delay type and is a count down type alarm to trigger the event.

Definition at line 253 of file sp_simeventset.h.

◆ mExpiresAt

Time::Type faudes::SimEventAttribute::mExpiresAt

Time at which the recent schedule expires.

This is part of the execution state. Once a schedule expires, the event is re-scheduled.

Definition at line 246 of file sp_simeventset.h.

◆ mPriority

bool faudes::SimEventAttribute::mPriority
protected

Indicate precense of priority property.

Definition at line 273 of file sp_simeventset.h.

◆ mPriorityAttribute

SimPriorityEventAttribute faudes::SimEventAttribute::mPriorityAttribute
protected

Priority definition data

Definition at line 276 of file sp_simeventset.h.

◆ mReferenceInterval

TimeInterval faudes::SimEventAttribute::mReferenceInterval

Time domain on which the recent schedule was computed.

This is part of the execution state. It is used to invalidate schedules for events of trigger type.

Definition at line 259 of file sp_simeventset.h.

◆ mScheduledFor

Time::Type faudes::SimEventAttribute::mScheduledFor

Next scheduled occurence of this event relative to current time.

This is part of the execution state. It indicates the instance of time for which the respective event is scheduled to occur. Schedules, however, may expire or otherwise become invalid.

Definition at line 240 of file sp_simeventset.h.

◆ mStochastic

bool faudes::SimEventAttribute::mStochastic
protected

Indicate precense of stochastic behaviour.

Definition at line 270 of file sp_simeventset.h.

◆ mStochasticAttribute

SimStochasticEventAttribute faudes::SimEventAttribute::mStochasticAttribute
protected

Stochastic definition data

Definition at line 279 of file sp_simeventset.h.


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

libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen