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
.Metering
.DeviceFunction
import DeviceFunction
19 class ConnectDisconnectFunction(DeviceFunction
):
20 """A function that will disconnect or reconnect the customer's load under defined conditions.
23 def __init__(self
, isLocalAutoReconOp
=False, isLocalAutoDisconOp
=False, isRemoteAutoReconOp
=False, isRemoteAutoDisconOp
=False, isConnected
=False, eventCount
=0, isDelayedDiscon
=False, rcdInfo
=None, Switches
=None, *args
, **kw_args
):
24 """Initialises a new 'ConnectDisconnectFunction' instance.
26 @param isLocalAutoReconOp: If set true and if reconnection can be operated locally, then the operation happens automatically. Otherwise, it is manually.
27 @param isLocalAutoDisconOp: (if disconnection can be operated locally) If set true, the operation happens automatically, otherwise it happens manually.
28 @param isRemoteAutoReconOp: If set true and if reconnection can be operated remotely, then the operation happens automatically. If false and if reconnection can be operated remotely, then the operation happens manually.
29 @param isRemoteAutoDisconOp: If set true and if disconnection can be operated remotely, then the operation happens automatically. If set false and if disconnection can be operated remotely, then the operation happens manually.
30 @param isConnected: True if this function is in the connected state.
31 @param eventCount: Running cumulative count of (connect or disconnect) events, for the lifetime of this function or until the value is cleared.
32 @param isDelayedDiscon: If set true, the switch may disconnect the service at the end of a specified time delay after the disconnect signal had been given. If set false, the switch may disconnect the service immediately after the disconnect signal had been given. This is typically the case for over current circuit-breakers which are classified as either instantaneous or slow acting.
33 @param rcdInfo: Information on remote connect disconnect switch.
36 #: If set true and if reconnection can be operated locally, then the operation happens automatically. Otherwise, it is manually.
37 self
.isLocalAutoReconOp
= isLocalAutoReconOp
39 #: (if disconnection can be operated locally) If set true, the operation happens automatically, otherwise it happens manually.
40 self
.isLocalAutoDisconOp
= isLocalAutoDisconOp
42 #: If set true and if reconnection can be operated remotely, then the operation happens automatically. If false and if reconnection can be operated remotely, then the operation happens manually.
43 self
.isRemoteAutoReconOp
= isRemoteAutoReconOp
45 #: If set true and if disconnection can be operated remotely, then the operation happens automatically. If set false and if disconnection can be operated remotely, then the operation happens manually.
46 self
.isRemoteAutoDisconOp
= isRemoteAutoDisconOp
48 #: True if this function is in the connected state.
49 self
.isConnected
= isConnected
51 #: Running cumulative count of (connect or disconnect) events, for the lifetime of this function or until the value is cleared.
52 self
.eventCount
= eventCount
54 #: If set true, the switch may disconnect the service at the end of a specified time delay after the disconnect signal had been given. If set false, the switch may disconnect the service immediately after the disconnect signal had been given. This is typically the case for over current circuit-breakers which are classified as either instantaneous or slow acting.
55 self
.isDelayedDiscon
= isDelayedDiscon
57 self
.rcdInfo
= rcdInfo
60 self
.Switches
= [] if Switches
is None else Switches
62 super(ConnectDisconnectFunction
, self
).__init
__(*args
, **kw_args
)
64 _attrs
= ["isLocalAutoReconOp", "isLocalAutoDisconOp", "isRemoteAutoReconOp", "isRemoteAutoDisconOp", "isConnected", "eventCount", "isDelayedDiscon"]
65 _attr_types
= {"isLocalAutoReconOp": bool, "isLocalAutoDisconOp": bool, "isRemoteAutoReconOp": bool, "isRemoteAutoDisconOp": bool, "isConnected": bool, "eventCount": int, "isDelayedDiscon": bool}
66 _defaults
= {"isLocalAutoReconOp": False, "isLocalAutoDisconOp": False, "isRemoteAutoReconOp": False, "isRemoteAutoDisconOp": False, "isConnected": False, "eventCount": 0, "isDelayedDiscon": False}
68 _refs
= ["rcdInfo", "Switches"]
69 _many_refs
= ["Switches"]
71 # Information on remote connect disconnect switch.
74 def getSwitches(self
):
78 def setSwitches(self
, value
):
79 for p
in self
._Switches
:
80 filtered
= [q
for q
in p
.ConnectDisconnectFunctions
if q
!= self
]
81 self
._Switches
._ConnectDisconnectFunctions
= filtered
83 if self
not in r
._ConnectDisconnectFunctions
:
84 r
._ConnectDisconnectFunctions
.append(self
)
85 self
._Switches
= value
87 Switches
= property(getSwitches
, setSwitches
)
89 def addSwitches(self
, *Switches
):
91 if self
not in obj
._ConnectDisconnectFunctions
:
92 obj
._ConnectDisconnectFunctions
.append(self
)
93 self
._Switches
.append(obj
)
95 def removeSwitches(self
, *Switches
):
97 if self
in obj
._ConnectDisconnectFunctions
:
98 obj
._ConnectDisconnectFunctions
.remove(self
)
99 self
._Switches
.remove(obj
)