Can I build a small GUI application with CODESYS and Python

ramas
2022-06-30
2022-07-12
  • ramas - 2022-06-30

    Hello all,

    I want to create an application: a testing application which checks a DUT for anomalies for example: the python script checks if the DUT has the proper Serial number etc.

    I want to use Codesys visualization manager to build the GUI and I want to use python to run the tests on the DUT.
    In the end, imagine a GUI done with codesys but when a button is clicked a Python script is run which run the Tests.
    All of this will be run on a Raspberry pi through the Raspberrypi MC SL runtime for codesys.
    Could someone please tell me if sucha thing has been done or if it is doable or if it takes way too much time and if i should use PyQT or Tkinter python GUI libraries to make the GUI.

    Any suggestion and help is greatly appreciated

    Viele Grüße
    Sebastian Herrman

     
  • paulpotat

    paulpotat - 2022-07-01

    Hello,
    One solution to make CodeSys and Python to exchange data could be to use a Shared Memory (see this example).
    This allows you to dedicate a space in the memory where both Codesys and Python are able to read/write.
    You can also use the OPCUA functionnality of CodeSys to Exchange data if you want, but I have not tried it yet.

    However if you just use CodeSys for building the interface I think it would be easier to go full python.

    Hope this helps,
    BR

     
  • nothinrandom - 2022-07-12

    You could possibly write the value(s) out to a CSV file and have your python code run it. You can execute python via Sysprocess.SysProcessExecuteCommand. So when you click this button, write values out to a file, and also execute python code that you can read back in the result to be displayed on the screen or something.

     

Log in to post a comment.