Device Classes

Classes for managing Revolution Pi devices.

Device

class revpimodio2.device.Device(parentmodio, dict_device, simulator=False)[source]

Bases: object

Base class for all device objects.

The base functionality generates all IOs upon instantiation and extends the process image buffer by the required bytes. It manages its process image buffer and ensures the updating of IO values.

Base class for all Revolution Pi devices.

__init__(parentmodio, dict_device, simulator=False)[source]

Instantiation of the Device class.

Parameters:
  • parentmodio – RevpiModIO parent object

  • dict_device – <class ‘dict’> for this device from piCtory

  • simulator – Loads the module as simulator and swaps IOs

bmk

Component designator from piCtory configuration.

catalognr

Catalog number of the device (deprecated).

comment

Comment text from piCtory configuration.

extend

Extended configuration data from piCtory.

guid

Global unique identifier of the device.

id

Device identifier from piCtory configuration.

inpvariant

Input variant number.

outvariant

Output variant number.

type

Device position type string.

__bytes__()[source]

Returns all device data as <class ‘bytes’>.

Returns:

Device data as <class ‘bytes’>

__contains__(key)[source]

Checks if IO is on this device.

Parameters:

key – IO-Name <class ‘str’> / IO-Bytenummer <class ‘int’>

Returns:

True if IO is present on device

__getitem__(key)[source]

Returns IO at specified position.

Parameters:

key – Index of the IO on the device as <class ‘int’>

Returns:

Found IO object

__int__()[source]

Returns the position on the RevPi bus.

Returns:

Position number

__iter__()[source]

Returns iterator of all IOs.

Returns:

<class ‘iter’> of all IOs

__len__()[source]

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

__str__()[source]

Returns the name of the device.

Returns:

Device name

autorefresh(activate=True) None[source]

Registers this device for automatic synchronization.

Parameters:

activate – Default True adds device to synchronization

get_allios(export=None) list[source]

Returns a list of all inputs and outputs, no MEMs.

If parameter ‘export’ remains None, all inputs and outputs will be returned. If ‘export’ is set to True/False, only inputs and outputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only in-/outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Input and Output, no MEMs

get_inputs(export=None) list[source]

Returns a list of all inputs.

If parameter ‘export’ remains None, all inputs will be returned. If ‘export’ is set to True/False, only inputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only inputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Inputs

get_outputs(export=None) list[source]

Returns a list of all outputs.

If parameter ‘export’ remains None, all outputs will be returned. If ‘export’ is set to True/False, only outputs returned, for which the value ‘Export’ in piCtory matches.

Parameters:

export – Only outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Outputs

get_memories(export=None) list[source]

Returns a list of all memory objects.

If parameter ‘export’ remains None, all mems will be returned. If ‘export’ is set to True/False, only mems will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only mems with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Mems

readprocimg() bool[source]

Read all inputs for this device from process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.readprocimg()

setdefaultvalues() None[source]

Set all output buffers for this device to default values.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.setdefaultvalues()

shared_procimg(activate: bool) None[source]

Activate sharing of process image just for this device.

Parameters:

activate – Set True to activate process image sharing

syncoutputs() bool[source]

Read all outputs in process image for this device.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.syncoutputs()

writeprocimg() bool[source]

Write all outputs of this device to process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.writeprocimg()

property length

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

property name

Returns the name of the device.

Returns:

Device name

property offset: int

Returns the device offset in the process image.

Returns:

Device offset

property position

Returns the position on the RevPi bus.

Returns:

Position number

property producttype: int

Returns the product type of the device.

Returns:

Device product type

DeviceList

class revpimodio2.device.DeviceList[source]

Bases: object

Base class for direct access to device objects.

Container for accessing devices.

Example:

# Access device by name
dio_module = rpi.device.DIO_Module_1

# Access device by position
first_device = rpi.device[0]

# Iterate all devices
for device in rpi.device:
    print(f"Device: {device.name}")
__init__()[source]

Init DeviceList class.

__contains__(key)[source]

Checks if device exists.

Parameters:

key – DeviceName <class ‘str’> / Position number <class ‘int’>

Returns:

True if device exists

__delattr__(key, delcomplete=True)[source]

Removes specified device.

Parameters:
  • key – Device to remove

  • delcomplete – If True, device will be removed completely

__delitem__(key)[source]

Removes device at specified position.

Parameters:

key – Device position to remove

__getitem__(key)[source]

Returns specified device.

Parameters:

key – DeviceName <class ‘str’> / Position number <class ‘int’>

Returns:

Found <class ‘Device’> object

__iter__()[source]

Returns iterator of all devices.

The order is sorted by position in the process image and not by position number (this corresponds to the positioning from piCtory)!

Returns:

<class ‘iter’> of all devices

__len__()[source]

Returns number of devices.

Returns:

Number of devices

__setattr__(key, value)[source]

Sets attributes only if device.

Parameters:
  • key – Attribute name

  • value – Attribute object

Base

class revpimodio2.device.Base(parentmodio, dict_device, simulator=False)[source]

Bases: Device

Class for all base devices like Core / Connect etc.

Base class for Revolution Pi base modules.

__bytes__()

Returns all device data as <class ‘bytes’>.

Returns:

Device data as <class ‘bytes’>

__contains__(key)

Checks if IO is on this device.

Parameters:

key – IO-Name <class ‘str’> / IO-Bytenummer <class ‘int’>

Returns:

True if IO is present on device

__getitem__(key)

Returns IO at specified position.

Parameters:

key – Index of the IO on the device as <class ‘int’>

Returns:

Found IO object

__init__(parentmodio, dict_device, simulator=False)

Instantiation of the Device class.

Parameters:
  • parentmodio – RevpiModIO parent object

  • dict_device – <class ‘dict’> for this device from piCtory

  • simulator – Loads the module as simulator and swaps IOs

__int__()

Returns the position on the RevPi bus.

Returns:

Position number

__iter__()

Returns iterator of all IOs.

Returns:

<class ‘iter’> of all IOs

__len__()

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

__str__()

Returns the name of the device.

Returns:

Device name

autorefresh(activate=True) None

Registers this device for automatic synchronization.

Parameters:

activate – Default True adds device to synchronization

bmk

Component designator from piCtory configuration.

catalognr

Catalog number of the device (deprecated).

