How to Reuse Configurations with Library
How to Reuse Configurations with Library
Why Reuse Configurations?
You can save any part of an existing system configuration into a library for later reuse. This allows you to save a lot of time when developing projects with similar configuration blocks. This is best explained with an example.
Let's assume you have a controller (a drive) for an electrical motor. A complex drive may have hundreds of settings that have to be set exactly right. Of course all the settings for all these drives can be manually configured but this is very time consuming and error prone.
But, you can make the configuring of these types of drives lot easier. Considering you have already configured one drive once, you can copy its configuration with all the settings (including I/O channels or other possible subelements) and paste it into a library as a pre-configured building block - a recipe. You can then use this pre-configured drive recipe for all drives of the same type.
An added benefit is that, as the recipe is a separate file, you can store and maintain it in GIT, thereby having version control and history of that drive configuration.
How to Create Reusable Configuration Recipes
To copy a configuration to recipe, you first have to create a library that is a container for recipes (and also more complex variants of recipes - models). To create a library:
- In Welcome mode select the Projects tab and click New Project button. Alternatively open the File menu and choose Create New....
- Select CDP Library and click Choose....
- Type in the name of the library, select the storage location and click Next. Note that after the library is built, the name will also show in Resource tree, similar to how CDPCore and other resources are shown.
- Select the CDP version to be used and click Finish.
Now use the Table Editor in Configure mode and locate a pre-configured configuration block in your system in the Project tree or the Configuration editor . To copy the located object, right click on and choose Copy from the context menu.
Now, right click on the library name that you want to paste the configuration block into and choose Paste from the context menu. The new library element (i.e. recipe) will appear in the library.
You can rename the newly created recipe for your convenience by right clicking on the name and choosing Rename... from the context menu.
To make the newly created pre-configured recipe for your system available, the library must first be built.
- Right click on the library name in the Project tree.
- Select "Build" in the context menu.
After build successfully completed, the newly created pre-configured recipe will appear as a new resource in a Resource tree in Configure mode. You can now add it to any application by locating the corresponding configuration element in the application where you want the recipe to be added into . Then locate the recipe from Resource tree and add it by right clicking its name and then selecting Add from the context menu, or by double clicking on it.
Creating Configuration Recipes from Scratch
You can also create new configuration recipes from scratch (i.e. without any existing system to copy from). To do that, click on library name , then select "Table Editor" and then add any resource from resource tree . The added resource becomes the base of the newly created recipe.
Additional Tips Using Libraries and Recipes
- You can copy an unlimited number of pre-configured recipes into a library. You should rename them to reflect their content, so they are easily findable in the Resource tree later on
- You can review and alter the copied configuration of the recipe in Configure mode almost in the same way that systems can be configured. You can also add new resources (like new I/O channels etc) to a model from the Resource tree
- After modifying recipes, the library must always be re-built for the changes to become available in the Resource tree
- Changes to the recipe will not alter any existing system that was configured by using this recipe. If your system needs to be updated with the changes that were made to a recipe, you should remove the old configuration and add in a new one based on the changed recipe.
- You can also remove unused recipes from library. Just right click on the library name and choose Delete... To get the recipe unlisted in the Resource tree, you have to remove the deployed library by right clicking the model name in the Resource tree and selecting Remove . Recipes from that library will now not be shown any more in the resource list.