I have some questions about implementation of OPC :
Can I write my own OPC server and OPC client for a PLC that want to send and receive real-time data to the server ??
How much is easy for a undergraduate student ??!!
Or can I use free software for the server (for example "MartikonOPC Explorer") and for the client to connect to the PLC ??
Which Programming language can I use ?
======================================
review :
PLC model : Delta
Can I write my own OPC server and OPC client for a PLC that want to
send and receive real-time data to the server ??
yes you can, sounds as if you only need OPC DA i.e. read/write of values.
How much is easy for a undergraduate student ??!!
It depends, if you want to implement OPCDA 3.0 then you would need some knowledge about COM which could be daunting if you haven't worked with it before. Normally when you create a OPC server you would use a framework from some vendor e.g. Matrikon but if you are on a tight budget you may need to do it all yourself.
Or can I use free software for the server (for example "MartikonOPC
Explorer") and for the client to connect to the PLC ??
You can use the Matrikon OPC explorer to connect to your OPC server but normally you want to embedd your client code in a program and do something with the values, the explorer is more for testing
Which Programming language can I use ?
For the server part C/C++, for the client part you are more flexible, any language that supports COM
Alternatively you could implement an OPC UA server instead, OPC UA is platform independent and pretty much language independent.
See more at opcfoundation.org
Depending on your skills the answer can be yes or no. The OPC foundation holds the standards and these are available to members.
Keep in mind that PLC's don't use OPC for communication, an OPC server uses the PLC manufacturers propriety protocol to be able to "serve" data to clients using OPC protocol.
To properly answer this question it needs a lot of clarification, how much is easy for a undergraduate student depends on what you study.
Which programming language to use, any you can find, what's your prefference.
Python is easy way and can do.
Only create global communication module (global for reuse).
Some problems :
1- More PLC brand use BUFFER for access (Delta not use).Need register first later can read (all EV values).
2-All inside a thread (not only one, per node threading)
3-Your resolution is 1/10 sec(for modbus over serial)
4-Need write a strong security program in PLC (otherwise claim a lot risk!)
5-Minimal communication line is 2(two)(when lose one, use other).
All programming language is a baby. If you feed a lot and love it, groove up faster.You can do ! Don't forget you got a baby!
Last time I checked Delphi was the only one to have both free OPC client and OPC server examples. I have made both OPC DA 2.04 servers and clients using sources from this page.
Related
I am new to OPC UA standard and being a java developer was trying to search for a good java library for the standard.
I cam across https://github.com/OPCFoundation/UA-Java and Eclipse Milo(or digitalpetri).
How does Eclipse Milo compare with UA-Java? which one should I choose?
My use case is to develop a NIFI(nifi.apache.org) custom processor that can read data from an OPC UA server like Kepware and channel that data into our bigdata store and later build analytics on top of it. I want to implement OPC features like subscription and historical data access as well in the processor.
I may be a little biased as I'm the primary author of Eclipse Milo, but you should use it because it's both a stack and SDK implementation of OPC UA where the code provided by the foundation is only a stack.
If you don't have extensive knowledge of OPC UA and time to write a lot of code that SDKs have typically already written then you don't want just a stack.
You might find these links on the subject helpful to your effort
https://community.hortonworks.com/articles/90355/collect-data-from-opc-ua-protocol.html
https://community.hortonworks.com/articles/88649/control-system-data-from-kepware.html
I have created a user interface in java which uses card layout. It basically shows a lot of readings in it which it receives through our company's local network. Now I had to write an OPC server in java so that all the readings my ui receives is stored onto that server. I successfully wrote it. My UI works awesome for almost a day but the next day when i come to office, I find my UI frozen, as in there is no more communication taking place. The UI stops receiving or transmitting numbers. When i run the UI without OPC, it goes on and on forever but its when i add OPC to it, that it freezes/ I have tried all sorts of stuff but I still have not been able to solve it. ANd yes, I have used Jnet Pcap to capture the packets in the UI. There is a huge amount of code in it so if anyone requires any specific code to look at, let me know.
This is really hard to follow. What is the exact problem that you are facing is still unclear.
The openSCADA website that has the free OPC implementation should be your best bet...
http://openscada.org/projects/utgard/
More over you can try the JEasyOPC client which is also free incipiently.
I am going to write a client/server card game for learning/practice purposes, and intend to use Java for both the client and server to begin with. In the future I will be looking to continue to use this project for learning, and thus will want write additional clients in other languages such as C and C++.
The main detail I am unsure about is whether I need to use a MOM with a message broker, or if I can get away without using one.
My initial thought was I could handle the failure to send/receive a message on both sides, prompting an attempt to re-send the message resulting into the game being ended if the amount of attempts reaches a maximum.
However, instead of just having the game client and game server I was thinking about having a client, lobby server and game server. This way I would need the message broker to route the correct messages to the correct server, however I am unsure whether apart from that if I have any need for message broker, as I'm not sure if I really need to have any facility for message persistency.
I am leaning towards going for a MOM with a message broker, but I would welcome anymore lightweight solutions if I am doing so unnecessarilly. That said, if I did what would be a suitable cross-language MOM to use? I have seen quite a few suggested on SO before, but I'm not sure what would best meet my needs.
For cross language MOM - I suggest you use Apache ActiveMQ. It complies to the JMS spec and also has a robust C++ client library. It is open source (Apache license)
Yes the other lightweight option you could explore is HTTP. esp. for the client to server communication. (Since clients may need to connect to the server across firewalls etc - HTTP port is easiest to access etc).
For lobby server - game server communication - I like your idea of MOM.
Where would I go to learn write code that had to be very, very secure and that DOES expose external services (running on a standard Windows or Linux OS). Knowing what services can and cannot be safely exposed would be part of the issue. Note that I am not looking for a favorite choice between Linux and Windows, as the choice is not likely to be mine to make in any given case. However the level of security needs to be military grade.
I almost feel embarressed giving this as a for instance, but how would I know whether or not I could use, say, WCF, in such a setting.
High security is a difficult concept as it generally involves way more than just the code you wrote.
Basically every layer of the OSI model has to be taken into consideration. Things like, preventing capture of the data stream (or it being rerouted) between the end points (quantum cryptography).
At the higher levels, you have things like various things like
Physical security of the devices (all endpoints if possible).
Hardening the OS (e.g: closing ports, turning off unused services, using kerberos, VPN tunnels, and leveraging white lists of machines allowed to connect, etc);
Encrypting the data at rest (file encryption), in transmission (SSL), and in memory (column/table encryption).
Ensuring and enforcing proper authentication and authorization at every level (in app, in sql, etc).
Log EVERYTHING. At a minimal it should answer "who/what/when/where/how"
Along with the logging, Actively Monitor it. aka: intrusion detection.
Then we can move on to other things like looking at other attack vectors like sql injection, xss, internal / disgruntled employees, etc.
And once you've done all of that be prepared when a hacker gets away with everything they want simply by social engineering.
In short, the best tact to take in order to secure any computer related application is to listen to the ethos of Fox Mulder, and Trust No One. Another favorite of mine that applies is: It's only paranoia if they aren't after you.
You could use formal methods to (sort-of) prove the critical parts of your software. A tool like Frama-C (free, LGPL license, targetting embedded systems) could be relevant (at least if your software is critical, embedded, written in C).
But military grade don't mean much. Your client will (and should) define exactly the standards to respect. For instance, critical [civilian] aircraft software needs to follow something like DO-178C (or its predecessor, DO-178B). Different industries have different standards similar to that. (both railways and medical industries have their own standards, which might be different in North America than in Europe).
If your system (& client) is less demanding (i.e. no billion dollars or hundreds lives threatened by bugs) you could consider customizing your compiler or using some other tool. For example, GCC is customizable thru plugins or thru MELT extensions.
Don't forget that software reliability has a big price (that means a big cost for you, hence for your client).
Well, the question of where can be answered simply. Not in school. I suggest to create a learning path for yourself. Pick a technology that you like and learn it inside out. A basic book to get you started should suffice, however the rest of the stuff you learn as you go, or via the documentation of that technology.
For instance - learning under .NET (Microsoft) involves a basic A-Press text-book (i suggest Pro C# and The .NET 4.0 Platform). Thereafter searching through the .NET Framework Reference on MSDN will give you the rest.
If you are looking for WCF reference, I suggest the (MCTS Exam 70-503, Microsoft .NET Framework 3.5 Windows Communication Foundation) and MSDN.
Just keep in mind that not a single technology will achieve what you are looking for. For example: WCF co-mingles with WF (Windows Workflow Foundation), as well as SQL Data Services and Entity Framework. Being exposed to multiple technologies will definitely broaden your vision.
===============================================================================
WCF is a beast in this regard. Here are the advantages over some other means of communication:
Messages (data) passed between end points can be secured via message-level security (encryption). The transport channel chosen can also be secured at protocol level via transport layer security (encryption).
End points themselves can authorize and impersonate clients (client level security). You can implement end-to-end service tracing, health monitoring & performance counters, message logging, as well as forward and backward compatibility with newer/older clients (via graceful degradation of the message format, provided in WCF). If you chose to do so, you can even implement routing as fail-safe for your communications channel. WCF also supports transactions (ACID), concurrency, as well as a per-instance throttling, giving you the most flexibility in writing secure/robust military grade code.
In retrospect the security and flexibility of WCF are astonishing. A similiar technology (if not the same) is the WS-Security spec. It is part of the WS-* specifications for web services and deals with Xml signature and Xml encryption to provide secure communications channel between two end points.
The disadvantages of WS-* however is that it is a one-way means of communication. WCF can facilitate 2 way communication. A client can send a request to a server, but also a server can send requests to the client. WS-* dictates that a client can only send and receive responses to the server, but not vice versa.
I am not a WCF developer so i thought the highlights might provoke you into doing your own research. "There are hundreds of ways to skin an animal, neither of them is wrong..."
I am currently working on a project that embeds a flash game, that uses Smartfoxserver for the flash communication. That communication is mostly just synchronizing the cursor and object movements between the two players.
Since I am not a flash guy, but a ruby programmer, I got curious: What kind of communication options does flash offer for this kind of time sensitive data exchange? I was thinking of writing a ruby-eventmachine based communication server to minimize the dependencies on external programs. Would that even be feasible?
Although I don't have a complete answer for you, because I'm not done myself, I have found myself in almost the exact same position as you.
My current approach is for my ruby server to essentially just be a socket server that handles all of the communication between clients, however I personally intend on keeping any of the logic outside of the server ( unless I run across a reason to change that idea).
If you haven't done any socket programming in ruby, I recommend the following as a jumping point. This is an IBM document on Ruby Socket programming and discusses an approach for asynchronous data:
Ruby Sockets - IBM
I think what it ultimately comes down to as well will be performance. I currently use a version of my ruby server in my daily work, but the data doesn't have to be updated in a time sensitive manner.
You can create a server in (almost?) any language that supports sockets and manage your clients with that.
From a flash perspective you could use ruby, but I don't know how fitted ruby would be for the task...I mean, you can make a PHP socket server but it would not handle much stress.
An alternative to SmartFoxServer could be open sourced Red5, written in Java.
If you want to know about flash built in capabilities in handling p2p:
Flash p2p: Everett Church
In Flash Player 10 adobe added Live media (RTMFP) support- Media was always sourced from the publishing peer. In Flash Player 10.1 beta they introduced groups and application-level multicast.
However, you would still need a server (Stratus) to handle introductions and manage active connections. ( Also, I regard it as geared towards flash video, Stratus does not support shared objects or scripting. So with Stratus, your applications will be clients communicating directly with each other.)
Edit:
After re-reading your question and the answer provided by Beanish, I think the first time I got your question wrong. So I just re-wrote my answer...