Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • slave: The address of the server to connect to
  • port: The port where the service is found
  • ref: the position to start
  • count: the number of bytes to read
  • function_code: The function to use: 2 = READ_INPUT_DISCRETES, 3= READ_MULTIPLE_REGISTERS, 4= READ_INPUT_REGISTERS;
  • unitid (integer): The id of the unit to use.

Depending on the function code, this operator needs different schemas in output:

READ_INPUT_DISCRETES: Return This operator always return a tuple with a BitVector attribute. (TODO: describe MEP-Functions: toLong, [], and subset, BitSet is interpreted from left to right)

READ_MULTIPLE_REGISTERS:Returns a tuple with a List<Integer> attribute.

READ_INPUT_REGISTERS: Returns a tuple with a List<Integer> attribute.

Code Block
languagepql
#PARSER PQL
#RUNQUERY
modbussource := RETRIEVE({
            transport = 'modbustcp',
            source = 'modbussource',
            datahandler = 'tuple',
            protocol = 'none',
            schema = [['value', 'BitVector']], // or [['value',List<Integer>]]
            options = [
              ['slave','localhost'],
              ['port','502'],
              ['ref','0'],
              ['count','4'],
              ['scheduler.delay','1000']
            ]          
          }        
        ) 

#PARSER PQL
#RUNQUERY
out1 = MAP({
            expressions = [
                'toLong(value)',
                'toLong(subset(value,0,1))',
                'value [0]',
                'value [1]',
                'value [2]',
                'value [3]',
                'value [4]',
                'value [5]',
                'value [6]',
                'value [7]'
            ]
          },
          modbussource
        )

...