Configuring recipes

Create and configure a set of objects to manage a recipe.
This module describes creating and configuring:
  • a database in which to store the recipes data at runtime
  • a Recipe Schema object in which to define the set of variables or
    ingredients
    of the recipe
  • a graphical widget (Recipes Editor) used to manage recipes at runtime
This is the final result:
Step #1: Create the database for the recipes
  1. In
    Project
    , right-click
    DataStores
    , then select
    New
    >
    Embedded Database.
    EmbeddedDatabase1
    appears.
  2. Rename
    EmbeddedDatabase1
    to
    RecipeDB.
NOTE: Multiple databases used to store different data can exist in the same project. This allows for better project readability.
Step #2 Create and set the Recipe Schema object
In the Recipe Schema object, set up the controller variables that make up the recipe and the database in which to store recipes at runtime. Configure the object:
  1. Right-click
    Recipes
    , and select
    New
    >
    Recipe Schema
    :
    RecipeSchema1
    appears.
  2. Rename
    RecipeSchema1
    to
    MyRecipe
    .
  3. Select
    MyRecipe.
    In the
    Destination node
    property, set a dynamic link with
    controller_PRG
    .
  4. from
    Project
    drag
    controller_PRG
    onto the
    Destination node
    value. In this way, from the
    MyRecipe
    object the variables that make up the recipe can be selected from those imported from the controller.
  5. Double-click
    MyRecipe.
    The editor to select the variables of interest opens.
  6. Select the variables
    Ingredient01
    ,
    Ingredient02
    and
    Ingredient03
    and select
    Apply
    .Tthe variables synchronized are the recipe ingredients.
    NOTE: If the selected controller variables are changed, repeat this step to display the changes in the
    MyRecipe
    object.
  7. In the MyRecipe
    Store
    property, set a dynamic link with
    RecipeDB.
    In
    RecipeDB,
    a
    MyRecipe
    three-column table is automatically configured, one for each recipe variable.
Step #3: Configure the widget to manage the recipes
Use the Recipes Editor widget to display the recipe ingredients at runtime and set the values of the variables, to store/modify different recipes, and to load the desired recipe on the controller. Configure the widget:
  1. To add the widget, select . The template library opens.
  2. In
    Widgets
    , drag the
    Recipes Editor
    into
    Page4 (type)
    . The
    RecipesEditor1
    object appears in the panel.
  3. Close the template library.
  4. To link the widget to the recipe, select
    RecipesEditor1.
    In the
    RecipeSchema
    property, set a dynamic link with
    MyRecipe
    .
  5. For the widget to show the recipe variables inside
    RecipesEditor1
    , right-click
    RecipesEditorUISetup
    and select
    Execute Setup
    . The ingredients in the widget update.
This tables describes the widget buttons.
Recipe toolbar
Button
Function
Save
Store the recipe in the database during editing.
Delete
Delete the selected recipe from the database.
Load
Load the recipe values from the controller to the HMI application.
Apply
Apply the selected recipe on the controller.
Step #4: Check the operation at runtime
  1. Select
    Emulator
    and wait for the runtime window to appear.
  2. Select
    Page4
    to display the recipe widgets.
Step #5: Store a new recipe
  1. Edit the value of the ingredients.
  2. In the combo box, enter a name for the recipe and select Enter.
  3. Select
    Save
    to store the recipe in the database.
  4. Repeat the previous three steps for each recipe to save.
Step #6: Apply a recipe on the controller
  1. Select the desired recipe to display the recipe ingredient values.
  2. Select
    Apply
    . The widget shows the ingredient values loaded on the controller in the right column.
  3. To change the ingredient values on the controller, change the values in the spin box and select
    Apply
    . The updated ingredient values on the controller appear in the right column.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.