DPsim
Loading...
Searching...
No Matches
DP_Ph1_PiLine.h
1/* Copyright 2017-2021 Institute for Automation of Complex Power Systems,
2 * EONERC, RWTH Aachen University
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
7 *********************************************************************************/
8
9#pragma once
10
11#include <dpsim-models/Base/Base_Ph1_PiLine.h>
12#include <dpsim-models/CompositePowerComp.h>
13#include <dpsim-models/DP/DP_Ph1_Capacitor.h>
14#include <dpsim-models/DP/DP_Ph1_Inductor.h>
15#include <dpsim-models/DP/DP_Ph1_Resistor.h>
16#include <dpsim-models/Solver/MNATearInterface.h>
17
18namespace CPS {
19namespace DP {
20namespace Ph1 {
25class PiLine : public CompositePowerComp<Complex>,
26 public MNATearInterface,
27 public Base::Ph1::PiLine,
28 public SharedFactory<PiLine> {
29protected:
31 std::shared_ptr<Inductor> mSubSeriesInductor;
33 std::shared_ptr<Resistor> mSubSeriesResistor;
35 std::shared_ptr<Resistor> mSubParallelResistor0;
36 // Parallel Capacitor submodel at Terminal 0
37 std::shared_ptr<Capacitor> mSubParallelCapacitor0;
39 std::shared_ptr<Resistor> mSubParallelResistor1;
41 std::shared_ptr<Capacitor> mSubParallelCapacitor1;
43 std::vector<const Matrix *> mRightVectorStamps;
44
45public:
47 PiLine(String uid, String name, Logger::Level logLevel = Logger::Level::off);
49 PiLine(String name, Logger::Level logLevel = Logger::Level::off)
50 : PiLine(name, name, logLevel) {}
51
52 SimPowerComp<Complex>::Ptr clone(String copySuffix) override;
53
54 // #### General ####
56 void initializeFromNodesAndTerminals(Real frequency) override;
57
58 // #### MNA section ####
60 void mnaCompUpdateCurrent(const Matrix &leftVector) override;
62 void mnaCompUpdateVoltage(const Matrix &leftVector) override;
64 void mnaParentPreStep(Real time, Int timeStepCount) override;
65 void mnaParentPostStep(Real time, Int timeStepCount,
66 Attribute<Matrix>::Ptr &leftVector) override;
69 AttributeBase::List &prevStepDependencies,
70 AttributeBase::List &attributeDependencies,
71 AttributeBase::List &modifiedAttributes) override;
72 void
73 mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
74 AttributeBase::List &attributeDependencies,
75 AttributeBase::List &modifiedAttributes,
76 Attribute<Matrix>::Ptr &leftVector) override;
77
78 MNAInterface::List mnaTearGroundComponents() override;
79 void mnaTearInitialize(Real omega, Real timeStep) override;
80 void mnaTearApplyMatrixStamp(SparseMatrixRow &tearMatrix) override;
81 void mnaTearApplyVoltageStamp(Matrix &voltageVector) override;
82 void mnaTearPostStep(Complex voltage, Complex current) override;
83};
84} // namespace Ph1
85} // namespace DP
86} // namespace CPS
CompositePowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
void mnaParentPreStep(Real time, Int timeStepCount) override
MNA pre and post step operations.
std::shared_ptr< Capacitor > mSubParallelCapacitor1
Parallel capacitor submodel at Terminal 1.
SimPowerComp< Complex >::Ptr clone(String copySuffix) override
DEPRECATED: Remove method.
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Updates internal current variable of the component.
std::shared_ptr< Resistor > mSubParallelResistor1
Parallel resistor submodel at Terminal 1.
std::shared_ptr< Resistor > mSubSeriesResistor
Series Resistor submodel.
void initializeFromNodesAndTerminals(Real frequency) override
Initializes component from power flow data.
std::shared_ptr< Inductor > mSubSeriesInductor
Series Inductance submodel.
PiLine(String name, Logger::Level logLevel=Logger::Level::off)
Defines name and logging level.
PiLine(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and logging level.
std::shared_ptr< Resistor > mSubParallelResistor0
Parallel Resistor submodel at Terminal 0.
std::vector< const Matrix * > mRightVectorStamps
Right side vectors of subcomponents.
void mnaParentAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
add MNA pre and post step dependencies
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Updates internal voltage variable of the component.
String uid()
Returns unique id.