comment

Comment text from piCtory configuration.

extend

Extended configuration data from piCtory.

get_allios(export=None) list

Returns a list of all inputs and outputs, no MEMs.

If parameter ‘export’ remains None, all inputs and outputs will be returned. If ‘export’ is set to True/False, only inputs and outputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only in-/outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Input and Output, no MEMs

get_inputs(export=None) list

Returns a list of all inputs.

If parameter ‘export’ remains None, all inputs will be returned. If ‘export’ is set to True/False, only inputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only inputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Inputs

get_memories(export=None) list

Returns a list of all memory objects.

If parameter ‘export’ remains None, all mems will be returned. If ‘export’ is set to True/False, only mems will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only mems with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Mems

get_outputs(export=None) list

Returns a list of all outputs.

If parameter ‘export’ remains None, all outputs will be returned. If ‘export’ is set to True/False, only outputs returned, for which the value ‘Export’ in piCtory matches.

Parameters:

export – Only outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Outputs

guid

Global unique identifier of the device.

id

Device identifier from piCtory configuration.

inpvariant

Input variant number.

property length

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

property name

Returns the name of the device.

Returns:

Device name

property offset: int

Returns the device offset in the process image.

Returns:

Device offset

outvariant

Output variant number.

property position

Returns the position on the RevPi bus.

Returns:

Position number

property producttype: int

Returns the product type of the device.

Returns:

Device product type

readprocimg() bool

Read all inputs for this device from process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.readprocimg()

setdefaultvalues() None

Set all output buffers for this device to default values.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.setdefaultvalues()

shared_procimg(activate: bool) None

Activate sharing of process image just for this device.

Parameters:

activate – Set True to activate process image sharing

syncoutputs() bool

Read all outputs in process image for this device.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.syncoutputs()

type

Device position type string.

writeprocimg() bool

Write all outputs of this device to process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.writeprocimg()

GatewayMixin

class revpimodio2.device.GatewayMixin[source]

Bases: object

Mixin class providing piGate module detection functionality.

Mixin class providing gateway functionality for piGate modules.

property leftgate: bool

Status bit indicating a piGate module is connected on the left side.

Returns:

True if piGate left exists

property rightgate: bool

Status bit indicating a piGate module is connected on the right side.

Returns:

True if piGate right exists

ModularBaseConnect_4_5

class revpimodio2.device.ModularBaseConnect_4_5(parentmodio, dict_device, simulator=False)[source]

Bases: ModularBase

Class for overlapping functions of Connect 4/5.

Base class for Connect 4 and Connect 5 modules.

__setattr__(key, value)[source]

Prevents overwriting the special IOs.

wd_toggle()[source]

Toggle watchdog bit to prevent a timeout.

property A1: int

Returns the state of LED A1 of the Connect.

Returns:

0=off, 1=green, 2=red, 4=blue, mixed RGB colors

property A2: int

Returns the state of LED A2 from the Core.

Returns:

0=off, 1=green, 2=red, 4=blue, mixed RGB colors

property A3: int

Returns the state of LED A3 of the Core.

Returns:

0=off, 1=green, 2=red, 4=blue, mixed RGB colors

property A4: int

Returns the state of LED A4 of the Core.

Returns:

0=off, 1=green, 2=red, 4=blue, mixed RGB colors

property A5: int

Returns the state of LED A5 of the Core.

Returns:

0=off, 1=green, 2=red, 4=blue, mixed RGB colors

a1red
a1green
a1blue
a2red
a2green
a2blue
a3red
a3green
a3blue
a4red
a4green
a4blue
a5red
a5green
a5blue
__bytes__()

Returns all device data as <class ‘bytes’>.

Returns:

Device data as <class ‘bytes’>

__contains__(key)

Checks if IO is on this device.

Parameters:

key – IO-Name <class ‘str’> / IO-Bytenummer <class ‘int’>

Returns:

True if IO is present on device

__getitem__(key)

Returns IO at specified position.

Parameters:

key – Index of the IO on the device as <class ‘int’>

Returns:

Found IO object

__init__(parentmodio, dict_device, simulator=False)

Instantiation of the Device class.

Parameters:
  • parentmodio – RevpiModIO parent object

  • dict_device – <class ‘dict’> for this device from piCtory

  • simulator – Loads the module as simulator and swaps IOs

__int__()

Returns the position on the RevPi bus.

Returns:

Position number

__iter__()

Returns iterator of all IOs.

Returns:

<class ‘iter’> of all IOs

__len__()

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

__str__()

Returns the name of the device.

Returns:

Device name

autorefresh(activate=True) None

Registers this device for automatic synchronization.

Parameters:

activate – Default True adds device to synchronization

bmk

Component designator from piCtory configuration.

catalognr

Catalog number of the device (deprecated).

comment

Comment text from piCtory configuration.

property errorlimit1: int

Returns RS485 ErrorLimit1 value.

Returns:

Current value for ErrorLimit1 (-1 if not available)

property errorlimit2: int

Returns RS485 ErrorLimit2 value.

Returns:

Current value for ErrorLimit2 (-1 if not available)

extend

Extended configuration data from piCtory.

property frequency: int

Returns CPU clock frequency.

Returns:

CPU clock frequency in MHz (-1 if not available)

get_allios(export=None) list

Returns a list of all inputs and outputs, no MEMs.

If parameter ‘export’ remains None, all inputs and outputs will be returned. If ‘export’ is set to True/False, only inputs and outputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only in-/outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Input and Output, no MEMs

get_inputs(export=None) list

Returns a list of all inputs.

If parameter ‘export’ remains None, all inputs will be returned. If ‘export’ is set to True/False, only inputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only inputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Inputs

get_memories(export=None) list

Returns a list of all memory objects.

If parameter ‘export’ remains None, all mems will be returned. If ‘export’ is set to True/False, only mems will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only mems with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Mems

get_outputs(export=None) list

Returns a list of all outputs.

If parameter ‘export’ remains None, all outputs will be returned. If ‘export’ is set to True/False, only outputs returned, for which the value ‘Export’ in piCtory matches.

Parameters:

export – Only outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Outputs

guid

Global unique identifier of the device.

id

Device identifier from piCtory configuration.

inpvariant

Input variant number.

property iocycle: int

Returns cycle time of process image synchronization.

