Commit 8abaadbf authored by Markus Mirz's avatar Markus Mirz
Browse files

rename Terminal

parent a5d2f21b
......@@ -30,7 +30,7 @@ namespace CPS {
protected:
/// List of Terminals
typename Terminal<VarType>::List mTerminals;
typename SimTerminal<VarType>::List mTerminals;
/// List of virtual nodes
typename SimNode<VarType>::List mVirtualNodes;
/// Voltage between terminals
......@@ -80,18 +80,18 @@ namespace CPS {
///
void checkForUnconnectedTerminals();
/// Return list of Terminal pointers
typename Terminal<VarType>::List terminals() { return mTerminals; }
typename SimTerminal<VarType>::List terminals() { return mTerminals; }
/// Get pointer to Terminal
typename Terminal<VarType>::Ptr terminal(UInt index);
typename SimTerminal<VarType>::Ptr terminal(UInt index);
/// Returns the list of terminals as TopologicalTerminal pointers
TopologicalTerminal::List topologicalTerminals();
///
void setTerminalNumber(UInt num);
/// Sets all Terminals of the component and checks if the number of Terminals is too large
/// fir this component type.
void setTerminals(typename Terminal<VarType>::List terminals);
void setTerminals(typename SimTerminal<VarType>::List terminals);
/// Sets Terminal at index terminalPosition.
void setTerminalAt(typename Terminal<VarType>::Ptr terminal, UInt terminalPosition);
void setTerminalAt(typename SimTerminal<VarType>::Ptr terminal, UInt terminalPosition);
/// Update the "cached" mMatrixNodeIndices and mMatrixNodeIndexIsGround members
void updateMatrixNodeIndices();
......
......@@ -25,18 +25,20 @@
namespace CPS {
template <typename VarType>
class Terminal : public TopologicalTerminal, public SharedFactory<Terminal<VarType>> {
class SimTerminal :
public TopologicalTerminal,
public SharedFactory<SimTerminal<VarType>> {
protected:
MatrixVar<VarType> mCurrent;
std::weak_ptr<SimNode<VarType>> mNode;
public:
typedef std::shared_ptr<Terminal<VarType>> Ptr;
typedef std::shared_ptr<SimTerminal<VarType>> Ptr;
typedef std::vector<Ptr> List;
///
Terminal(String name) : TopologicalTerminal(name, name) { }
SimTerminal(String name) : TopologicalTerminal(name, name) { }
///
Terminal(String uid, String name) : TopologicalTerminal(uid, name) { }
SimTerminal(String uid, String name) : TopologicalTerminal(uid, name) { }
///
typename SimNode<VarType>::Ptr node() {
return mNode.lock();
......
......@@ -714,7 +714,7 @@ void Reader::processTopologicalNode(IEC61970::Base::Topology::TopologicalNode* t
for (auto term : topNode->Terminal) {
// Insert Terminal if it does not exist in the map and add reference to node.
// This could be optimized because the Terminal is searched twice.
auto cpsTerm = Terminal<VarType>::make(term->mRID);
auto cpsTerm = SimTerminal<VarType>::make(term->mRID);
mPowerflowTerminals.insert(std::make_pair(term->mRID, cpsTerm));
cpsTerm->setNode(std::dynamic_pointer_cast<SimNode<VarType>>(mPowerflowNodes[topNode->mRID]));
......@@ -743,7 +743,7 @@ void Reader::processTopologicalNode(IEC61970::Base::Topology::TopologicalNode* t
auto pfEquipment = mPowerflowEquipment.at(equipment->mRID);
std::dynamic_pointer_cast<SimPowerComp<VarType>>(pfEquipment)->setTerminalAt(
std::dynamic_pointer_cast<Terminal<VarType>>(mPowerflowTerminals[term->mRID]), term->sequenceNumber-1);
std::dynamic_pointer_cast<SimTerminal<VarType>>(mPowerflowTerminals[term->mRID]), term->sequenceNumber-1);
mSLog->info(" Added Terminal {} to Equipment {}", term->mRID, equipment->mRID);
}
......
......@@ -67,7 +67,7 @@ void DP::Ph1::Transformer::initializeFromPowerflow(Real frequency) {
// Switch terminals if transformer is connected the other way around.
if (Math::abs(mRatio) < 1.) {
mRatio = 1. / mRatio;
std::shared_ptr<Terminal<Complex>> tmp = mTerminals[0];
std::shared_ptr<SimTerminal<Complex>> tmp = mTerminals[0];
mTerminals[0] = mTerminals[1];
mTerminals[1] = tmp;
}
......
......@@ -73,7 +73,7 @@ void EMT::Ph3::Transformer::initializeFromPowerflow(Real frequency) {
// Switch terminals if transformer is connected the other way around.
if (Math::abs(mRatio) < 1.) {
mRatio = 1. / mRatio;
std::shared_ptr<Terminal<Real>> tmp = mTerminals[0];
std::shared_ptr<SimTerminal<Real>> tmp = mTerminals[0];
mTerminals[0] = mTerminals[1];
mTerminals[1] = tmp;
}
......
......@@ -200,7 +200,7 @@ void SP::Ph1::Transformer::initializeFromPowerflow(Real frequency) {
// Switch terminals if transformer is connected the other way around.
if (Math::abs(mRatio) < 1.) {
mRatio = 1. / mRatio;
std::shared_ptr<Terminal<Complex>> tmp = mTerminals[0];
std::shared_ptr<SimTerminal<Complex>> tmp = mTerminals[0];
mTerminals[0] = mTerminals[1];
mTerminals[1] = tmp;
}
......
......@@ -71,7 +71,7 @@ void EMT::Ph3::Transformer::initializeFromPowerflow(Real frequency) {
// Switch terminals if transformer is connected the other way around.
if (Math::abs(mRatio) < 1.) {
mRatio = 1. / mRatio;
std::shared_ptr<Terminal<Real>> tmp = mTerminals[0];
std::shared_ptr<SimTerminal<Real>> tmp = mTerminals[0];
mTerminals[0] = mTerminals[1];
mTerminals[1] = tmp;
}
......
......@@ -48,7 +48,7 @@ void SimPowerComp<VarType>::checkForUnconnectedTerminals() {
}
template <typename VarType>
typename Terminal<VarType>::Ptr SimPowerComp<VarType>::terminal(UInt index) {
typename SimTerminal<VarType>::Ptr SimPowerComp<VarType>::terminal(UInt index) {
if (index >= mTerminals.size()) {
throw SystemError("Terminal not available for " + mUID);
}
......@@ -58,7 +58,7 @@ typename Terminal<VarType>::Ptr SimPowerComp<VarType>::terminal(UInt index) {
template <typename VarType>
TopologicalTerminal::List SimPowerComp<VarType>::topologicalTerminals() {
TopologicalTerminal::List terminals;
for (typename Terminal<VarType>::Ptr term : mTerminals) {
for (typename SimTerminal<VarType>::Ptr term : mTerminals) {
terminals.push_back(term);
}
return terminals;
......@@ -73,7 +73,7 @@ void SimPowerComp<VarType>::setTerminalNumber(UInt num) {
}
template <typename VarType>
void SimPowerComp<VarType>::setTerminals(typename Terminal<VarType>::List terminals) {
void SimPowerComp<VarType>::setTerminals(typename SimTerminal<VarType>::List terminals) {
if (mNumTerminals < terminals.size()) {
mSLog->error("Number of Terminals is too large for Component {} - Ignoring", mName);
return;
......@@ -82,7 +82,7 @@ void SimPowerComp<VarType>::setTerminals(typename Terminal<VarType>::List termin
}
template <typename VarType>
void SimPowerComp<VarType>::setTerminalAt(typename Terminal<VarType>::Ptr terminal, UInt terminalPosition) {
void SimPowerComp<VarType>::setTerminalAt(typename SimTerminal<VarType>::Ptr terminal, UInt terminalPosition) {
if (mNumTerminals <= terminalPosition) {
mSLog->error("Terminal position number too large for Component {} - Ignoring", mName);
return;
......@@ -110,7 +110,7 @@ UInt SimPowerComp<VarType>::nodeNumber() {
template <typename VarType>
TopologicalNode::List SimPowerComp<VarType>::topologicalNodes() {
TopologicalNode::List nodes;
for (typename Terminal<VarType>::Ptr term : mTerminals) {
for (typename SimTerminal<VarType>::Ptr term : mTerminals) {
nodes.push_back(term->node());
}
return nodes;
......@@ -155,7 +155,7 @@ void SimPowerComp<VarType>::connect(typename SimNode<VarType>::List nodes) {
}
for (UInt i = 0; i < nodes.size(); i++) {
String name = mName + "_T" + std::to_string(i);
typename Terminal<VarType>::Ptr terminal = Terminal<VarType>::make(name);
typename SimTerminal<VarType>::Ptr terminal = SimTerminal<VarType>::make(name);
terminal->setNode(nodes[i]);
setTerminalAt(terminal, i);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment