cpx_io.cpx_system.cpx_e package

Submodules

cpx_io.cpx_system.cpx_e.cpx_e module

CPX-E module implementations

class cpx_io.cpx_system.cpx_e.cpx_e.CpxE(modules: list | None = None, timeout: float | None = None, **kwargs)

Bases: CpxBase

CPX-E base class

Constructor of the CpxE class.

Parameters:

modules (list) – List of module instances e.g. [CpxEEp(), CpxE8Do(), CpxE16Di()]

property modules

getter function for private modules property

static unwrap_cpxe_typecode(typecode: str) str

Takes care of the cpx-e typecode merging more than two of the same module type into a number. For example MMM will be merged to 3M while MM stays.

set_timeout(timeout_ms: int) None

Sets the modbus timeout to the provided value

Parameters:

timeout_ms (int) – Modbus timeout in ms (milli-seconds)

write_function_number(function_number: int, value: int) None

Write parameters via function number

Parameters:
  • function_number (int) – Function number (see datasheet)

  • value (int) – Value to write to function number

read_function_number(function_number: int) int

Read parameters via function number

Parameters:

function_number (int) – Function number (see datasheet)

Returns:

Value read from function number

Return type:

int

module_count() int

reads the module configuration register from the system

Returns:

total module count

Return type:

int

read_fault_detection() list[bool]

reads the fault detection register from the system

Returns:

list of bools with Errors (True = Error)

Return type:

list[bool]

read_status() tuple

reads the status register.

Returns:

tuple (Write-protected, Force active)

Return type:

tuple

read_device_identification() int

reads device identification

Returns:

Objects IDO 1,2,3,4,5

Return type:

int

add_module(module)

Adds one module to the base. This is required to use the module.

Parameters:

module – the module that should be added to the system

cpx_io.cpx_system.cpx_e.cpx_e_enums module

CPX-AP Enums for configure functions

class cpx_io.cpx_system.cpx_e.cpx_e_enums.DebounceTime(value)

Bases: Enum

Enum for configure_debounce_time

T_100US = 0
T_3MS = 1
T_10MS = 2
T_20MS = 3
class cpx_io.cpx_system.cpx_e.cpx_e_enums.SignalExtension(value)

Bases: Enum

Enum for configure_signal_extension_time

T_500US = 0
T_15MS = 1
T_50MS = 2
T_100MS = 3
class cpx_io.cpx_system.cpx_e.cpx_e_enums.ChannelRange(value)

Bases: Enum

Enum for configure_channel_range * U means unipolar e.g. 0..10 V, 1..5 V * B means bipolar e.g. +/- 10 V Not all modules accept all values

NONE = 0
U_10V = 1
B_10V = 2
B_5V = 3
U_1_5V = 4
U_20MA = 5
U_4_20MA = 6
B_20MA = 7
U_10V_NO_UNDERDRIVE = 8
U_20MA_NO_UNDERDRIVE = 9
U_4_20MA_NO_UNDERDRIVE = 10
class cpx_io.cpx_system.cpx_e.cpx_e_enums.DigInDebounceTime(value)

Bases: Enum

Enum for configure_debounce_time_for_digital_inputs

T_20US = 0
T_100US = 1
T_3MS = 2
class cpx_io.cpx_system.cpx_e.cpx_e_enums.IntegrationTime(value)

Bases: Enum

Enum for configure_integration_time_for_speed_measurement

T_1MS = 0
T_10MS = 1
T_100MS = 2
class cpx_io.cpx_system.cpx_e.cpx_e_enums.SignalType(value)

Bases: Enum

Enum for configure_signal_type

ENCODER_5V_DIFFERENTIAL = 0
ENCODER_5V_SINGLE_ENDED = 1
ENCODER_24V_SINGLE_ENDED = 2
class cpx_io.cpx_system.cpx_e.cpx_e_enums.SignalEvaluation(value)

Bases: Enum

Enum for configure_signal_evaluation

INCREMENTAL_SINGLE_EVALUATION = 0
INCREMENTAL_DOUBLE_EVALUATION = 1
INCREMENTAL_QUADRUPLE_EVALUATION = 2
PULSE_GENERATOR = 3
class cpx_io.cpx_system.cpx_e.cpx_e_enums.LatchingEvent(value)

Bases: Enum

Enum for configure_latching_event

RISING_EDGE = 1
FALLING_EDGE = 2
BOTH_EDGES = 3
class cpx_io.cpx_system.cpx_e.cpx_e_enums.AddressSpace(value)

Bases: Enum

Enum for CpxE4Iol init