Returns:

Cycle time in ms (-1 if not available)

property ioerrorcount: int

Returns error count on RS485 piBridge bus.

Returns:

Number of errors of the piBridge (-1 if not available)

property length

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

property missingdeviceorgate: bool

Status bit for an IO module missing or piGate configured.

Returns:

True if IO module is missing or piGate is configured

property name

Returns the name of the device.

Returns:

Device name

property offset: int

Returns the device offset in the process image.

Returns:

Device offset

outvariant

Output variant number.

property overunderflow: bool

Module occupies more or less memory than configured.

Returns:

True if wrong memory is occupied

Type:

Status bit

property picontrolrunning: bool

Status bit indicating piControl driver is running.

Returns:

True if driver is running

property position

Returns the position on the RevPi bus.

Returns:

Position number

property producttype: int

Returns the product type of the device.

Returns:

Device product type

readprocimg() bool

Read all inputs for this device from process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.readprocimg()

setdefaultvalues() None

Set all output buffers for this device to default values.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.setdefaultvalues()

shared_procimg(activate: bool) None

Activate sharing of process image just for this device.

Parameters:

activate – Set True to activate process image sharing

property status: int

Returns the RevPi Core status.

Returns:

Status as <class ‘int’>

syncoutputs() bool

Read all outputs in process image for this device.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.syncoutputs()

property temperature: int

Returns CPU temperature.

Returns:

CPU temperature in Celsius (-273 if not available)

type

Device position type string.

property unconfdevice: bool

Status bit for an IO module not configured with piCtory.

Returns:

True if IO module is not configured

writeprocimg() bool

Write all outputs of this device to process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.writeprocimg()

Core

class revpimodio2.device.Core(parentmodio, dict_device, simulator=False)[source]

Bases: ModularBase, GatewayMixin

Class for the RevPi Core.

Provides functions for the LEDs and the status.

Revolution Pi Core module.

__setattr__(key, value)[source]

Prevents overwriting the LEDs.

wd_toggle()[source]

Toggle watchdog bit to prevent a timeout.

property A1: int

Returns the state of LED A1 from the Core.

Returns:

0=off, 1=green, 2=red

property A2: int

Returns the state of LED A2 from the Core.

Returns:

0=off, 1=green, 2=red

a1green
a1red
a2green
a2red
wd
__bytes__()

Returns all device data as <class ‘bytes’>.

Returns:

Device data as <class ‘bytes’>

__contains__(key)

Checks if IO is on this device.

Parameters:

key – IO-Name <class ‘str’> / IO-Bytenummer <class ‘int’>

Returns:

True if IO is present on device

__getitem__(key)

Returns IO at specified position.

Parameters:

key – Index of the IO on the device as <class ‘int’>

Returns:

Found IO object

__init__(parentmodio, dict_device, simulator=False)

Instantiation of the Device class.

Parameters:
  • parentmodio – RevpiModIO parent object

  • dict_device – <class ‘dict’> for this device from piCtory

  • simulator – Loads the module as simulator and swaps IOs

__int__()

Returns the position on the RevPi bus.

Returns:

Position number

__iter__()

Returns iterator of all IOs.

Returns:

<class ‘iter’> of all IOs

__len__()

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

__str__()

Returns the name of the device.

Returns:

Device name

autorefresh(activate=True) None

Registers this device for automatic synchronization.

Parameters:

activate – Default True adds device to synchronization

bmk

Component designator from piCtory configuration.

catalognr

Catalog number of the device (deprecated).

comment

Comment text from piCtory configuration.

property errorlimit1: int

Returns RS485 ErrorLimit1 value.

Returns:

Current value for ErrorLimit1 (-1 if not available)

property errorlimit2: int

Returns RS485 ErrorLimit2 value.

Returns:

Current value for ErrorLimit2 (-1 if not available)

extend

Extended configuration data from piCtory.

property frequency: int

Returns CPU clock frequency.

Returns:

CPU clock frequency in MHz (-1 if not available)

get_allios(export=None) list

Returns a list of all inputs and outputs, no MEMs.

If parameter ‘export’ remains None, all inputs and outputs will be returned. If ‘export’ is set to True/False, only inputs and outputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only in-/outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Input and Output, no MEMs

get_inputs(export=None) list

Returns a list of all inputs.

If parameter ‘export’ remains None, all inputs will be returned. If ‘export’ is set to True/False, only inputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only inputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Inputs

get_memories(export=None) list

Returns a list of all memory objects.

If parameter ‘export’ remains None, all mems will be returned. If ‘export’ is set to True/False, only mems will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only mems with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Mems

get_outputs(export=None) list

Returns a list of all outputs.

If parameter ‘export’ remains None, all outputs will be returned. If ‘export’ is set to True/False, only outputs returned, for which the value ‘Export’ in piCtory matches.

Parameters:

export – Only outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Outputs

guid

Global unique identifier of the device.

id

Device identifier from piCtory configuration.

inpvariant

Input variant number.

property iocycle: int

Returns cycle time of process image synchronization.

Returns:

Cycle time in ms (-1 if not available)

property ioerrorcount: int

Returns error count on RS485 piBridge bus.

Returns:

Number of errors of the piBridge (-1 if not available)

property leftgate: bool

Status bit indicating a piGate module is connected on the left side.

Returns:

True if piGate left exists

property length

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

property missingdeviceorgate: bool

Status bit for an IO module missing or piGate configured.

Returns:

True if IO module is missing or piGate is configured

property name

Returns the name of the device.

Returns:

Device name

property offset: int

Returns the device offset in the process image.

Returns:

Device offset

outvariant

Output variant number.

property overunderflow: bool

Module occupies more or less memory than configured.

Returns:

True if wrong memory is occupied

Type:

Status bit

property picontrolrunning: bool

Status bit indicating piControl driver is running.

Returns:

True if driver is running

property position

Returns the position on the RevPi bus.

Returns:

Position number

property producttype: int

Returns the product type of the device.

Returns:

Device product type

readprocimg() bool

Read all inputs for this device from process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.readprocimg()

property rightgate: bool

Status bit indicating a piGate module is connected on the right side.

Returns:

True if piGate right exists

setdefaultvalues() None

Set all output buffers for this device to default values.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.setdefaultvalues()

shared_procimg(activate: bool) None

