9#include <dpsim-models/DP/DP_Ph1_RxLine.h>
16 setVirtualNodeNumber(1);
19 SPDLOG_LOGGER_INFO(
mSLog,
"Create {} {}", this->
type(), name);
26 auto copy = RxLine::make(name,
mLogLevel);
33 (**mIntfVoltage)(0, 0) = initialSingleVoltage(1) - initialSingleVoltage(0);
35 (**mIntfCurrent)(0, 0) = 0;
45 mSubResistor->initializeFromNodesAndTerminals(frequency);
47 MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT,
false);
54 mSubInductor->initializeFromNodesAndTerminals(frequency);
56 MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT,
true);
59 std::make_shared<DP::Ph1::Resistor>(**
mName +
"_snubber_res",
mLogLevel);
65 MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT,
66 MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT,
false);
68 SPDLOG_LOGGER_INFO(
mSLog,
69 "\n--- Initialization from powerflow ---"
70 "\nVoltage across: {:s}"
72 "\nTerminal 0 voltage: {:s}"
73 "\nTerminal 1 voltage: {:s}"
74 "\n--- Initialization from powerflow finished ---",
77 Logger::phasorToString(initialSingleVoltage(0)),
78 Logger::phasorToString(initialSingleVoltage(1)));
85void DP::Ph1::RxLine::mnaParentAddPreStepDependencies(
86 AttributeBase::List &prevStepDependencies,
87 AttributeBase::List &attributeDependencies,
88 AttributeBase::List &modifiedAttributes) {
89 modifiedAttributes.push_back(mRightVector);
92void DP::Ph1::RxLine::mnaParentAddPostStepDependencies(
93 AttributeBase::List &prevStepDependencies,
94 AttributeBase::List &attributeDependencies,
95 AttributeBase::List &modifiedAttributes,
96 Attribute<Matrix>::Ptr &leftVector) {
97 attributeDependencies.push_back(leftVector);
98 modifiedAttributes.push_back(mIntfCurrent);
99 modifiedAttributes.push_back(mIntfVoltage);
102void DP::Ph1::RxLine::mnaParentPostStep(Real time, Int timeStepCount,
103 Attribute<Matrix>::Ptr &leftVector) {
104 mnaCompUpdateVoltage(**leftVector);
105 mnaCompUpdateCurrent(**leftVector);
108void DP::Ph1::RxLine::mnaCompUpdateVoltage(
const Matrix &leftVector) {
109 (**mIntfVoltage)(0, 0) = 0;
110 if (terminalNotGrounded(1))
111 (**mIntfVoltage)(0, 0) =
112 Math::complexFromVectorElement(leftVector, matrixNodeIndex(1));
113 if (terminalNotGrounded(0))
114 (**mIntfVoltage)(0, 0) =
115 (**mIntfVoltage)(0, 0) -
116 Math::complexFromVectorElement(leftVector, matrixNodeIndex(0));
119void DP::Ph1::RxLine::mnaCompUpdateCurrent(
const Matrix &leftVector) {
120 (**mIntfCurrent)(0, 0) = mSubInductor->intfCurrent()(0, 0);
const Attribute< Real >::Ptr mSeriesInd
Inductance along the line [H].
const Attribute< Real >::Ptr mSeriesRes
Resistance along the line [ohms].
void addMNASubComponent(typename SimPowerComp< Complex >::Ptr subc, MNA_SUBCOMP_TASK_ORDER preStepOrder, MNA_SUBCOMP_TASK_ORDER postStepOrder, Bool contributeToRightVector)
void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override
CompositePowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
void initializeFromNodesAndTerminals(Real frequency) override
Initializes component from power flow data.
std::shared_ptr< Resistor > mSubResistor
Resistor submodel.
SimPowerComp< Complex >::Ptr clone(String name) override
DEPRECATED: Delete method.
std::shared_ptr< Inductor > mSubInductor
Inductance submodel.
std::shared_ptr< Resistor > mInitialResistor
Inductor end to ground resistor to facilitate initialization.
void mnaParentPreStep(Real time, Int timeStepCount) override
MNA pre and post step operations.
RxLine(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name, logging level.
const Attribute< String >::Ptr mName
Human readable name.
String uid()
Returns unique id.
String type()
Get component type (cross-platform)
AttributeList::Ptr mAttributes
Attribute List.
Attribute< Matrix >::Ptr mRightVector
const Attribute< MatrixVar< Complex > >::Ptr mIntfCurrent
SimTerminal< Complex >::List mTerminals
const Attribute< MatrixVar< Complex > >::Ptr mIntfVoltage
SimNode< Complex >::List mVirtualNodes
Logger::Level mLogLevel
Component logger control for internal variables.
Logger::Log mSLog
Component logger.