PORT_2E2A = 2
PORT_4E4A = 4
PORT_8E8A = 8
PORT_16E16A = 16
PORT_32E32A = 32
class cpx_io.cpx_system.cpx_e.cpx_e_enums.OperatingMode(value)

Bases: Enum

Enum for configure_operating_mode

INACTIVE = 0
DI = 1

cpx_io.cpx_system.cpx_e.cpx_e_modbus_registers module

Modbus register definitions for CPX-E

class cpx_io.cpx_system.cpx_e.cpx_e_modbus_registers.ModbusRegister(register_address, length)

Bases: tuple

Create new instance of ModbusRegister(register_address, length)

length

Alias for field number 1

register_address

Alias for field number 0

cpx_io.cpx_system.cpx_e.cpx_e_module_definitions module

Constant definitions for CPX-E

cpx_io.cpx_system.cpx_e.cpx_e_supported_datatypes module

All implemented datatypes

cpx_io.cpx_system.cpx_e.e16di module

CPX-E-16DI module implementation

class cpx_io.cpx_system.cpx_e.e16di.CpxE16Di(name=None)

Bases: CpxModule

Class for CPX-E-16DI module

read_channels() list[bool]

read all channels as a list of bool values

Returns:

Values of all channels

Return type:

list[bool]

read_channel(channel: int) bool

read back the value of one channel

Parameters:

channel (int) – Channel number, starting with 0

Returns:

Value of the channel

Return type:

bool

read_status() list[bool]

read module status register. Further information see module datasheet

Returns:

status information (see datasheet)

Return type:

list[bool]

configure_diagnostics(value: bool) None

The “Diagnostics of sensor supply short circuit” defines whether the diagnostics of the sensor supply in regard to short circuit or overload should be activated (“True”, default) or deactivated (False). When the diagnostics are activated, the error will be sent to the bus module and displayed on the module by the error LED.

Parameters:

value (int) – diagnostics of sensor supply short circuit

configure_power_reset(value: bool) None

“Behaviour after SCO” parameter defines whether the voltage remains switched off (“False”) or automatically switches on again (“True”, default) after a short circuit or overload of the sensor supply. In the case of the “Leave power switched off” setting, the CPX-E automation system must be switched off and on to restore the power.

Parameters:

value (int) – behaviour after sco

configure_debounce_time(value: DebounceTime | int) None

The “Input debounce time” parameter defines when an edge change of the sensor signal shall be assumed as a logical input signal. In this way, unwanted signal edge changes can be suppressed during switching operations (bouncing of the input signal).

  • 0: 0.1 ms

  • 1: 3 ms (default)

  • 2: 10 ms

  • 3: 20 ms

Parameters:

value – Debounce time for all channels. Use DebounceTime from cpx_e_enums or

see datasheet. :type value: DebounceTime | int

configure_signal_extension_time(value: SignalExtension | int) None

The “Signal extension time” parameter defines the minimum valid duration of the assumed signal status of the input signal. Edge changes within the signal extension time are ignored. Short input signals can also be recorded by defining a signal extension time.

  • 0: 0.5 ms

  • 1: 15 ms (default)

  • 2: 50 ms

  • 3: 100 ms

Parameters:

value (SignalExtension | int) – Signal extension time

cpx_io.cpx_system.cpx_e.e1ci module

CPX-E-1CI module implementation

class cpx_io.cpx_system.cpx_e.e1ci.CpxE1Ci(name=None)

Bases: CpxModule

Class for CPX-E-1CI counter module

class StatusWord(di0: bool, di1: bool, di2: bool, di3: bool, _: None, latchin_missed: bool, latching_set: bool, latching_blocked: bool, lower_cl_exceeded: bool, upper_cl_exceeded: bool, counting_direction: bool, counter_blocked: bool, counter_set: bool, enable_di2: bool, enable_zero: bool, speed_measurement: bool)

Bases: BitwiseReg16

Statusword dataclass

di0: bool
di1: bool
di2: bool
di3: bool
latchin_missed: bool
latching_set: bool
latching_blocked: bool
lower_cl_exceeded: bool
upper_cl_exceeded: bool
counting_direction: bool
counter_blocked: bool
counter_set: bool
enable_di2: bool
enable_zero: bool
speed_measurement: bool
class ProcessData(enable_setting_di2: bool, enable_setting_zero: bool, set_counter: bool, block_counter: bool, overrun_cl_confirm: bool, speed_measurement: bool, confirm_latching: bool, block_latching: bool)

Bases: BitwiseReg8

Processdata dataclass

enable_setting_di2: bool
enable_setting_zero: bool
set_counter: bool
block_counter: bool
overrun_cl_confirm: bool
speed_measurement: bool
confirm_latching: bool
block_latching: bool
read_value() int