Activate sharing of process image just for this device.

Parameters:

activate – Set True to activate process image sharing

property status: int

Returns the RevPi Core status.

Returns:

Status as <class ‘int’>

syncoutputs() bool

Read all outputs in process image for this device.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.syncoutputs()

property temperature: int

Returns CPU temperature.

Returns:

CPU temperature in Celsius (-273 if not available)

type

Device position type string.

property unconfdevice: bool

Status bit for an IO module not configured with piCtory.

Returns:

True if IO module is not configured

writeprocimg() bool

Write all outputs of this device to process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.writeprocimg()

Connect

class revpimodio2.device.Connect(parentmodio, dict_device, simulator=False)[source]

Bases: Core

Class for the RevPi Connect.

Provides functions for the LEDs, watchdog and the status.

Revolution Pi Connect module.

__setattr__(key, value)[source]

Prevents overwriting the special IOs.

property A3: int

Returns the state of LED A3 of the Connect.

Returns:

0=off, 1=green, 2=red

property wdautotoggle: bool

Retrieves the automatic watchdog toggle status.

Returns:

True if automatic watchdog toggle is active

a3green
a3red
x2in
x2out
property A1: int

Returns the state of LED A1 from the Core.

Returns:

0=off, 1=green, 2=red

property A2: int

Returns the state of LED A2 from the Core.

Returns:

0=off, 1=green, 2=red

__bytes__()

Returns all device data as <class ‘bytes’>.

Returns:

Device data as <class ‘bytes’>

__contains__(key)

Checks if IO is on this device.

Parameters:

key – IO-Name <class ‘str’> / IO-Bytenummer <class ‘int’>

Returns:

True if IO is present on device

__getitem__(key)

Returns IO at specified position.

Parameters:

key – Index of the IO on the device as <class ‘int’>

Returns:

Found IO object

__init__(parentmodio, dict_device, simulator=False)

Instantiation of the Device class.

Parameters:
  • parentmodio – RevpiModIO parent object

  • dict_device – <class ‘dict’> for this device from piCtory

  • simulator – Loads the module as simulator and swaps IOs

__int__()

Returns the position on the RevPi bus.

Returns:

Position number

__iter__()

Returns iterator of all IOs.

Returns:

<class ‘iter’> of all IOs

__len__()

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

__str__()

Returns the name of the device.

Returns:

Device name

a1green
a1red
a2green
a2red
autorefresh(activate=True) None

Registers this device for automatic synchronization.

Parameters:

activate – Default True adds device to synchronization

bmk

Component designator from piCtory configuration.

catalognr

Catalog number of the device (deprecated).

comment

Comment text from piCtory configuration.

property errorlimit1: int

Returns RS485 ErrorLimit1 value.

Returns:

Current value for ErrorLimit1 (-1 if not available)

property errorlimit2: int

Returns RS485 ErrorLimit2 value.

Returns:

Current value for ErrorLimit2 (-1 if not available)

extend

Extended configuration data from piCtory.

property frequency: int

Returns CPU clock frequency.

Returns:

CPU clock frequency in MHz (-1 if not available)

get_allios(export=None) list

Returns a list of all inputs and outputs, no MEMs.

If parameter ‘export’ remains None, all inputs and outputs will be returned. If ‘export’ is set to True/False, only inputs and outputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only in-/outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Input and Output, no MEMs

get_inputs(export=None) list

Returns a list of all inputs.

If parameter ‘export’ remains None, all inputs will be returned. If ‘export’ is set to True/False, only inputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only inputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Inputs

get_memories(export=None) list

Returns a list of all memory objects.

If parameter ‘export’ remains None, all mems will be returned. If ‘export’ is set to True/False, only mems will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only mems with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Mems

get_outputs(export=None) list

Returns a list of all outputs.

If parameter ‘export’ remains None, all outputs will be returned. If ‘export’ is set to True/False, only outputs returned, for which the value ‘Export’ in piCtory matches.

Parameters:

export – Only outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Outputs

guid

Global unique identifier of the device.

id

Device identifier from piCtory configuration.

inpvariant

Input variant number.

property iocycle: int

Returns cycle time of process image synchronization.

Returns:

Cycle time in ms (-1 if not available)

property ioerrorcount: int

Returns error count on RS485 piBridge bus.

Returns:

Number of errors of the piBridge (-1 if not available)

property leftgate: bool

Status bit indicating a piGate module is connected on the left side.

Returns:

True if piGate left exists

property length

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

property missingdeviceorgate: bool

Status bit for an IO module missing or piGate configured.

Returns:

True if IO module is missing or piGate is configured

property name

Returns the name of the device.

Returns:

Device name

property offset: int

Returns the device offset in the process image.

Returns:

Device offset

outvariant

Output variant number.

property overunderflow: bool

Module occupies more or less memory than configured.

Returns:

True if wrong memory is occupied

Type:

Status bit

property picontrolrunning: bool

Status bit indicating piControl driver is running.

Returns:

True if driver is running

property position

Returns the position on the RevPi bus.

Returns:

Position number

property producttype: int

Returns the product type of the device.

Returns:

Device product type

readprocimg() bool

Read all inputs for this device from process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.readprocimg()

property rightgate: bool

Status bit indicating a piGate module is connected on the right side.

Returns:

True if piGate right exists

setdefaultvalues() None

Set all output buffers for this device to default values.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.setdefaultvalues()

shared_procimg(activate: bool) None

Activate sharing of process image just for this device.

Parameters:

activate – Set True to activate process image sharing

property status: int

Returns the RevPi Core status.

Returns:

Status as <class ‘int’>

syncoutputs() bool

Read all outputs in process image for this device.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.syncoutputs()

property temperature: int

Returns CPU temperature.

Returns:

CPU temperature in Celsius (-273 if not available)

type

Device position type string.

property unconfdevice: bool

Status bit for an IO module not configured with piCtory.

Returns:

True if IO module is not configured

wd
wd_toggle()

Toggle watchdog bit to prevent a timeout.

writeprocimg() bool

Write all outputs of this device to process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.writeprocimg()

Connect4

class revpimodio2.device.Connect4(parentmodio, dict_device, simulator=False)[source]

Bases: ModularBaseConnect_4_5

Class for the RevPi Connect 4.

