Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Desktop SCADA Application - Reading and Writing to PLCs through C++

Tags:

c++

tcp

plc

scada

I did my best to search all topics regarding to SCADA and developing your own C++ desktop application to communicate with PLCs, but could not find any recent, or in my opinion, relevant topics that fit what I needed. If I missed them, a link to them would be very much appreciated. If I also happened to post this in the wrong section, or you can think of a better section for me to post this in, I will take it there.

With that said, I thank you in advance for taking the time to read my questions, and appreciate any input you have to offer.


A little bit about what I'm doing

I'm currently in school for electromechanical engineering, and for my final year project I am developing a desktop application in C++ to monitor PLCs we have located within one of our labs.

Within this lab, I have a pre-existing ethernet network connecting all PLCs to single point, which I am tying into with a PC, and will be doing all my work from there.

I will be developing the application in Qt for an easy way to design the GUI, and giving me access to the QNetworkInterface as well as QTcpSocket.

With that said, I wouldn't go as far as saying I'm an experienced programmer, but I have been fooling around with a few languages (i.e.: python, c++, c, php) for quite a few years, and am still learning, considering the learning NEVER stops.


My questions

  1. Is there any reference material I can read, that you can suggest, on the subject to more easily understand what sort of process I need to go through to receive information (i.e.: individual I/Os, status bits, tags, logs, etc...) from the PLCs directly, and not through an OPC server?

  2. If an OPC server is required, I've never dealt with OPC links other than using Rockwell Automations RSLinx to grab tags and display their values within excel (I had created a prototype using that exact method to start, but would like to move away from excel, and if possible, the OPC server (RSLinx) as well). What would you suggest to someone who knows nothing about the subject of OPC servers, or to my knowledge, OPC in general?

  3. Have any of you previously written your own application to do something similar, if not of the same nature to what I'm trying to accomplish?

  4. What advice or suggestions would you give for someone who is attempting this type of project?


PS: As a start for this project, I would initially just want to get the reading of the I/Os (tags or addresses) to view what their current values are (closed or open for inputs, energized or not for outputs). But eventually I would also like to be able to write values to tags on the PLCs I'm monitoring based on the values I've received from them.

PSS: I would like to note again, that I am still a student, and am still learning about this subject in it's entirety. I would just like to ask for your patience, as I may not grasp things completely the first time!

If I've missed any information you feel is pertinent to be able to provide an answer, please let me know! I will do my best to come up with said information in a timely manner!

Thank you!


EDIT #1: Added in another question, and altered my first question slightly

EDIT #2: Fixed up question 2

like image 561
Josh Avatar asked Dec 25 '22 15:12

Josh


2 Answers

IMHO a SCADA program should have as a minimum requirement to be able to connect to an OPC server. OPC is used for most commercial PLCs.

Strictly speaking there is no need to have an OPC server/client approach but it gives you flexibility and gives you an abstraction model. If you want to directly connect to PLCs using a protocol then that is of course possible as well. You then need to know more details about the protocols and their various versions.

Yes I worked for a few years in a team that developed a commercial SCADA application.

It is very easy to get lost in details in such a project so try to keep things as simple as possible. By using OPC you will save time instead of fiddling directly with the protocols. You could add the ability to add custom-drivers for other protocols - depending on your timeframe. Try to model up your project before you start coding to a birdsview of the model and avoid getting lost in the details.

like image 186
AndersK Avatar answered Jan 13 '23 11:01

AndersK


I would stay well away from looking to write your own code to connect directly to an AB PLC - there are products out there that you can use in your application: http://www.rtaautomation.com/software/ethernetip/client/tagc/ControlWin.html http://www.automatedsolutions.com/products/dotnet/ascomm/

You would be better to use OPC - you can write you own OPC client if you want and follow examples you find here: http://www.opcconnect.com/source.php#freesource

According to this http://www.control.com/thread/1026173407 you should be able to get source code of Kepwares OPC Quick Client.

It would probably be easier to just use a library as in this example (RSLogix,C#): http://www.mesta-automation.com/opc-client-with-c-an-how-to-video/

You might find this of use: http://www.rockwellautomation.co.kr/applications/gs/ap/GSKR.nsf/files/rslinxsdk_ma_eng.pdf/$file/rslinxsdk_ma_eng.pdf

Some resources: http://www.opcconnect.com/ , http://www.mesta-automation.com/

like image 33
A Murray Avatar answered Jan 13 '23 13:01

A Murray