Read the counter value or speed (if process data “speed_measurement” is set)

Returns:

counter value or speed

Return type:

int

read_latching_value() int

Read the latching value

Returns:

latching value

Return type:

int

read_status_word() StatusWord

Read the status word

Returns:

status word

Return type:

StatusWord

read_process_data() ProcessData

Read back the process data

Returns:

process data

Return type:

ProcessData

write_process_data(**kwargs) None

Write the process data.

Available keywordarguments are:
  • enable_setting_di2: enable setting counter value via input I2 (1=enabled)

  • enable_setting_zero: enable setting counter value via zero pulse (1=enabled)

  • set_counter: setting the counter to the load value (1=set)

  • block_counter: switch counter to inactive (1=block)

  • overrun_cl_confirm: confirm overrun of upper/lower count limit (1=acknowledge overrun)

  • speed_measurement: speed measurement instead of counter values (1=active)

  • confirm_latching: confirm latching event (1=acknowledge latching event)

  • block_latching: switch latching to inactive (1=block)

read_status() list[bool]

Read module status register. Further information see module datasheet

Returns:

status information (see datasheet)

Return type:

list[bool]

configure_signal_type(value: SignalType | int) None

The parameter “Signal type/encoder type” defines the encoder supply and connection type of the encoder.

  • 0: Encoder 5 Vdc differential (default)

  • 1: Encoder 5 Vdc single ended

  • 2: Encoder 24 Vdc single ended

Parameters:

value (SignalType | int) – Signal type. Use SignalType from cpx_e_enums or see datasheet.

configure_signal_evaluation(value: SignalEvaluation | int) None

The “Signal evaluation” parameter defines the encoder type and evaluation

  • 0: Incremental encoder with single evaluation

  • 1: Incremental encoder with double evaluation

  • 2: Incremental encoder with quadruple evaluation (default)

  • 3: Pulse generator with or without direction signal

Parameters:

value (SignalEvaluation | int) – Signal evaluation. Use SignalEvaluation from cpx_e_enums or see datasheet.

configure_monitoring_of_cable_brake(value: bool) None

The “Monitoring of cable break” parameter defines whether a diagnostic message should be output when a cable break of the encoder cable is detected.

  • False: No diagnostic message (default)

  • True: Diagnostic message active

The “Monitoring of cable break” parameter is only relevant for encoder 5 V DC (differential) with tracks A and B offset in phase.

Parameters:

value (bool) – True if diagnostic message should be active

configure_monitoring_of_tracking_error(value: bool) None

The “Monitoring of tracking error” parameter defines whether a diagnostic message should be output when a tracking error is detected.

  • False: No diagnostic message (default)

  • True: Diagnostic message active

The “Monitoring of tracking error” parameter is only relevant for encoders with tracks A and B offset in phase.

Parameters:

value (bool) – True if diagnostic message should be active

configure_monitoring_of_zero_pulse(value: bool) None

The “Monitoring of zero pulse” parameter defines whether a diagnostic message should be output when a zero pulse error is detected.

  • False: No diagnostic message (default)

  • True: Diagnostic message active

The “Monitoring of zero pulse” parameter is only relevant for encoders with zero track (track 0). With this diagnostic function enabled, the number of pulses per zero pulse must be set correctly using the “Pulses per zero pulse” parameter.

Parameters:

value (bool) – True if diagnostic message should be active

configure_pulses_per_zero_pulse(value: int) None

The “Pulses per zero pulse” parameter defines the number of pulses on track A or track B between 2 pulses of track 0. Value must be between 0 and 65535 The “Pulses per zero pulse” parameter is only relevant for encoders with zero track (track 0) and is required for zero pulse monitoring via the “Monitoring of zero pulse” parameter

Parameters:

value (int) – number of pulses on tracks between 2 pulses of track 0

configure_latching_signal(value: bool) None

The “Latching signal” parameter defines whether the digital input I0 or the zero pulse (track 0) is used as signal source to trigger the “Latching” function.

  • False: Evaluate input I0 (default)

  • True: Evaluate zero pulse

Parameters:

value (bool) – Sets the input for the latching signal

configure_latching_event(value: LatchingEvent | int) None

The “Latching event” parameter defines whether the “Latching” function is triggered on a rising and/or falling edge.

  • 1: Latching on rising edge (default)

  • 2: Latching on falling edge

  • 3: Latching on rising and falling edge

Parameters:

value (LatchingEvent | int) – Latching event parameter. Use LatchingEvent from cpx_e_enums or see datasheet

configure_latching_response(value: bool) None

The “Latching response” parameter defines whether, if there is a latching event, the current counter value is continuous (False, default) or is set to the load value (True).

