adccommunitymod (AutomationDirect) asked a question.

Click PLC Project

Created Date: April 13,2014

Created By: a_rishi

**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****

Hi Actually I'm planning to do my Final Year Project using Click PLC for a Wastewater Treatment Plant. The aim of the project is to automate the plant i.e the Aeration system using a DO transmitter and VSD connect to PLC using Modbus. In addition, control the sludge removal, recirculation and regulate the soilds in the system. Furthermore, I would like to connect an HMI using Modbus to the PLC. And either the HMI to an SCADA located at a Sub-Office or connect an SCADA directly to the Click PLC which we can poll the PLC to retreive data and the PLC poll the SCADA in case of an alarm. I would be glad, if someone could guide me on this project, ideas how to do the liaison of the PLC and the SCADA or any tips that may be helpful to me. The main part of the project is the remote viewing of the system. Is it possible to use a web browser. Thanks


  • adccommunitymod (AutomationDirect)

    Created Date: April 16,2014

    Created by: AlbertL

    Sounds like a fun project!

    I'm working on a home-automation project that has some aspects similar to your project, so I might be able to help.

    My system uses a Click PLC as the controller, and an Apache web server for remote access. The server talks to the PLC via Modbus TCP through a Modbus-Ethernet gateway, which connects the PLC's serial port (using Modbus RTU protocol) to my LAN. The server runs PHP for application programming and MySQL for data storage and retrieval.

    The application software uses the PHPModbus package to issue Modbus commands. I wrote (actually, I'm still writing - it's not finished yet) an object-oriented PHP class which allows a program to read and write Click registers by Modbus address, Click address, or nickname.

    For example, to read the scan counter, I would first create a Click PLC object using the gateway address, the PLC's Modbus unit number, and optionally the name of a CSV file containing the PLC program's nicknames, exported from the Click programming software:

    $plc = new ClickPLC( "192.168.1.3 ", 1, "nicknameFileName " );

    Then I can read the desired register either by Click address:

    $scan_counter = $plc->readFromClickAddress( "SD9 " );

    or by nickname:

    $scan_counter = $plc->readFromNickname( "_Scan_Counter " );

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: April 17,2014

    Created by: a_rishi

    Help

    Hi

    Would you please share your project. It will be helpful for me to understand the clickplc programming particularly the communication and the modbus part.

    Thank You in advance.

  • adccommunitymod (AutomationDirect)

    Created Date: April 17,2014

    Created by: AlbertL

    Sure, I'll try to do that this evening.

    One thing I should point out is that my approach, using Modbus TCP, requires a Modbus serial-to-Ethernet gateway device since the Click doesn't have a built-in Ethernet adapter. If you have a project budget this may be a concern.

    I'm using a GridConnect adapter ( http://gridconnect.com/industrial-protocols/modbus/modbus-rs485.html ), and Automation Direct offers one ( http://www.automationdirect.com/adc/Shopping/Catalog/Communications/Serial/Serial_Isolators_-a-_Converters/MB-GATEWAY )

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: April 18,2014

    Created by: AlbertL

    My apologies, I ran late yesterday and wasn't able to post the files - will do so this afternoon or evening.

  • adccommunitymod (AutomationDirect)

    Created Date: April 19,2014

    Created by: AlbertL

    I 've attached the files for my (extremely) incomplete home automation project. Here's an overview:

    TempLog3.ckp is the PLC program. All it does is logs data from a rain gauge, and averages readings from a couple of temperature sensors. You'll notice that there aren't any rungs for remote communications - no programming is needed on the PLC side because the PLC operates as a Modbus slave. The only thing I had to do was set up the communications port with the right parameters for it to talk to the Ethernet gateway.

    homecontrol2.html is the client-side code for the user interface. It uses AJAX to periodically request data from the server, and displays it. screenshot.jpg shows a typical display. The buttons don't do anything :(

    This is the essential code to understand:

    xmlhttp.open( "POST ", "plcMonitor1.php ",true);

    xmlhttp.setRequestHeader( "Content-type ", "application/x-www-form-urlencoded ");

    reqText = "01=DS7&02=DS5&03=DF106&04=DF206&05=SD24&06=SD25&07=SD26& ";

    xmlhttp.send( reqText )

    Note the list of Click addresses in the reqText string - this is how the client tells the server what data to retrieve from the PLC.

    plcControl1.php is the program running on the web server which parses requests from the client, reads the requested data from the PLC, and sends the data (as a JSON object) to the client. It creates an instance of the clickPLC object, and calls the readFromClickAddress method to read the content of each Click address requested by the client.

    clickPLC.php is the object-oriented PHP class which reads and writes data in the PLC registers. It uses the Phpmodbus package to implement the various Modbus function codes.

    In addition to reading and writing the Click registers, an important function of clickPLC is converting Click addresses to the corresponding Modbus addresses, which are passed to the appropriate Phpmodbus method for the desired function code. This is done by the clickToModbusAddress method, using a combination of table lookup and calculation.

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: April 19,2014

    Created by: AlbertL

    Oops, sorry - forgot to attach the files. Here they are:

  • adccommunitymod (AutomationDirect)

    Created Date: April 21,2014

    Created by: a_rishi

    Thanks

    Hi

    Thank you very much.

    Regards

  • adccommunitymod (AutomationDirect)

    Created Date: May 25,2015

    Created by: MikeMc

    ADC Modbus Gateway

    Been using the MB Gateway from ADC for years to get Ethernet access to any device that did not support TCP Modbus. Works like a dream.:)

  • adccommunitymod (AutomationDirect)

    Created Date: April 13,2014

    Created by: a_rishi

    Hi

    Actually I'm planning to do my Final Year Project using Click PLC for a Wastewater Treatment Plant. The aim of the project is to automate the plant i.e the Aeration system using a DO transmitter and VSD connect to PLC using Modbus. In addition, control the sludge removal, recirculation and regulate the soilds in the system.

    Furthermore, I would like to connect an HMI using Modbus to the PLC. And either the HMI to an SCADA located at a Sub-Office or connect an SCADA directly to the Click PLC which we can poll the PLC to retreive data and the PLC poll the SCADA in case of an alarm.

    I would be glad, if someone could guide me on this project, ideas how to do the liaison of the PLC and the SCADA or any tips that may be helpful to me. The main part of the project is the remote viewing of the system. Is it possible to use a web browser.

    Thanks

    Expand Post