Object .device

This class provides direct access to the Revolution Pi devices.

revpimodio2.device.DeviceList()
Classobjects

This class provides all devices as attributes. The names of the attributes are taken from the piCtory configuration.

If a device with the Name “dio01” is configured in piCtory, Python can Access ist attributes and functions as following:
.device.dio01.autorefresh()

Note 1: For piCtory naming, the python rules must be observed for Name assignments (no blankspaces!). If this is not possible, access is only possible via string specifications (.device["§ad Name"].autorefresh()) or its position nummer (.device[33].autorefresh()).

Note 2: Since in Hardware configuration in piCtory devices of the same type, also get the same name, we STRONGLY RECOMMEND to pay attention to clear name assignments. For duplicate names, access is only possible using the position number (.device[33].autorefresh()).


All attribute objects have the following general properties:

Classattributes

  • .bmk
    Returns the text as <class ‘str’> from the field “BMK” of the “Value Editors” in piCtory.

  • .comment
    Returns the text as <class ‘str’> from the field “Comment” of the “Value Editors” in piCtory.

  • .length
    Returns the number of bytes, that this device is occupieing.

  • .name
    Returns the name  of the device  – Matches names in piCtory.

  • .offset
    Returns the Deviceoffset in the process image.

  • .positon
    Returns the position number of the device in the RevPi bus.

Further piCtory values
  • .catalogNr
    Returns the Kunbus product name, e.g. “RevPiDO”

  • .id
    Returns the name of the .rap data, that was used by piCtory configuration for this device.

  • .producttype
    Returns the product number of the device.

  • .type
    Returns the device type, e.g. “LEFT_RIGHT”

Classfunctions

.autorefresh(activate=True)

If .autorefresh()is called for a device, it is added to the cyclic AutoRefresh routine. This automatically synchronizes all IOs with the process image.
It is recommended to instantiate the RevPiModIO module with autorefresh=True– all devices will be added to the AutoRefresh at startup.

  • activate
    If this parameter is set to False , then the device will be removed from the AutoRefresh.
.get_allios([export=None])

Returns a list of type <class ‘list’> with all inputs and outputs that are located on this device. This list does NOT contain any memories.

  • export=None
    Filter for export flag in piCtory True / False. If you leave this parameter, you will get all inputs and outputs of this device.

.get_inputs([export=None])

Returns a list of type <class ‘list’> with all inputs that are located on this device.

  • export=None
    Filter for export flag in piCtory True / False. If you leave this parameter, you will get all inputs of this device.

.get_memories([export=None])

Returns a list of type <class ‘list’> with all memories that are located on this device.

  • export=None
    Filter for export flag in piCtory True / False. If you leave this parameter, you will get all memories of this device.

.get_outputs([export=None])

Returns a list of type <class ‘list’> with all outputs that are located on this device.

  • export=None
    Filter for export flag in piCtory True / False. If you leave this parameter, you will get all outputs of this device.

RevPiModIO main function for single devices (use only if neccessary!)

.readprocimg()

Read all inputs that are located on this device from the process image.

Note: Not possible, if the device is running in AutoRefresh.

  • Return value is True, if work was successful.

.setdefaultvalues()

All outputs that are located on this device are set to the piCtory default values.

Note: If autorefresh is not active, all output values must be written to the process image via .writeprocimg().


.syncoutputs()

Read all current output values, which are located on this device, from the process imagebild. Can be used for initial synchronization, should be syncoutputs = False for instantiation.

Note: Not possible, if device is running in AutoRefresh.

  • Return value is True, if work was successful.

.writeprocimg()

Write all output values that are located on this device into the process image.

Note: Not possible, if device is running in AutoRefresh.

  • Return value is True, if work was successful.