Parameters:

value (bool) – Latching response parameter

configure_upper_counter_limit(value: int) None

The “Upper count limit” parameter defines the upper count limit in the value range 0 … 4,294,967,295 (2^32 - 1). If the value set for the upper count limit is lower than the current counter value, the counter value is reduced to the set count limit. The value for the upper count limit must be larger than the value for the lower count limit. Invalid values will result in an error (error number 2)

Parameters:

value (int) – Upper count limit

configure_lower_counter_limit(value: int) None

The “Lower count limit” parameter defines the lower count limit in the value range 0 … 4,294,967,295 (2^32 - 1). If the value set for the lower count limit is higher than the current counter value, the counter value is increased to the set count limit. The value for the lower count limit must be smaller than the value for the upper count limit. Invalid values will result in an error (error number 29).

Parameters:

value (int) – Lower count limit

configure_load_value(value: int) None

The “Load value” parameter defines the value in the value range 0 … 4,294,967,295 (2^32 - 1) that is adopted as the counter value when the “Set counter” function is enabled or during latching with the parameter setting “Latching response = load value”

Parameters:

value (int) – Load value

configure_debounce_time_for_digital_inputs(value: DigInDebounceTime | int) None

The parameter “Debounce time for digital inputs” defines the total debounce time for all digital inputs I0 … I3

  • 0: 20 us (default)

  • 1: 100 us

  • 2: 3 ms

Parameters:

value (DigInDebounceTime | int) – debounce time option. Use DigInDebounceTime from cpx_e_enums or see datasheet

configure_integration_time_for_speed_measurement(value: IntegrationTime | int) None

The parameter “Integration time for speed measurement” defines the length of the measurement cycles for determining the measured value in the “Speed measurement” function

  • 0: 1 ms

  • 1: 10 ms (default)

  • 2: 100 ms

Parameters:

value (IntegrationTime | int) – integration time. Use IntegrationTime from cpx_e_enums or see datasheet

cpx_io.cpx_system.cpx_e.e4aiui module

CPX-E-4AI-UI module implementation

class cpx_io.cpx_system.cpx_e.e4aiui.CpxE4AiUI(name=None)

Bases: CpxModule

Class for CPX-E-4AI-UI module

read_channels() list[int]

read all channels as a list of (signed) integers

Returns:

Values of all channels

Return type:

list[int]

read_status() list[bool]

read module status register. Further information see module datasheet

Returns:

status information (see datasheet)

Return type:

list[bool]

read_channel(channel: int) int

read back the value of one channel

Parameters:

channel (int) – Channel number, starting with 0

configure_diagnostics(short_circuit: bool = None, param_error: bool = None) None

The “Diagnostics of sensor supply short circuit” defines whether the diagnostics of the sensor supply in regard to short circuit or overload should be activated (“True”, default) or deactivated (“False”). The parameter “Diagnostics of parameterisation error” defines if the diagnostics for the subsequently listed parameters must be activated (“True”, default) or deactivated (“False) with regard to unapproved settings:

  • Hysteresis < 0

  • Signal range (sensor type)

  • Lower limit > upper limit

When the diagnostics are activated,the error will be sent to the bus module and displayed on the module by the error LED.

Parameters:
  • short_circuit (bool) – Short circuit diagnostics

  • param_error (bool) – Parameter error diagnostics

configure_power_reset(value: bool) None

The “Behaviour after SCO” parameter defines whetherthe voltage remains switched off (“False”) or automatically switches on (“True, default”) again after a short circuit or overload of the sensor supply. In the case of the “Leave power switched off” setting, the CPX-E automation system must be switched off and on to restore the power.

Parameters:

value (bool) – behaviour after power reset

configure_data_format(value: bool) None

The parameter “Data format” defines the “Sign + 15 bit” or “linear scaling”.

  • False (default): Sign + 15 bit

  • True: Linear scaled

Parameters:

value (bool) – data format

configure_sensor_supply(value: bool) None

The parameter “Sensor supply” defines if the sensor supply must be switched off (“False”) or switched on (“True”, default). The sensor supply can also be switched off and switched on during operation.

Parameters:

value (bool) – sensor supply

configure_diagnostics_overload(value: bool) None

The parameter “Diagnostics of overload at analogue inputs” defines if the diagnostics for the current inputs must be activated (“True”, default) or deactivated (“False”) with regard to overload. When the diagnostics are activated, the error at an input current of >30 mA will be sent to the bus module and displayed with the error LED on the module.

Parameters:

value (bool) – diagnostics of overload at analogue inputs

configure_behaviour_overload(value: bool) None

