DPsim
Loading...
Searching...
No Matches
EMT_Ph3_RXLoad.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/CompositePowerComp.h>
12#include <dpsim-models/EMT/EMT_Ph3_Capacitor.h>
13#include <dpsim-models/EMT/EMT_Ph3_Inductor.h>
14#include <dpsim-models/EMT/EMT_Ph3_Resistor.h>
15#include <dpsim-models/Solver/MNAInterface.h>
16
17namespace CPS {
18namespace EMT {
19namespace Ph3 {
23class RXLoad : public CompositePowerComp<Real>, public SharedFactory<RXLoad> {
24protected:
27 MatrixComp mPower;
31 Matrix mReactance;
37 Bool initPowerFromTerminal = true;
41 std::shared_ptr<EMT::Ph3::Inductor> mSubInductor;
43 std::shared_ptr<EMT::Ph3::Capacitor> mSubCapacitor;
45 std::shared_ptr<EMT::Ph3::Resistor> mSubResistor;
46
47public:
49 const Attribute<Matrix>::Ptr mActivePower;
51 const Attribute<Matrix>::Ptr mReactivePower;
53 const Attribute<Real>::Ptr mNomVoltage;
55 RXLoad(String uid, String name, Logger::Level logLevel = Logger::Level::off);
57 RXLoad(String name, Logger::Level logLevel = Logger::Level::off);
59 RXLoad(String name, Matrix activePower, Matrix reactivePower, Real volt,
60 Logger::Level logLevel = Logger::Level::off);
61
62 // #### General ####
63 virtual String description() override {
64 return fmt::format("Active: {}MW, Reactive: {}MVAr, Voltage: {}kV",
65 (**mActivePower)(0, 0) / 1e6,
66 (**mReactivePower)(0, 0) / 1e6, (**mNomVoltage) / 1e3);
67 };
69 void setParameters(Matrix activePower, Matrix reactivePower, Real volt,
70 bool reactanceInSeries = false);
72 void createSubComponents() override;
74 void initializeParentFromNodesAndTerminals(Real frequency) override;
75
76 // #### MNA section ####
77 void mnaCompUpdateCurrent(const Matrix &leftVector) override;
78 void mnaCompUpdateVoltage(const Matrix &leftVector) override;
79
81 void mnaParentPreStep(Real time, Int timeStepCount) override;
82 void mnaParentPostStep(Real time, Int timeStepCount,
83 Attribute<Matrix>::Ptr &leftVector) override;
84
85 void mnaParentAddPreStepDependencies(
86 AttributeBase::List &prevStepDependencies,
87 AttributeBase::List &attributeDependencies,
88 AttributeBase::List &modifiedAttributes) override;
89 void
90 mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
91 AttributeBase::List &attributeDependencies,
92 AttributeBase::List &modifiedAttributes,
93 Attribute<Matrix>::Ptr &leftVector) override;
94};
95} // namespace Ph3
96} // namespace EMT
97} // namespace CPS
CompositePowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
const Attribute< Matrix >::Ptr mActivePower
Active power [Watt].
Bool mReactanceInSeries
If set to true, the reactance is in series with the resistor. Otherwise it is parallel to the resisto...
RXLoad(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and logging level.
std::shared_ptr< EMT::Ph3::Resistor > mSubResistor
Internal resistance.
std::shared_ptr< EMT::Ph3::Inductor > mSubInductor
Internal inductor.
void createSubComponents() override
Constructs and registers MNA subcomponents; idempotent.
std::shared_ptr< EMT::Ph3::Capacitor > mSubCapacitor
Internal capacitor.
Matrix mResistance
Resistance [Ohm].
void initializeParentFromNodesAndTerminals(Real frequency) override
Derives values from power flow data and pushes them to subcomponents.
Matrix mReactance
Reactance [Ohm].
const Attribute< Real >::Ptr mNomVoltage
Nominal voltage [V].
void mnaParentPreStep(Real time, Int timeStepCount) override
MNA pre and post step operations.
Matrix mCapacitance
Capacitance [F].
const Attribute< Matrix >::Ptr mReactivePower
Reactive power [VAr].
Matrix mInductance
Inductance [H].
String uid()
Returns unique id.