Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Replace Application.app and Application.crc on PI

2017-03-27
2017-03-30
  • AndreasDeDeDe - 2017-03-27

    Hello,

    I automatically compiled several codesys projects using codesys python scripting engine, calling create_boot_application() on the project. I saved the results into a folder structure on the pi. (Multiple folders each containing an "Application.app" and "Application.crc"). They only differ in the configuration of a ProfiNet device, and no network settings are being changed.
    I'd like to switch through this applications in a python script, which is running on the pi with root permissions, like this:

    os.system("sudo service codesyscontrol stop")
    copyfile(sourceDir + "//Application.app","//root//PlcLogic//Application//Application.app")
    copyfile(sourceDir + "//Application.crc","//root//PlcLogic//Application//Application.crc")
    os.system("sudo service codesyscontrol start")
    

    But once i switched the Application like this, it seems the Application will not run. The Profinet Device won't connect anymore. If i make the same changes to the Project Manually and download it to the PLC, the Application runs and connects with the profinet device without any errors, though. Are there additional Files that need to be changed, or is it not possible at all to change the Application?

    Thanks and Greetings

     
  • eschwellinger

    eschwellinger - 2017-03-28

    Hi,
    you need to check the plc logger for more Information.
    BR
    Edwin

     
  • AndreasDeDeDe - 2017-03-30

    The logger always stopped mid-starting, even mid message. I found a solution:
    I don't use create_boot_application() anymore - now i use onlineapp = online.create_online_application(proj.active_application) and onlineapp.login(OnlineChangeOption.Try, False) commands, and i have a script running on the pi that watches for changes in the Application.app and Application.crc files. each time they change, i grab them and copy them into a new folder. this way i get all my different Application.app and Application.crc 's, and with this new files, everything (including the code snippet in the OP) works just fine

     

Log in to post a comment.