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
.IdentifiedObject
import IdentifiedObject
19 class EndDeviceControl(IdentifiedObject
):
20 """Instructs an EndDeviceAsset (or EndDeviceGroup) to perform a specified action.
23 def __init__(self
, type='', drProgramMandatory
=False, priceSignal
=0.0, drProgramLevel
=0, EndDeviceGroup
=None, DemandResponseProgram
=None, CustomerAgreement
=None, EndDeviceAsset
=None, scheduledInterval
=None, *args
, **kw_args
):
24 """Initialises a new 'EndDeviceControl' instance.
26 @param type: Type of control.
27 @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).
28 @param priceSignal: (if applicable) Price signal used as parameter for this end device control.
29 @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).
30 @param EndDeviceGroup: End device group receiving commands from this end device control.
31 @param DemandResponseProgram: Demand response program for this end device control.
32 @param CustomerAgreement: Could be deprecated in the future.
33 @param EndDeviceAsset: End device asset receiving commands from this end device control.
34 @param scheduledInterval: (if control has scheduled duration) Date and time interval the control has been scheduled to execute within.
39 #: 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).
40 self
.drProgramMandatory
= drProgramMandatory
42 #: (if applicable) Price signal used as parameter for this end device control.
43 self
.priceSignal
= priceSignal
45 #: 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).
46 self
.drProgramLevel
= drProgramLevel
48 self
._EndDeviceGroup
= None
49 self
.EndDeviceGroup
= EndDeviceGroup
51 self
._DemandResponseProgram
= None
52 self
.DemandResponseProgram
= DemandResponseProgram
54 self
._CustomerAgreement
= None
55 self
.CustomerAgreement
= CustomerAgreement
57 self
._EndDeviceAsset
= None
58 self
.EndDeviceAsset
= EndDeviceAsset
60 self
.scheduledInterval
= scheduledInterval
62 super(EndDeviceControl
, self
).__init
__(*args
, **kw_args
)
64 _attrs
= ["type", "drProgramMandatory", "priceSignal", "drProgramLevel"]
65 _attr_types
= {"type": str, "drProgramMandatory": bool, "priceSignal": float, "drProgramLevel": int}
66 _defaults
= {"type": '', "drProgramMandatory": False, "priceSignal": 0.0, "drProgramLevel": 0}
68 _refs
= ["EndDeviceGroup", "DemandResponseProgram", "CustomerAgreement", "EndDeviceAsset", "scheduledInterval"]
71 def getEndDeviceGroup(self
):
72 """End device group receiving commands from this end device control.
74 return self
._EndDeviceGroup
76 def setEndDeviceGroup(self
, value
):
77 if self
._EndDeviceGroup
is not None:
78 filtered
= [x
for x
in self
.EndDeviceGroup
.EndDeviceControls
if x
!= self
]
79 self
._EndDeviceGroup
._EndDeviceControls
= filtered
81 self
._EndDeviceGroup
= value
82 if self
._EndDeviceGroup
is not None:
83 if self
not in self
._EndDeviceGroup
._EndDeviceControls
:
84 self
._EndDeviceGroup
._EndDeviceControls
.append(self
)
86 EndDeviceGroup
= property(getEndDeviceGroup
, setEndDeviceGroup
)
88 def getDemandResponseProgram(self
):
89 """Demand response program for this end device control.
91 return self
._DemandResponseProgram
93 def setDemandResponseProgram(self
, value
):
94 if self
._DemandResponseProgram
is not None:
95 filtered
= [x
for x
in self
.DemandResponseProgram
.EndDeviceControls
if x
!= self
]
96 self
._DemandResponseProgram
._EndDeviceControls
= filtered
98 self
._DemandResponseProgram
= value
99 if self
._DemandResponseProgram
is not None:
100 if self
not in self
._DemandResponseProgram
._EndDeviceControls
:
101 self
._DemandResponseProgram
._EndDeviceControls
.append(self
)
103 DemandResponseProgram
= property(getDemandResponseProgram
, setDemandResponseProgram
)
105 def getCustomerAgreement(self
):
106 """Could be deprecated in the future.
108 return self
._CustomerAgreement
110 def setCustomerAgreement(self
, value
):
111 if self
._CustomerAgreement
is not None:
112 filtered
= [x
for x
in self
.CustomerAgreement
.EndDeviceControls
if x
!= self
]
113 self
._CustomerAgreement
._EndDeviceControls
= filtered
115 self
._CustomerAgreement
= value
116 if self
._CustomerAgreement
is not None:
117 if self
not in self
._CustomerAgreement
._EndDeviceControls
:
118 self
._CustomerAgreement
._EndDeviceControls
.append(self
)
120 CustomerAgreement
= property(getCustomerAgreement
, setCustomerAgreement
)
122 def getEndDeviceAsset(self
):
123 """End device asset receiving commands from this end device control.
125 return self
._EndDeviceAsset
127 def setEndDeviceAsset(self
, value
):
128 if self
._EndDeviceAsset
is not None:
129 filtered
= [x
for x
in self
.EndDeviceAsset
.EndDeviceControls
if x
!= self
]
130 self
._EndDeviceAsset
._EndDeviceControls
= filtered
132 self
._EndDeviceAsset
= value
133 if self
._EndDeviceAsset
is not None:
134 if self
not in self
._EndDeviceAsset
._EndDeviceControls
:
135 self
._EndDeviceAsset
._EndDeviceControls
.append(self
)
137 EndDeviceAsset
= property(getEndDeviceAsset
, setEndDeviceAsset
)
139 # (if control has scheduled duration) Date and time interval the control has been scheduled to execute within.
140 scheduledInterval
= None