hvl_ccb.dev.supercube.base

Inheritance diagram of hvl_ccb.dev.supercube.base

Base classes for the Supercube device.

class SupercubeBase(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

display_message_board() None[source]

Display 15 newest messages

display_status_board() None[source]

Display status board.

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.supercube.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_rod_status(earthing_rod: int) hvl_ccb.dev.supercube.constants.EarthingRodStatus[source]

Get the status of a earthing rod. See constants.EarthingRodStatus for possible returned earthing rod statuses.

Parameters

earthing_rod – the earthing rod number (1..3)

Returns

the earthing rod status

get_earthing_stick_manual(number: int) hvl_ccb.dev.supercube.constants.EarthingStickOperation[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

operation of the earthing stick in a manual operating mode (open == 0, close == 1)

Raises

ValueError – when earthing stick number is not valid

get_earthing_stick_operating_status(number: int) hvl_ccb.dev.supercube.constants.EarthingStickOperatingStatus[source]

Get the operating status of an earthing stick.

Parameters

number – number of the earthing stick (1..6)

Returns

earthing stick operating status (auto == 0, manual == 1)

Raises

ValueError – when earthing stick number is not valid

get_earthing_stick_status(number: int) hvl_ccb.dev.supercube.constants.EarthingStickStatus[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

Raises

ValueError – when earthing stick number is not valid

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.

Parameters

channel – number of the input channel (1..4)

Returns

the ratio

Raises

ValueError – when channel is not valid

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.

Parameters

channel – number of the input channel (1..4)

Returns

measured voltage

Raises

ValueError – when channel is not valid

get_status() hvl_ccb.dev.supercube.constants.SafetyStatus[source]

Get the safety circuit status of the Supercube. :return: the safety status of the supercube’s state machine.

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

Raises

ValueError – when port or contact number is not valid

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

Raises

ValueError – when port or contact number is not valid

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

Raises

ValueError – when port is not valid

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

operate_earthing_stick(number: int, operation: hvl_ccb.dev.supercube.constants.EarthingStickOperation) None[source]

Operation of an earthing stick, which is set to manual operation. If an earthing stick is set to manual, it stays closed even if the system is in states RedReady or RedOperate.

Parameters
  • number – number of the earthing stick (1..6)

  • operation – earthing stick manual status (close or open)

Raises

SupercubeEarthingStickOperationError – when operating status of given number’s earthing stick is not manual

quit_error() None[source]

Quits errors that are active on the Supercube.

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_message_board(msgs: List[str], display_board: bool = True) None[source]

Fills messages into message board that display that 15 newest messages with a timestamp.

Parameters
  • msgs – list of strings

  • display_board – display 15 newest messages if True (default)

Raises

ValueError – if there are too many messages or the positions indices are invalid.

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_status_board(msgs: List[str], pos: Optional[List[int]] = None, clear_board: bool = True, display_board: bool = True) None[source]

Sets and displays a status board. The messages and the position of the message can be defined.

Parameters
  • msgs – list of strings

  • pos – list of integers [0…14]

  • clear_board – clear unspecified lines if True (default), keep otherwise

  • display_board – display new status board if True (default)

Raises

ValueError – if there are too many messages or the positions indices are invalid.

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

Raises

ValueError – when port or contact number is not valid

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

Raises

ValueError – when port or contact number is not valid

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

Raises

ValueError – when port is not valid or state is not of type bool

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.

stop() None[source]

Stop the Supercube device. Deactivates the remote control and closes the communication protocol.

write(node_id, value) None[source]

Local wrapper for the OPC UA communication protocol write method.

Parameters
  • node_id – the id of the node to read

  • value – the value to write to the variable

class SupercubeConfiguration(namespace_index: int = 3, polling_delay_sec: Union[int, float] = 5.0, polling_interval_sec: Union[int, float] = 1.0)[source]

Bases: object

Configuration dataclass for the Supercube devices.

clean_values()[source]
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 = 3

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.

polling_delay_sec: Union[int, float] = 5.0
polling_interval_sec: Union[int, float] = 1.0
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.

exception SupercubeEarthingStickOperationError[source]

Bases: Exception

class SupercubeOpcUaCommunication(config)[source]

Bases: hvl_ccb.comm.opc.OpcUaCommunication

Communication protocol specification for Supercube devices.

static config_cls()[source]

Return the default configdataclass class.

Returns

a reference to the default configdataclass class

class SupercubeOpcUaCommunicationConfig(host: str, endpoint_name: str, port: int = 4840, sub_handler: hvl_ccb.comm.opc.OpcUaSubHandler = <hvl_ccb.dev.supercube.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.

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.supercube.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