Placeholder and Library profile

davec
2015-02-10
2015-02-15
  • davec - 2015-02-10

    Hi,
    we have 3 projects
    1. HardwareLib (containing only methods to interact with hardware)
    2. SoftwareLib (referencing to latest version of HardwareLib)
    3. MainProject (referencing to latest version of SoftwareLib )

    To test the whole project (MainProject + Libraries) we created a FakeHardwareLib to mimic the real hardware.
    Each time we need to open SoftwareLib, replace HardwareLib by FakeHardwareLib, re-install the SoftwareLib and re-compile the MainProject
    We did a python script using ScriptEngine to automate this operation but we are now wondering if there is a better way of doing the same process maybe with Placeholder and Library profile
    We looked at the documentation and in Codesys forum, did some tests, but we can't figure out exactly how to manage that

    Do you have an example or perhaps more detailed documentation on that subject

    Regards,
    Dave

     
  • Strucc - 2015-02-15

    I'm in a similar situation, I think it's quite usual to manage simulation and real "live" environments together.

    What I did was:
    - One project, with 2 (or 3 devices)
    - All the common project code is defined in the POU tab (in your case, you can add a library manager there as well, for all the common referenced libraries)
    - For the simulation device, the simulation library is included (in the library manager of the device/application tree), and some extra programs are added to the main task for simulation purposes
    - For the real device, IO is assigned, and the real code is used (the real hardware library is included in the application tree)
    - (I added a 3rd device, it's a PLC panel, but without the IO from the real technology, to test the UI experience)

    • When I do the development, and simulation, I use my PC as a PLC, and use some extra code to simulate the inputs
    • Sometimes I test the UI on the real touch panel
    • And if everything is fine, i upload the project to the real system... and debug

    Hint: If you have multiple devices, and applications, just right click on the one, you'd like to work with, and "Set active application"...

     

Log in to post a comment.