The parameter “Behaviour after overload at analogue inputs” defines if the power remains switched off (“False”) after an overload at the inputs or if it should be switched on again (“True”, default) automatically. In the case of the “Leave power switched off” setting, the automation system CPX-E must be switched off and on to restore the power.

Parameters:

value (bool) – behaviour after overload at analogue inputs

configure_hysteresis_limit_monitoring(lower: int = None, upper: int = None) None

The parameter “Hysteresis of limit monitoring” defines the hysteresis value of the limit monitoring for all channels. The set hysteresis value must not be larger than the difference between the upper and lower limit values. The defined value is not checked for validity and incorrect parameterisations will be applied.

Parameters:
  • lower (int) – hysteresis of lower limit monitoring

  • upper (int) – hysteresis of upper limit monitoring

configure_channel_diagnostics_limits(channel: int, lower: bool = None, upper: bool = None) None

The parameter “ Diagnostics of lower/upper limit” defines if the diagnostics for the input signals must be activated or deactivated with regard to compliance with the defined lower limits. When the diagnostics are activated, the error will be sent to the bus module and displayed on the module by the error LED.

Parameters:
  • channel (int) – Channel number, starting with 0

  • lower (bool) – channel diagnostics of lower limit monitoring

  • upper (bool) – channel diagnostics of upper limit monitoring

configure_channel_diagnostics_wire_break(channel: int, value: bool) None

The parameter “Wire break diagnostics” defines whether the diagnostics for the input signals must be activated or deactivated with regard to a shortfall of the input current. When the diagnostics are activated, the error at an input current of <1.2 mA will be sent to the bus module and displayed with the error LED on the module. The parameter is only effective with a defined signal range of 4 … 20 mA

Parameters:
  • channel (int) – Channel number, starting with 0

  • value (bool) – wire brake diagnostics

configure_channel_diagnostics_underflow_overflow(channel: int, value: bool) None

The parameter “ Underflow/overflow diagnostics” defines whether the diagnostics of the input signals should be activated or deactivated with regard to compliance with the defined signal ranges. When the diagnostics are activated, the error will be sent to the bus module and displayed on the module by the error LED.

Parameters:
  • channel (int) – Channel number, starting with 0

  • value (bool) – underflow/overflow diagnostics

configure_channel_diagnostics_parameter_error(channel: int, value: bool) None

The parameter “Parameter error diagnostics” defines if the diagnostics for the subsequently listed parameters must be activated or deactivated with regard to unapproved settings:

  • Signal range

  • Lower limit

  • Upper limit

When the diagnostics are activated, the error will be sent to the bus module and displayed on the module by the error LED

Parameters:
  • channel (int) – Channel number, starting with 0

  • value (bool) – parameter error diagnostics

configure_channel_range(channel: int, value: ChannelRange | int) None

The parameter “Signal range” defines the signal range of the channels 0 … 3 independently of each other

  • 0: None

  • 1: 0…10 V

  • 2: -10…+10 V

  • 3: -5…+5 V

  • 4: 1…5 V

  • 5: 0…20 mA

  • 6: 4…20 mA

  • 7: -20…+20 mA

  • 8: 0…20 mA oU

  • 9: 4…20 mA oU

Parameters:
  • channel (int) – Channel number, starting with 0

  • value (ChannelRange | int) – Channel range. Use ChannelRange from cpx_e_enums or see datasheet

configure_channel_smoothing(channel: int, value: int) None

The parameter “Smoothing factor” defines the measured value smoothing for the channels 0 … 3 independent from each other. The measured value smoothing can be used to suppress interference.

Parameters:
  • channel (int) – Channel number, starting with 0

  • value (int) – Channel smoothing

configure_channel_limits(channel: int, upper: int = None, lower: int = None) None

The parameters “Lower limit” and “Upper limit” define the lower or upper limit of the channels 0 … 3 independent from each other. When the input value falls short of or exceeds the parameterised limits, an error will be displayed provided that the relevant parameter Diagnostics of lower/upper limit is activated The limit values are checked for validity during parameterisation. Invalid parameterisations are not accepted and the module uses the last valid parameterisations. The upper limit value must always be greater than the lower limit value. The permitted limits depend on the parameterised data format. With the data format “linear scaled”, the limits function as scaling end values

Parameters:
  • channel (int) – Channel number, starting with 0

  • upper (int) – Upper limit

  • lower (int) – Lower limit

cpx_io.cpx_system.cpx_e.e4aoui module

CPX-E-4AO-UI module implementation

class cpx_io.cpx_system.cpx_e.e4aoui.CpxE4AoUI(name=None)

Bases: CpxModule

