Netduino and OPC
#1
Posted 07 August 2011 - 06:41 PM
#2
Posted 07 August 2011 - 09:31 PM
welcome to the Netduino forums!
An OPC server is usually a gateway between some device that supports a proprietary communication protocol (e.g., a PLC), and client applications on a Windows network. Any client that supports the OPC protocol can then access measurements from the device, send setpoints to the device, and receive alarms from the device. As an industry standard, at least these basic elements of OPC have been very successful.
OPC is based on Microsoft's older Component Object Model, therefore a computer that supports an OPC server (i.e., a COM server) needs COM support, or rather its network-version DCOM (Distributed COM). This is quite out of the question for a Netduino. You'd better stick to an embedded Windows computer if you want to use the original OPC protocol.
There is the newer OPC UA specification, which does not rely on DCOM but on Web services technologies such as SOAP. However, this is a far more ambitious specification than the original OPC. It goes all the way to modeling automation systems, and one add-on specification is currently being created for PLC interfacing. Even though the specification is somewhat modular, I wouldn't expect an implementation for even the smallest possible subset to be feasible for a Netduino. From the perspective of OPC UA, a "small" embedded computer is orders of magnitude more powerful than a Netduino.
For some companies, OPC UA was too much, so they created what is now called OPC .NET 3.0. It is basically a .NET oriented version with the original scope of OPC. However, it requires the Windows Communication Foundation (WCF), so is probably out of reach as well.
Just to put things in perspective: a Netduino Plus is too resource-limited to run SSL.
However, if you don't mind unencrypted communication (which most people in industrial automation are somewhat allergic to), you could use some plain vanilla REST server with HTTP instead of OPC. This is perfectly within reach of a Netduino Plus. IMHO, in many cases it is the better architectural approach anyway, due to its platform independence, scalability to (relatively) small embedded devices, and natural integration with the world-wide web.
Best regards
Cuno
#3
Posted 11 August 2011 - 04:30 PM
OPC UA runs on this:Even though the specification is somewhat modular, I wouldn't expect an implementation for even the smallest possible subset to be feasible for a Netduino. From the perspective of OPC UA, a "small" embedded computer is orders of magnitude more powerful than a Netduino.
http://embeddedlabs....rvermodule.html
The .NET SDK uses .NET 3.5. WCF is not required for the binary protocol.For some companies, OPC UA was too much, so they created what is now called OPC .NET 3.0. It is basically a .NET oriented version with the original scope of OPC. However, it requires the Windows Communication Foundation (WCF), so is probably out of reach as well.
OPC UA has REST + UA Binary option now. No SOAP, No XML, No Security. Runs in Silverlight.However, if you don't mind unencrypted communication (which most people in industrial automation are somewhat allergic to), you could use some plain vanilla REST server with HTTP instead of OPC.
I would be happy to work with you or anyone who is interested in getting OPC UA to run on your board.
Randy Armstrong
OPC Foundation
#4
Posted 11 August 2011 - 06:18 PM
#5
Posted 12 August 2011 - 12:45 AM
#6
Posted 12 August 2011 - 09:49 AM
The new Netduino Plus beta firmware has 38KB of RAM available for the application. Not quite enough to put aside 64KB for another protocol stack, unfortunately.There are companies selling DA-only implementations that run in 64KB of RAM.
I will have to check on the ROM footprint but I assume it is the same order of magnitude.
Of course, if you eliminate the .NET Micro Framework entirely, then such a protocol stack might well fit on a Netduino Plus. Could be a very interesting project to run an OPC server on the bare metal, with little or no operating system!
As for the REST question, I have downloaded the current version of the OPC UA specifications, and will take a look at the new HTTP features. I hope that HTTP GET is also supported. At least for data access, so that the Web's caching magic works.
Yes, I would indeed avoid XML on a small device. Even if some efficient binary encoding were used, you still need an XML parser. Unless you only produce XML, never consume it.You can use XML bodies but I am assuming that XML on small devices is not desireable.
During the Getting Started with the Internet of Things project, the most unpleasant experience for me was that I learned to not rely on port forwarding for its target audience of makers. I got so unambiguous feedback (thanks, Corey :-) in this respect that I rewrote much of the book and used another approach to solve the firewall/NAT issue.The NAT firewall traversal is part of the architecture but assumes you have port forwarding enabled if a server is behind a NAT firewall.
For professional automation projects, this was obvious much earlier. If you ask an IT administrator to open an incoming port, to make your devices accessible as servers over the Internet, he will often just say "no" without further discussion. Sometimes, we think ourselves lucky if the network admin is even willing to only open an outgoing port with a predefined list of IP addresses (whitelist), to which the device may open a connection as a client. You cannot assume VPNs either, especially for small devices like the Netduino for which there simply are no VPN clients.
What this means is that an Internet-oriented automation architecture fundamentally cannot assume that incoming ports are available. Simply cannot.
That's why we had to find another solution for the firewall issue, but that's probably a bit out of scope here. It is definitely possible to solve the problem for OPC UA as well though.
Best regards
Cuno
#7
Posted 12 August 2011 - 10:39 AM
#8
Posted 12 August 2011 - 11:26 AM
Ok. A lot of IA applications have higher price points and can afford more RAM. It may make more sense to have a UA server that can be a gateway for a network of these devices that be on the device itself.The new Netduino Plus beta firmware has 38KB of RAM available for the application. Not quite enough to put aside 64KB for another protocol stack, unfortunately.
You need to get V1.02 which is not posted yet. Members can find drafts here (Part 6):As for the REST question, I have downloaded the current version of the OPC UA specifications, and will take a look at the new HTTP features. I hope that HTTP GET is also supported. At least for data access, so that the Web's caching magic works.
http://lists.opcfoun...5-2F2FC9333917}
Why would you need an XML parser?Yes, I would indeed avoid XML on a small device. Even if some efficient binary encoding were used, you still need an XML parser. Unless you only produce XML, never consume it.
If there is a business case for external communication then the IT must open ports to something. Whether it is some gateway or the device itself is TBD.What this means is that an Internet-oriented automation architecture fundamentally cannot assume that incoming ports are available. Simply cannot.
#9
Posted 12 August 2011 - 01:13 PM
If I use a binary encoding for my XML documents, e.g., Efficient XML Interchange (EXI), I win by reducing the amount of data I send around. But on the device, I still need some kind of parser for this format. Since it has a shorter input "text" to process, it may be faster than a normal XML parser, but it is still not a trivial program.Why would you need an XML parser?
If XML on the device is really important for some reason, though, one can certainly use such an approach. But if I have the choice, I personally prefer to use an efficient non-XML binary protocol, as you do with OPC UA on these low-end devices that you pointed out.
If you mean allowing outgoing connections to something, absolutely. This is usually possible. Sometimes by default, then people don't even need any cooperation from IT administration. The client devices simply connect out to some server on the Internet. No problem here.If there is a business case for external communication then the IT must open ports to something. Whether it is some gateway or the device itself is TBD.
In our experience, this is far less straightforward in practice for incoming connections, i.e., for devices as servers. But maybe we address different use cases and different types of customers. For example, assume company X sells devices to thousands of customers around the world: to large companies, small companies, government organizations, maybe even consumers. Now X wants to offer a remote monitoring service to its customers, e.g., to detect possible malfunctions of devices before they actually occur, in order to reduce costly downtimes of the device. The devices of many customers are connected to X through mobile phone networks, using different network operators in different countries.
Then X would not only have to convince (and maybe help) its customers to open up incoming ports in all their networks, it would also have to negotiate with all the involved mobile phone operators to allow opening connections to devices on the networks. On nearly all mobile networks, a phone (or a Netduino with a GSM modem) can connect "out" to the Internet, but no one can connect "in" from the Internet to a phone or Netduino that's on the mobile network. Neither X nor its customers have control over the network operators' firewalls and NATs. Some of the mobile operators sell separate subnets where they allow incoming connections, but these can be prohibitively expensive.
As far as I can tell, these hassles are simply too much for the companies of type X that I have met. Moreover, such services are innovations with which X necessarily has little or no prior experience, and so the business cases are less clear-cut than in more traditional settings like plant monitoring within a single company.
Wouldn't it be wonderful to use an approach where companies and their IT departments don't have to worry about opening potential security holes in their networks? And where makers are not required to find out whether it is possible to enable port forwarding on their home routers, and how to do it?
Anyway, as for OPC on Netduino, you really answered the original question:
Thanks for your inputs here - it is great to meet OPC guys on this kind of forum!It may make more sense to have a UA server that can be a gateway for a network of these devices that be on the device itself.
Cuno
#10
Posted 12 August 2011 - 01:43 PM
Yes!Pardon me for the question, but a small device like Netduino wouldn't be more feasible to *act* as a PLC, instead *serving* a PLC?
Usually it needs a PC to aggregate (and elaborate) the data coming from 1+ PLC, so...how could a Netduino fits the needs of a even small SCADA?
Thank you all.
Cheers
In an ideal world, it would be possible (and cost nothing) to connect every PLC and Netduino etc. directly to the Internet, and a SCADA system that fetches measurements from all these devices over the Internet (well, if the data is not time- or safety-critical). Then the PLCs and Netduinos and SCADA systems would have to support some common standard, let's say OPC UA.
In reality, it makes more sense to have a PC or the like as aggregator for several devices, as you said. If this aggregator is powerful enough, it could translate between the OPC UA standard protocols and the PLC's/Netduino's proprietary formats. (Especially if these formats were designed to facilitate the translation.) Such a gateway scenario is the original OPC standard's primary use case. Because of COM, it required a Windows PC. With OPC UA, this restriction doesn't exist anymore. But as Randy pointed out, a Netduino is not necessarily a good choice for such a gateway.
Best regards
Cuno
#11
Posted 23 August 2011 - 02:33 PM
Yes!
In an ideal world, it would be possible (and cost nothing) to connect every PLC and Netduino etc. directly to the Internet, and a SCADA system that fetches measurements from all these devices over the Internet (well, if the data is not time- or safety-critical). Then the PLCs and Netduinos and SCADA systems would have to support some common standard, let's say OPC UA.
In reality, it makes more sense to have a PC or the like as aggregator for several devices, as you said. If this aggregator is powerful enough, it could translate between the OPC UA standard protocols and the PLC's/Netduino's proprietary formats. (Especially if these formats were designed to facilitate the translation.) Such a gateway scenario is the original OPC standard's primary use case. Because of COM, it required a Windows PC. With OPC UA, this restriction doesn't exist anymore. But as Randy pointed out, a Netduino is not necessarily a good choice for such a gateway.
Best regards
Cuno
So let me see here. We could have a machine that talks to various devices using a protocol they understand, and then presents it in a normalized protocol to a machine that records and aggregates all this I/O. Maybe we could call them an I/O server and a Historian. That would be some wonderful software. We could call it, um, Wonderware. Ja, that's it. AHHHHHHHHHHHHH!!! It hurts!!! It's too late for me. Turn back while you still can!
Yes, indeed, we have a common task to achieve, and an industry with a handful of players, all solving the problem with the same broad strokes, but subtly different details. It is time for me to look back into OPC UA again (it's been a couple of years for me, too), since I tire of working in a Babble of Wonderware, Modicon, and Allen-Bradley (with a few others too weird to mention.)
Oh, and to be vaguely on topic, I am meandering toward using my N+ as the PLC for my ranch (open the gate, monitor starts and stops of the well, etc.) I have this new wheel I'm working on, I think I'll call it Supervisory Control and Data Acquisition, or maybe something like that ;-)
Cheers,
Siggy
#12
Posted 10 July 2012 - 07:12 PM
A Netduino could serve as a data concentrator bringing in IO and serial data from other devices then talk OPC directly to a PC. This may not be possible now but the next version will surely have more power and RAM.
Please help me understand, are there other more secure ways to communicate to a netduino through a firewall that does not entail opening a port? Does opening a port to communicate with a Netduino using OPC pose more of a security risk than opening a different port to communicate with the Netduino in any other way?Wouldn't it be wonderful to use an approach where companies and their IT departments don't have to worry about opening potential security holes in their networks? And where makers are not required to find out whether it is possible to enable port forwarding on their home routers, and how to do it?
#13
Posted 04 March 2013 - 09:16 AM
There is definitely a case for an OPC-client on a Netduino NETMF (plus or 2). Can anyone point to sources, a port, or sample?
Thanks!
Rich
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users