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
.IEC61968
.Common
.Location
import Location
19 class ServiceLocation(Location
):
20 """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.
23 def __init__(self
, siteAccessProblem
='', accessMethod
='', needsInspection
=False, EndDeviceAssets
=None, CustomerAgreements
=None, ServiceDeliveryPoints
=None, *args
, **kw_args
):
24 """Initialises a new 'ServiceLocation' instance.
26 @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.
27 @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.
28 @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.
29 @param EndDeviceAssets: All end device assets that measure the service delivered to this service location.
30 @param CustomerAgreements: All customer agreements regulating this service location.
31 @param ServiceDeliveryPoints: All service delivery points delivering service (of the same type) to this service location.
33 #: Problems previously encountered when visiting or performing work on this site. Examples include: bad dog, violent customer, verbally abusive occupant, obstructions, safety hazards, etc.
34 self
.siteAccessProblem
= siteAccessProblem
36 #: 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.
37 self
.accessMethod
= accessMethod
39 #: 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.
40 self
.needsInspection
= needsInspection
42 self
._EndDeviceAssets
= []
43 self
.EndDeviceAssets
= [] if EndDeviceAssets
is None else EndDeviceAssets
45 self
._CustomerAgreements
= []
46 self
.CustomerAgreements
= [] if CustomerAgreements
is None else CustomerAgreements
48 self
._ServiceDeliveryPoints
= []
49 self
.ServiceDeliveryPoints
= [] if ServiceDeliveryPoints
is None else ServiceDeliveryPoints
51 super(ServiceLocation
, self
).__init
__(*args
, **kw_args
)
53 _attrs
= ["siteAccessProblem", "accessMethod", "needsInspection"]
54 _attr_types
= {"siteAccessProblem": str, "accessMethod": str, "needsInspection": bool}
55 _defaults
= {"siteAccessProblem": '', "accessMethod": '', "needsInspection": False}
57 _refs
= ["EndDeviceAssets", "CustomerAgreements", "ServiceDeliveryPoints"]
58 _many_refs
= ["EndDeviceAssets", "CustomerAgreements", "ServiceDeliveryPoints"]
60 def getEndDeviceAssets(self
):
61 """All end device assets that measure the service delivered to this service location.
63 return self
._EndDeviceAssets
65 def setEndDeviceAssets(self
, value
):
66 for x
in self
._EndDeviceAssets
:
67 x
.ServiceLocation
= None
69 y
._ServiceLocation
= self
70 self
._EndDeviceAssets
= value
72 EndDeviceAssets
= property(getEndDeviceAssets
, setEndDeviceAssets
)
74 def addEndDeviceAssets(self
, *EndDeviceAssets
):
75 for obj
in EndDeviceAssets
:
76 obj
.ServiceLocation
= self
78 def removeEndDeviceAssets(self
, *EndDeviceAssets
):
79 for obj
in EndDeviceAssets
:
80 obj
.ServiceLocation
= None
82 def getCustomerAgreements(self
):
83 """All customer agreements regulating this service location.
85 return self
._CustomerAgreements
87 def setCustomerAgreements(self
, value
):
88 for p
in self
._CustomerAgreements
:
89 filtered
= [q
for q
in p
.ServiceLocations
if q
!= self
]
90 self
._CustomerAgreements
._ServiceLocations
= filtered
92 if self
not in r
._ServiceLocations
:
93 r
._ServiceLocations
.append(self
)
94 self
._CustomerAgreements
= value
96 CustomerAgreements
= property(getCustomerAgreements
, setCustomerAgreements
)
98 def addCustomerAgreements(self
, *CustomerAgreements
):
99 for obj
in CustomerAgreements
:
100 if self
not in obj
._ServiceLocations
:
101 obj
._ServiceLocations
.append(self
)
102 self
._CustomerAgreements
.append(obj
)
104 def removeCustomerAgreements(self
, *CustomerAgreements
):
105 for obj
in CustomerAgreements
:
106 if self
in obj
._ServiceLocations
:
107 obj
._ServiceLocations
.remove(self
)
108 self
._CustomerAgreements
.remove(obj
)
110 def getServiceDeliveryPoints(self
):
111 """All service delivery points delivering service (of the same type) to this service location.
113 return self
._ServiceDeliveryPoints
115 def setServiceDeliveryPoints(self
, value
):
116 for x
in self
._ServiceDeliveryPoints
:
117 x
.ServiceLocation
= None
119 y
._ServiceLocation
= self
120 self
._ServiceDeliveryPoints
= value
122 ServiceDeliveryPoints
= property(getServiceDeliveryPoints
, setServiceDeliveryPoints
)
124 def addServiceDeliveryPoints(self
, *ServiceDeliveryPoints
):
125 for obj
in ServiceDeliveryPoints
:
126 obj
.ServiceLocation
= self
128 def removeServiceDeliveryPoints(self
, *ServiceDeliveryPoints
):
129 for obj
in ServiceDeliveryPoints
:
130 obj
.ServiceLocation
= None