hvl_ccb.dev.supercube2015.base¶
Base classes for the Supercube device.
-
exception
InvalidSupercubeStatusError
[source]¶ Bases:
Exception
Exception raised when supercube has invalid status.
-
class
Supercube2015Base
(com, dev_config=None)[source]¶ Bases:
hvl_ccb.dev.base.SingleCommDevice
Base class for Supercube variants.
-
static
config_cls
()[source]¶ Return the default configdataclass class.
- Returns
a reference to the default configdataclass class
-
static
default_com_cls
()[source]¶ Get the class for the default communication protocol used with this device.
- Returns
the type of the standard communication protocol for this device
-
get_cee16_socket
() → bool[source]¶ Read the on-state of the IEC CEE16 three-phase power socket.
- Returns
the on-state of the CEE16 power socket
-
get_door_status
(door: int) → hvl_ccb.dev.supercube2015.constants.DoorStatus[source]¶ Get the status of a safety fence door. See
constants.DoorStatus
for possible returned door statuses.- Parameters
door – the door number (1..3)
- Returns
the door status
-
get_earthing_manual
(number: int) → bool[source]¶ Get the manual status of an earthing stick. If an earthing stick is set to manual, it is closed even if the system is in states RedReady or RedOperate.
- Parameters
number – number of the earthing stick (1..6)
- Returns
earthing stick manual status
-
get_earthing_status
(number: int) → int[source]¶ Get the status of an earthing stick, whether it is closed, open or undefined (moving).
- Parameters
number – number of the earthing stick (1..6)
- Returns
earthing stick status; see constants.EarthingStickStatus
-
get_measurement_ratio
(channel: int) → float[source]¶ Get the set measurement ratio of an AC/DC analog input channel. Every input channel has a divider ratio assigned during setup of the Supercube system. This ratio can be read out.
Attention: Supercube 2015 does not have a separate ratio for every analog input. Therefore there is only one ratio for
channel = 1
.- Parameters
channel – number of the input channel (1..4)
- Returns
the ratio
-
get_measurement_voltage
(channel: int) → float[source]¶ Get the measured voltage of an analog input channel. The voltage read out here is already scaled by the configured divider ratio.
Attention: In contrast to the new Supercube, the old one returns here the input voltage read at the ADC. It is not scaled by a factor.
- Parameters
channel – number of the input channel (1..4)
- Returns
measured voltage
-
get_status
() → int[source]¶ Get the safety circuit status of the Supercube.
- Returns
the safety status of the supercube’s state machine; see constants.SafetyStatus.
-
get_support_input
(port: int, contact: int) → bool[source]¶ Get the state of a support socket input.
- Parameters
port – is the socket number (1..6)
contact – is the contact on the socket (1..2)
- Returns
digital input read state
-
get_support_output
(port: int, contact: int) → bool[source]¶ Get the state of a support socket output.
- Parameters
port – is the socket number (1..6)
contact – is the contact on the socket (1..2)
- Returns
digital output read state
-
get_t13_socket
(port: int) → bool[source]¶ Read the state of a SEV T13 power socket.
- Parameters
port – is the socket number, one of constants.T13_SOCKET_PORTS
- Returns
on-state of the power socket
-
horn
(state: bool) → None[source]¶ Turns acoustic horn on or off.
- Parameters
state – Turns horn on (True) or off (False)
-
operate
(state: bool) → None[source]¶ Set operate state. If the state is RedReady, this will turn on the high voltage and close the safety switches.
- Parameters
state – set operate state
-
read
(node_id: str)[source]¶ Local wrapper for the OPC UA communication protocol read method.
- Parameters
node_id – the id of the node to read.
- Returns
the value of the variable
-
ready
(state: bool) → None[source]¶ Set ready state. Ready means locket safety circuit, red lamps, but high voltage still off.
- Parameters
state – set ready state
-
set_cee16_socket
(state: bool) → None[source]¶ Switch the IEC CEE16 three-phase power socket on or off.
- Parameters
state – desired on-state of the power socket
- Raises
ValueError – if state is not of type bool
-
set_earthing_manual
(number: int, manual: bool) → None[source]¶ Set the manual status of an earthing stick. If an earthing stick is set to manual, it is closed even if the system is in states RedReady or RedOperate.
- Parameters
number – number of the earthing stick (1..6)
manual – earthing stick manual status (True or False)
-
set_remote_control
(state: bool) → None[source]¶ Enable or disable remote control for the Supercube. This will effectively display a message on the touchscreen HMI.
- Parameters
state – desired remote control state
-
set_support_output
(port: int, contact: int, state: bool) → None[source]¶ Set the state of a support output socket.
- Parameters
port – is the socket number (1..6)
contact – is the contact on the socket (1..2)
state – is the desired state of the support output
-
set_support_output_impulse
(port: int, contact: int, duration: float = 0.2, pos_pulse: bool = True) → None[source]¶ Issue an impulse of a certain duration on a support output contact. The polarity of the pulse (On-wait-Off or Off-wait-On) is specified by the pos_pulse argument.
This function is blocking.
- Parameters
port – is the socket number (1..6)
contact – is the contact on the socket (1..2)
duration – is the length of the impulse in seconds
pos_pulse – is True, if the pulse shall be HIGH, False if it shall be LOW
-
set_t13_socket
(port: int, state: bool) → None[source]¶ Set the state of a SEV T13 power socket.
- Parameters
port – is the socket number, one of constants.T13_SOCKET_PORTS
state – is the desired on-state of the socket
-
start
() → None[source]¶ Starts the device. Sets the root node for all OPC read and write commands to the Siemens PLC object node which holds all our relevant objects and variables.
-
static
-
class
SupercubeConfiguration
(namespace_index: int = 7)[source]¶ Bases:
object
Configuration dataclass for the Supercube devices.
-
clean_values
()¶ Cleans and enforces configuration values. Does nothing by default, but may be overridden to add custom configuration value checks.
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
- Parameters
fieldname – name of the field
value – value to assign
-
is_configdataclass
= True¶
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
- Returns
a list of strings containing all keys.
-
namespace_index
: int = 7¶ Namespace of the OPC variables, typically this is 3 (coming from Siemens)
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
- Returns
a list of strings containing all optional keys.
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
- Returns
a list of strings containing all required keys.
-
-
class
SupercubeOpcUaCommunication
(config)[source]¶ Bases:
hvl_ccb.comm.opc.OpcUaCommunication
Communication protocol specification for Supercube devices.
-
class
SupercubeOpcUaCommunicationConfig
(host: str, endpoint_name: str, port: int = 4845, sub_handler: hvl_ccb.comm.opc.OpcUaSubHandler = <hvl_ccb.dev.supercube2015.base.SupercubeSubscriptionHandler object>, update_period: int = 500, wait_timeout_retry_sec: Union[int, float] = 1, max_timeout_retry_nr: int = 5)[source]¶ Bases:
hvl_ccb.comm.opc.OpcUaCommunicationConfig
Communication protocol configuration for OPC UA, specifications for the Supercube devices.
-
force_value
(fieldname, value)¶ Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
- Parameters
fieldname – name of the field
value – value to assign
-
classmethod
keys
() → Sequence[str]¶ Returns a list of all configdataclass fields key-names.
- Returns
a list of strings containing all keys.
-
classmethod
optional_defaults
() → Dict[str, object]¶ Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
- Returns
a list of strings containing all optional keys.
-
port
: int = 4845¶ Port of the OPC UA server to connect to.
-
classmethod
required_keys
() → Sequence[str]¶ Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
- Returns
a list of strings containing all required keys.
-
sub_handler
: hvl_ccb.comm.opc.OpcUaSubHandler = <hvl_ccb.dev.supercube2015.base.SupercubeSubscriptionHandler object>¶ Subscription handler for data change events
-
-
class
SupercubeSubscriptionHandler
[source]¶ Bases:
hvl_ccb.comm.opc.OpcUaSubHandler
OPC Subscription handler for datachange events and normal events specifically implemented for the Supercube devices.
-
datachange_notification
(node: opcua.common.node.Node, val, data)[source]¶ In addition to the standard operation (debug logging entry of the datachange), alarms are logged at INFO level using the alarm text.
- Parameters
node – the node object that triggered the datachange event
val – the new value
data –
-