Skip to main content
January 25, 2016
Solved

Connect Thingworx and PLC

  • January 25, 2016
  • 21 replies
  • 9831 views

Hi,

I'm trying to connect PLC and Thingworx via EMS.

In modbusExample.lua file, defining property for Thing is essential.

I put this property like this,

properties.Int16HoldRegExample = {value="300", dataChangeType="ALWAYS",pushType="ALWAYS", key ="holding_register/1/40001", handler="modbus_handler", basetype="NUMBER"}

But I can't connect.

Which URL does this "key" table mean?   PLC ,EMS or Thingworx Composer ?

please let me know information...

Best answer by PaiChung

The Modbus example is specifically for connecting using Modbus protocol.

You have a modbus protocol setup to your PLC?

the Key refers to the Modbus register that is to be read.

21 replies

PaiChung22-Sapphire IAnswer
22-Sapphire I
January 25, 2016

The Modbus example is specifically for connecting using Modbus protocol.

You have a modbus protocol setup to your PLC?

the Key refers to the Modbus register that is to be read.

January 26, 2016

I use Modbus package and set up modbus protocol to my PLC.

Is it ok that only modbus register is included in key contents,for example key = "40001" ?

22-Sapphire I
January 26, 2016

Unfortunately I'm not too familiar with how the modbus.lua is setup and how it processes the key that is put in.

Hopefully someone else can give some input on that.

1-Visitor
May 12, 2016

Hi,

I also facing problem on connecting IDEC to ThingWorx.

below is the result after I run ./luascriptresources

[ERROR] 2016-04-09 11:34:20,113 luaScriptProxy::execute: [1094014096] Error executing script modbus_handler, Error = Error: ...t/thingworx/MicroServer/etc/thingworx/lua/modbus.lua:104: module 'socket' not found:

        no field package.preload['socket']

        no file '/opt/thingworx/MicroServer/etc/socket.lua'

        no file '/opt/thingworx/MicroServer/etc/thingworx/socket.lua'

        no file '/opt/thingworx/MicroServer/etc/thingworx/lua/socket.lua'

        no file '/opt/thingworx/MicroServer/etc/custom/socket.lua'

        no file '/opt/thingworx/MicroServer/etc/custom/lua/socket.lua'

        no file '/opt/thingworx/MicroServer/etc/community/lua/socket.lua'

        no file './socket.lua'

        no file '/usr/local/share/lua/5.1/socket.lua'

        no file '/usr/local/share/lua/5.1/socket/init.lua'

        no file '/usr/local/lib/lua/5.1/socket.lua'

        no file '/usr/local/lib/lua/5.1/socket/init.lua'

        no file '/opt/thingworx/MicroServer/etc/thingworx/clibs/socket.so'

        no file '/opt/thingworx/MicroServer/etc/custom/clibs/socket.so'

        no file '/opt/thingworx/MicroServer/etc/community/clibs/socket.so'

        no file './socket.so'

        no file '/usr/local/lib/lua/5.1/socket.so'

        no file '/usr/local/lib/lua/5.1/loadall.so'

[ERROR] 2016-04-09 11:34:20,118 luaScriptProxy::app_unlock: [1094014096] Attempt to unlock app_mutex while not holding it.L= 0x1141f0

hope someone can help.

thanks in advance

5-Regular Member
May 12, 2016

Eric, what version of the MicroServer are you using? Do you have the Modbus package with it as well?

1-Visitor
May 12, 2016

Hi,


Thanks for your fast reply. Sorry that i am very new to Thingworx.

How to check the version? The modbus package is that something like mobusscript.lua?

Fyi, i had actually downloaded the EMS to Syslink Systech SL-3000.