Adding CDPSM package.
[PyCIM.git] / CIM14 / Dynamics / Generators / GenEquiv.py
blobbd287c500f41185111c530e65f6e418e4e069724
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.
21 """
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:
28 """
29 #: Equivalent reactance, also known as Xp.
30 self.xp = xp
32 self._synchronousMachine0 = []
33 self.synchronousMachine0 = [] if synchronousMachine0 is None else synchronousMachine0
35 super(GenEquiv, self).__init__(*args, **kw_args)
37 _attrs = ["xp"]
38 _attr_types = {"xp": float}
39 _defaults = {"xp": 0.0}
40 _enums = {}
41 _refs = ["synchronousMachine0"]
42 _many_refs = ["synchronousMachine0"]
44 def getsynchronousMachine0(self):
46 return self._synchronousMachine0
48 def setsynchronousMachine0(self, value):
49 for p in self._synchronousMachine0:
50 filtered = [q for q in p.genEquiv0 if q != self]
51 self._synchronousMachine0._genEquiv0 = filtered
52 for r in value:
53 if self not in r._genEquiv0:
54 r._genEquiv0.append(self)
55 self._synchronousMachine0 = value
57 synchronousMachine0 = property(getsynchronousMachine0, setsynchronousMachine0)
59 def addsynchronousMachine0(self, *synchronousMachine0):
60 for obj in synchronousMachine0:
61 if self not in obj._genEquiv0:
62 obj._genEquiv0.append(self)
63 self._synchronousMachine0.append(obj)
65 def removesynchronousMachine0(self, *synchronousMachine0):
66 for obj in synchronousMachine0:
67 if self in obj._genEquiv0:
68 obj._genEquiv0.remove(self)
69 self._synchronousMachine0.remove(obj)