11 Replies Latest reply on Apr 26, 2016 5:22 AM by pkeckes RSS
    jasonpe Explorer

    Modbus Driver

    When using Modbus over TCP we discovered that coils could not be set. I found some bugs in the way that the code was creating the frame for setting single coils and single registers. I'm putting the fixed modbus.lua into my repository, it can be used if anybody else if having trouble with coils or single registers. I suggest that the dev team take a look at the changes and consider pushing it into a new release.


    Thanks,

    Jason



      • Re: Modbus Driver
        anishi Explorer

        Hello Jason

         

        That sounds nice for me.

        Could you share your revised file to me, please?

          • Re: Modbus Driver
            jasonpe Explorer

            I uploaded the file to my repository on the old twc.thingworx.com platform. I can no longer log in to that platform and I cannot find where my repository would have been migrated to on this new platform. I am unable to find the revised file on my local computer so we might be out of luck. My hope is that my revised changes made it into the latest releases but I'm not sure if this is the case. Maybe someone from thingworx support can help with this?

          • Re: Modbus Driver
            patn Explorer

            Hi Jason

             

            We too had issues with coils in the Modbus implementation. It doesn't seem to have been fixed in source yet.

            Would you be prepared to share the updated Modbus.lua file with me too?

             

            Thanks,

            Patrick

              • Re: Modbus Driver
                aanjan Heavyweight Champ

                Is there any specific error with the coil?  Are you using a similar structure on your modbus template like the following to get them?

                 

                properties.Test = {key="coil/9/61?format=Uint16", handler="modbus_handler", basetype="NUMBER"}

                  • Re: Modbus Driver
                    patn Explorer

                    Hi Aanjan

                     

                    I don't have the config. to hand but I suspect we used the same format as provided in the modbus_example.lua file.

                    One of my guys searched out docs, KB and community posts and didn't find any further instruction - beyond that given in the example files.

                     

                    Thanks,

                    Pat

                    • Re: Modbus Driver
                      khorie Newbie

                      Dear Aanjan


                      Could you provide the download link for the updated modbus package ?

                       

                      I downloaded it from the link you mentioned in the following article.

                      https://community.thingworx.com/message/2618#2618

                       

                      But it seems this module is old one.

                      I am having trouble to start up the modbus module and want to try the latest modbus package.

                       

                      Your prompt response would be greatly appreciated.

                      Thank you,

                      Kunio

                    • Re: Modbus Driver
                      jasonpe Explorer

                      Unfortunately the file was in my repository which appears to be missing now that the community site has been upgraded. I compared the latest modbus file provided by TW with the latest I have and it appears my changes have been merged.

                    • Re: Modbus Driver
                      darrenba Newbie

                      What about using a Kepware server?  Modbus Suite for KEPServerEX | Kepware

                        • Re: Modbus Driver
                          patn Explorer

                          Thanks all for the responses. We will check for the updates to the Modbus_handler.lua relating to the coils.

                           

                          We have used Kepware products for years and years, which are great, and allow you to use the ThingWorx OPC DA SDK for connectivity instead. They are, however, quite an expensive license cost per node. This makes it very costly to scale out for many assets.

                        • Re: Modbus Driver
                          pkeckes Explorer

                          Hi all, I have done some digging around and manage to get Modbus working. It's workaround for the coils and discrete inputs, but it's let you to read them and also control coil. It's using Uin16 format except of bits, then be aware, when implemented in TWX, not true/false is shown, but 0/1. And same is with entry. This also allows you to change holding registers. Please feel free to try attached example and let me know id is working for you: https://onedrive.live.com/redir?resid=164BA8CE410AFBB!640&authkey=!AI_pwRLziipDdv8&ithint=file%2czip

                          All is based on localhost connections, then don't forget to change as your application require.