SimulationChain
 All Classes Functions Variables Pages
CSimObject Class Reference

#include <SimObject.h>

Inheritance diagram for CSimObject:
Collaboration diagram for CSimObject:

Public Member Functions

 CSimObject (int nID=0, ObjType Type=simobject, std::string sName="object")
 Constructs SimObject. More...
 
double Simulate (double dInSample) override
 Outputs one step of the simualtion given one sample of the input. More...
 
void SaveState (boost::property_tree::ptree &pt) const override
 Adds internal object state data to the stream object. More...
 
void LoadState (boost::property_tree::ptree::value_type const &v) override
 Load internal object state data from tree. Each object manages the data itself. More...
 
void SetVectorA (std::vector< double > &&vA)
 Function to set vector a of the model. More...
 
const std::vector< double > & GetVectorA () const
 Function to retrive vector a of the model. More...
 
void SetVectorB (std::vector< double > &&vB)
 Function to set vector b of the model. More...
 
const std::vector< double > & GetVectorB () const
 Function to retrive vector b of the model. More...
 
void SetK (int nK)
 Set K value. More...
 
int GetK () const
 Receive K value. More...
 
void SetStationary (bool bStationary)
 Set if object is stationary. More...
 
- Public Member Functions inherited from CSimNode
 CSimNode (int nID=0, ObjType Type=simobject, std::string const &sName=std::string("node"))
 Constructs the base abstract class for simulation object handling. More...
 
void GetOutputHistory (std::vector< double > &vHist) const override
 Outputs all output samples recorded by far. More...
 
void EraseOutputHistory () override
 Deletes all recorded samples of output. More...
 
virtual void SetOutputHistory (std::vector< double > &vHist) override
 Set output history. More...
 
virtual void SetInputHistory (std::vector< double > &vHist) override
 Set input history. More...
 
void SetID (int nID=0) override
 Enables user to set an ID of the object. User must ensure that the name is unique. More...
 
int GetID () const override
 Fetches object's ID. More...
 
void SetName (std::string &sName) override
 Registers a name with the object. User must ensure that the name is unique. More...
 
const std::string & GetName () const override
 Fetches object's name. More...
 
void GetName (boost::property_tree::ptree &nameTree) const override
 Builds a tree containing names and types of all children nodes. More...
 
void SetParent (ISISO *Parent) override
 Sets object's parent. There can be only one parent of the same object. More...
 
ISISOGetParent () override
 Fetches object's parent pointer. More...
 
void AddChild (std::shared_ptr< ISISO > Child) override
 Allows adding children to the object. More...
 
void RemoveChild (std::shared_ptr< ISISO > Child)
 Removes a child of the object. More...
 
void GetChildren (std::list< std::weak_ptr< ISISO > > &lChildren) const override
 Fetches the list of object's children. More...
 
bool RemoveObject (int nID) override
 Allows to remove the object. Function searches all the children of the object. More...
 
ISISOSearchObject (const std::string &s) override
 Searches all the children of the object to find object with the specified name. More...
 
ISISOFindFirstRegulator () override
 Searches the tree for the first regulator object.
 
ObjType GetType () const override
 Retrive object functional type. More...
 
void SetType (ObjType Type) override
 Set object functional type. More...
 
void SetStreamForOutput (std::shared_ptr< std::ostream > oStream) override
 Set the output stream for object output values. More...
 
void SetVariableToStoreCurrentOutput (std::weak_ptr< double > dOutVal)
 Set the variable to store the current output value. More...
 
void SetVariableToStoreCurrentInput (std::weak_ptr< double > dInVal)
 Set the variable to store the current input value. More...
 
void RemoveStreamForOutput () override
 Disable the output stream for objects input values. More...
 
bool MoveObjectToFront (ISISO *FrontObject) override
 Move object to the front so it can be run first. More...
 
void ResetMemory () override
 Resets objects memory (reset generators if present). More...
 

Protected Attributes

bool m_bStationary
 Is stationary?
 
std::vector< double > m_vA
 Vector with denominator values.
 
std::vector< double > m_vB
 Vector with nominator values.
 
int m_nK
 
- Protected Attributes inherited from CSimNode
int m_nID
 Objects unique ID.
 
std::string m_sName
 Objects unique name.
 
CHistorian m_OutputHistory
 Output sample history.
 
CHistorian m_InputHistory
 Input sample history.
 
std::list< std::shared_ptr
< ISISO > > 
m_lChildren
 List of children.
 
ISISOm_Parent
 Pointer to parent.
 
ObjType m_Type
 Objects type.
 
std::shared_ptr< std::ostream > m_oStream
 Output stream.
 
std::weak_ptr< double > m_dOutVal
 Pointer to variable storing last output value.
 
std::weak_ptr< double > m_dInVal
 Pointer to variable storing last input value.
 

Detailed Description

Simulated object base class with all necessary properties.

Constructor & Destructor Documentation

CSimObject::CSimObject ( int  nID = 0,
ObjType  Type = simobject,
std::string  sName = "object" 
)

Constructs SimObject.

Warning
THIS CONSTRUCTOR HAS TO RUN CSimNode CONSTRUCTOR OR THE OBJECT WILL BE CORRUPTED

Member Function Documentation

int CSimObject::GetK ( ) const
inline

Receive K value.

Returns
Delay value.
const std::vector<double>& CSimObject::GetVectorA ( ) const
inline

Function to retrive vector a of the model.

Returns
Reference to the A vector.
const std::vector<double>& CSimObject::GetVectorB ( ) const
inline

Function to retrive vector b of the model.

Returns
Reference to the B vector.
void CSimObject::LoadState ( boost::property_tree::ptree::value_type const &  v)
overridevirtual

Load internal object state data from tree. Each object manages the data itself.

Parameters
[in]vProperty tree to deserialize objects data from.

Implements CSimNode.

Here is the call graph for this function:

void CSimObject::SaveState ( boost::property_tree::ptree &  pt) const
overridevirtual

Adds internal object state data to the stream object.

Parameters
[out]ptProperty tree to store serialized object.

Implements CSimNode.

Here is the call graph for this function:

void CSimObject::SetK ( int  nK)
inline

Set K value.

Parameters
[in]Newdelay value.

Here is the caller graph for this function:

void CSimObject::SetStationary ( bool  bStationary)
inline

Set if object is stationary.

Parameters
[in]Eitherstationary (true) or not (false).

Here is the caller graph for this function:

void CSimObject::SetVectorA ( std::vector< double > &&  vA)

Function to set vector a of the model.

Parameters
[in]vAVector A to std::move() to the object.

Here is the call graph for this function:

Here is the caller graph for this function:

void CSimObject::SetVectorB ( std::vector< double > &&  vB)

Function to set vector b of the model.

Parameters
[in]vBVector B to std::move() to the object.

Here is the call graph for this function:

Here is the caller graph for this function:

double CSimObject::Simulate ( double  dInSample)
overridevirtual

Outputs one step of the simualtion given one sample of the input.

Returns
Next simulation output.
Parameters
[in]dInputNext input (can be feedback) value.

from -1 to 1

Implements CSimNode.

Here is the call graph for this function:


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