DPsim
Loading...
Searching...
No Matches
Base_Ph1_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 Ph1 {
19protected:
24
25public:
27 Real nominalVoltageAt(UInt terminal) const {
28 return terminal == 0 ? mNominalVoltagePrimary : mNominalVoltageSecondary;
29 }
30
41
42 explicit Transformer(CPS::AttributeList::Ptr attributeList)
43 : mRatedPower(attributeList->create<Real>("S")),
44 mRatio(attributeList->create<Complex>("ratio")),
45 mTapRatio(attributeList->create<Real>("tapRatio")),
46 mResistance(attributeList->create<Real>("R")),
47 mInductance(attributeList->create<Real>("L")) {
48 **mTapRatio = 1.;
49 }
50
53 if (!std::isfinite(tapRatio) || tapRatio <= 0.)
56 }
57
58 Real tapRatio() const { return **mTapRatio; }
59
60 Complex effectiveRatio() const { return **mRatio * **mTapRatio; }
61
63 void setParameters(Real nomVoltagePrimary, Real nomVoltageSecondary,
64 Real ratioAbs, Real ratioPhase, Real resistance,
65 Real inductance) {
66 mNominalVoltagePrimary = nomVoltagePrimary;
67 mNominalVoltageSecondary = nomVoltageSecondary;
68 **mRatio = std::polar<Real>(ratioAbs, ratioPhase);
69 **mResistance = resistance;
70 **mInductance = inductance;
71 }
72};
73} // namespace Ph1
74} // namespace Base
75} // namespace CPS
AttributePointer< Attribute< T > > Ptr
Definition Attribute.h:249
std::shared_ptr< AttributeList > Ptr
const Attribute< Real >::Ptr mRatedPower
Rated Apparent Power [VA].
void setTapRatio(Real tapRatio)
Set a positive tap multiplier applied to the nominal complex ratio.
const Attribute< Real >::Ptr mTapRatio
Per-unit tap adjustment applied to the nominal complex transformer ratio.
Transformer(CPS::AttributeList::Ptr attributeList)
const Attribute< Real >::Ptr mInductance
Inductance [H].
void setParameters(Real nomVoltagePrimary, Real nomVoltageSecondary, Real ratioAbs, Real ratioPhase, Real resistance, Real inductance)
Real mNominalVoltageSecondary
Nominal voltage of secondary side.
const Attribute< Real >::Ptr mResistance
Resistance [Ohm].
Real mNominalVoltagePrimary
Nominal voltage of primary side.
Real nominalVoltageAt(UInt terminal) const
Nominal voltage of the winding at the given terminal.
const Attribute< Complex >::Ptr mRatio
Complex transformer ratio.
double Real
Definition Definitions.h:60
std::complex< Real > Complex
Definition Definitions.h:61
unsigned int UInt
Definition Definitions.h:58