DPsim
Loading...
Searching...
No Matches
Base_Ph3_Transformer.h
Go to the documentation of this file.
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 <cmath>
14
15namespace CPS {
16namespace Base {
17namespace Ph3 {
19protected:
30
31public:
33 Real nominalVoltageAt(UInt terminal) const {
34 return terminal == 0 ? mNominalVoltagePrimary : mNominalVoltageSecondary;
35 }
36
41
42 explicit Transformer(CPS::AttributeList::Ptr attributeList)
43 : mRatio(attributeList->create<Complex>("ratio")),
44 mTapRatio(attributeList->create<Real>("tapRatio")) {
45 **mTapRatio = 1.;
46 }
47
50 if (!std::isfinite(tapRatio) || tapRatio <= 0.)
53 }
54
55 Real tapRatio() const { return **mTapRatio; }
56
57 Complex effectiveRatio() const { return **mRatio * **mTapRatio; }
58
60 void setParameters(Real nomVoltagePrimary, Real nomVoltageSecondary,
61 Real ratedPower, Real ratioAbs, Real ratioPhase,
62 Matrix resistance, Matrix inductance) {
63 mNominalVoltagePrimary = nomVoltagePrimary;
64 mNominalVoltageSecondary = nomVoltageSecondary;
65 mRatedPower = ratedPower;
66 **mRatio = std::polar<Real>(ratioAbs, ratioPhase);
67 mResistance = resistance;
68 mInductance = inductance;
69 }
70};
71} // namespace Ph3
72} // namespace Base
73} // namespace CPS
AttributePointer< Attribute< T > > Ptr
Definition Attribute.h:249
std::shared_ptr< AttributeList > Ptr
Real mNominalVoltagePrimary
Nominal voltage of primary side.
Real mNominalVoltageSecondary
Nominal voltage of secondary side.
const Attribute< Real >::Ptr mTapRatio
Per-unit tap adjustment applied to the nominal complex transformer ratio.
const Attribute< Complex >::Ptr mRatio
Transformer ratio.
void setParameters(Real nomVoltagePrimary, Real nomVoltageSecondary, Real ratedPower, Real ratioAbs, Real ratioPhase, Matrix resistance, Matrix inductance)
Matrix mResistance
Resistance [Ohm].
Matrix mInductance
Inductance [H].
Real nominalVoltageAt(UInt terminal) const
Nominal voltage of the winding at the given terminal.
void setTapRatio(Real tapRatio)
Set a positive tap multiplier applied to the nominal complex ratio.
Real mRatedPower
Rated Apparent Power [VA].
Transformer(CPS::AttributeList::Ptr attributeList)
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
Definition Definitions.h:79
double Real
Definition Definitions.h:60
std::complex< Real > Complex
Definition Definitions.h:61
unsigned int UInt
Definition Definitions.h:58