Fixing website and API documentation links
[PyCIM.git] / CIM14 / CPSM / Equipment / Meas / Measurement.py
blobf072ca6ec1de33d9c9a5bca4b218582c6e69227a
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.IdentifiedObject import IdentifiedObject
23 class Measurement(IdentifiedObject):
24 """A Measurement represents any measured, calculated or non-measured non-calculated quantity. Any piece of equipment may contain Measurements, e.g. a substation may have temperature measurements and door open indications, a transformer may have oil temperature and tank pressure measurements, a bay may contain a number of power flow measurements and a Breaker may contain a switch status measurement. The PSR - Measurement association is intended to capture this use of Measurement and is included in the naming hierarchy based on EquipmentContainer. The naming hierarchy typically has Measurements as leafs, e.g. Substation-VoltageLevel-Bay-Switch-Measurement. Some Measurements represent quantities related to a particular sensor location in the network, e.g. a voltage transformer (PT) at a busbar or a current transformer (CT) at the bar between a breaker and an isolator. The sensing position is not captured in the PSR - Measurement association. Instead it is captured by the Measurement - Terminal association that is used to define the sensing location in the network topology. The location is defined by the connection of the Terminal to ConductingEquipment. Two possible paths exist: 1) Measurement-Terminal- ConnectivityNode-Terminal-ConductingEquipment 2) Measurement-Terminal-ConductingEquipment Alternative 2 is the only allowed use. When the sensor location is needed both Measurement-PSR and Measurement-Terminal are used. The Measurement-Terminal association is never used alone.
25 """
27 def __init__(self, measurementType='', Unit=None, Terminal=None, PowerSystemResource=None, *args, **kw_args):
28 """Initialises a new 'Measurement' instance.
30 @param measurementType: Specifies the type of Measurement, e.g. IndoorTemperature, OutDoorTemperature, BusVoltage, GeneratorVoltage, LineFlow etc.
31 @param Unit: The Unit for the Measurement
32 @param Terminal: One or more measurements may be associated with a terminal in the network
33 @param PowerSystemResource: The PowerSystemResource that contains the Measurement in the naming hierarchy
34 """
35 #: Specifies the type of Measurement, e.g. IndoorTemperature, OutDoorTemperature, BusVoltage, GeneratorVoltage, LineFlow etc.
36 self.measurementType = measurementType
38 self._Unit = None
39 self.Unit = Unit
41 self._Terminal = None
42 self.Terminal = Terminal
44 self._PowerSystemResource = None
45 self.PowerSystemResource = PowerSystemResource
47 super(Measurement, self).__init__(*args, **kw_args)
49 _attrs = ["measurementType"]
50 _attr_types = {"measurementType": str}
51 _defaults = {"measurementType": ''}
52 _enums = {}
53 _refs = ["Unit", "Terminal", "PowerSystemResource"]
54 _many_refs = []
56 def getUnit(self):
57 """The Unit for the Measurement
58 """
59 return self._Unit
61 def setUnit(self, value):
62 if self._Unit is not None:
63 filtered = [x for x in self.Unit.Measurements if x != self]
64 self._Unit._Measurements = filtered
66 self._Unit = value
67 if self._Unit is not None:
68 if self not in self._Unit._Measurements:
69 self._Unit._Measurements.append(self)
71 Unit = property(getUnit, setUnit)
73 def getTerminal(self):
74 """One or more measurements may be associated with a terminal in the network
75 """
76 return self._Terminal
78 def setTerminal(self, value):
79 if self._Terminal is not None:
80 filtered = [x for x in self.Terminal.Measurements if x != self]
81 self._Terminal._Measurements = filtered
83 self._Terminal = value
84 if self._Terminal is not None:
85 if self not in self._Terminal._Measurements:
86 self._Terminal._Measurements.append(self)
88 Terminal = property(getTerminal, setTerminal)
90 def getPowerSystemResource(self):
91 """The PowerSystemResource that contains the Measurement in the naming hierarchy
92 """
93 return self._PowerSystemResource
95 def setPowerSystemResource(self, value):
96 if self._PowerSystemResource is not None:
97 filtered = [x for x in self.PowerSystemResource.Measurements if x != self]
98 self._PowerSystemResource._Measurements = filtered
100 self._PowerSystemResource = value
101 if self._PowerSystemResource is not None:
102 if self not in self._PowerSystemResource._Measurements:
103 self._PowerSystemResource._Measurements.append(self)
105 PowerSystemResource = property(getPowerSystemResource, setPowerSystemResource)