-1

I have a PLC Siemens s7-1500 that did not include the license for the OPC-UA server, in consequence I'm trying to look for alternatives because I need to link this PLC information to an OPC-UA server than will be then consulted by another OPC-UA client.

By the moment I have explored the python library python-opcua, but I am new to IoT and OPC-UA and I was hoping to get some guidance for continuing this implementation.

Best regards Alejandro

alejovelez41
  • 3
  • 1
  • 3

4 Answers4

0

Generally, I don't think it's very feasible to write your own OPC UA server for S7. Even with the help of a good SDK, it will not be a simple task to accomplish.

There are several software and hardware products in the market that provide OPC UA for S7, and although they are not for free, they are usually very much worth it, unless you don't count much value for your own work.

Jouni Aro
  • 2,099
  • 14
  • 30
  • Hello Jouni and thank you for your answer, I think in the short them it is not possible to buy the license for our project, that is why I am trying to explore other options. I have read that it would be necessary to code a driver via other protocol (for example Profinet, Ethernet/IP, Modbus, Fins, etc. ..) and then connect it with the OPC-UA coded server. Any thoughts or orientation about this way of approaching the problem? – alejovelez41 Jul 02 '20 at 07:12
  • Yes, @Stefan Profanter mentioned some freeware options that are probably the best, if you have no budget except your own work. But be prepared to use quite a while for it, although it might look simple at first. We have done something similar with Prosys OPC UA Modbus Server - and it took a couple of years to get it right, although we had a good level SDK on the basis. But it's a reliable and efficient commercial product now. So depends on the level that you need for your application. – Jouni Aro Jul 03 '20 at 08:58
0

OPC UA is a complex protocol, it is not easy to write your own server and it will also be complex to write the part that must communicate with S7 that is not related to OPC UA.

Siemens never published the protocol to communicate with S7, you can only find some 20 years old library that has very limited capabilities.

It will be much cheaper and much safer to buy the OPC UA license from Siemens, which I think I remember is not expensive, compared with the PLC price.

from56
  • 3,976
  • 2
  • 13
  • 23
  • Hello Lluis and thank you for your answer, I think in the short them it is not possible to buy the license for our project, that is why I am trying to explore other options. I have read that it would be necessary to code a driver via other protocol (for example Profinet, Ethernet/IP, Modbus, Fins, etc. ..) and then connect it with the OPC-UA coded server. Any thoughts or orientation about this way of approaching the problem? – alejovelez41 Jul 02 '20 at 07:10
  • You should be informed about the complexity of the OPC UA protocol, for example by downloading the thousands of pages of the specifications on opcfoundation.org, I think then you will understand the difficulty of programming your own server in a reasonable period of time. I think I remember that the price of the Siemens license is about $150, very little compared to the thousands of dollars that the PLC costs. – from56 Jul 02 '20 at 14:20
  • Profinet is the Siemens protocol that was never published, some libraries like Snap7 only have a limited access to the PLC data. Ethernet/IP is a protocol mainly used by Allen Bradley PLCs. Fins is exclusive for Omron PLCs, Modbus is a very simple protocol, but I don't know if S7-1500 supports it. – from56 Jul 02 '20 at 14:28
0

As other answers already mention, it's not the best option to write your own OPC UA server around a closed PLC as it is the case for the Siemens S7.

If you still need to do it, you can try out the following approach:

  1. Use the Snap7 Library (http://snap7.sourceforge.net/) with C++ to connect to the Siemens S7
  2. Use the open62541 OPC UA Stack (https://github.com/open62541/open62541) to wrap the code from previous step into an OPC UA Server
  3. Release everything on GitHub as Open Source to help others :)

There are some examples for OPC UA servers in open62541, which should get you started: https://github.com/open62541/open62541/blob/master/examples/tutorial_server_variable.c

Stefan Profanter
  • 6,458
  • 6
  • 41
  • 73
  • Hello Stefan, Thanks a lot for your answers. I see the approach that you propose but I would like to understand the difference with making a driver from protocols like Profinet, Ethernet/IP, Modbus, Fins, etc. as it was proposed in the answer you showed me earlier. In comparison, is there any advantage proceeding this way ? – alejovelez41 Jul 02 '20 at 13:22
  • The related question I showed you earlier is mainly related on how to get an OPC UA client for a Simatic PLC which already comes with an OPC UA Server. You are asking two different things and the answer depends on your use case. You can either create your custom OPC UA server which wraps custom protocols (Profinet, Modbus, ...) or you can create an OPC UA server which wraps the Simatic API. My answer here assumes the latter case but can also be applied to the first case. You just need to find libraries which implement the corresponding protocol. – Stefan Profanter Jul 03 '20 at 07:47
0

I have not done what you are asking on a Siemens S7 PLC but I have done it with many other PLCs using node-red.

There is a node for Siemens S7 PLC

CTGControls
  • 104
  • 1
  • 8