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.
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.
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
)
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.
61 def setControls(self
, value
):
62 for x
in self
._Controls
:
66 self
._Controls
= value
68 Controls
= property(getControls
, setControls
)
70 def addControls(self
, *Controls
):
73 self
._Controls
.append(obj
)
75 def removeControls(self
, *Controls
):
78 self
._Controls
.remove(obj
)
80 def getMeasurements(self
):
81 """The Measurements having the Unit
83 return self
._Measurements
85 def setMeasurements(self
, value
):
86 for x
in self
._Measurements
:
90 self
._Measurements
= value
92 Measurements
= property(getMeasurements
, setMeasurements
)
94 def addMeasurements(self
, *Measurements
):
95 for obj
in Measurements
:
97 self
._Measurements
.append(obj
)
99 def removeMeasurements(self
, *Measurements
):
100 for obj
in Measurements
:
102 self
._Measurements
.remove(obj
)
104 def getMetaBlockConOutput(self
):
106 return self
._MetaBlockConOutput
108 def setMetaBlockConOutput(self
, value
):
109 for x
in self
._MetaBlockConOutput
:
113 self
._MetaBlockConOutput
= value
115 MetaBlockConOutput
= property(getMetaBlockConOutput
, setMetaBlockConOutput
)
117 def addMetaBlockConOutput(self
, *MetaBlockConOutput
):
118 for obj
in MetaBlockConOutput
:
120 self
._MetaBlockConOutput
.append(obj
)
122 def removeMetaBlockConOutput(self
, *MetaBlockConOutput
):
123 for obj
in MetaBlockConOutput
:
125 self
._MetaBlockConOutput
.remove(obj
)
127 def getMetaBlockConInput(self
):
129 return self
._MetaBlockConInput
131 def setMetaBlockConInput(self
, value
):
132 for x
in self
._MetaBlockConInput
:
136 self
._MetaBlockConInput
= value
138 MetaBlockConInput
= property(getMetaBlockConInput
, setMetaBlockConInput
)
140 def addMetaBlockConInput(self
, *MetaBlockConInput
):
141 for obj
in MetaBlockConInput
:
143 self
._MetaBlockConInput
.append(obj
)
145 def removeMetaBlockConInput(self
, *MetaBlockConInput
):
146 for obj
in MetaBlockConInput
:
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
:
160 self
._ProtectionEquipments
= value
162 ProtectionEquipments
= property(getProtectionEquipments
, setProtectionEquipments
)
164 def addProtectionEquipments(self
, *ProtectionEquipments
):
165 for obj
in ProtectionEquipments
:
167 self
._ProtectionEquipments
.append(obj
)
169 def removeProtectionEquipments(self
, *ProtectionEquipments
):
170 for obj
in ProtectionEquipments
:
172 self
._ProtectionEquipments
.remove(obj
)