Class for CPX-E-4AO-UI module

read_channels() list[int]

read all channels as a list of (signed) integers

Returns:

Values of all channels

Return type:

list[int]

read_status() list[bool]

read module status register. Further information see module datasheet

Returns:

status information (see datasheet)

Return type:

list[bool]

read_channel(channel: int) bool

read back the value of one channel

Parameters:

channel (int) – Channel number, starting with 0

write_channels(values: list[int]) None

write (signed 16bit int) data list to module channels in ascending order

Parameters:

values (list[int]) – values to write to the channels

write_channel(channel: int, value: int) None

write (signed 16 bit) value to module channel number

Parameters:
  • channel (int) – Channel number, starting with 0

  • value (int) – Value to write to the channel

configure_diagnostics(short_circuit: bool = None, undervoltage: bool = None, param_error: bool = None) None

The parameter “Diagnostics of short circuit in actuator supply” defines if the diagnostics for the actuator supply with regard to short circuit or overload must be activated (“True”, default) or deactivated (“False”). When the diagnostics are activated, the error will be sent to the bus module and displayed on the module by the error LED.

Parameters:
  • short_circuit (bool) – diagnostics of short circuit

  • undervoltage (bool) – diagnostics of undervoltage

  • param_error (bool) – diagnostics of parameter error

configure_power_reset(value: bool) None

The parameter “Behaviour after SCS actuator supply” defines if the power remains switched off (“False) after a short circuit or overload of the actuator supply or if it should be switched on again automatically (“True”, default). In the case of the “Leave power switched off” setting, the automation system CPX-E must be switched off and on to restore the power.

Parameters:

value (bool) – behaviour after short circuit or overload at actuator supply

configure_behaviour_overload(value: bool) None

The parameter “Behaviour after SCS analogue output” defines if the power remains switched off (“False”) after a short circuit or overload at the outputs or if it should be switched on again automatically (“True”, default). In the case of the “Leave power switched off” setting, the automation system CPX-E must be switched off and on to restore the power.

Parameters:

value (bool) – behaviour after short circuit at analogue output

configure_data_format(value: bool) None
The parameter “Data format” defines the data format “Sign + 15 bit” or “linear scaled”.
  • False (default): Sign + 15 bit

  • True: Linear scaled

Parameters:

value (bool) – data format

configure_actuator_supply(value: bool) None

The parameter “Actuator supply” defines if the diagnostics for the actuator supply must be activated (“True”, default) or deactivated (“False”).

Parameters:

value (bool) – actuator supply

configure_channel_diagnostics_wire_break(channel: int, value: bool) None

The parameter “Enable wire break / idling diagnostics” defines whether the diagnostics of the outputs with regard to wire break/idling should be activated or deactivated. When the diagnostics are activated, the error will be sent to the bus module and displayed on the module by the error LED

Parameters:
  • channel (int) – Channel number, starting with 0

  • value (bool) – wirebrake diagnostics

configure_channel_diagnostics_overload_short_circuit(channel: int, value: bool) None

The parameter “Enable overload/short circuit diagnostics” defines if the diagnostics for the outputs with regard to overload/short circuit must be activated or deactivated. When the diagnostics are activated, the error will be sent to the bus module and displayed on the module by the error LED.

Parameters:
  • channel (int) – Channel number, starting with 0

  • value (bool) – overload/short circuit diagnostics

configure_channel_diagnostics_parameter_error(channel: int, value: bool) None

The parameter “Enable parameter error diagnostics” defines if the diagnostics for the outputs with regard to parameter errors must be activated or deactivated. When the diagnostics are activated, the error will be sent to the bus node and displayed with the error LED on the module

Parameters:
  • channel (int) – Channel number, starting with 0

  • value (bool) – parameter error diagnostics

configure_channel_range(channel: int, value: ChannelRange | int) None

Set the signal range and type of one channel

  • 1: 0…10 V

  • 2: -10…+10 V

  • 3: -5…+5 V

  • 4: 1…5 V

  • 5: 0…20 mA

  • 6: 4…20 mA

  • 7: -20…+20 mA

Parameters:
  • channel (int) – Channel number, starting with 0

  • signalrange (ChannelRange | int) – Channel range. Use ChannelRange from cpx_e_enums or see datasheet

cpx_io.cpx_system.cpx_e.e4iol module

CPX-E-4IOL module implementation

class cpx_io.cpx_system.cpx_e.e4iol.CpxE4Iol(address_space: int | AddressSpace = 2, **kwargs)

Bases: CpxModule

Class for CPX-E-4IOL io-link master module

