Writing control code on WAGO PFC200 PLC in C/C++ languages? - plc

I have a WAGO PFC200 750-8206 and was wondering if I can write my control logic code in C/C++. I know that WAGO uses codesys runtime and codesys only supports IEC languages, but WAGO claims that their PLCs support C/C++ programs. What I am not sure about is if they mean C/C++ applications in Linux or actual control code running inside codeys?
copy/paste from WAGO:
"Alternatively, the runtime environment can also be completely created by its own “C/C++” programs, permitting access to both the internal bus, as well as MODBUS, CAN and PROFIBUS."
https://www.wago.com/global/embedded-linux

Wago provide an SDK that will permit you access to the IO. Use this link to apply for access to the SDK

Related

Use python instead of Structured Text

I have a Codesys Project which becomes more and more complex.
Now I’m wondering if there is a python library that lets me do the programming part, I’m usually doing with Structured Text via Python?
Thank you
A
If you were using the Beckhoff platform which is very similar to Codesys I would have advised you to look into the ADS interface which helps interface PLC's with user space programs.
For Codesys there is also a proprietary interface called the PLC-Handler but it's not free of cost.
Since you have to pay one way or the other the approach I suggest is to buy the MQTT-Client for Codesys and write a Python-Client with one of the freely available libraries like the one of the eclipse foundatation: https://www.eclipse.org/paho/index.php?page=clients/python/index.php
The advantage of this approach is that once you've written the user space client you can interface with all PLC brands, since every major PLC brand offers an MQTT-Client library which you can use to write a small command and control PLC-Library for your PLC's.

Codesys CAA_File and SysFile library difference

What is the difference between Codesys CAA_File lib and SysFile lib? When to use CAA_File instead of SysFile?
SysFile
Makes a direct call to the CODESYS Runtime component. This API is used by the CODESYS Runtime to download program / open programs ETC.
Its very optimized in the sense that every function does a very well define task.
All the functions here a very low level.
CAA_File,
Uses a standardized API (defined by the CAA Workgroup), focused on the IEC Programmer needs.
It takes a more high level approach, giving you extra functionality that will not find in SysFile (but you can implement it yourself).
At the end, CAA_File ends up calling SysFile.
Depending on your target, you might not be able to use SysFile. Linux / Windows devices usually come with all the components.
I would use SysFile only if I wanted to create my own library or if I wanted to have a very efficient process, or if I didn't require any special protection / features.
If I wanted to keep things simple I would use CAA_File.
Source: I have integrated CODESYS Runtime into custom embedded platforms.

Codesys fatek programming

