Library- Versioning one POU

bamia
2021-03-24
2021-03-30
  • bamia

    bamia - 2021-03-24

    Hello everyone,

    I'm new to codesys and have the vanilla version 3.5 SP16 and work mostly with EcoStruxre Machine Expert v1.2
    I read and watch tutorials about library use but can't figure out how to work with POUs in a library and project. Say I have created a POU and added it to library project then later made some changes to it and want to add it to the same project as version 2 and so on.
    How can that be achieved?

    Thanks

     
  • bamia

    bamia - 2021-03-26

    I take it either no one knows or it is not possible, which is it?
    Thanks

     
  • eschwellinger

    eschwellinger - 2021-03-26

    you just open two instances of CODESYS - one with the library the other open your testproject.
    Then you add changes in the library and after doing this press the yellow icon ( which installs the changes to the libraryreporsitory)
    You see in the message view of the project instance that this has successfully done - and now compile your project and do your tests with your code changes.
    https://help.codesys.com/webapp/f_libraries;product=codesys;version=3.5.16.0

    BR
    Edwin

     
    👍
    1

    Last edit: eschwellinger 2021-03-26
  • bamia

    bamia - 2021-03-27

    Thanks. So here's what I did:
    -Created a library project and added a POU with some code and
    Saved the project and updated the repo.
    -Opened a standard project and added the library and opened and FB then I inserted an empty EN/ENO and selected my POU from the library
    -Now here's what I want to do,
    1- Make changes to the POU in the library and version to 2.0. In the my library project I will have to versions of the same POU, version 1 and version 2.
    2-Go to my standard/work project when I am using and instance of that version 1 POU and update it to latest version 2

    How do I go about doing that?
    Thanks

     

    Last edit: bamia 2021-03-28
  • eschwellinger

    eschwellinger - 2021-03-28

    Maybe i do not understand. If you have opened 2 CODESYS Development sytems, it is exactly what you need, one for change/edit the library the other to test the pou's from your library

     
    👍
    1

    Last edit: eschwellinger 2021-03-28
  • i-campbell

    i-campbell - 2021-03-28

    If you have for example FB_Motor (v1) and FB_Motor (V2), and you want to reference both of them in a project, you will need to have different names for them.
    For Codesys libraries, the developers make only compatible changes to a POU. If the library developer wants to make a new POU which is not compatible, they change the name, eg. AddLog and AddLog2. In your case you could name them FB_Motor and FB_Motor2.

    If you however mean that you wish to know how to update your .project, so it uses now library V2.
    1. Install library V2 to library repository as you have already done.
    2. In your project use Menu > Project > Project Environment... to identify and update any libraries.
    OR you can select the versions from Library Manager > Placeholders
    3. If you have changed the inputs and outputs of the POU, in graphical languages you can right click it and "update pins". In ST you must add or remove the entries manually.

     
    👍
    1
  • bamia

    bamia - 2021-03-28

    Thanks everyone.
    I figure out some of it and working on the rest.
    So what I wanted to do is this:
    I have FB_Motor and its version in the library is 0.0.0.1 and that's how it shows up in the repository. Then I go back later to make some changes to it and want to have a new version 0.0.0.2 while keeping the other version available.
    What I figured out thus far is that I have to do that manually but going to "Project Information" and changing the version number there then save and install the repo to have it available in the project.
    Is that the way it is done?
    Could it be done automatically, somehow?
    After making changes and saving FB_Motor V2, how can I go back to FB_Motor V1 if I want to?
    Oh, and one more question, let's say I am using FB_Motor V1 in a project how do I update it (the library itself is set to automatically update to latest version), do I have to delete the function call and insert another block/call.
    Thanks

     

    Last edit: bamia 2021-03-28
  • bamia

    bamia - 2021-03-28

    How do you guys work with libraries in general.

    I would like to use it like this:
    Create a standard project for a specific controller and develop, let's say FB_Motor, and work with that and other POUs. Then at some point I will be happy with it and want to archive it so I will create a project and add it. Then sometime later I will want to modify it but I need to do that in a project where its functionality can be tested and compiled, what to do then?
    I can not edit it on its own in the library project because I need to test its functionality in a working project.

    I am looking for something like how SVN does it, or Siemens TIA, where the library is linked to the project and I can modify the FB right where I have it being used and test and compile it then when I'm happy with it I can "commit" or save it to a new version FB_Motor V2
    Is that possible?

    Thanks again.

     
  • h-hermsen

    h-hermsen - 2021-03-29

    No, the way you describe your preferred workflow is not possible in CODESYS. I do recognize your described workflow from from a different IDE but it is not possible here.

    You cannot edit the preferred FB directly from the project in which you referenced library x.y.z. This is similar as in behavior in e.g. VS.NET or JAVA.

    Getting a hang of the preferred way of working in CODESYS is easy though. This has been posted here before, but just for sake: Just open CODESYS twice. Load your library in IDE1 and load your project in IDE2. Editing and saving and archive the library to your local Library Repo (commit as you call this) is entirely done via IDE1.
    Modifying your project itself and testing of the library component from IDE1 is done in IDE2. This is the normal vanilla way of managing it in CODESYS.

    Regards

     
    👍
    1

    Last edit: h-hermsen 2021-03-29
  • bamia

    bamia - 2021-03-30

    Thanks h-hermsen
    One last question, using the same scenario and example as before, I have FB_Motor V1 and later I modified it to FB_V2 and saved that to the repo as well as saved the library with the new changes. So in the standard project I have access to both V1 and V2 which is great but in the library project it opens with the last saved version which is V2. Is there a way to open V1?
    I can copy and paste from standard project to library but curious, since the both versions exist in the repo there must be a way to open either one.

    Thanks

     

Log in to post a comment.