The address space (inputs/outputs) provided by the module is set using DIL switches (see Datasheet CPX-E-4IOL-…)

  • 2: Per port: 2 E / 2 A Module: 8 E / 8 A (default)

  • 4: Per port: 4 E / 4 A Module: 16 E / 16 A

  • 8: Per port: 8 E / 8 A Module: 32 E / 32 A

  • 16: Per port: 16 E / 16 A Module: 32 E /32 A

  • 32: Per port: 32 E / 32 A Module: 32 E / 32 A

Parameters:

address_space (int | AddressSpace) – Use AddressSpace from cpx_e_enums or see datasheet

read_status() list[bool]

read module status register. Further information see module datasheet

Returns:

status information (see datasheet)

Return type:

list[bool]

read_channels(bytelength: int = None) list[bytes]

read all channels as a list of bytes values

Parameters:

bytelength (int) – Length of the expected data in bytes. (optional)

Returns:

All registers from all channels

Return type:

list[bytes (byteorder big endian)]

read_channel(channel: int, bytelength: int = None) bytes

read back the value of one channel

Parameters:
  • channel (int) – Channel number, starting with 0

  • bytelength (int) – Length of the expected data in bytes. (optional)

Returns:

Channel value

Return type:

bytes (byteorder big endian)

write_channel(channel: int, data: bytes) None

set one channel to a value

Parameters:
  • channel (int) – Channel number, starting with 0

  • data (bytes (byteorder big endian)) – Value to write

write_channels(data: list[bytes]) None

set all channels to values from a list of 4 elements

Parameters:

data (list[bytes (byteorder big endian)]) – Values to write

configure_monitoring_uload(value: bool) None

The “Monitoring Uload” parameter defines whether the monitoring of the load voltage supply shall be activated or deactivated in regard to undervoltage. When the monitoring is activated, the error is sent to the bus module and indicated by the error LED on the module

Parameters:

value (int) – monitoring uload value (see datasheet)

configure_behaviour_after_scl(value: bool) None

The “Behaviour after SCS” parameter defines whether the voltage remains deactivated or reactivates automatically after a short circuit or overload at the IO-Link® interfaces (ports). The voltage can be switched on again with the “leave switched off” setting by deactivating and then reactivating the “PS supply” parameter. Otherwise the activation and deactivation of the automation system CPX-E is required to restore the voltage.

Parameters:

value (int) – behaviour after scs (see datasheet)

configure_behaviour_after_sco(value: bool) None

The “Behaviour after SCO” parameter defines whether the voltage remains deactivated or reactivates automatically after a short circuit or overload at the IO-Link® interfaces (ports). The voltage can be switched on again with the “leave switched off” setting by deactivating and then reactivating the “PS supply” parameter. Otherwise the activation and deactivation of the automation system CPX-E is required to restore the voltage.

Parameters:

value (int) – behaviour after sco (see datasheet)

configure_ps_supply(value: bool) None

The “PS supply” parameter defines whether the operating voltage supply shall be deactivated or activated. The setting applies for all IO-Link interfaces (ports).

Parameters:

value (int) – ps supply

configure_cycle_time(value: tuple[int], channel: int | list = None) None

The “Cycle time” parameter defines the cycle time (low/high) set by the IO-Link master. The setting can be made separately for each IO-Link interface (port). The value becomes effective at the start of the IO-Link connection by setting the “Operating mode” parameter to “IO-Link”. Changes during IO-Link operation are not made until the connection has been deactivated and then reactivated again. Values are tuple of (low, high) 16 bit in us unit. Default is 0 (minimum supported cycle time). If no channels are specified, all channels are set to the given value.

Parameters:
  • value (tuple[int]) – cycle time (see datasheet) as tuple (low, high)

  • channel (int | list[int]) – Channel number, starting with 0 or list of channels e.g. [0, 2], optional

configure_pl_supply(value: bool, channel: int | list = None) None

The “PL supply” parameter defines whether the load voltage supply shall be deactivated or activated. The setting can be made separately for each IO-Link interface (port). If no channel is specified, the value will be applied to all channels.

Parameters:
  • value (bool) – pl supply

  • channel (int | list[int]) – Channel number, starting with 0 or list of channels e.g. [0, 2], optional

configure_operating_mode(value: OperatingMode | int, channel: int | list = None) None

The “Operating mode” parameter defines the operating mode of the IO-Link® interface (port). The setting can be made separately for each IO-Link interface (port).

  • 0: Inactive: Port is not in use (default)

  • 1: DI: Port acts like a digital input

  • 2: [DO]: reserved

  • 3: IO-Link: IO-Link communication

Parameters:
  • value (OperatingMode | int) – operating mode. Use OperatingMode from cpx_e_enums or see datasheet.

  • channel (int | list[int]) – Channel number, starting with 0 or list of channels e.g. [0, 2], optional

