Changing the MERLIC Recipe (Hilscher)
MERLIC RTE also allows the PLC to load a different recipe file A MERLIC recipe file is a crucial part for the MERLIC process integration. It is a separate file (with file ending .mrcp) that defines which MERLIC Vision App is loaded for the process integration. It also defines how the MVApp is parametrized because it contains a set of pre-defined input values for selected tool parameters. You can create multiple recipe files with individual sets of input values for one and the same MVApp. This enables you to reuse an MVApp with different parameter settings for various scenarios of your application. You can also use a recipe file to load an MVApp for a completely different image processing task. for further processing. The recipe change can be triggered with the command "PrepareRecipe", that is, with the respective command code 4.
In case no recipe is prepared, the Frontend will show a respective text message.
Prerequisites
The "PrepareRecipe" command can only be called if MERLIC is in the state "Initialized" or "Ready". Therefore, you have to make sure that MERLIC is in one of these states before changing the recipe. In addition, the recipe that shall be loaded must be defined in the member Selector in the protocol FromPLCProtocol.
Changing the Recipe
Set the following members in the protocol FromPLCProtocol to load a recipe.
|
Member |
Value |
Description |
|---|---|---|
|
CommandCode |
4 |
Define the code value 4 for the command "PrepareRecipe". |
|
Selector |
ID |
Define the ID of the recipe that shall be loaded. The ID represents the ID that is assigned for the recipe in the "Recipes" of the MERLIC RTE Setup, for example, to load the recipe with ID 1, you have to set the value of "Selector" to 1. In case no recipe with this ID exists, MERLIC changes to the "Error" state. |
The protocol FromPLCProtocol that is sent from the PLC to MERLIC could be defined as shown in the following example:
TYPE
FromPLCProtocol :
STRUCT
Preamble : 17;
CommandCode : 4;
Selector : 5;
END_STRUCT
END_TYPE
In the example above, the value of the member CommandCode is set to 4. Therefore, MERLIC recognizes the command "PrepareRecipe". The recipe file that shall be loaded is defined in the member Selector. In our example, the recipe with ID 5 shall be prepared and loaded in MERLIC.
Synchronization
The following graphic shows the handshaking process for the command "PrepareRecipe". The PLC triggers the recipe change by setting CommandCode in the protocol FromPLCProtocol to 4. Make sure to set the ID of the recipe to be loaded for the member Selector before triggering the command for the recipe change.
When MERLIC recognized the command, the member CommandCode in the protocol FromMerlicProtocol is also set to 4 as confirmation for the PLC and MERLIC starts to load the recipe file with the specified recipe ID and thus also the MVApp that is referenced in the recipe. As soon as the PLC receives the confirmation from MERLIC that the command was recognized, the member CommandCode in FromPLCProtocol is set to 0 to finalize the handshaking process. After the recipe has been loaded, MERLIC checks which CommandCode is sent from the PLC and proceeds accordingly.
