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>
12
#include <
dpsim-models/AttributeList.h
>
13
#include <
dpsim-models/Definitions.h
>
14
15
namespace
CPS
{
16
namespace
Base
{
17
namespace
Ph1
{
18
class
Transformer
{
19
protected
:
21
Real
mNominalVoltagePrimary
;
23
Real
mNominalVoltageSecondary
;
24
25
public
:
27
Real
nominalVoltageAt
(
UInt
terminal)
const
{
28
return
terminal == 0 ?
mNominalVoltagePrimary
:
mNominalVoltageSecondary
;
29
}
30
32
const
Attribute<Real>::Ptr
mRatedPower
;
34
const
Attribute<Complex>::Ptr
mRatio
;
36
const
Attribute<Real>::Ptr
mTapRatio
;
38
const
Attribute<Real>::Ptr
mResistance
;
40
const
Attribute<Real>::Ptr
mInductance
;
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
52
void
setTapRatio
(
Real
tapRatio
) {
53
if
(!std::isfinite(
tapRatio
) ||
tapRatio
<= 0.)
54
throw
InvalidArgumentException
();
55
**
mTapRatio
=
tapRatio
;
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
AttributeList.h
CPS::Attribute::Ptr
AttributePointer< Attribute< T > > Ptr
Definition
Attribute.h:249
CPS::AttributeList::Ptr
std::shared_ptr< AttributeList > Ptr
Definition
AttributeList.h:26
CPS::Base::Ph1::Transformer::mRatedPower
const Attribute< Real >::Ptr mRatedPower
Rated Apparent Power [VA].
Definition
Base_Ph1_Transformer.h:32
CPS::Base::Ph1::Transformer::effectiveRatio
Complex effectiveRatio() const
Definition
Base_Ph1_Transformer.h:60
CPS::Base::Ph1::Transformer::setTapRatio
void setTapRatio(Real tapRatio)
Set a positive tap multiplier applied to the nominal complex ratio.
Definition
Base_Ph1_Transformer.h:52
CPS::Base::Ph1::Transformer::mTapRatio
const Attribute< Real >::Ptr mTapRatio
Per-unit tap adjustment applied to the nominal complex transformer ratio.
Definition
Base_Ph1_Transformer.h:36
CPS::Base::Ph1::Transformer::Transformer
Transformer(CPS::AttributeList::Ptr attributeList)
Definition
Base_Ph1_Transformer.h:42
CPS::Base::Ph1::Transformer::mInductance
const Attribute< Real >::Ptr mInductance
Inductance [H].
Definition
Base_Ph1_Transformer.h:40
CPS::Base::Ph1::Transformer::setParameters
void setParameters(Real nomVoltagePrimary, Real nomVoltageSecondary, Real ratioAbs, Real ratioPhase, Real resistance, Real inductance)
Definition
Base_Ph1_Transformer.h:63
CPS::Base::Ph1::Transformer::tapRatio
Real tapRatio() const
Definition
Base_Ph1_Transformer.h:58
CPS::Base::Ph1::Transformer::mNominalVoltageSecondary
Real mNominalVoltageSecondary
Nominal voltage of secondary side.
Definition
Base_Ph1_Transformer.h:23
CPS::Base::Ph1::Transformer::mResistance
const Attribute< Real >::Ptr mResistance
Resistance [Ohm].
Definition
Base_Ph1_Transformer.h:38
CPS::Base::Ph1::Transformer::mNominalVoltagePrimary
Real mNominalVoltagePrimary
Nominal voltage of primary side.
Definition
Base_Ph1_Transformer.h:21
CPS::Base::Ph1::Transformer::nominalVoltageAt
Real nominalVoltageAt(UInt terminal) const
Nominal voltage of the winding at the given terminal.
Definition
Base_Ph1_Transformer.h:27
CPS::Base::Ph1::Transformer::mRatio
const Attribute< Complex >::Ptr mRatio
Complex transformer ratio.
Definition
Base_Ph1_Transformer.h:34
CPS::InvalidArgumentException
Definition
Definitions.h:141
Definitions.h
CPS::Base::Ph1
Definition
Base_Ph1_Capacitor.h:16
CPS::Base
Definition
Base_AvVoltageSourceInverterDQ.h:15
CPS
Definition
Attribute.h:17
CPS::Real
double Real
Definition
Definitions.h:60
CPS::Complex
std::complex< Real > Complex
Definition
Definitions.h:61
CPS::UInt
unsigned int UInt
Definition
Definitions.h:58
dpsim-models
include
dpsim-models
Base
Base_Ph1_Transformer.h
Generated by
1.13.2