Update README.rst
[PyCIM.git] / CIM14 / IEC61968 / Customers / ServiceLocation.py
bloba43c7d4e40826022e4017dd40f0ee428d7cdc811
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.IEC61968.Common.Location import Location
23 class ServiceLocation(Location):
24 """A customer ServiceLocation has one or more ServiceDeliveryPoint(s), which in turn relate to Meters. The location may be a point or a polygon, depending on the specific circumstances. For distribution, the ServiceLocation is typically the location of the utility customer's premise. Because a customer's premise may have one or more meters, the ServiceDeliveryPoint is used to define the actual conducting equipment that the EndDeviceAsset attaches to at the utility customer's ServiceLocation. For transmission, it is the point(s) of interconnection on the transmission provider's transmission system where capacity and/or energy transmitted by the transmission provider is made available to the receiving party.
25 """
27 def __init__(self, siteAccessProblem='', accessMethod='', needsInspection=False, EndDeviceAssets=None, CustomerAgreements=None, ServiceDeliveryPoints=None, *args, **kw_args):
28 """Initialises a new 'ServiceLocation' instance.
30 @param siteAccessProblem: Problems previously encountered when visiting or performing work on this site. Examples include: bad dog, violent customer, verbally abusive occupant, obstructions, safety hazards, etc.
31 @param accessMethod: Method for the service person to access the appropriate service locations. For example, a description of where to obtain a key if the facility is unmanned and secured.
32 @param needsInspection: True if inspection is needed of facilities at this service location. This could be requested by a customer, due to suspected tampering, environmental concerns (e.g., a fire in the vicinity), or to correct incompatible data.
33 @param EndDeviceAssets: All end device assets that measure the service delivered to this service location.
34 @param CustomerAgreements: All customer agreements regulating this service location.
35 @param ServiceDeliveryPoints: All service delivery points delivering service (of the same type) to this service location.
36 """
37 #: Problems previously encountered when visiting or performing work on this site. Examples include: bad dog, violent customer, verbally abusive occupant, obstructions, safety hazards, etc.
38 self.siteAccessProblem = siteAccessProblem
40 #: Method for the service person to access the appropriate service locations. For example, a description of where to obtain a key if the facility is unmanned and secured.
41 self.accessMethod = accessMethod
43 #: True if inspection is needed of facilities at this service location. This could be requested by a customer, due to suspected tampering, environmental concerns (e.g., a fire in the vicinity), or to correct incompatible data.
44 self.needsInspection = needsInspection
46 self._EndDeviceAssets = []
47 self.EndDeviceAssets = [] if EndDeviceAssets is None else EndDeviceAssets
49 self._CustomerAgreements = []
50 self.CustomerAgreements = [] if CustomerAgreements is None else CustomerAgreements
52 self._ServiceDeliveryPoints = []
53 self.ServiceDeliveryPoints = [] if ServiceDeliveryPoints is None else ServiceDeliveryPoints
55 super(ServiceLocation, self).__init__(*args, **kw_args)
57 _attrs = ["siteAccessProblem", "accessMethod", "needsInspection"]
58 _attr_types = {"siteAccessProblem": str, "accessMethod": str, "needsInspection": bool}
59 _defaults = {"siteAccessProblem": '', "accessMethod": '', "needsInspection": False}
60 _enums = {}
61 _refs = ["EndDeviceAssets", "CustomerAgreements", "ServiceDeliveryPoints"]
62 _many_refs = ["EndDeviceAssets", "CustomerAgreements", "ServiceDeliveryPoints"]
64 def getEndDeviceAssets(self):
65 """All end device assets that measure the service delivered to this service location.
66 """
67 return self._EndDeviceAssets
69 def setEndDeviceAssets(self, value):
70 for x in self._EndDeviceAssets:
71 x.ServiceLocation = None
72 for y in value:
73 y._ServiceLocation = self
74 self._EndDeviceAssets = value
76 EndDeviceAssets = property(getEndDeviceAssets, setEndDeviceAssets)
78 def addEndDeviceAssets(self, *EndDeviceAssets):
79 for obj in EndDeviceAssets:
80 obj.ServiceLocation = self
82 def removeEndDeviceAssets(self, *EndDeviceAssets):
83 for obj in EndDeviceAssets:
84 obj.ServiceLocation = None
86 def getCustomerAgreements(self):
87 """All customer agreements regulating this service location.
88 """
89 return self._CustomerAgreements
91 def setCustomerAgreements(self, value):
92 for p in self._CustomerAgreements:
93 filtered = [q for q in p.ServiceLocations if q != self]
94 self._CustomerAgreements._ServiceLocations = filtered
95 for r in value:
96 if self not in r._ServiceLocations:
97 r._ServiceLocations.append(self)
98 self._CustomerAgreements = value
100 CustomerAgreements = property(getCustomerAgreements, setCustomerAgreements)
102 def addCustomerAgreements(self, *CustomerAgreements):
103 for obj in CustomerAgreements:
104 if self not in obj._ServiceLocations:
105 obj._ServiceLocations.append(self)
106 self._CustomerAgreements.append(obj)
108 def removeCustomerAgreements(self, *CustomerAgreements):
109 for obj in CustomerAgreements:
110 if self in obj._ServiceLocations:
111 obj._ServiceLocations.remove(self)
112 self._CustomerAgreements.remove(obj)
114 def getServiceDeliveryPoints(self):
115 """All service delivery points delivering service (of the same type) to this service location.
117 return self._ServiceDeliveryPoints
119 def setServiceDeliveryPoints(self, value):
120 for x in self._ServiceDeliveryPoints:
121 x.ServiceLocation = None
122 for y in value:
123 y._ServiceLocation = self
124 self._ServiceDeliveryPoints = value
126 ServiceDeliveryPoints = property(getServiceDeliveryPoints, setServiceDeliveryPoints)
128 def addServiceDeliveryPoints(self, *ServiceDeliveryPoints):
129 for obj in ServiceDeliveryPoints:
130 obj.ServiceLocation = self
132 def removeServiceDeliveryPoints(self, *ServiceDeliveryPoints):
133 for obj in ServiceDeliveryPoints:
134 obj.ServiceLocation = None