Update README.rst
[PyCIM.git] / CIM14 / IEC61968 / Metering / EndDeviceControl.py
blobc67f7dd6ed6976ad9c0f4889e920256f1566971a
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.IEC61970.Core.IdentifiedObject import IdentifiedObject
23 class EndDeviceControl(IdentifiedObject):
24 """Instructs an EndDeviceAsset (or EndDeviceGroup) to perform a specified action.
25 """
27 def __init__(self, type='', drProgramMandatory=False, priceSignal=0.0, drProgramLevel=0, EndDeviceGroup=None, DemandResponseProgram=None, CustomerAgreement=None, EndDeviceAsset=None, scheduledInterval=None, *args, **kw_args):
28 """Initialises a new 'EndDeviceControl' instance.
30 @param type: Type of control.
31 @param drProgramMandatory: Whether a demand response program request is mandatory. Note: Attribute is not defined on DemandResponseProgram as it is not its inherent property (it serves to control it).
32 @param priceSignal: (if applicable) Price signal used as parameter for this end device control.
33 @param drProgramLevel: Level of a demand response program request, where 0=emergency. Note: Attribute is not defined on DemandResponseProgram as it is not its inherent property (it serves to control it).
34 @param EndDeviceGroup: End device group receiving commands from this end device control.
35 @param DemandResponseProgram: Demand response program for this end device control.
36 @param CustomerAgreement: Could be deprecated in the future.
37 @param EndDeviceAsset: End device asset receiving commands from this end device control.
38 @param scheduledInterval: (if control has scheduled duration) Date and time interval the control has been scheduled to execute within.
39 """
40 #: Type of control.
41 self.type = type
43 #: Whether a demand response program request is mandatory. Note: Attribute is not defined on DemandResponseProgram as it is not its inherent property (it serves to control it).
44 self.drProgramMandatory = drProgramMandatory
46 #: (if applicable) Price signal used as parameter for this end device control.
47 self.priceSignal = priceSignal
49 #: Level of a demand response program request, where 0=emergency. Note: Attribute is not defined on DemandResponseProgram as it is not its inherent property (it serves to control it).
50 self.drProgramLevel = drProgramLevel
52 self._EndDeviceGroup = None
53 self.EndDeviceGroup = EndDeviceGroup
55 self._DemandResponseProgram = None
56 self.DemandResponseProgram = DemandResponseProgram
58 self._CustomerAgreement = None
59 self.CustomerAgreement = CustomerAgreement
61 self._EndDeviceAsset = None
62 self.EndDeviceAsset = EndDeviceAsset
64 self.scheduledInterval = scheduledInterval
66 super(EndDeviceControl, self).__init__(*args, **kw_args)
68 _attrs = ["type", "drProgramMandatory", "priceSignal", "drProgramLevel"]
69 _attr_types = {"type": str, "drProgramMandatory": bool, "priceSignal": float, "drProgramLevel": int}
70 _defaults = {"type": '', "drProgramMandatory": False, "priceSignal": 0.0, "drProgramLevel": 0}
71 _enums = {}
72 _refs = ["EndDeviceGroup", "DemandResponseProgram", "CustomerAgreement", "EndDeviceAsset", "scheduledInterval"]
73 _many_refs = []
75 def getEndDeviceGroup(self):
76 """End device group receiving commands from this end device control.
77 """
78 return self._EndDeviceGroup
80 def setEndDeviceGroup(self, value):
81 if self._EndDeviceGroup is not None:
82 filtered = [x for x in self.EndDeviceGroup.EndDeviceControls if x != self]
83 self._EndDeviceGroup._EndDeviceControls = filtered
85 self._EndDeviceGroup = value
86 if self._EndDeviceGroup is not None:
87 if self not in self._EndDeviceGroup._EndDeviceControls:
88 self._EndDeviceGroup._EndDeviceControls.append(self)
90 EndDeviceGroup = property(getEndDeviceGroup, setEndDeviceGroup)
92 def getDemandResponseProgram(self):
93 """Demand response program for this end device control.
94 """
95 return self._DemandResponseProgram
97 def setDemandResponseProgram(self, value):
98 if self._DemandResponseProgram is not None:
99 filtered = [x for x in self.DemandResponseProgram.EndDeviceControls if x != self]
100 self._DemandResponseProgram._EndDeviceControls = filtered
102 self._DemandResponseProgram = value
103 if self._DemandResponseProgram is not None:
104 if self not in self._DemandResponseProgram._EndDeviceControls:
105 self._DemandResponseProgram._EndDeviceControls.append(self)
107 DemandResponseProgram = property(getDemandResponseProgram, setDemandResponseProgram)
109 def getCustomerAgreement(self):
110 """Could be deprecated in the future.
112 return self._CustomerAgreement
114 def setCustomerAgreement(self, value):
115 if self._CustomerAgreement is not None:
116 filtered = [x for x in self.CustomerAgreement.EndDeviceControls if x != self]
117 self._CustomerAgreement._EndDeviceControls = filtered
119 self._CustomerAgreement = value
120 if self._CustomerAgreement is not None:
121 if self not in self._CustomerAgreement._EndDeviceControls:
122 self._CustomerAgreement._EndDeviceControls.append(self)
124 CustomerAgreement = property(getCustomerAgreement, setCustomerAgreement)
126 def getEndDeviceAsset(self):
127 """End device asset receiving commands from this end device control.
129 return self._EndDeviceAsset
131 def setEndDeviceAsset(self, value):
132 if self._EndDeviceAsset is not None:
133 filtered = [x for x in self.EndDeviceAsset.EndDeviceControls if x != self]
134 self._EndDeviceAsset._EndDeviceControls = filtered
136 self._EndDeviceAsset = value
137 if self._EndDeviceAsset is not None:
138 if self not in self._EndDeviceAsset._EndDeviceControls:
139 self._EndDeviceAsset._EndDeviceControls.append(self)
141 EndDeviceAsset = property(getEndDeviceAsset, setEndDeviceAsset)
143 # (if control has scheduled duration) Date and time interval the control has been scheduled to execute within.
144 scheduledInterval = None