read_line_state(channel: int | list = None) list[str] | str

Line state for all channels. If no channel is provided, list of all channels is returned.

Parameters:

channel (int | list[int]) – Channel number, starting with 0 or list of channels e.g. [0, 2], optional

Returns:

Line state for all or all requested channels

Return type:

list[str] | str

read_device_error(channel: int | list = None) tuple[int] | int

the “Device error code” parameter displays the current lowest-value error code (event code) of the connected IO-Link device. If no event is reported, the parameter has a value of 0. Returns list of tuples of (Low, High) values in hexadecimal strings for each requested channel. If only one channel is requested, only one tuple is returned.

Parameters:

channel (int | list[int]) – Channel number, starting with 0 or list of channels e.g. [0, 2], optional

Returns:

device error for all or all requested channels

Return type:

tuple[int] | int

read_isdu(channel: int, index: int, subindex: int = 0, *, data_type: str = 'raw') any

Read isdu (device parameter) from defined channel. Raises CpxRequestError when read failed.

Parameters:
  • channel (int) – Channel number, starting with 0

  • index (int) – io-link parameter index

  • subindex (int) – (optional) io-link parameter subindex

  • data_type (str) – (optional) datatype for correct interptetation. Check cpx_e_supported_datatypes.SUPPORTED_ISDU_DATATYPES for a list of supported datatypes

:return : Value depending on the datatype :rtype : any

write_isdu(data: bytes | str | int | bool | float, channel: int, index: int, subindex: int = 0, *, data_type: str = 'raw') None

Write isdu (device parameter) to defined channel. Raises CpxRequestError when write failed.

Parameters:
  • data (bytes|str|int|bool) – Data to write.

  • channel (int) – Channel number, starting with 0

  • index (int) – io-link parameter index

  • subindex (int) – (optional) io-link parameter subindex

  • data_type (str) – (optional) datatype for correct interptetation. Check cpx_e_supported_datatypes.SUPPORTED_ISDU_DATATYPES for a list of supported datatypes.

cpx_io.cpx_system.cpx_e.e8do module

CPX-E-8DO module implementation

class cpx_io.cpx_system.cpx_e.e8do.CpxE8Do(name=None)

Bases: CpxModule

Class for CPX-E-8DO module

read_channels() list[bool]

read all channels as a list of bool values

Returns:

Values of all channels

Return type:

list[bool]

read_channel(channel: int) bool

read back the value of one channel

Parameters:

channel (int) – Channel number, starting with 0

Returns:

Value of the channel

Return type:

bool

write_channels(data: list[bool]) None

write all channels with a list of bool values

Parameters:

data (list[bool]) – list of bool values containing exactly 4 elements for each output channel

write_channel(channel: int, value: bool) None

set one channel to logic value

Parameters:

channel (int) – Channel number, starting with 0

Value:

Value that should be written to the channel

read_status() list[bool]

read module status register. Further information see module datasheet

Returns:

status information (see datasheet)

Return type:

list[bool]

set_channel(channel: int) None

set one channel to logic high level

Parameters:

channel (int) – Channel number, starting with 0

reset_channel(channel: int) None

set one channel to logic low level

Parameters:

channel (int) – Channel number, starting with 0

toggle_channel(channel: int) None

set one channel the inverted of current logic level

Parameters:

channel (int) – Channel number, starting with 0

configure_diagnostics(short_circuit: bool = None, undervoltage: bool = None) None

The “Diagnostics of short circuit at output” parameter defines whether the diagnostics of the outputs in regard to short circuit or overload should be activated or deactivated. The “Diagnostics of undervoltage at load supply” parameter defines if the diagnostics for the load supply must be activated or deactivated with regard to undervoltage. When the diagnostics are activated, the error will be sent to the bus module and displayed on the module by the error LED.

Parameters:
  • short_circuit (bool) – diagnostics of short circuit

  • undervoltage (bool) – diagnostics of undervoltage

configure_power_reset(value: bool)

The “Behaviour after SCO” parameter defines whether the voltage remains switched off (“False”, default) or automatically switches on (“True”) again after a short circuit or overload at the outputs. In the case of the “Leave power switched off” setting, the CPX-E automation system must be switched off and on or the corresponding output must be reset and to restore the power.

Parameters:

value (bool) – behaviour after power reset

cpx_io.cpx_system.cpx_e.eep module

CPX-E-EP module implementation

class cpx_io.cpx_system.cpx_e.eep.CpxEEp(name=None)

Bases: CpxModule

Class for CPX-E-EP module

Module contents