Provides functions for the LEDs and the status.

Revolution Pi Connect 4 module.

__setattr__(key, value)[source]

Prevents overwriting the special IOs.

x2in
x2out
property A1: int

Returns the state of LED A1 of the Connect.

Returns:

0=off, 1=green, 2=red, 4=blue, mixed RGB colors

property A2: int

Returns the state of LED A2 from the Core.

Returns:

0=off, 1=green, 2=red, 4=blue, mixed RGB colors

property A3: int

Returns the state of LED A3 of the Core.

Returns:

0=off, 1=green, 2=red, 4=blue, mixed RGB colors

property A4: int

Returns the state of LED A4 of the Core.

Returns:

0=off, 1=green, 2=red, 4=blue, mixed RGB colors

property A5: int

Returns the state of LED A5 of the Core.

Returns:

0=off, 1=green, 2=red, 4=blue, mixed RGB colors

__bytes__()

Returns all device data as <class ‘bytes’>.

Returns:

Device data as <class ‘bytes’>

__contains__(key)

Checks if IO is on this device.

Parameters:

key – IO-Name <class ‘str’> / IO-Bytenummer <class ‘int’>

Returns:

True if IO is present on device

__getitem__(key)

Returns IO at specified position.

Parameters:

key – Index of the IO on the device as <class ‘int’>

Returns:

Found IO object

__init__(parentmodio, dict_device, simulator=False)

Instantiation of the Device class.

Parameters:
  • parentmodio – RevpiModIO parent object

  • dict_device – <class ‘dict’> for this device from piCtory

  • simulator – Loads the module as simulator and swaps IOs

__int__()

Returns the position on the RevPi bus.

Returns:

Position number

__iter__()

Returns iterator of all IOs.

Returns:

<class ‘iter’> of all IOs

__len__()

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

__str__()

Returns the name of the device.

Returns:

Device name

a1blue
a1green
a1red
a2blue
a2green
a2red
a3blue
a3green
a3red
a4blue
a4green
a4red
a5blue
a5green
a5red
autorefresh(activate=True) None

Registers this device for automatic synchronization.

Parameters:

activate – Default True adds device to synchronization

bmk

Component designator from piCtory configuration.

catalognr

Catalog number of the device (deprecated).

comment

Comment text from piCtory configuration.

property errorlimit1: int

Returns RS485 ErrorLimit1 value.

Returns:

Current value for ErrorLimit1 (-1 if not available)

property errorlimit2: int

Returns RS485 ErrorLimit2 value.

Returns:

Current value for ErrorLimit2 (-1 if not available)

extend

Extended configuration data from piCtory.

property frequency: int

Returns CPU clock frequency.

Returns:

CPU clock frequency in MHz (-1 if not available)

get_allios(export=None) list

Returns a list of all inputs and outputs, no MEMs.

If parameter ‘export’ remains None, all inputs and outputs will be returned. If ‘export’ is set to True/False, only inputs and outputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only in-/outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Input and Output, no MEMs

get_inputs(export=None) list

Returns a list of all inputs.

If parameter ‘export’ remains None, all inputs will be returned. If ‘export’ is set to True/False, only inputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only inputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Inputs

get_memories(export=None) list

Returns a list of all memory objects.

If parameter ‘export’ remains None, all mems will be returned. If ‘export’ is set to True/False, only mems will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only mems with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Mems

get_outputs(export=None) list

Returns a list of all outputs.

If parameter ‘export’ remains None, all outputs will be returned. If ‘export’ is set to True/False, only outputs returned, for which the value ‘Export’ in piCtory matches.

Parameters:

export – Only outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Outputs

guid

Global unique identifier of the device.

id

Device identifier from piCtory configuration.

inpvariant

Input variant number.

property iocycle: int

Returns cycle time of process image synchronization.

Returns:

Cycle time in ms (-1 if not available)

property ioerrorcount: int

Returns error count on RS485 piBridge bus.

Returns:

Number of errors of the piBridge (-1 if not available)

property length

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

property missingdeviceorgate: bool

Status bit for an IO module missing or piGate configured.

Returns:

True if IO module is missing or piGate is configured

property name

Returns the name of the device.

Returns:

Device name

property offset: int

Returns the device offset in the process image.

Returns:

Device offset

outvariant

Output variant number.

property overunderflow: bool

Module occupies more or less memory than configured.

Returns:

True if wrong memory is occupied

Type:

Status bit

property picontrolrunning: bool

Status bit indicating piControl driver is running.

Returns:

True if driver is running

property position

Returns the position on the RevPi bus.

Returns:

Position number

property producttype: int

Returns the product type of the device.

Returns:

Device product type

readprocimg() bool

Read all inputs for this device from process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.readprocimg()

setdefaultvalues() None

Set all output buffers for this device to default values.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.setdefaultvalues()

shared_procimg(activate: bool) None

Activate sharing of process image just for this device.

Parameters:

activate – Set True to activate process image sharing

property status: int

Returns the RevPi Core status.

Returns:

Status as <class ‘int’>

syncoutputs() bool

Read all outputs in process image for this device.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.syncoutputs()

property temperature: int

Returns CPU temperature.

Returns:

CPU temperature in Celsius (-273 if not available)

type

Device position type string.

property unconfdevice: bool

Status bit for an IO module not configured with piCtory.

Returns:

True if IO module is not configured

wd_toggle()

Toggle watchdog bit to prevent a timeout.

writeprocimg() bool

Write all outputs of this device to process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.writeprocimg()

Connect5

class revpimodio2.device.Connect5(parentmodio, dict_device, simulator=False)[source]

Bases: ModularBaseConnect_4_5, GatewayMixin

Class for the RevPi Connect 5.

Provides functions for the LEDs and the status.

Revolution Pi Connect 5 module.

a1red
a1green
a1blue
a2red
a2green
a2blue
a3red
a3green
a3blue
a4red
a4green
a4blue
a5red
a5green
a5blue
property A1: int

Returns the state of LED A1 of the Connect.

Returns:

0=off, 1=green, 2=red, 4=blue, mixed RGB colors

property A2: int

Returns the state of LED A2 from the Core.

Returns:

0=off, 1=green, 2=red, 4=blue, mixed RGB colors

property A3: int

Returns the state of LED A3 of the Core.

Returns:

