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 Control(IdentifiedObject
):
20 """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.
23 def __init__(self
, timeStamp
='', operationInProgress
=False, Unit
=None, RegulatingCondEq
=None, ControlType
=None, RemoteControl
=None, *args
, **kw_args
):
24 """Initialises a new 'Control' instance.
26 @param timeStamp: The last time a control output was sent
27 @param operationInProgress: Indicates that a client is currently sending control commands that has not completed
28 @param Unit: The Unit for the Control.
29 @param RegulatingCondEq: Regulating device governed by this control output.
30 @param ControlType: The type of Control
31 @param RemoteControl: The remote point controlling the physical actuator.
33 #: The last time a control output was sent
34 self
.timeStamp
= timeStamp
36 #: Indicates that a client is currently sending control commands that has not completed
37 self
.operationInProgress
= operationInProgress
42 self
._RegulatingCondEq
= None
43 self
.RegulatingCondEq
= RegulatingCondEq
45 self
._ControlType
= None
46 self
.ControlType
= ControlType
48 self
._RemoteControl
= None
49 self
.RemoteControl
= RemoteControl
51 super(Control
, self
).__init
__(*args
, **kw_args
)
53 _attrs
= ["timeStamp", "operationInProgress"]
54 _attr_types
= {"timeStamp": str, "operationInProgress": bool}
55 _defaults
= {"timeStamp": '', "operationInProgress": False}
57 _refs
= ["Unit", "RegulatingCondEq", "ControlType", "RemoteControl"]
61 """The Unit for the Control.
65 def setUnit(self
, value
):
66 if self
._Unit
is not None:
67 filtered
= [x
for x
in self
.Unit
.Controls
if x
!= self
]
68 self
._Unit
._Controls
= filtered
71 if self
._Unit
is not None:
72 self
._Unit
._Controls
.append(self
)
74 Unit
= property(getUnit
, setUnit
)
76 def getRegulatingCondEq(self
):
77 """Regulating device governed by this control output.
79 return self
._RegulatingCondEq
81 def setRegulatingCondEq(self
, value
):
82 if self
._RegulatingCondEq
is not None:
83 filtered
= [x
for x
in self
.RegulatingCondEq
.Controls
if x
!= self
]
84 self
._RegulatingCondEq
._Controls
= filtered
86 self
._RegulatingCondEq
= value
87 if self
._RegulatingCondEq
is not None:
88 self
._RegulatingCondEq
._Controls
.append(self
)
90 RegulatingCondEq
= property(getRegulatingCondEq
, setRegulatingCondEq
)
92 def getControlType(self
):
93 """The type of Control
95 return self
._ControlType
97 def setControlType(self
, value
):
98 if self
._ControlType
is not None:
99 filtered
= [x
for x
in self
.ControlType
.Controls
if x
!= self
]
100 self
._ControlType
._Controls
= filtered
102 self
._ControlType
= value
103 if self
._ControlType
is not None:
104 self
._ControlType
._Controls
.append(self
)
106 ControlType
= property(getControlType
, setControlType
)
108 def getRemoteControl(self
):
109 """The remote point controlling the physical actuator.
111 return self
._RemoteControl
113 def setRemoteControl(self
, value
):
114 if self
._RemoteControl
is not None:
115 self
._RemoteControl
._Control
= None
117 self
._RemoteControl
= value
118 if self
._RemoteControl
is not None:
119 self
._RemoteControl
._Control
= self
121 RemoteControl
= property(getRemoteControl
, setRemoteControl
)