Hopsan
PowerPort Class Reference
Inheritance diagram for PowerPort:
Port

Public Member Functions

 PowerPort (const HString &rNodeType, const HString &rPortName, Component *pParentComponent, Port *pParentPort=0)
 PowerPort constructor.
 
PortTypesEnumT getPortType () const
 Get the port type.
 
- Public Member Functions inherited from Port
 Port (const HString &rNodeType, const HString &rPortName, Component *pParentComponent, Port *pParentPort=0)
 Port base class constructor.
 
virtual ~Port ()
 Destructor.
 
double readNode (const size_t idx) const
 Reads a value from the connected node. More...
 
virtual double readNode (const size_t idx, const size_t subPortIdx) const
 Reads a value from the connected node. More...
 
void writeNode (const size_t idx, const double value)
 Writes a value to the connected node. More...
 
virtual void writeNode (const size_t idx, const double value, const size_t subPortIdx)
 Writes a value to the connected node. More...
 
virtual double readNodeSafe (const size_t idx, const size_t subPortIdx=0) const
 Reads a value from the connected node. More...
 
virtual void writeNodeSafe (const size_t idx, const double value, const size_t subPortIdx=0)
 Writes a value to the connected node. More...
 
virtual NodegetNodePtr (const size_t subPortIdx=0)
 Returns a pointer to the connected node or 0 if no node exist. More...
 
virtual const NodegetNodePtr (const size_t subPortIdx=0) const
 Returns the node pointer in the port. More...
 
virtual double * getNodeDataPtr (const size_t idx, const size_t subPortIdx=0) const
 Get a ptr to the data variable in the node. More...
 
virtual std::vector< double > * getDataVectorPtr (const size_t subPortIdx=0)
 
virtual size_t getNumDataVariables () const
 Returns the number of data variables in the node. More...
 
virtual const std::vector< NodeDataDescription > * getNodeDataDescriptions (const size_t subPortIdx=0) const
 Get all node data descriptions. More...
 
virtual const NodeDataDescriptiongetNodeDataDescription (const size_t dataid, const size_t subPortIdx=0) const
 Get a specific node data description. More...
 
virtual int getNodeDataIdFromName (const HString &rName, const size_t subPortIdx=0)
 Ask the node for the dataId for a particular data name such as (Pressure) More...
 
virtual void setSignalNodeQuantityOrUnit (const HString &rQuantityOrUnit)
 A help function that makes it possible to overwrite the unit or quantity of scalar signal node variables. More...
 
virtual void setSignalNodeQuantityModifyable (bool tf)
 
virtual HString getSignalNodeQuantity () const
 
virtual bool getSignalNodeQuantityModifyable () const
 
const HStringgetVariableAlias (const size_t id) const
 Get the alias name for a specific node variable id. More...
 
int getVariableIdByAlias (const HString &rAlias) const
 Get the variable id for a specific alias name. More...
 
virtual bool haveLogData (const size_t subPortIdx=0)
 Check if log data exist in the ports node. More...
 
virtual std::vector< double > * getLogTimeVectorPtr (const size_t subPortIdx=0)
 
virtual std::vector< std::vector< double > > * getLogDataVectorPtr (size_t subPortIdx=0)
 
virtual const std::vector< std::vector< double > > * getLogDataVectorPtr (size_t subPortIdx=0) const
 
virtual void setEnableLogging (const bool enableLog)
 
bool isLoggingEnabled () const
 
virtual bool isConnected () const
 Check if the port is currently connected. More...
 
virtual bool isConnectedTo (Port *pOtherPort)
 Check if this port is connected to other port. More...
 
bool isConnectionRequired ()
 Check if the port MUST be connected.
 
virtual std::vector< Port * > getConnectedPorts (const int subPortIdx=-1) const
 Get a vector of pointers to all other ports connected connected to this one. More...
 
size_t getNumConnectedPorts (const int subPortIdx=-1)
 Returns the number of ports connected to this port. More...
 
virtual size_t getNumPorts ()
 
bool isInterfacePort () const
 
virtual bool isMultiPort () const
 Convenience function to check if port is multiport.
 
const HStringgetNodeType () const
 Returns the type of node that can be connected to this port.
 
virtual PortTypesEnumT getExternalPortType ()
 Get the External port type (virtual, should be overloaded in systemports only)
 
virtual PortTypesEnumT getInternalPortType ()
 Get the Internal port type (virtual, should be overloaded in systemports only)
 
virtual SortHintEnumT getSortHint () const
 
virtual void setSortHint (SortHintEnumT hint)
 
virtual SortHintEnumT getInternalSortHint ()
 
PortgetParentPort () const
 
ComponentgetComponent () const
 Returns the parent component.
 
const HStringgetName () const
 Get the port name.
 
const HStringgetComponentName () const
 Get the name of the component that the port is attached to.
 
const HStringgetDescription () const
 Get port description. More...
 
void setDescription (const HString &rDescription)
 Set port description. More...
 
virtual double getStartValue (const size_t idx, const size_t subPortIdx=0)
 Get the actual start value of the port. More...
 
virtual void loadStartValues ()
 Load start values by copying the start values from the port to the node.
 
virtual void loadStartValuesFromSimulation ()
 Load start values to the start value container from the node (last values from simulation)
 
std::vector< double > & getNodeDataVector ()
 Returns a reference to the Node data in the port. More...
 
const std::vector< double > & getNodeDataVector () const
 Returns a reference to the Node data in the port. More...
 
virtual std::vector< double > & getNodeDataVector (const size_t subPortIdx)
 Returns a reference to the Node data in the port. More...
 
virtual const std::vector< double > & getNodeDataVector (const size_t subPortIdx) const
 Returns a reference to the Node data in the port. More...
 

Friends

class Component
 
class ComponentSystem
 
class ConnectionAssistant
 

Additional Inherited Members

- Public Types inherited from Port
enum  RequireConnectionEnumT { Required, NotRequired }
 This enum specifies the RequiredConnection enums.
 
- Protected Member Functions inherited from Port
virtual void setDefaultStartValue (const size_t idx, const double value, const size_t subPortIdx=0)
 Set the an actual start value of the port. More...
 
virtual void disableStartValue (const size_t idx)
 Disables start value for specified data type. More...
 
virtual NodegetStartNodePtr ()
 Get a pointer to the start node. More...
 
virtual void setNode (Node *pNode)
 Set the node that the port is connected to. More...
 
virtual PortaddSubPort ()
 Adds a subport to a multiport.
 
virtual void removeSubPort (Port *pPort)
 Removes a subport from multiport.
 
void registerStartValueParameters ()
 This function registers the startvalue parameters from the start node.
 
void unRegisterStartValueParameters ()
 Unregisters all startvalue parameters from the start node.
 
void addConnectedPort (Port *pPort, const size_t subPortIdx=0)
 Adds a pointer to an other connected port to a port. More...
 
void eraseConnectedPort (Port *pPort, const size_t subPortIdx=0)
 Removes a pointer to an other connected port from a port. More...
 
void createStartNode (const HString &rNodeType)
 Creates a start node in the port. More...
 
void eraseStartNode ()
 Removes the start node in the port and unregisters all start value parameters.
 
void setVariableAlias (const HString &rAlias, const size_t id)
 
- Protected Attributes inherited from Port
HString mNodeType
 
SortHintEnumT mSortHint
 
ComponentmpComponent
 
PortmpParentPort
 
bool mEnableLogging
 
std::vector< Port * > mConnectedPorts