Understanding the process image and pitest

Topics about the Software of Revolution Pi
Post Reply
alf@emcom.no
Posts: 20
Joined: 25 Sep 2018, 10:17
Answers: 0

Understanding the process image and pitest

Post by alf@emcom.no »

I am using the RevPi Connect with some sensors connected as RTU slaves.
I am reading 20 word-sized registers (some of which to be interpreted as IEE754 later) from them.
I put the read values in Input_Word_1, Input_Word_21, Input_Word_21 etc just adding the number of registers read each time.

I am not sure I understand how the pitest and registers from process image actually works.

I want to read the registers from the sensors every 1 minute and write the values to a file.
I have configured the RTU Master correctly I think, but are the actual values stored in Input_Word_1, Input_Word_2, Input_Word_3.... etc naming words 1..20 or are the Input Words only pointers into a structure/array that I have to acces using the info in Input_Word_1, Input_Word_21, Input_Word_41 .. ??

Clarification ; I have used a loop writing Input_Word_$i where i goes from 1 to 20, but this tutorial - https://revolution.kunbus.com/tutorials ... tu-master/ seems to indicate that the input Input_Word_1 must be accessed and parsed to access the actual data ?
Attachments
xtended_data.png
xtended_data.png (56.45 KiB) Viewed 3389 times
revimg.png
revimg.png (625.71 KiB) Viewed 3389 times
Eduard
KUNBUS
Posts: 209
Joined: 18 Jun 2018, 16:16
Answers: 0

Re: Understanding the process image and pitest

Post by Eduard »

Hi,
Here you can find an explanation about PiControl, I think it will help you to understand it better.

Here is another example how you can access the process image with Python.
You can use for example the RevPiModIO2 library.

Before you can use this library, you have to install it first.

Code: Select all

„sudo apt-get update“
“sudo apt-get install python3-revpimodio2“
Here is an example of how to use the library.

Code: Select all

#!/usr/bin/python3
# -*- coding: utf-8 -*-
u"""Kleines Programm um zwei Eingänge zu prüfen und einen Ausgang zu sezten."""
import revpimodio2

# RevPiModIO instanziieren
rpi = revpimodio2.RevPiModIO(autorefresh=True)
rpi.handlesignalend()


def zyklus(ct):
    u"""Zyklusfunktion für Steuerung."""

    # Ausgang setzen wenn I_1 und nicht I_2
    if rpi.io.I_1.value and not rpi.io.I_2.value:
        rpi.io.O_1.value = True

    # Ausgang rücksetzen wenn I_2 und nicht I_1
    if rpi.io.I_2.value and not rpi.io.I_1.value:
        rpi.io.O_1.value = False


print("gehe in loop")
rpi.cycleloop(zyklus)
print("programm ende")
Post Reply