Implementing RDF/XML serialisation using meta-data attributes.
[PyCIM.git] / schemata / CIM14 / IEC61970 / SCADA / RemoteUnit.py
blobfe6cae8ff91d1d18c0084dae6128001599fd30ae
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.PowerSystemResource import PowerSystemResource
19 class RemoteUnit(PowerSystemResource):
20 """A remote unit can be a RTU, IED, substation control system, control center etc. The communication with the remote unit can be through various standard protocols (e.g. IEC 61870, IEC 61850) or non standard protocols (e.g. DNP, RP570 etc.). A remote unit contain remote data points that might be telemetered, collected or calculated. The RemoteUnit class inherit PowerSystemResource. The intention is to allow RemotUnits to have Measurements. These Measurements can be used to model unit status as operational, out of service, unit failure etc.
21 """
23 def __init__(self, remoteUnitType="IED", CommunicationLinks=None, RemotePoints=None, *args, **kw_args):
24 """Initialises a new 'RemoteUnit' instance.
26 @param remoteUnitType: Type of remote unit. Values are: "IED", "ControlCenter", "RTU", "SubstationControlSystem"
27 @param CommunicationLinks: RTUs may be attached to communication links.
28 @param RemotePoints: Remote points this Remote unit contains.
29 """
30 #: Type of remote unit. Values are: "IED", "ControlCenter", "RTU", "SubstationControlSystem"
31 self.remoteUnitType = remoteUnitType
33 self._CommunicationLinks = []
34 self.CommunicationLinks = [] if CommunicationLinks is None else CommunicationLinks
36 self._RemotePoints = []
37 self.RemotePoints = [] if RemotePoints is None else RemotePoints
39 super(RemoteUnit, self).__init__(*args, **kw_args)
41 _attrs = ["remoteUnitType"]
42 _attr_types = {"remoteUnitType": str}
43 _defaults = {"remoteUnitType": "IED"}
44 _enums = {"remoteUnitType": "RemoteUnitType"}
45 _refs = ["CommunicationLinks", "RemotePoints"]
46 _many_refs = ["CommunicationLinks", "RemotePoints"]
48 def getCommunicationLinks(self):
49 """RTUs may be attached to communication links.
50 """
51 return self._CommunicationLinks
53 def setCommunicationLinks(self, value):
54 for p in self._CommunicationLinks:
55 filtered = [q for q in p.RemoteUnits if q != self]
56 self._CommunicationLinks._RemoteUnits = filtered
57 for r in value:
58 if self not in r._RemoteUnits:
59 r._RemoteUnits.append(self)
60 self._CommunicationLinks = value
62 CommunicationLinks = property(getCommunicationLinks, setCommunicationLinks)
64 def addCommunicationLinks(self, *CommunicationLinks):
65 for obj in CommunicationLinks:
66 if self not in obj._RemoteUnits:
67 obj._RemoteUnits.append(self)
68 self._CommunicationLinks.append(obj)
70 def removeCommunicationLinks(self, *CommunicationLinks):
71 for obj in CommunicationLinks:
72 if self in obj._RemoteUnits:
73 obj._RemoteUnits.remove(self)
74 self._CommunicationLinks.remove(obj)
76 def getRemotePoints(self):
77 """Remote points this Remote unit contains.
78 """
79 return self._RemotePoints
81 def setRemotePoints(self, value):
82 for x in self._RemotePoints:
83 x._RemoteUnit = None
84 for y in value:
85 y._RemoteUnit = self
86 self._RemotePoints = value
88 RemotePoints = property(getRemotePoints, setRemotePoints)
90 def addRemotePoints(self, *RemotePoints):
91 for obj in RemotePoints:
92 obj._RemoteUnit = self
93 self._RemotePoints.append(obj)
95 def removeRemotePoints(self, *RemotePoints):
96 for obj in RemotePoints:
97 obj._RemoteUnit = None
98 self._RemotePoints.remove(obj)