0=off, 1=green, 2=red, 4=blue, mixed RGB colors

property A4: int

Returns the state of LED A4 of the Core.

Returns:

0=off, 1=green, 2=red, 4=blue, mixed RGB colors

property A5: int

Returns the state of LED A5 of the Core.

Returns:

0=off, 1=green, 2=red, 4=blue, mixed RGB colors

__bytes__()

Returns all device data as <class ‘bytes’>.

Returns:

Device data as <class ‘bytes’>

__contains__(key)

Checks if IO is on this device.

Parameters:

key – IO-Name <class ‘str’> / IO-Bytenummer <class ‘int’>

Returns:

True if IO is present on device

__getitem__(key)

Returns IO at specified position.

Parameters:

key – Index of the IO on the device as <class ‘int’>

Returns:

Found IO object

__init__(parentmodio, dict_device, simulator=False)

Instantiation of the Device class.

Parameters:
  • parentmodio – RevpiModIO parent object

  • dict_device – <class ‘dict’> for this device from piCtory

  • simulator – Loads the module as simulator and swaps IOs

__int__()

Returns the position on the RevPi bus.

Returns:

Position number

__iter__()

Returns iterator of all IOs.

Returns:

<class ‘iter’> of all IOs

__len__()

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

__setattr__(key, value)

Prevents overwriting the special IOs.

__str__()

Returns the name of the device.

Returns:

Device name

autorefresh(activate=True) None

Registers this device for automatic synchronization.

Parameters:

activate – Default True adds device to synchronization

bmk

Component designator from piCtory configuration.

catalognr

Catalog number of the device (deprecated).

comment

Comment text from piCtory configuration.

property errorlimit1: int

Returns RS485 ErrorLimit1 value.

Returns:

Current value for ErrorLimit1 (-1 if not available)

property errorlimit2: int

Returns RS485 ErrorLimit2 value.

Returns:

Current value for ErrorLimit2 (-1 if not available)

extend

Extended configuration data from piCtory.

property frequency: int

Returns CPU clock frequency.

Returns:

CPU clock frequency in MHz (-1 if not available)

get_allios(export=None) list

Returns a list of all inputs and outputs, no MEMs.

If parameter ‘export’ remains None, all inputs and outputs will be returned. If ‘export’ is set to True/False, only inputs and outputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only in-/outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Input and Output, no MEMs

get_inputs(export=None) list

Returns a list of all inputs.

If parameter ‘export’ remains None, all inputs will be returned. If ‘export’ is set to True/False, only inputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only inputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Inputs

get_memories(export=None) list

Returns a list of all memory objects.

If parameter ‘export’ remains None, all mems will be returned. If ‘export’ is set to True/False, only mems will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only mems with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Mems

get_outputs(export=None) list

Returns a list of all outputs.

If parameter ‘export’ remains None, all outputs will be returned. If ‘export’ is set to True/False, only outputs returned, for which the value ‘Export’ in piCtory matches.

Parameters:

export – Only outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Outputs

guid

Global unique identifier of the device.

id

Device identifier from piCtory configuration.

inpvariant

Input variant number.

property iocycle: int

Returns cycle time of process image synchronization.

Returns:

Cycle time in ms (-1 if not available)

property ioerrorcount: int

Returns error count on RS485 piBridge bus.

Returns:

Number of errors of the piBridge (-1 if not available)

property leftgate: bool

Status bit indicating a piGate module is connected on the left side.

Returns:

True if piGate left exists

property length

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

property missingdeviceorgate: bool

Status bit for an IO module missing or piGate configured.

Returns:

True if IO module is missing or piGate is configured

property name

Returns the name of the device.

Returns:

Device name

property offset: int

Returns the device offset in the process image.

Returns:

Device offset

outvariant

Output variant number.

property overunderflow: bool

Module occupies more or less memory than configured.

Returns:

True if wrong memory is occupied

Type:

Status bit

property picontrolrunning: bool

Status bit indicating piControl driver is running.

Returns:

True if driver is running

property position

Returns the position on the RevPi bus.

Returns:

Position number

property producttype: int

Returns the product type of the device.

Returns:

Device product type

readprocimg() bool

Read all inputs for this device from process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.readprocimg()

property rightgate: bool

Status bit indicating a piGate module is connected on the right side.

Returns:

True if piGate right exists

setdefaultvalues() None

Set all output buffers for this device to default values.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.setdefaultvalues()

shared_procimg(activate: bool) None

Activate sharing of process image just for this device.

Parameters:

activate – Set True to activate process image sharing

property status: int

Returns the RevPi Core status.

Returns:

Status as <class ‘int’>

syncoutputs() bool

Read all outputs in process image for this device.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.syncoutputs()

property temperature: int

Returns CPU temperature.

Returns:

CPU temperature in Celsius (-273 if not available)

type

Device position type string.

property unconfdevice: bool

Status bit for an IO module not configured with piCtory.

Returns:

True if IO module is not configured

wd_toggle()

Toggle watchdog bit to prevent a timeout.

writeprocimg() bool

Write all outputs of this device to process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.writeprocimg()

DioModule

class revpimodio2.device.DioModule(parentmodio, dict_device, simulator=False)[source]

Bases: Device

Represents a DIO / DI / DO module.

Digital I/O module.

__bytes__()

Returns all device data as <class ‘bytes’>.

Returns:

Device data as <class ‘bytes’>

__contains__(key)

Checks if IO is on this device.

Parameters:

key – IO-Name <class ‘str’> / IO-Bytenummer <class ‘int’>

Returns:

True if IO is present on device

__getitem__(key)

Returns IO at specified position.

Parameters:

key – Index of the IO on the device as <class ‘int’>

Returns:

Found IO object

__int__()

Returns the position on the RevPi bus.

Returns:

Position number

__iter__()

Returns iterator of all IOs.

Returns:

<class ‘iter’> of all IOs

__len__()

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

__str__()

Returns the name of the device.

Returns:

Device name

autorefresh(activate=True) None

Registers this device for automatic synchronization.

Parameters:

activate – Default True adds device to synchronization

bmk

Component designator from piCtory configuration.

catalognr

Catalog number of the device (deprecated).

comment

Comment text from piCtory configuration.

extend

Extended configuration data from piCtory.

get_allios(export=None) list

