Update README.rst
[PyCIM.git] / CIM14 / CPSM / Equipment / Core / Equipment.py
blob41baacb18bb33dc7f69ed7c77ce60e4034766dcd
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
19 # IN THE SOFTWARE.
21 from CIM14.CPSM.Equipment.Core.PowerSystemResource import PowerSystemResource
23 class Equipment(PowerSystemResource):
24 """The parts of a power system that are physical devices, electronic or mechanical
25 """
27 def __init__(self, aggregate=False, OperationalLimitSet=None, EquipmentContainer=None, *args, **kw_args):
28 """Initialises a new 'Equipment' instance.
30 @param aggregate: The single instance of equipment represents multiple pieces of equipment that have been modeled together as an aggregate. Examples would be PowerTransformers or SychronousMachines operating in parallel modeled as a single aggregate PowerTransformer or aggregate SynchronousMachine. This is not to be used to indicate equipment that is part of a group of interdependent equipment produced by a network production program.
31 @param OperationalLimitSet: The equipment limit sets associated with the equipment.
32 @param EquipmentContainer: The association is used in the naming hierarchy.
33 """
34 #: The single instance of equipment represents multiple pieces of equipment that have been modeled together as an aggregate. Examples would be PowerTransformers or SychronousMachines operating in parallel modeled as a single aggregate PowerTransformer or aggregate SynchronousMachine. This is not to be used to indicate equipment that is part of a group of interdependent equipment produced by a network production program.
35 self.aggregate = aggregate
37 self._OperationalLimitSet = []
38 self.OperationalLimitSet = [] if OperationalLimitSet is None else OperationalLimitSet
40 self._EquipmentContainer = None
41 self.EquipmentContainer = EquipmentContainer
43 super(Equipment, self).__init__(*args, **kw_args)
45 _attrs = ["aggregate"]
46 _attr_types = {"aggregate": bool}
47 _defaults = {"aggregate": False}
48 _enums = {}
49 _refs = ["OperationalLimitSet", "EquipmentContainer"]
50 _many_refs = ["OperationalLimitSet"]
52 def getOperationalLimitSet(self):
53 """The equipment limit sets associated with the equipment.
54 """
55 return self._OperationalLimitSet
57 def setOperationalLimitSet(self, value):
58 for x in self._OperationalLimitSet:
59 x.Equipment = None
60 for y in value:
61 y._Equipment = self
62 self._OperationalLimitSet = value
64 OperationalLimitSet = property(getOperationalLimitSet, setOperationalLimitSet)
66 def addOperationalLimitSet(self, *OperationalLimitSet):
67 for obj in OperationalLimitSet:
68 obj.Equipment = self
70 def removeOperationalLimitSet(self, *OperationalLimitSet):
71 for obj in OperationalLimitSet:
72 obj.Equipment = None
74 def getEquipmentContainer(self):
75 """The association is used in the naming hierarchy.
76 """
77 return self._EquipmentContainer
79 def setEquipmentContainer(self, value):
80 if self._EquipmentContainer is not None:
81 filtered = [x for x in self.EquipmentContainer.Equipments if x != self]
82 self._EquipmentContainer._Equipments = filtered
84 self._EquipmentContainer = value
85 if self._EquipmentContainer is not None:
86 if self not in self._EquipmentContainer._Equipments:
87 self._EquipmentContainer._Equipments.append(self)
89 EquipmentContainer = property(getEquipmentContainer, setEquipmentContainer)