How can I write program in codesys (ST or IL) and put it on fatek FBs series PLC? It is posible? I was not use codesys before. I was using Ladder and other PLC (Omron, Unitronics, Simens, Schnider Electric).
In order to be able to program PLC with CodeSys, CodeSys RT (Runtime) have to be installed to the controller.
This RT environment acts as tiny OS. It includes all libraries and executables. For example you use function TON in your ST PRG. In order to execute it, there should be a library that define this function.
CoDeSys RT made to support all IEC 61131-3 standards which includes support for all ST, LD, SFC, CFC, FBD, IL. CodeSys RT is also licensed. So if PLC developer whats their controllers to be programmed with CoDeSys, they purchase 1000 licenses and install RT on 1000 PLCs.
So as you can already see that it is impossible to use other languages than one provided by FATEK.
As far as I knew, there is no any Fatek PLCs based on CoDeSys system.
For this reason, it's impossible to write program in CoDeSys to control them.
You only can use their own software as WinProladder.
Downloading website
All the Fatek PLC's just has ladder functionalities.
As far as I know there is no tool to convert Ladder code ST.
Unfortunately, you can just use ladder on Fatek.
You will need to have the codesys RT installed in the target and this will handle all the interactions with the underlining interfaces and drivers. Codesys RT doens`t only execute on system with an OS but also on embedded devices. With some targets you can actually purchase the codesys RT license (i.e. raspberry) and then to install it yourself, with commercial devices this is normally done at the factory when this is sold, as there are several different types of licenses (RT, visu, webvisu) with different pricing.
Codesys is not an open-source and you will need to pay for the licensing, either yourself or this will be passed through the manufacturer added on top of the cost of the hardware.

How to write an application like skype as a Browser plugin?

What technology, frameworks, programming languages are involved? Must support for tcp inbound and outbound connections, read webcam and mic data.
Browser plugins have access to the operating systems native APIs, so there is no major difference to a stand-alone application regarding camera-, audio- and network-access. What you have to be aware of though is that your code might run in a less privileged process.
For Internet Explorer you will have to write content extensions, specifically ActiveX controls, using C++. For all other browsers you will write NPAPI plugins C++ or C.
On Windows you can combine the two plugin types into one DLL. FireBreath does that, which you should look into as it already abstracts over the browsers (and other problems) for you.

Sockets Programming

This is more of a general quick question.
But in like C#,Python,C,C++.......etc
Are all the basic "Sockets" network programming essentially the same. Like do they all use the Berkley Sockets (i think thats what they are called) or does each language have it's own way of doing sockets.
Thanks
Sockets are platform-dependent, not language dependent. So, linux uses the BSD sockets alone, Windows offers both BSD sockets (used almost exclusively) and a M$ flavour of sockets (called WSA), dunno about others. It all boils to what is found under the hood - more exactly at the kernel level of the OS. The socket implementation found there will offer a first set of API in order to make them accessible to kernel/user space - usually through a shared object / dynamic linked library and thus "natively" supporting the c/c++ languages. All the other languages are relying on language specific bindings to those SO / DLL files offered by the OS natively for C/C++.
HTH
Sockets are basically the same in C, C++, Java, Ruby. They are slightly easier (because the build in classes handle the boiler plate) in higher level languages. If you can write Socket code in C, then you can do it anywhere if you have a reference to translate.
#Kellogs brings up a good point, Windows has their own Socket API which (typically) performs better (in my experiences) on Windows than the Posix implementations offered. The APIs are very similar. I would make the analogy of OpenGL to DirectX. If you really know one, then you can figure out the other with a reference.
Now a days we don't differentiate the language, the class library that can be accessed from the language and the underlying operating system. Here is my explanation
C,C++,C#,Java - Are just the languages has no specific support regarding the network programming.
Java class library, .Net Framework, C++ standard library - among this I think C# & Java provides some classes for network programming. C++ standard library does not provide any network programming classes (only iostreams for file, stdinput & strings are available). But BOOST library for C++ provides classes for network programming. I am not aware of the other libraries.
OS - The operating system proives a base api (mostly in C) that is utilised by the class libraries above. In case of windows it is the winsock api (WSA) and in case of unix it is the BSD socket api. I think windows also supports to some extent the BSD api so that the learning curve is less. But as #EnabrenTane said it is more than that.
Agree with kellogs above. Windows & most major POSIX-compliant OSs support the basic BSD socket API. In addition to the Berkeley socket, each platform provides additional proprietary API for performance & scalability enhancement. These extended APIs are not strictly confined to sockets only - they work on any I/O operations (i.e. disk files, named pipes etc.). For example, (in addition to traditional select() & poll()) Linux has it's own epoll mechanism, BSDs have kqueue, Windows has WSAevent*, WSAaAsync* and I/O completion ports APIs.
These differences are visible mostly in lower level languages like C, C++ or Pascal.
C#, Java, Python, Ruby et al. are somewhat "higher level" compared to C - they provide robust technologies to insulate you from the low-level APIs. Instead of fiddling directly with the bare-bones socket API, you can use the extensive run-time class libraries provided with each platform. For example, to write a TCP/IP server in Python, you could simply use the SocketServer class. Similarly in C#, you can use WebClient to downlad files of the net. In C++, you have the Boost library. Of course, there's nothing stopping you from using raw socket API directly in your app.