Returns a list of all inputs and outputs, no MEMs.

If parameter ‘export’ remains None, all inputs and outputs will be returned. If ‘export’ is set to True/False, only inputs and outputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only in-/outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Input and Output, no MEMs

get_inputs(export=None) list

Returns a list of all inputs.

If parameter ‘export’ remains None, all inputs will be returned. If ‘export’ is set to True/False, only inputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only inputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Inputs

get_memories(export=None) list

Returns a list of all memory objects.

If parameter ‘export’ remains None, all mems will be returned. If ‘export’ is set to True/False, only mems will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only mems with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Mems

get_outputs(export=None) list

Returns a list of all outputs.

If parameter ‘export’ remains None, all outputs will be returned. If ‘export’ is set to True/False, only outputs returned, for which the value ‘Export’ in piCtory matches.

Parameters:

export – Only outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Outputs

guid

Global unique identifier of the device.

id

Device identifier from piCtory configuration.

inpvariant

Input variant number.

property length

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

property name

Returns the name of the device.

Returns:

Device name

property offset: int

Returns the device offset in the process image.

Returns:

Device offset

outvariant

Output variant number.

property position

Returns the position on the RevPi bus.

Returns:

Position number

property producttype: int

Returns the product type of the device.

Returns:

Device product type

readprocimg() bool

Read all inputs for this device from process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.readprocimg()

setdefaultvalues() None

Set all output buffers for this device to default values.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.setdefaultvalues()

shared_procimg(activate: bool) None

Activate sharing of process image just for this device.

Parameters:

activate – Set True to activate process image sharing

syncoutputs() bool

Read all outputs in process image for this device.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.syncoutputs()

type

Device position type string.

writeprocimg() bool

Write all outputs of this device to process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.writeprocimg()

__init__(parentmodio, dict_device, simulator=False)[source]

Extends Device class for detecting IntIOCounter.

Rev:

Device.__init__()

RoModule

class revpimodio2.device.RoModule(parentmodio, dict_device, simulator=False)[source]

Bases: Device

Relais output (RO) module with

Relay output module.

bmk

Component designator from piCtory configuration.

catalognr

Catalog number of the device (deprecated).

comment

Comment text from piCtory configuration.

extend

Extended configuration data from piCtory.

guid

Global unique identifier of the device.

id

Device identifier from piCtory configuration.

inpvariant

Input variant number.

outvariant

Output variant number.

type

Device position type string.

__bytes__()

Returns all device data as <class ‘bytes’>.

Returns:

Device data as <class ‘bytes’>

__contains__(key)

Checks if IO is on this device.

Parameters:

key – IO-Name <class ‘str’> / IO-Bytenummer <class ‘int’>

Returns:

True if IO is present on device

__getitem__(key)

Returns IO at specified position.

Parameters:

key – Index of the IO on the device as <class ‘int’>

Returns:

Found IO object

__int__()

Returns the position on the RevPi bus.

Returns:

Position number

__iter__()

Returns iterator of all IOs.

Returns:

<class ‘iter’> of all IOs

__len__()

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

__str__()

Returns the name of the device.

Returns:

Device name

autorefresh(activate=True) None

Registers this device for automatic synchronization.

Parameters:

activate – Default True adds device to synchronization

get_allios(export=None) list

Returns a list of all inputs and outputs, no MEMs.

If parameter ‘export’ remains None, all inputs and outputs will be returned. If ‘export’ is set to True/False, only inputs and outputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only in-/outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Input and Output, no MEMs

get_inputs(export=None) list

Returns a list of all inputs.

If parameter ‘export’ remains None, all inputs will be returned. If ‘export’ is set to True/False, only inputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only inputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Inputs

get_memories(export=None) list

Returns a list of all memory objects.

If parameter ‘export’ remains None, all mems will be returned. If ‘export’ is set to True/False, only mems will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only mems with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Mems

get_outputs(export=None) list

Returns a list of all outputs.

If parameter ‘export’ remains None, all outputs will be returned. If ‘export’ is set to True/False, only outputs returned, for which the value ‘Export’ in piCtory matches.

Parameters:

export – Only outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Outputs

property length

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

property name

Returns the name of the device.

Returns:

Device name

property offset: int

Returns the device offset in the process image.

Returns:

Device offset

property position

Returns the position on the RevPi bus.

Returns:

Position number

property producttype: int

Returns the product type of the device.

Returns:

Device product type

readprocimg() bool

Read all inputs for this device from process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.readprocimg()

setdefaultvalues() None

Set all output buffers for this device to default values.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.setdefaultvalues()

shared_procimg(activate: bool) None

Activate sharing of process image just for this device.

Parameters:

activate – Set True to activate process image sharing

syncoutputs() bool

Read all outputs in process image for this device.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.syncoutputs()

writeprocimg() bool

Write all outputs of this device to process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.writeprocimg()

__init__(parentmodio, dict_device, simulator=False)[source]

Relais outputs of this device has a cycle counter for the relais.

Rev:

Device.__init__()

Gateway

class revpimodio2.device.Gateway(parent, dict_device, simulator=False)[source]

Bases: Device

Class for the RevPi Gateway-Devices.

Provides additional functions for the RevPi Gateway devices besides the functions from RevPiDevice. Gateways are ready. IOs on this device provide the replace_io function, which allows defining custom IOs that map to a RevPiStructIO object. This IO type can process and return values via multiple bytes.

Ref:

revpimodio2.io.IntIOReplaceable.replace_io()

Gateway module (ModbusTCP, Profinet, etc.).

__bytes__()

Returns all device data as <class ‘bytes’>.

Returns:

Device data as <class ‘bytes’>

__contains__(key)

Checks if IO is on this device.

Parameters:

key – IO-Name <class ‘str’> / IO-Bytenummer <class ‘int’>

Returns:

True if IO is present on device

__getitem__(key)

Returns IO at specified position.

Parameters:

key – Index of the IO on the device as <class ‘int’>

Returns:

Found IO object

__int__()

Returns the position on the RevPi bus.

Returns:

Position number

__iter__()

Returns iterator of all IOs.

Returns:

<class ‘iter’> of all IOs

__len__()

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

__str__()

Returns the name of the device.

Returns:

Device name

autorefresh(activate=True) None

Registers this device for automatic synchronization.

Parameters:

