Skip to content

Postgres and PLCnext

Hello!

I need to transfer data from PLCnext controller to DB Postgres (on other PC). As I understand it, this needs to be done through the C ++ program for PLCnext.

How can i do it better?

Pass data into a C++ program via IN/OUT PORT? Or can I take data via PLCnext API directly from the Global Date Space (GDS)? How?

What type of program should I choose in MS Visual Studio when creating a C++ program? I cannot understand the difference between them.


Thank You in advance!


BR

Maksim

Comments

  • edited August 2022

    There is some information about the difference between ACF projects and PLM projects in the PLCnext Info Center, on this page:

    There is more detail in the sections of the Info Center related to C++ Programming.

    To your specific application, there are probably a few alternative solutions, depending on the requirements of the application (e.g. data frequency, accuracy of timestamps, etc). Some possible solutions do not require C++ programming. Some potential solutions do not require the PLCnext Runtime to be extended at all, but if it does then I suspect you'd be looking at an ACF component (again, depending on the requirements).

    If you want to discuss the details of your application offline, please let us know.

  • Thank You!

    Yes, I have project's details that I need to do. I would like to discuss the possible best solution for this project. How can we do this? Here on the forum? Or how else?


    BR

    Maksim

  • You're free to share details of your project here on the forum, but I will send you an email in case you would prefer to discuss it offline.

  • Ok, no problem, we can discuss it here on the forum.

    Aufgabe: there is a line for the production of dairy products and it is necessary to read the DataMatrix code from each finished package on the conveyor. To read the DataMatrix code, a special camera (Honeywell HF800) is used, which transmits the read code (~ 40 bytes) over ethernet network. In total, the controller will process 8 such cameras. For each received DataMatrix code, the time of its receipt is fixed also.

    Then this data (code and time) should be sent to Postgres database, which is installed on the corporate server.

    Also considered the option of transmission through JSON something like:

    curl -X POST 'http://localhost:8069/data_from_cam' -H 'Content-Type:application/json' -d '{"collection": [{"code_id": "0104070071967072215hsGMe", "create_date": "15/09/2021 01:00"},{"code_id": "0104070071967072215Zfy2r", "create_date": "15/09/2021 01:00"}]}'

    Now we're talking about 2-3 codes per second for each camera (8 cameras in total). PLC AXC F 3152.

  • Does the controller use the data from the cameras in any other way?

    If the controller only forwards the information to the database, then there is no need to use any features of the PLCnext Runtime. You could write code, in any language, that receives information from the cameras and sends it to the database.

    If the controller does require information from the cameras to control the process, then what information is used, and what types of decisions are made using that information? e.g. is response time important?

Sign In or Register to comment.