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
21 from CIM14
.IEC61970
.Core
.IdentifiedObject
import IdentifiedObject
23 class Control(IdentifiedObject
):
24 """Control is used for supervisory/device control. It represents control outputs that are used to change the state in a process, e.g. close or open breaker, a set point value or a raise lower command.
27 def __init__(self
, timeStamp
='', operationInProgress
=False, Unit
=None, RegulatingCondEq
=None, ControlType
=None, RemoteControl
=None, *args
, **kw_args
):
28 """Initialises a new 'Control' instance.
30 @param timeStamp: The last time a control output was sent
31 @param operationInProgress: Indicates that a client is currently sending control commands that has not completed
32 @param Unit: The Unit for the Control.
33 @param RegulatingCondEq: Regulating device governed by this control output.
34 @param ControlType: The type of Control
35 @param RemoteControl: The remote point controlling the physical actuator.
37 #: The last time a control output was sent
38 self
.timeStamp
= timeStamp
40 #: Indicates that a client is currently sending control commands that has not completed
41 self
.operationInProgress
= operationInProgress
46 self
._RegulatingCondEq
= None
47 self
.RegulatingCondEq
= RegulatingCondEq
49 self
._ControlType
= None
50 self
.ControlType
= ControlType
52 self
._RemoteControl
= None
53 self
.RemoteControl
= RemoteControl
55 super(Control
, self
).__init
__(*args
, **kw_args
)
57 _attrs
= ["timeStamp", "operationInProgress"]
58 _attr_types
= {"timeStamp": str, "operationInProgress": bool}
59 _defaults
= {"timeStamp": '', "operationInProgress": False}
61 _refs
= ["Unit", "RegulatingCondEq", "ControlType", "RemoteControl"]
65 """The Unit for the Control.
69 def setUnit(self
, value
):
70 if self
._Unit
is not None:
71 filtered
= [x
for x
in self
.Unit
.Controls
if x
!= self
]
72 self
._Unit
._Controls
= filtered
75 if self
._Unit
is not None:
76 if self
not in self
._Unit
._Controls
:
77 self
._Unit
._Controls
.append(self
)
79 Unit
= property(getUnit
, setUnit
)
81 def getRegulatingCondEq(self
):
82 """Regulating device governed by this control output.
84 return self
._RegulatingCondEq
86 def setRegulatingCondEq(self
, value
):
87 if self
._RegulatingCondEq
is not None:
88 filtered
= [x
for x
in self
.RegulatingCondEq
.Controls
if x
!= self
]
89 self
._RegulatingCondEq
._Controls
= filtered
91 self
._RegulatingCondEq
= value
92 if self
._RegulatingCondEq
is not None:
93 if self
not in self
._RegulatingCondEq
._Controls
:
94 self
._RegulatingCondEq
._Controls
.append(self
)
96 RegulatingCondEq
= property(getRegulatingCondEq
, setRegulatingCondEq
)
98 def getControlType(self
):
99 """The type of Control
101 return self
._ControlType
103 def setControlType(self
, value
):
104 if self
._ControlType
is not None:
105 filtered
= [x
for x
in self
.ControlType
.Controls
if x
!= self
]
106 self
._ControlType
._Controls
= filtered
108 self
._ControlType
= value
109 if self
._ControlType
is not None:
110 if self
not in self
._ControlType
._Controls
:
111 self
._ControlType
._Controls
.append(self
)
113 ControlType
= property(getControlType
, setControlType
)
115 def getRemoteControl(self
):
116 """The remote point controlling the physical actuator.
118 return self
._RemoteControl
120 def setRemoteControl(self
, value
):
121 if self
._RemoteControl
is not None:
122 self
._RemoteControl
._Control
= None
124 self
._RemoteControl
= value
125 if self
._RemoteControl
is not None:
126 self
._RemoteControl
.Control
= None
127 self
._RemoteControl
._Control
= self
129 RemoteControl
= property(getRemoteControl
, setRemoteControl
)