1 # Copyright (C) 2010 Richard Lincoln
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, USA
17 from CIM14
.Dynamics
.RotatingMachine
import RotatingMachine
19 class GenEquiv(RotatingMachine
):
20 """An equivalent representation of a synchronous generator as a constant internal voltage behind an impedance Ra plus Xp.
23 def __init__(self
, xp
=0.0, synchronousMachine0
=None, *args
, **kw_args
):
24 """Initialises a new 'GenEquiv' instance.
26 @param xp: Equivalent reactance, also known as Xp.
27 @param synchronousMachine0:
29 #: Equivalent reactance, also known as Xp.
32 self
._synchronousMachine
0 = []
33 self
.synchronousMachine0
= [] if synchronousMachine0
is None else synchronousMachine0
35 super(GenEquiv
, self
).__init
__(*args
, **kw_args
)
38 _attr_types
= {"xp": float}
39 _defaults
= {"xp": 0.0}
41 _refs
= ["synchronousMachine0"]
42 _many_refs
= ["synchronousMachine0"]
44 def getsynchronousMachine0(self
):
46 return self
._synchronousMachine
0
48 def setsynchronousMachine0(self
, value
):
49 for p
in self
._synchronousMachine
0:
50 filtered
= [q
for q
in p
.genEquiv0
if q
!= self
]
51 self
._synchronousMachine
0._genEquiv
0 = filtered
53 if self
not in r
._genEquiv
0:
54 r
._genEquiv
0.append(self
)
55 self
._synchronousMachine
0 = value
57 synchronousMachine0
= property(getsynchronousMachine0
, setsynchronousMachine0
)
59 def addsynchronousMachine0(self
, *synchronousMachine0
):
60 for obj
in synchronousMachine0
:
61 if self
not in obj
._genEquiv
0:
62 obj
._genEquiv
0.append(self
)
63 self
._synchronousMachine
0.append(obj
)
65 def removesynchronousMachine0(self
, *synchronousMachine0
):
66 for obj
in synchronousMachine0
:
67 if self
in obj
._genEquiv
0:
68 obj
._genEquiv
0.remove(self
)
69 self
._synchronousMachine
0.remove(obj
)