Result
Understand how to create a Template, instantiate instances using the template, and push template changes through to the instances.
Tutorial steps
- Create a Template - of the Steam metric as defined in your Flow Information Model
- Link your Steam Metric - in the Model view to the Steam Template
- Instantiate two more boilers - by using the Steam Template
- Link the newly created Boilers - to the correct Historian tags
- Deploy - the newly created Boilers
- Push a change - by making a change to a template and then updating instances of that template
Templates
To speed up development and to ensure faster time to value, Flow embraces the concept of "Template First" design. The template functionality also facilitates:
- Change management – Propagating changes automatically to instances
- Conformance – Templates and associated calculations can be "locked down", thus enabling the capability of performing standardized comparisons between different lines and even different sites.
- Ease of distribution – Templates can be "served" by a template server to the individual sites.
Locate the Templates view by selecting the Template icon in the top right-hand view of the config tool.
One can create a hierarchy for your templates by using Folders.
Create two Folders, one for Production Templates and one for Engineering Templates.
Under the Engineering Templates Folder, create a new Template Folder for Utilities, and then create a new Template Folder for Steam:
Let’s create a Template from the already created Steam metric in the Flow Model view. By performing a "Drag and Drop" operation, drag the Steam Metric from your Model view to the Steam Template Folder in the Templates section.
Flow will create a Template with the same structure as built in the Model section.
Note the orange disks next to each of the items in the template folder. This indicates that the template is not yet Released. The Steam template needs to be Released to be used to instantiate more boilers.
Right-click on the Engineering Templates folder and release the Engineering Templates Folder. This will release all the Metrics and Measures contained in the Engineering Templates Folder structure.
Link the Existing Model Boiler Metric to the Template
By default, Flow will not link the metrics and measures used to create a Template to that Template. This must be done by the user if required. By linking the measures, any changes and updates performed on the Template will also be pushed to the original measures used to create the Template.
Items can be linked by performing a "Shift + Drag" operation from the Template items onto items in the Model view.
Press Shift+Drag the Steam Metric from the Template View to the corresponding item in the Model view. Notice that when the linking is complete, the color of the Metric icon changes from gray to blue. A blue icon indicates that the item is linked to a Template.
Note: Performing a normal drag and drop function will create a new metric/event/measure instead of linking existing metrics/events/measures to the Template
Update Linked Measures
Notice that after linking the metric to the template, a blue disk appears next to the metric. This means that the metric needs to be updated with the latest version of the template.
To perform an update, right-click on the Metric and select "Update":
Notice that after updating the metric, all the measures contained by the metric are now also linked to the template (they now have a blue icon). When you updated the metric, Flow automatically matched the measures that were in the model with those from the template. Where it found a corresponding match, it linked the measure to the template.
Since you created the template metric from the model metric, all the measures matched, and so all were linked. If Flow found a measure that was in the template that is not in the model, it would create it for you in the model during the Update process.
Create Additional Steam Instances
The plant has 2 additional boilers producing steam, one in the east section of the plant and one in the west. We need to create two more Steam Metrics by utilizing the Steam Template we just created.
Use Model Attributes for Retrieval
Before you create the additional two Steam Metrics, you need to prepare your template to handle the different tag names that each of the boiler measures references.
In the Data tab, select the Historian Simulator data source, and expand the namespace to view the three Boilers' tags.
Thus far, you have used the following tags for your Steam boiler's measures:
- 010-FT-001.PV - in the hourly Production (ton) measure
- 010-TT-001.PV - in the hourly Temperature (°C) measure
There is a pattern to the tag names for the boilers, as is usually the case if your environment uses naming standards. In this case, the pattern is as follows:
- nnn-XX-001.PV, where nnn is a reference to the Boiler number, and XX references the instrument
Flow allows you to use Model Attributes as "placeholders" to cater for tag names that are used in template measures.
Let's see how this works.
In the Tools tab, right-click the Attributes item, then select New, then Attribute.
Rename the Attribute "Boiler Number"
Open the Template Metric named Steam. When the editor opens, drag the Boiler Number model attribute into the Model Attributes tab of the editor.
Now enter the following for the Instantiated Name field at the top of the metric editor: Steam [ModelAttribute("Boiler Number")]. You can also type in the word "Steam " and then drag and drop the Boiler Number attribute from the Toolbox into the Instantiated Name text box
Now open the "Production [kg/s]" Template Tag. Expand the Model Attributes tab.
Notice that the Boiler Number model attribute, which you previously added to the Steam template metric, has automatically been propagated to the Production template measure. This will be the case for all template measures within the Steam template metric.
We want to use the Boiler Number in the tag name, as described previously. The plan is that for each of the instantiated Steam metrics, the value in the Boiler Number will be set to "010", "020", and "030" respectively (we will learn more about how to set these values shortly).
Expand the Retrieval tab. Since we created this template from the Steam model metric, the tag name is currently 010-FT-001.PV
Change the tag name to be [ModelAttribute("Boiler Number")]-FT-001.PV
Lock the retrieval properties' configuration by clicking the lock icon above the properties window.
Repeat the above step for the Temperature template measure, this time making the tag name [ModelAttribute("Boiler Number")]-TT-001.PV. Again, you can drag the Boiler Number attribute from the Toolbox, which will populate the placeholder for you, after which you can complete the tag name manually.
Lock the retrieval properties so that these can be pushed down to the existing instance of the template with the next update. Release any template objects that have been unreleased while you were editing.
Note: When editing properties in a template, Flow will automatically unrelease the template. This allows you to choose when the template becomes available to any instances that are derived from the template, thus preventing another user from updating their linked instance/s before you are done with your changes.
After release, you will note that the existing Steam model metric and the child measures that are linked to template measures that you edited require an update.
Go ahead and update these by right-clicking on the Steam folder and selecting "Recursive Update"
Open the Steam.Production (kg/s) tag in the model to see what changes have taken effect.
As expected, the Tag property has been updated from the template. But there is an issue: notice that the Boiler Number model attribute is not set. This is because it is inherited from the metric, but we have not set the value in the metric!
This will cause an issue for the Data Engine, because it will be trying to find a tag that does not exist!
Can you guess what tag the Engine will be trying to retrieve from?
Since the Boiler Number is blank, the tag name will be " -FT-001.PV"
You will also find errors being logged in the Flow Event Viewer log about this tag name that cannot be found.
Let's fix the above problem. Close the open editor.
Double-click the "Steam" model metric. Set the Boiler Number to 010
Now, when you click away from the value that you just entered, or if you try and close the editor, you will get a message:
Flow has detected that there are measures within this metric that are referencing this model attribute and is informing you that it will be setting those measures' Boiler Number model attribute to the same value as the one you just entered.
This is what we want to happen, so select Yes.
Now expand the measures under the Steam metric until you get to the Steam.Production.Daily [ton/day] measure, open its Editor and expand the Model Attributes tab. Note now that the Boiler Number is set to 010, as we expect.
Since the Engine can now resolve the tag name, you may also note that it has retrieved values for this measure again.
Confirm that the model attribute change has also taken effect in the Temperature model measure.
Now we are ready to add our Steam East and Steam West boiler metrics.
Drag the Steam Template Metric from the Templates tab onto the Steam folder in the Model tab.
Notice the editor that now opens. This is the "Bulk Instantiation Configuration" editor and allows one to instantiate multiple instances of the template in one operation.
Change the Instantiation Count from 1 to 2. Click on the Preview button.
In the Mapped Preview tab, you can preview what Flow will do if you were to select Continue. Notice that Flow is warning you that something is not quite right. In this case, it is showing you that because you are about to instantiate 2 metrics with the same name, it is going to append the word "Copy" to the names. Is this really what you want to do?
Recall that we used the Boiler Number in the Instantiated Name field of the template metric. But we haven't yet specified the Boiler Number. Let's do that now using the field in the Template Map Settings of the editor.
Notice the following available fields:
- Name: All placeholders (or model attributes) that you have configured in the template will be available here for you to configure. In this case, we only have one - Boiler Number
- Values: This allows you to specify how the placeholder values should change with every instance that you are creating. This can be a comma-separated list or a range. If you specify a range, you can also specify a step increment between each value. Examples:
- 1, 3, 5, 8 - this will set the placeholder value to each of the values in the list (NB. You must have changed the instantiation count to at least 4 for all four instances to be created)
- 1-5 - this will set the placeholder value to 1, 2, 3, 4, and 5 (NB. You must have changed the instantiation count to at least 5 for all five instances to be created)
- 100-300/100 - this will set the placeholder value to 100, 200, and 300 (NB. You must have changed the instantiation count to at least 3 for all three instances to be created)
- Format: By default, the format from the Values field is used. If you wish to modify this, such as if you need to pad the value with zeroes, use this Format field
Make the following changes in your editor:
- Set the Values field to 20-30/10
- Set the Format field to 000
Now select the Preview again, and this time notice that there are no red indicators, and the two metrics that will be created will be named Steam 020 and Steam 030
Select Continue to initiate the instantiation process. The two new metrics should be created within the Steam folder
Deploy the two new metrics and open the hourly Steam 020...Production [ton/hr] measure.
If the Engine has already processed this measure, you'll notice that there are values in the Context tab. Expand the Model Attributes tab and note that the Boiler Number has correctly been set to 020
Earlier we mentioned that the names of the boilers should be as follows:
- Steam Primary
- Steam East
- Steam West
Change the metric names from Steam, Steam 020, and Steam 030 to the names mentioned above, respectively.