Start and Stop a PLC Application using a Command Line Tool

The following describes the process by which you may start and stop a KAS project  from an external device (such as an HMI"Human-machine interfaces " Also known as computer-human interfaces (CHI), and formerly known as man-machine interfaces, they are usually employed to communicate with PLCs and other computers, such as entering and monitoring temperatures or pressures for further automated control or emergency response) using HTTP communications. This method uses cURL (http://curl.haxx.se), a popular command line tool for performing HTTP communication with a server. Two HTTP requests will be sent, the first to authenticate, the second to start the application.

curl.exe -X POST -d "username=administrator" -d "password=administrator" -G http://203.0.113.0/authorize/login -c cookie.txt
curl.exe -X PUT http://203.0.113.0/kas/state?newstate=started -b cookie.txt

The first request is a POST used to provide credentials to the webserver. The cookie received from the server is stored in a temporary “cookie.txt” file. This will be used in the second request. The username, password, and IP address will need to be customized for your system.

The second request starts the application using a HTTP PUT request. The -b cookie.txtat the end is used to add the authentication cookie received after the first request. The IP address will need to be customized for your system.

To stop the system a similar set of commands is used.

curl.exe -X POST -d "username=administrator" -d "password=administrator" -G http://203.0.113.0/authorize/login -c cookie.txt
curl.exe -X PUT http://203.0.113.0/kas/state?newstate=stopped -b cookie.txt

 


Stay Connected with Kollmorgen

Copyright © 2015 Kollmorgen™