Adding class meta-data attributes.
[PyCIM.git] / schemata / CIM14 / IEC61970 / Core / Unit.py
blob98b99ab9285acae5a7c38f71da858b0f042e335a
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.IEC61970.Core.IdentifiedObject import IdentifiedObject
19 class Unit(IdentifiedObject):
20 """Quantity being measured. The Unit.name shall be unique among all specified quantities and describe the quantity. The Unit.aliasName is meant to be used for localization.
21 """
23 def __init__(self, Controls=None, Measurements=None, MetaBlockConOutput=None, MetaBlockConInput=None, ProtectionEquipments=None, *args, **kw_args):
24 """Initialises a new 'Unit' instance.
26 @param Controls: The Controls having the Unit.
27 @param Measurements: The Measurements having the Unit
28 @param MetaBlockConOutput:
29 @param MetaBlockConInput:
30 @param ProtectionEquipments: The Protection Equipments having the Unit.
31 """
32 self._Controls = []
33 self.Controls = [] if Controls is None else Controls
35 self._Measurements = []
36 self.Measurements = [] if Measurements is None else Measurements
38 self._MetaBlockConOutput = []
39 self.MetaBlockConOutput = [] if MetaBlockConOutput is None else MetaBlockConOutput
41 self._MetaBlockConInput = []
42 self.MetaBlockConInput = [] if MetaBlockConInput is None else MetaBlockConInput
44 self._ProtectionEquipments = []
45 self.ProtectionEquipments = [] if ProtectionEquipments is None else ProtectionEquipments
47 super(Unit, self).__init__(*args, **kw_args)
49 _attrs = []
50 _attr_types = {}
51 _defaults = {}
52 _enums = {}
53 _refs = ["Controls", "Measurements", "MetaBlockConOutput", "MetaBlockConInput", "ProtectionEquipments"]
54 _many_refs = ["Controls", "Measurements", "MetaBlockConOutput", "MetaBlockConInput", "ProtectionEquipments"]
56 def getControls(self):
57 """The Controls having the Unit.
58 """
59 return self._Controls
61 def setControls(self, value):
62 for x in self._Controls:
63 x._Unit = None
64 for y in value:
65 y._Unit = self
66 self._Controls = value
68 Controls = property(getControls, setControls)
70 def addControls(self, *Controls):
71 for obj in Controls:
72 obj._Unit = self
73 self._Controls.append(obj)
75 def removeControls(self, *Controls):
76 for obj in Controls:
77 obj._Unit = None
78 self._Controls.remove(obj)
80 def getMeasurements(self):
81 """The Measurements having the Unit
82 """
83 return self._Measurements
85 def setMeasurements(self, value):
86 for x in self._Measurements:
87 x._Unit = None
88 for y in value:
89 y._Unit = self
90 self._Measurements = value
92 Measurements = property(getMeasurements, setMeasurements)
94 def addMeasurements(self, *Measurements):
95 for obj in Measurements:
96 obj._Unit = self
97 self._Measurements.append(obj)
99 def removeMeasurements(self, *Measurements):
100 for obj in Measurements:
101 obj._Unit = None
102 self._Measurements.remove(obj)
104 def getMetaBlockConOutput(self):
106 return self._MetaBlockConOutput
108 def setMetaBlockConOutput(self, value):
109 for x in self._MetaBlockConOutput:
110 x._Unit = None
111 for y in value:
112 y._Unit = self
113 self._MetaBlockConOutput = value
115 MetaBlockConOutput = property(getMetaBlockConOutput, setMetaBlockConOutput)
117 def addMetaBlockConOutput(self, *MetaBlockConOutput):
118 for obj in MetaBlockConOutput:
119 obj._Unit = self
120 self._MetaBlockConOutput.append(obj)
122 def removeMetaBlockConOutput(self, *MetaBlockConOutput):
123 for obj in MetaBlockConOutput:
124 obj._Unit = None
125 self._MetaBlockConOutput.remove(obj)
127 def getMetaBlockConInput(self):
129 return self._MetaBlockConInput
131 def setMetaBlockConInput(self, value):
132 for x in self._MetaBlockConInput:
133 x._Unit = None
134 for y in value:
135 y._Unit = self
136 self._MetaBlockConInput = value
138 MetaBlockConInput = property(getMetaBlockConInput, setMetaBlockConInput)
140 def addMetaBlockConInput(self, *MetaBlockConInput):
141 for obj in MetaBlockConInput:
142 obj._Unit = self
143 self._MetaBlockConInput.append(obj)
145 def removeMetaBlockConInput(self, *MetaBlockConInput):
146 for obj in MetaBlockConInput:
147 obj._Unit = None
148 self._MetaBlockConInput.remove(obj)
150 def getProtectionEquipments(self):
151 """The Protection Equipments having the Unit.
153 return self._ProtectionEquipments
155 def setProtectionEquipments(self, value):
156 for x in self._ProtectionEquipments:
157 x._Unit = None
158 for y in value:
159 y._Unit = self
160 self._ProtectionEquipments = value
162 ProtectionEquipments = property(getProtectionEquipments, setProtectionEquipments)
164 def addProtectionEquipments(self, *ProtectionEquipments):
165 for obj in ProtectionEquipments:
166 obj._Unit = self
167 self._ProtectionEquipments.append(obj)
169 def removeProtectionEquipments(self, *ProtectionEquipments):
170 for obj in ProtectionEquipments:
171 obj._Unit = None
172 self._ProtectionEquipments.remove(obj)