9 #include <dpsim-models/TopologicalNode.h>
13 Bool TopologicalNode::isGround()
const {
return mIsGround; }
15 MatrixComp TopologicalNode::initialVoltage()
const {
return **mInitialVoltage; }
17 void TopologicalNode::setInitialVoltage(MatrixComp voltage)
const {
18 **mInitialVoltage = voltage;
21 void TopologicalNode::setInitialVoltage(Complex voltage)
const {
22 if (mPhaseType == PhaseType::Single) {
23 (**mInitialVoltage)(0, 0) = voltage;
25 (**mInitialVoltage)(0, 0) = voltage;
26 (**mInitialVoltage)(1, 0) = SHIFT_TO_PHASE_B * voltage;
27 (**mInitialVoltage)(2, 0) = SHIFT_TO_PHASE_C * voltage;
31 void TopologicalNode::setInitialVoltage(Complex voltage, Int phaseIndex)
const {
32 (**mInitialVoltage)(phaseIndex, 0) = voltage;
35 PhaseType TopologicalNode::phaseType()
const {
return mPhaseType; }
37 TopologicalNode::TopologicalNode(String uid, String name, PhaseType phaseType,
38 const std::vector<Complex> &initialVoltage)
40 mInitialVoltage(mAttributes->create<MatrixComp>(
"voltage_init")) {
42 mPhaseType = phaseType;
43 if (phaseType == PhaseType::ABC) {
45 **mInitialVoltage = MatrixComp::Zero(3, 1);
46 **mInitialVoltage << initialVoltage[0], initialVoltage[1],
50 **mInitialVoltage = MatrixComp::Zero(1, 1);
51 **mInitialVoltage << initialVoltage[0];
55 Complex TopologicalNode::initialSingleVoltage(PhaseType phaseType) {
56 if (phaseType == PhaseType::B)
57 return (**mInitialVoltage)(1, 0);
58 else if (phaseType == PhaseType::C)
59 return (**mInitialVoltage)(2, 0);
61 return (**mInitialVoltage)(0, 0);