>Opener_Mmap 

Last Edit: Oct. 15, 2021, 1:05 p.m.

There is an open source project called OpENer that has implemented an ethernet/IP communication protocl suite.

That's pretty nice but to make it easier to use I've made a sample application that opens two binary files (input.dat and output.dat) and produces/consumes them as fist class IO to an ethernet/IP controller as memory mapped files. This lets you use pretty well any programming language you want to communicate in "high speed" (as high speed as you can get with ethernet/IP anyway) with the controller without requesting individual tags or polling similarly.

I put together a virtualbox image that provides this functionality as a service. It is using an image from osboxes along with the default username/passwords for their images - you'll want to change these. There are two files that dictate how the system works. /srv/input.dat and /srv/output.dat. These are defined from the controllers perspective and they dictate what the IO size is. They're memory mapped by the service and get updated from/ sent to the PLC cyclicly. You can open them in other programs and any changes will be immediately reflected on the PLC.

This image:

shows how to configure the system. There are /root/make_input.sh and /root/make_output.sh scripts which create empty input and output files of xxx bytes as shown int he screenshot (100 bytes in the screenshot).

Note: You might need to chown these file to the EIP user after running those scripts (or edit the scripts to do that). This is something I thought about after the fact.

Whatever size these files are at the start of the systemd OpENer.service is what the controller needs to be set to for the assembly 100 and 150 data sizes in bytes. You could use dints and quarter this value if you want.

There is a python script that opens the memory mapped files at /var/test.py which opens the files as memorry mapped files and reads/writes to them. You can see that in the following images - but keep in mind the endianness of the bytes.:

Note that if the virtual ethernet card is not /dev/enp0s3 you'll need to edit /etc/systemd/system/OpENer.service to match your actual card.

Download the compressed VirtualBox image here.

If you want to modify it you can find the base code here.

Having eaten from the fruit of knowledge, our minds understand that the myths don't stand up but our hearts are not cheered by looking into the abyss.