DPsim
Loading...
Searching...
No Matches
CPS::EMT::Ph1::Switch Class Reference

One phase EMT switch. More...

#include <EMT_Ph1_Switch.h>

Inheritance diagram for CPS::EMT::Ph1::Switch:
[legend]
Collaboration diagram for CPS::EMT::Ph1::Switch:
[legend]

Public Member Functions

 Switch (String uid, String name, Logger::Level loglevel=Logger::Level::off)
 Defines UID, name, component parameters and logging level.
 
 Switch (String name, Logger::Level logLevel=Logger::Level::off)
 Defines name, component parameters and logging level.
 
SimPowerComp< Real >::Ptr clone (String name) override
 Returns a modified copy of the component with the given suffix added to the name and without.
 
void initializeFromNodesAndTerminals (Real frequency) override
 Initializes component from power flow data.
 
void mnaCompInitialize (Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
 
void mnaCompApplySystemMatrixStamp (SparseMatrixRow &systemMatrix) override
 Stamps system matrix.
 
void mnaCompApplyRightSideVectorStamp (Matrix &rightVector) override
 Stamps right side (source) vector.
 
void mnaCompUpdateVoltage (const Matrix &leftVector) override
 Update interface voltage from MNA system result.
 
void mnaCompUpdateCurrent (const Matrix &leftVector) override
 Update interface current from MNA system result.
 
Bool mnaIsClosed () override
 Check if switch is closed.
 
void mnaCompApplySwitchSystemMatrixStamp (Bool closed, SparseMatrixRow &systemMatrix, Int freqIdx) override
 Stamps system matrix considering the defined switch position.
 
void mnaCompPostStep (Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
 MNA post step operations.
 
void mnaCompAddPostStepDependencies (AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
 Add MNA post step dependencies.
 
Bool hasParameterChanged () override
 Returns true if one of the element paramters has changed.
 
- Public Member Functions inherited from CPS::MNASimPowerComp< Real >
 MNASimPowerComp (String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
 Basic constructor that takes UID, name and log level.
 
 MNASimPowerComp (String name, Bool hasPreStep=true, Bool hasPostStep=true, Logger::Level logLevel=Logger::Level::off)
 Basic constructor that takes name and log level and sets the UID to name as well.
 
virtual ~MNASimPowerComp ()=default
 Destructor - does not do anything.
 
void mnaInitialize (Real omega, Real timeStep) final
 Initializes variables of components.
 
void mnaInitialize (Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) final
 
void mnaApplySystemMatrixStamp (SparseMatrixRow &systemMatrix) final
 Stamps system matrix.
 
void mnaApplyRightSideVectorStamp (Matrix &rightVector) final
 Stamps right side (source) vector.
 
void mnaUpdateVoltage (const Matrix &leftVector) final
 Update interface voltage from MNA system result.
 
void mnaUpdateCurrent (const Matrix &leftVector) final
 Update interface current from MNA system result.
 
void mnaPreStep (Real time, Int timeStepCount) final
 MNA pre step operations.
 
void mnaPostStep (Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) final
 
void mnaAddPreStepDependencies (AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) final
 Add MNA pre step dependencies.
 
void mnaAddPostStepDependencies (AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) final
 
void mnaInitializeHarm (Real omega, Real timeStep, std::vector< Attribute< Matrix >::Ptr > leftVector) final
 
void mnaApplySystemMatrixStampHarm (SparseMatrixRow &systemMatrix, Int freqIdx) final
 Stamps system matrix considering the frequency index.
 
void mnaApplyRightSideVectorStampHarm (Matrix &sourceVector) final
 Stamps right side (source) vector considering the frequency index.
 
void mnaApplyRightSideVectorStampHarm (Matrix &sourceVector, Int freqIdx) final
 
virtual void mnaCompInitialize (Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector)
 
virtual void mnaCompPreStep (Real time, Int timeStepCount)
 
virtual void mnaCompPostStep (Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector)
 
virtual void mnaCompAddPreStepDependencies (AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes)
 
virtual void mnaCompAddPostStepDependencies (AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector)
 
virtual void mnaCompInitializeHarm (Real omega, Real timeStep, std::vector< Attribute< Matrix >::Ptr > leftVector)
 
virtual void mnaCompApplySystemMatrixStampHarm (SparseMatrixRow &systemMatrix, Int freqIdx)
 
virtual void mnaCompApplyRightSideVectorStampHarm (Matrix &sourceVector)
 
virtual void mnaCompApplyRightSideVectorStampHarm (Matrix &sourceVector, Int freqIdx)
 
const Task::List & mnaTasks () const final
 Return list of MNA tasks.
 
Attribute< Matrix >::Ptr getRightVector () const final
 
- Public Member Functions inherited from CPS::SimPowerComp< Real >
 SimPowerComp (String uid, String name, Logger::Level logLevel=Logger::Level::off)
 Basic constructor that takes UID, name and log level.
 
 SimPowerComp (String name, Logger::Level logLevel=Logger::Level::off)
 Basic constructor that takes name and log level and sets the UID to name as well.
 
virtual ~SimPowerComp ()
 Destructor - does not do anything.
 
UInt terminalNumber ()
 Returns nominal number of Terminals for this component type.
 
UInt terminalNumberConnected ()
 Returns the number of connected Terminals.
 
Bool hasUnconnectedTerminals ()
 
void checkForUnconnectedTerminals ()
 
SimTerminal< Real >::List terminals ()
 Return list of Terminal pointers.
 
SimTerminal< Real >::Ptr terminal (UInt index)
 Get pointer to Terminal.
 
TopologicalTerminal::List topologicalTerminals ()
 Returns the list of terminals as TopologicalTerminal pointers.
 
void setTerminalNumber (UInt num)
 
void setTerminals (typename SimTerminal< Real >::List terminals)
 
void setTerminalAt (typename SimTerminal< Real >::Ptr terminal, UInt terminalPosition)
 Sets Terminal at index terminalPosition.
 
void updateMatrixNodeIndices ()
 Update the "cached" mMatrixNodeIndices and mMatrixNodeIndexIsGround members.
 
UInt nodeNumber ()
 Returns the actual number of Nodes / Terminals that are already set to valid Nodes.
 
SimNode< Real >::Ptr node (UInt index)
 Get pointer to node.
 
UInt matrixNodeIndex (UInt nodeIndex)
 
UInt matrixNodeIndex (UInt nodeIndex, UInt phaseIndex)
 
std::vector< UInt > matrixNodeIndices (UInt index)
 TODO replace with access to mMatrixNodeIndices.
 
TopologicalNode::List topologicalNodes ()
 Get nodes as base type TopologicalNode.
 
UInt virtualNodesNumber ()
 Returns nominal number of virtual nodes for this component type.
 
Bool hasVirtualNodes ()
 Returns true if virtual node number is greater than zero.
 
Bool hasSubComponents ()
 Returns true if subcomponents included in this component.
 
SimPowerComp< Real >::List subComponents ()
 Get list of subcomponents.
 
SimNode< Real >::List & virtualNodes ()
 
SimNode< Real >::Ptr virtualNode (UInt index)
 Get pointer to virtual node.
 
std::vector< UInt > virtualMatrixNodeIndices (UInt index)
 Get vector of simulation node numbers from virtual Node.
 
UInt virtualSimNode (UInt nodeIndex, UInt phaseIndex=0)
 Get simulation node number from virtual node.
 
const MatrixVar< Real > & intfCurrent ()
 
const MatrixVar< Real > & intfVoltage ()
 
MatrixComp initialVoltage (UInt index)
 
Complex initialSingleVoltage (UInt index)
 
Bool terminalNotGrounded (UInt index)
 
void setIntfCurrent (MatrixVar< Real > current)
 
void setIntfVoltage (MatrixVar< Real > voltage)
 
void setVirtualNodeNumber (UInt num)
 
void setVirtualNodeAt (typename SimNode< Real >::Ptr virtualNode, UInt nodeNum)
 Sets the virtual node at index nodeNum.
 
void connect (typename SimNode< Real >::List nodes)
 Sets all nodes and checks for nominal number of Nodes for this Component.
 
virtual void initialize (Matrix frequencies)
 Initialize components with correct network frequencies.
 
- Public Member Functions inherited from CPS::TopologicalPowerComp
 TopologicalPowerComp (String uid, String name, Logger::Level logLevel=Logger::Level::off)
 Basic constructor that takes UID, name and log level.
 
 TopologicalPowerComp (String name, Logger::Level logLevel=Logger::Level::off)
 Basic constructor that takes name and log level and sets the UID to name as well.
 
virtual ~TopologicalPowerComp ()
 Destructor - does not do anything.
 
void setBehaviour (Behaviour behaviour)
 Set behavior of component, e.g. initialization.
 
- Public Member Functions inherited from CPS::IdentifiedObject
 IdentifiedObject (const String &uid, const String &name)
 
 IdentifiedObject (const String &name)
 
AttributeBase::Ptr attribute (const String &name) const
 Return pointer to an attribute.
 
template<typename T>
Attribute< T >::Ptr attributeTyped (const String &name) const
 Return pointer to an attribute.
 
const AttributeBase::Map & attributes () const
 
String name ()
 
String uid ()
 Returns unique id.
 
String type ()
 Get component type (cross-platform)
 
virtual String description ()
 
- Public Member Functions inherited from CPS::MNAInterface
virtual void mnaInitialize (Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector)=0
 
virtual void mnaPostStep (Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector)=0
 MNA post step operations.
 
virtual void mnaAddPostStepDependencies (AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector)=0
 Add MNA post step dependencies.
 
virtual void mnaInitializeHarm (Real omega, Real timeStep, std::vector< Attribute< Matrix >::Ptr > leftVector)=0
 Initializes variables of components.
 
- Public Member Functions inherited from CPS::Base::Ph1::Switch
 Switch (CPS::AttributeList::Ptr attributeList)
 
void setParameters (Real openResistance, Real closedResistance, Bool closed=false)
 
void close ()
 Close switch.
 
void open ()
 Open switch.
 
Bool isClosed ()
 Check if switch is closed.
 
- Public Member Functions inherited from CPS::MNASwitchInterface
virtual void mnaApplySwitchSystemMatrixStamp (Bool closed, SparseMatrixRow &systemMatrix, Int freqIdx) final
 Stamps system matrix considering the defined switch position.
 

Additional Inherited Members

- Public Types inherited from CPS::MNASimPowerComp< Real >
using Type
 
using Ptr
 
using List
 
- Public Types inherited from CPS::SimPowerComp< Real >
typedef Real Type
 
typedef std::shared_ptr< SimPowerComp< Real > > Ptr
 
typedef std::vector< Ptr > List
 
- Public Types inherited from CPS::TopologicalPowerComp
enum  Behaviour { Initialization , MNASimulation , PFSimulation }
 
typedef std::shared_ptr< TopologicalPowerCompPtr
 
typedef std::vector< Ptr > List
 
- Public Types inherited from CPS::IdentifiedObject
typedef std::shared_ptr< IdentifiedObjectPtr
 
typedef std::vector< Ptr > List
 
- Public Types inherited from CPS::MNAInterface
typedef std::shared_ptr< MNAInterfacePtr
 
typedef std::vector< Ptr > List
 
- Public Types inherited from CPS::MNAVariableCompInterface
typedef std::shared_ptr< MNAVariableCompInterfacePtr
 
typedef std::vector< Ptr > List
 
- Public Types inherited from CPS::MNASwitchInterface
typedef std::shared_ptr< MNASwitchInterfacePtr
 
typedef std::vector< Ptr > List
 
- Static Public Member Functions inherited from SharedFactory< Switch >
static std::shared_ptr< Switch > make (Args &&...args)
 
- Public Attributes inherited from CPS::MNASimPowerComp< Real >
Attribute< Matrix >::Ptr mRightVector
 
Task::List mMnaTasks
 List of tasks that relate to using MNA for this component (usually pre-step and/or post-step)
 
- Public Attributes inherited from CPS::SimPowerComp< Real >
const Attribute< MatrixVar< Real > >::Ptr mIntfVoltage
 Voltage between terminals.
 
const Attribute< MatrixVar< Real > >::Ptr mIntfCurrent
 Current through component.
 
- Public Attributes inherited from CPS::IdentifiedObject
const Attribute< String >::Ptr mName
 Human readable name.
 
const Attribute< String >::Ptr mUID
 Unique identifier.
 
- Public Attributes inherited from CPS::Base::Ph1::Switch
const Attribute< Real >::Ptr mOpenResistance
 Resistance if switch is open [ohm].
 
const Attribute< Real >::Ptr mClosedResistance
 Resistance if switch is closed [ohm].
 
const Attribute< Bool >::Ptr mIsClosed
 Defines if Switch is open or closed.
 
- Public Attributes inherited from CPS::MNAVariableCompInterface
std::vector< std::pair< UInt, UInt > > mVariableSystemMatrixEntries
 
- Protected Attributes inherited from CPS::SimPowerComp< Real >
SimTerminal< Real >::List mTerminals
 List of Terminals.
 
SimNode< Real >::List mVirtualNodes
 List of virtual nodes.
 
Matrix mFrequencies
 List of considered network frequencies.
 
UInt mNumFreqs
 Number of network frequencies.
 
PhaseType mPhaseType
 
std::vector< std::shared_ptr< SimPowerComp< Real > > > mSubComponents
 
std::vector< UInt > mMatrixNodeIndices
 "Cached" list of simulation nodes (to avoid shared_ptr accesses during simulation)
 
std::vector< bool > mMatrixNodeIndexIsGround
 "Cached" flags for whether the connected nodes are grounded
 
- Protected Attributes inherited from CPS::TopologicalPowerComp
UInt mNumTerminals = 0
 Determines the number of Terminals which can be connected to network Nodes.
 
UInt mNumVirtualNodes = 0
 Determines the number of virtual or internal Nodes.
 
Logger::Log mSLog
 Component logger.
 
Logger::Level mLogLevel
 Component logger control for internal variables.
 
Behaviour mBehaviour = Behaviour::MNASimulation
 
bool mParametersSet = false
 Flag indicating that parameters are set via setParameters() function.
 
- Protected Attributes inherited from CPS::IdentifiedObject
AttributeList::Ptr mAttributes = AttributeList::make()
 Attribute List.
 
- Protected Attributes inherited from CPS::Base::Ph1::Switch
Bool mIsClosedPrev = false
 

Detailed Description

One phase EMT switch.

The switch can be opened and closed. Each state has a specific resistance value.

Definition at line 25 of file EMT_Ph1_Switch.h.

Constructor & Destructor Documentation

◆ Switch() [1/2]

EMT::Ph1::Switch::Switch ( String uid,
String name,
Logger::Level loglevel = Logger::Level::off )

Defines UID, name, component parameters and logging level.

Definition at line 13 of file EMT_Ph1_Switch.cpp.

◆ Switch() [2/2]

CPS::EMT::Ph1::Switch::Switch ( String name,
Logger::Level logLevel = Logger::Level::off )
inline

Defines name, component parameters and logging level.

Definition at line 34 of file EMT_Ph1_Switch.h.

Member Function Documentation

◆ clone()

SimPowerComp< Real >::Ptr EMT::Ph1::Switch::clone ( String name)
overridevirtual

Returns a modified copy of the component with the given suffix added to the name and without.

Reimplemented from CPS::SimPowerComp< Real >.

Definition at line 21 of file EMT_Ph1_Switch.cpp.

◆ hasParameterChanged()

Bool EMT::Ph1::Switch::hasParameterChanged ( )
overridevirtual

Returns true if one of the element paramters has changed.

Implements CPS::MNAVariableCompInterface.

Definition at line 121 of file EMT_Ph1_Switch.cpp.

◆ initializeFromNodesAndTerminals()

void EMT::Ph1::Switch::initializeFromNodesAndTerminals ( Real frequency)
overridevirtual

Initializes component from power flow data.

Reimplemented from CPS::SimPowerComp< Real >.

Definition at line 27 of file EMT_Ph1_Switch.cpp.

◆ mnaCompAddPostStepDependencies()

void EMT::Ph1::Switch::mnaCompAddPostStepDependencies ( AttributeBase::List & prevStepDependencies,
AttributeBase::List & attributeDependencies,
AttributeBase::List & modifiedAttributes,
Attribute< Matrix >::Ptr & leftVector )
override

Add MNA post step dependencies.

Definition at line 85 of file EMT_Ph1_Switch.cpp.

◆ mnaCompApplyRightSideVectorStamp()

void EMT::Ph1::Switch::mnaCompApplyRightSideVectorStamp ( Matrix & rightVector)
overridevirtual

Stamps right side (source) vector.

Reimplemented from CPS::MNASimPowerComp< Real >.

Definition at line 83 of file EMT_Ph1_Switch.cpp.

◆ mnaCompApplySwitchSystemMatrixStamp()

void EMT::Ph1::Switch::mnaCompApplySwitchSystemMatrixStamp ( Bool closed,
SparseMatrixRow & systemMatrix,
Int freqIdx )
overridevirtual

Stamps system matrix considering the defined switch position.

Reimplemented from CPS::MNASwitchInterface.

Definition at line 71 of file EMT_Ph1_Switch.cpp.

◆ mnaCompApplySystemMatrixStamp()

void EMT::Ph1::Switch::mnaCompApplySystemMatrixStamp ( SparseMatrixRow & systemMatrix)
overridevirtual

Stamps system matrix.

Reimplemented from CPS::MNASimPowerComp< Real >.

Definition at line 59 of file EMT_Ph1_Switch.cpp.

◆ mnaCompInitialize()

void EMT::Ph1::Switch::mnaCompInitialize ( Real omega,
Real timeStep,
Attribute< Matrix >::Ptr leftVector )
override

Definition at line 51 of file EMT_Ph1_Switch.cpp.

◆ mnaCompPostStep()

void EMT::Ph1::Switch::mnaCompPostStep ( Real time,
Int timeStepCount,
Attribute< Matrix >::Ptr & leftVector )
override

MNA post step operations.

Definition at line 95 of file EMT_Ph1_Switch.cpp.

◆ mnaCompUpdateCurrent()

void EMT::Ph1::Switch::mnaCompUpdateCurrent ( const Matrix & leftVector)
overridevirtual

Update interface current from MNA system result.

Reimplemented from CPS::MNASimPowerComp< Real >.

Definition at line 115 of file EMT_Ph1_Switch.cpp.

◆ mnaCompUpdateVoltage()

void EMT::Ph1::Switch::mnaCompUpdateVoltage ( const Matrix & leftVector)
overridevirtual

Update interface voltage from MNA system result.

Reimplemented from CPS::MNASimPowerComp< Real >.

Definition at line 101 of file EMT_Ph1_Switch.cpp.

◆ mnaIsClosed()

Bool EMT::Ph1::Switch::mnaIsClosed ( )
overridevirtual

Check if switch is closed.

Implements CPS::MNASwitchInterface.

Definition at line 57 of file EMT_Ph1_Switch.cpp.


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