1 # Copyright (C) 2010-2011 Richard Lincoln
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to
5 # deal in the Software without restriction, including without limitation the
6 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 # sell copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 from CIM14
.IEC61970
.Dynamics
.RotatingMachine
import RotatingMachine
23 class GenEquiv(RotatingMachine
):
24 """An equivalent representation of a synchronous generator as a constant internal voltage behind an impedance Ra plus Xp.
27 def __init__(self
, xp
=0.0, synchronousMachine0
=None, *args
, **kw_args
):
28 """Initialises a new 'GenEquiv' instance.
30 @param xp: Equivalent reactance, also known as Xp.
31 @param synchronousMachine0:
33 #: Equivalent reactance, also known as Xp.
36 self
._synchronousMachine
0 = []
37 self
.synchronousMachine0
= [] if synchronousMachine0
is None else synchronousMachine0
39 super(GenEquiv
, self
).__init
__(*args
, **kw_args
)
42 _attr_types
= {"xp": float}
43 _defaults
= {"xp": 0.0}
45 _refs
= ["synchronousMachine0"]
46 _many_refs
= ["synchronousMachine0"]
48 def getsynchronousMachine0(self
):
50 return self
._synchronousMachine
0
52 def setsynchronousMachine0(self
, value
):
53 for p
in self
._synchronousMachine
0:
54 filtered
= [q
for q
in p
.genEquiv0
if q
!= self
]
55 self
._synchronousMachine
0._genEquiv
0 = filtered
57 if self
not in r
._genEquiv
0:
58 r
._genEquiv
0.append(self
)
59 self
._synchronousMachine
0 = value
61 synchronousMachine0
= property(getsynchronousMachine0
, setsynchronousMachine0
)
63 def addsynchronousMachine0(self
, *synchronousMachine0
):
64 for obj
in synchronousMachine0
:
65 if self
not in obj
._genEquiv
0:
66 obj
._genEquiv
0.append(self
)
67 self
._synchronousMachine
0.append(obj
)
69 def removesynchronousMachine0(self
, *synchronousMachine0
):
70 for obj
in synchronousMachine0
:
71 if self
in obj
._genEquiv
0:
72 obj
._genEquiv
0.remove(self
)
73 self
._synchronousMachine
0.remove(obj
)