Class: ModbusPollerTCP

Inherits:
Object
  • Object
show all
Includes:
ModbusPoller
Defined in:
lib/LMG_modbus.rb

Overview

Class to poll modbus TCP interfaces

Constant Summary

Constants included from ModbusPoller

ModbusPoller::XLUP

Constants included from Test

Test::REGISTER, Test::RESULT_POS1, Test::RESULT_POS2, Test::RESULT_POS3, Test::RESULT_POS4, Test::WRITE_VAL_POS1, Test::WRITE_VAL_POS2, Test::WRITE_VAL_POS3, Test::WRITE_VAL_POS4, Test::XLUP

Instance Method Summary collapse

Methods included from Test

#close, #create_test, #open_result, #run_modbus_write

Constructor Details

#initialize(slave_addr, ip, path_to_base_ss, path_to_modpoll, encapsulation = 'rtu') ⇒ ModbusPollerTCP

slave_addr

the address of the modpoll server.

ip

the ip address of the modpoll server.

path_to_base_ss

the spreadsheet that contains the modbus datapoints to poll.

path_to_modpoll

the path to the modpoll executable.

encapsulation

whether or not to use encapsulated RTU over TCP



280
281
282
283
284
285
286
287
288
289
290
# File 'lib/LMG_modbus.rb', line 280

def initialize(slave_addr, ip,path_to_base_ss,path_to_modpoll,encapsulation='rtu')

  prepare_test(path_to_base_ss,path_to_modpoll)
  case encapsulation
  when 'enc' then @base_cmd = 'modpoll -o 5.0 -p 8002 -1 -m enc -c '
  else @base_cmd = 'modpoll -o 5.0 -1 -m tcp -c ' #TODO This should get more specific or use an optional argument
  end

  @slave_addr = slave_addr
  @target = ip
end

Instance Method Details

#runObject

Call run to begin the test



292
293
294
# File 'lib/LMG_modbus.rb', line 292

def run
  super
end