activate – Default True adds device to synchronization

bmk

Component designator from piCtory configuration.

catalognr

Catalog number of the device (deprecated).

comment

Comment text from piCtory configuration.

extend

Extended configuration data from piCtory.

get_allios(export=None) list

Returns a list of all inputs and outputs, no MEMs.

If parameter ‘export’ remains None, all inputs and outputs will be returned. If ‘export’ is set to True/False, only inputs and outputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only in-/outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Input and Output, no MEMs

get_inputs(export=None) list

Returns a list of all inputs.

If parameter ‘export’ remains None, all inputs will be returned. If ‘export’ is set to True/False, only inputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only inputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Inputs

get_memories(export=None) list

Returns a list of all memory objects.

If parameter ‘export’ remains None, all mems will be returned. If ‘export’ is set to True/False, only mems will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only mems with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Mems

get_outputs(export=None) list

Returns a list of all outputs.

If parameter ‘export’ remains None, all outputs will be returned. If ‘export’ is set to True/False, only outputs returned, for which the value ‘Export’ in piCtory matches.

Parameters:

export – Only outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Outputs

guid

Global unique identifier of the device.

id

Device identifier from piCtory configuration.

inpvariant

Input variant number.

property length

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

property name

Returns the name of the device.

Returns:

Device name

property offset: int

Returns the device offset in the process image.

Returns:

Device offset

outvariant

Output variant number.

property position

Returns the position on the RevPi bus.

Returns:

Position number

property producttype: int

Returns the product type of the device.

Returns:

Device product type

readprocimg() bool

Read all inputs for this device from process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.readprocimg()

setdefaultvalues() None

Set all output buffers for this device to default values.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.setdefaultvalues()

shared_procimg(activate: bool) None

Activate sharing of process image just for this device.

Parameters:

activate – Set True to activate process image sharing

syncoutputs() bool

Read all outputs in process image for this device.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.syncoutputs()

type

Device position type string.

writeprocimg() bool

Write all outputs of this device to process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.writeprocimg()

__init__(parent, dict_device, simulator=False)[source]

Extends Device class with get_rawbytes functions.

Ref:

Device.__init__()

get_rawbytes() bytes[source]

Returns the bytes used by this device.

Returns:

<class ‘bytes’> of the Devices

Virtual

class revpimodio2.device.Virtual(parent, dict_device, simulator=False)[source]

Bases: Gateway

Class for the RevPi Virtual-Devices.

Provides the same functions as Gateway. Custom IOs can be defined via the replace_io functions that map to RevPiStructIO objects. This IO type can process and return values via multiple bytes.

Ref:

Gateway()

Virtual device for custom applications.

__bytes__()

Returns all device data as <class ‘bytes’>.

Returns:

Device data as <class ‘bytes’>

__contains__(key)

Checks if IO is on this device.

Parameters:

key – IO-Name <class ‘str’> / IO-Bytenummer <class ‘int’>

Returns:

True if IO is present on device

__getitem__(key)

Returns IO at specified position.

Parameters:

key – Index of the IO on the device as <class ‘int’>

Returns:

Found IO object

__init__(parent, dict_device, simulator=False)

Extends Device class with get_rawbytes functions.

Ref:

Device.__init__()

__int__()

Returns the position on the RevPi bus.

Returns:

Position number

__iter__()

Returns iterator of all IOs.

Returns:

<class ‘iter’> of all IOs

__len__()

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

__str__()

Returns the name of the device.

Returns:

Device name

autorefresh(activate=True) None

Registers this device for automatic synchronization.

Parameters:

activate – Default True adds device to synchronization

bmk

Component designator from piCtory configuration.

catalognr

Catalog number of the device (deprecated).

comment

Comment text from piCtory configuration.

extend

Extended configuration data from piCtory.

get_allios(export=None) list

Returns a list of all inputs and outputs, no MEMs.

If parameter ‘export’ remains None, all inputs and outputs will be returned. If ‘export’ is set to True/False, only inputs and outputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only in-/outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Input and Output, no MEMs

get_inputs(export=None) list

Returns a list of all inputs.

If parameter ‘export’ remains None, all inputs will be returned. If ‘export’ is set to True/False, only inputs will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only inputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Inputs

get_memories(export=None) list

Returns a list of all memory objects.

If parameter ‘export’ remains None, all mems will be returned. If ‘export’ is set to True/False, only mems will be returned for which the ‘Export’ value in piCtory matches.

Parameters:

export – Only mems with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Mems

get_outputs(export=None) list

Returns a list of all outputs.

If parameter ‘export’ remains None, all outputs will be returned. If ‘export’ is set to True/False, only outputs returned, for which the value ‘Export’ in piCtory matches.

Parameters:

export – Only outputs with specified ‘Export’ value in piCtory

Returns:

<class ‘list’> Outputs

get_rawbytes() bytes

Returns the bytes used by this device.

Returns:

<class ‘bytes’> of the Devices

guid

Global unique identifier of the device.

id

Device identifier from piCtory configuration.

inpvariant

Input variant number.

property length

Returns number of bytes occupied by this device.

Returns:

<class ‘int’>

property name

Returns the name of the device.

Returns:

Device name

property offset: int

Returns the device offset in the process image.

Returns:

Device offset

outvariant

Output variant number.

property position

Returns the position on the RevPi bus.

Returns:

Position number

property producttype: int

Returns the product type of the device.

Returns:

Device product type

readprocimg() bool

Read all inputs for this device from process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.readprocimg()

setdefaultvalues() None

Set all output buffers for this device to default values.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.setdefaultvalues()

shared_procimg(activate: bool) None

Activate sharing of process image just for this device.

Parameters:

activate – Set True to activate process image sharing

syncoutputs() bool

Read all outputs in process image for this device.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.syncoutputs()

type

Device position type string.

writeprocimg() bool

Write all outputs of this device to process image.

Returns:

True if successfully executed

Ref:

revpimodio2.modio.RevPiModIO.writeprocimg()

writeinputdefaults()[source]

Writes piCtory default input values for a virtual device.

If default values for inputs of a virtual device are specified in piCtory, these are only set at system startup or a piControl reset. If the process image is subsequently overwritten with NULL, these values will be lost. This function can only be applied to virtual devices!

Returns:

True if operations on the virtual device were successful