mtconnect / adapter

MTConnect adapter framework
90 stars 76 forks source link

Using the Modbus Adapter #23

Open sstencel opened 2 years ago

sstencel commented 2 years ago

I've managed to create my MTConnect via the C++ agent, and was wondering how I might go about adding this Modbus adapter to read and record some data. I see that there is a master.rb ruby file that I'm guessing might act as the adapter, but it keeps giving me an error when I try to run it.

<internal:C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- serialport (LoadError)
        from <internal:C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'

if anyone has any advice on getting this setup, it would be greatly appreciated.

wsobel commented 2 years ago

Which subdirectory are you working out of? I'm not sure what you're using to get this error?

Sorry, my previous answer assumed you were referring to the new agent.

sstencel commented 2 years ago

the directory that I was attempting to run master.rb from was C:\Users\pcadm\source\repos\adapter\modbus. Here's the error again with a bit more information

C:\Users\pcadm\source\repos\adapter\modbus>master.rb
<internal:C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- serialport (LoadError)
        from <internal:C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from C:/Users/pcadm/source/repos/adapter/modbus/master.rb:35:in `<main>'

I cloned the Adapter repository from Github, and have been working out of it. I thought I'd try to get it working alone before trying to implement it with the C++ agent. Do I need to add it to the Dot_Net_SDK Solution somewhere to make it work?

wsobel commented 2 years ago

I haven’t looked at this code in 12 years, but I think it was only for testing and not required by the C++ adapter. The C++ adapter connects to source. If you have built it, configure the serial port in the yaml file and then see if you can connect to TCP port 7878. If it can make the serial connection, it should begin streaming data as it changes.

It appears this version only supports modbus over serial, not TCP.

Best, W

On Aug 23, 2022, at 10:37, sstencel @.***> wrote:

the directory that I was attempting to run master.rb from was C:\Users\pcadm\source\repos\adapter\modbus. Here's the error again with a bit more information

C:\Users\pcadm\source\repos\adapter\modbus>master.rb <internal:C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in require': cannot load such file -- serialport (LoadError) from <internal:C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:inrequire' from C:/Users/pcadm/source/repos/adapter/modbus/master.rb:35:in `

' I cloned the Adapter repository from Github, and have been working out of it. I thought I'd try to get it working alone before trying to implement it with the C++ agent. Do I need to add it to the Dot_Net_SDK Solution somewhere to make it work?

— Reply to this email directly, view it on GitHub https://github.com/mtconnect/adapter/issues/23#issuecomment-1224430536, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ6BCLLYXRP6FQIKVFSBM3V2UD7BANCNFSM57MEJTZA. You are receiving this because you commented.