*This feature is added from version 7.1
Ever wanted to dynamically reference a group of measures in a calculation without having to add measures manually to the calculation dependency list? What if you commissioned a new line/piece of equipment, but have to manually update calculation based on this new instance of equipment?
Think about roll-up calculations, total in/out flows', scrap production over a line/area/plant etc. Relative Reference Calculations have the ability to grow and adapt as your Flow Model grows and expands.
The basis of Relative Reference Calculation is to determine how one would "group" a bunch of measures together, based on a set of rules, to be dynamically added to a calculation. Second to that is to be able to perform calculations and functions on the "Group" of measures.
A group of measures to dynamically added to your calculation is called a Measure "Collection".
Let's Look at the following example:
In my model, I have 10 filling machines, all of them records the total hourly scrap production.
I would like to add all the scrap production for all 10 lines together for a total scrap production number for the entire Filling process. And it should dynamically adjust if I introduce a new filler, i.e. Filler 011.
Measure Collections in Calculated Measures
Let's add a calculated Measure to add all scrap production together. a Measure Collections can be added to calculated measures within you Flow Model.
Notice when I "right click" on my Calculated Measures' Instance data, I know have the option to add a "New Measure Collection".
*Note - Measures can still be added as normal to your calculation instance date. This can become useful if you need to scale your result by a constant measure value.
Notice you know have a new Measure Collection. The purpose of the expression that you will configure on the Measure Collection is to "Find" the measures in your model to add dynamically to your expression.
In our example, we want to add all the hourly scrap production together. Lets add a rule to add all "1hr" measures together. Based on my model, I can search for all measures called "1hr"
This will not be good enough, as both my "Good" total and "Bad" total is called "1hr". Thus, I also need to look at the "Parent" object to filter out accordingly:
Where did I get a list of filter conditions that can be used in the expression? The "Insert" option menu has a complete list of conditions that can be used in the collection:
This filter rule for my collection might not be good enough, What If I add additional equipment, not of type "Filler" with the same measure name? Or I add an additional metric in the filler object with the same measure name? This is where I can use Model attributes as well to really preform complex and powerful filters:
This will add all relative measures dynamically to the Collection:
Collection Calculations
Now, this "Collection" is accessible in the Calculation expression to dynamically add all the Values together. As per normal, calculation expressions are configured on the calculation instance date.
This can be based in C# LINQ queries on the Collection dictionary. Values relate to the measures in the collection, where every measure "Value" will have its value, quality and duration available.
Commissioned Date
What If I need to add Filler 011? Well, if you instantiate a new filler, and the rules in your collection will match the newly instantiated measures, it will be added automatically. This is great, but what if my new filler will only have data from today going forward? What about backfilling my calculation? Will the fact that Filler 011 has no data break my calculation?
For these scenario's we introduced a concept on a measure that you can configure a "Commision Date". This is set on the manage tab of a measure:
In this case, the filler is only set to be "Commissioned" from 07/21/2024. Currently commissioned dates are only used and referenced by Measures Collections.
Notice that the Measure Collection now has 2 instances, one from 2023/07/20 and a new collection from the date that Filler 011 was introduced based on its commissioned date:
Only the later collection will include Filler 011.
The engine will process the calculation as per normal, and save the hourly total results to the Flow database: