AnsweredAssumed Answered

# [PI Analysis] Need help to build a PI AF Analysis which calculate the sum of each ingredient of a recipe

Question asked by Nicolas.Isambourg on Nov 22, 2017
Latest reply on Nov 23, 2017 by Roger Palmen

Dear Forum Members,

I need to calculate the mass of each ingredient used for the production of a recipe from the production steps.

A recipe has up to 12 production steps.

Below is an example of a recipe:

Step 1: Dosage of Flour,  Value: 200kg

Step 2: Dosage of Salt,  Value: 5kg

Step 3: Mixing, Value: 30s

Step 4: Dosage of Sugar, Value: 20kg

Step 5: Mixing, Value: 30s

Step 6: Dosage of sugar, Value: 10kg

Step 7: Mixing, Value: 30s

Step 8: Dosage of chocolate, Value: 100kg

Step 9: Mixing, Value: 30s

Step 10: Dosage of sugar, Value: 5kg

Step 11: Mixing, Value: 2min

So the ingredients of the recipe are:

Flour: 200kg

Salt: 5kg

Sugar: 35kg

Chocolate: 100kg

Egg: 0kg

I create a PI AF Attribute for each Step:

Each step attribute has a 'Value' child attribute From these steps, I need to calculate the mass of each ingredient with PI-Analysis.

The results will be copy to the "Ingredients" PI AF attributes. Each attribute is mapped to a PI Point.  I don't know how to do this.

I've thought to create a variable analysis for each ingredient and to calculate the mass like below: I don't know which expression I could write to calculate the sum of each ingredient.

Can I use a loop FOR from 1 to 12 for iterating each step ?

How could I calculate the mass of each ingredient of the recipe ?

Thanks,

Best regards,

Nicolas Isambourg