DPsim
Loading...
Searching...
No Matches
SP_Ph1_SolidStateTransformer.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/SP/SP_Ph1_Load.h>
13#include <dpsim-models/Solver/MNAInterface.h>
14
15namespace CPS {
16namespace SP {
17namespace Ph1 {
18/* \brief Ideal solid state transformer
19 * Modelled as two loads at each side.
20 * Demands Pref, Q1 from side 1, and generate Pref, Q2 to side 2.
21 * Depends on the actual condition, values can be negative
22 */
23class SolidStateTransformer : public CompositePowerComp<Complex>,
24 public SharedFactory<SolidStateTransformer> {
25private:
28 std::shared_ptr<SP::Ph1::Load> mSubLoadSide1;
30 std::shared_ptr<SP::Ph1::Load> mSubLoadSide2;
31
33 Real mP2 = std::numeric_limits<double>::infinity();
35 Real mNominalVoltageEnd1;
37 Real mNominalVoltageEnd2;
38 // Per Unit values
40 Real mPref_perUnit;
42 Real mP2_perUnit;
44 Real mQ1ref_perUnit;
46 Real mQ2ref_perUnit;
47
48public:
50 const Attribute<Real>::Ptr mPref;
52 const Attribute<Real>::Ptr mQ1ref;
54 const Attribute<Real>::Ptr mQ2ref;
55
57 SolidStateTransformer(String uid, String name,
58 Logger::Level logLevel = Logger::Level::off);
60 SolidStateTransformer(String name,
61 Logger::Level logLevel = Logger::Level::off)
62 : SolidStateTransformer(name, name, logLevel){};
64 SimPowerComp<Complex>::Ptr clone(String name) override;
65
66 // #### Power Flow Section ####
68 void createSubComponents() override;
70 void initializeParentFromNodesAndTerminals(Real frequency) override;
72 void setParameters(Real nomV1, Real nomV2, Real Pref, Real Q1ref, Real Q2ref);
74 void calculatePerUnitParameters(Real baseApparentPower, Real baseOmega);
76 Complex getNodalInjection(CPS::TopologicalNode::Ptr node);
77
78 // // #### MNA Section ####
79 // /// Initializes internal variables of the component
80 // void mnaCompInitialize(Real omega, Real timeStep, Attribute<Matrix>::Ptr leftVector);
81 // /// Stamps system matrix
82 // void mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMatrix);
83 // /// Updates internal current variable of the component
84 // void mnaCompUpdateCurrent(const Matrix& leftVector);
85 // /// Updates internal voltage variable of the component
86 // void mnaCompUpdateVoltage(const Matrix& leftVector);
87};
88
89} // namespace Ph1
90} // namespace SP
91} // namespace CPS
CompositePowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
String uid()
Returns unique id.
const Attribute< Real >::Ptr mQ2ref
Reactive power at secondary side [var].
const Attribute< Real >::Ptr mQ1ref
Reactive power at primary side [var].
void createSubComponents() override
Constructs and registers MNA subcomponents; idempotent.
void initializeParentFromNodesAndTerminals(Real frequency) override
Initializes component.
const Attribute< Real >::Ptr mPref
Power [watt].
SimPowerComp< Complex >::Ptr clone(String name) override
Returns a modified copy of the component with the given suffix added to the name and without.
SimNode< Complex >::Ptr node(UInt index)