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

Rezepturverwaltung Anweisung um Variablen auszulassen

paho
2022-10-26
2022-11-21
  • paho - 2022-10-26

    Hallo,

    aktuell arbeite ich mit Codesys 3.5 SP18 und zum ersten mal mit der Rezepturverwaltung. Speichern funktioniert, laden funktioniert. Jetzt habe ich aber umfangreichere Funktionsblöcke, welche Ein/Ausgänge, Einstellwerte und auch interne Werte (für Regler usw.) besitzen. Es sollen nur die Einstellwerte in das Rezept gespeichert werden. Aber für jeden Funktionsblock von dem es mehrfach Instanzen gibt händisch jede notwendige Variable hinzufügen ist sehr mühsam (vor allem, wenn sich die Blöcke ändern oder eventuell neue dazu kommen).

    Ist es möglich, gleich bei der Variablendeklarierung des Funktionsblocks Codesys zu sagen, hier soll die Rezepturverwaltung Variablen hinzufügen können bzw. genau umgekehrt? Oder eventuell überhaupt eine ganz andere Methode?

    Danke schon mal im Voraus!

     
  • ignat - 2022-11-18

    Hi,

    as far as I know there is no automatic binding to Recipe Manager.

    Ein paar ideas how to 'optimize' it, maybe it will be helpful:

    depends on how many FB you have and how many instances of Fb you have, but:

    1) I would make some UDT for transfer to RezeptVerwaltung like

    TYPE DUT_RM_VALUESET_MY_NEW_FB_1 :
    STRUCT
        rVal1 :REAL;
        rVal2 :REAL;
        ...
        rVal100 :REAL
    END_STRUCT
    

    2) and link them to specific instances of function blocks

    FUNCTION_BLOCK myNewFb_1
    
    VAR_IN_OUT
        ValuesSet_RM :DUT_RM_VALUESET_MY_NEW_FB_1;
    END_VAR
    

    3) when i collect all such a data in one GVL. e.g.

    //GVL_RecipeValues
    VAR_GLOBAL
        ValuesSet_RM_1 :ARRAY [0..NUM_OF_FB_1_INSTANCES]
        ValuesSet_RM_2 :ARRAY [0..NUM_OF_FB_2_INSTANCES]
    END_VAR
    

    4) and now if you need to update RECIPE DEFINITION you can just start to enter name in the first row of GVL and it puts all the variables from this list incl. structured variables.

    You can test it with GVL. I bet you have GVL in your project. Just try to put all values from GVL and it put them all there:

     
    👍
    1

    Last edit: ignat 2022-11-18
  • paho - 2022-11-20

    Hey ignat,
    thank you - that was a good one. You gave my brain a little kick with the STRUCT. Instead of writing the configuration variables of my function blocks directly in the VAR_INPUT, i've created a DUT for every FB with just the configuration variables declared.
    With the recipe manager i just had to insert the DUT (lets say the name of FB is "machine" and the configuration is "config" => PLC_PRG.machine.config) and everything was good :)

    With RecipeManCommands i can read and save the recipes. I just did that with a separate IEC-Task with low priority, saving the whole recipe every second and load that at startup.

    Could that be a problem? Because i don't know an easy way to check if an update is required... just iterating over all objects and check if the old value <> new value... something like an event would be great on value change :)

     
    👍
    1
  • ignat - 2022-11-21

    Hi paho,

    I did it quite the same - load on startup but during operation only logged-in user can edit/manage it. I have a page like 'Recipe' where operator can select recipe - and values are loaded by recipe name changing (all available recipes are in the dropdown menu, the list is loaded on Startup or by RecipeManCommands, i think it was from initial Recipe example, with little changes).

    And Administrator can edit recipes - and during editing all other menu are blocked, so you are not able to leave the page without saving.

    You approach is good, I would just check the task configuration. If the task doesn't load the plc too much - then it's ok.

    Some events like for VisuElems would be great, agree

     

    Last edit: ignat 2022-11-21

Log in to post a comment.