# Recipes

## Video Tutorial

{% embed url="<https://youtu.be/np5gajlQQ5w>" %}

## What are Recipes?

A recipe is used to group [control-parameters](https://help.tillit.cloud/tillit/knowledge-base/setting-up-tillit/recipe-management/control-parameters "mention") for a recipe to produce a material or a procedure. It is associated with an Asset Class as an optional fiter.

It contains rules, each with conditions that define when the rule should apply. These conditions can be configured using combinations of different Assets, Materials, and other criteria.

Each rule also includes values that will be set for the corresponding [control-parameters](https://help.tillit.cloud/tillit/knowledge-base/setting-up-tillit/recipe-management/control-parameters "mention"), which are triggered and sent when the conditions are met.

### Where do these values get sent?

These are sent to Ignition via the TilliT Ignition Module. See [ignition-module](https://help.tillit.cloud/tillit/tools/ignition-module "mention") for more.

## Important note

{% hint style="danger" %}

### Before creating Recipes

[control-parameters](https://help.tillit.cloud/tillit/knowledge-base/setting-up-tillit/recipe-management/control-parameters "mention") **must** be configured before creating Recipes.
{% endhint %}

## Navigation

Go to Settings > Recipe Management > Recipes

<figure><img src="https://352909507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrNT40XJFAFlAhUX8CcQS%2Fuploads%2Fgit-blob-62cc0d6094b14e3039cdc620ccd113d899add0dd%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

## Creating Recipes

Click on Create and fill out the modal

<figure><img src="https://352909507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrNT40XJFAFlAhUX8CcQS%2Fuploads%2Fgit-blob-eea823ef30e0502ba9126d7c6339d347b16b4b36%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

| Field        | Description                                                                                                             |
| ------------ | ----------------------------------------------------------------------------------------------------------------------- |
| Name\*       | Name of the recipe                                                                                                      |
| Asset Class  | If orders are started on asset(s) not included in this asset class, the rules within the recipe will not be considered. |
| Recipe Key\* | The ID of the recipe, cannot be changed once set.                                                                       |
| Description  | Description of the recipe                                                                                               |

## Creating Rules

Click on the recipe that you want to create rules for.

Fill in the modal for the first step, once you choose the Control Parameter, the fields to enter its value should appear.

<figure><img src="https://352909507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrNT40XJFAFlAhUX8CcQS%2Fuploads%2Fgit-blob-3d990995761520f0010645e8da8be923f01497a4%2Fimage.png?alt=media" alt="" width="414"><figcaption></figcaption></figure>

| Field                        |                                                                                                                                                                                                                                                                         |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Name                         | Name of the Rule                                                                                                                                                                                                                                                        |
| Control Parameter            | The [control-parameters](https://help.tillit.cloud/tillit/knowledge-base/setting-up-tillit/recipe-management/control-parameters "mention") that this rule applies to.                                                                                                   |
| Phase                        | The Phase that a specific value of the Control Parameter is supposed to be used for.                                                                                                                                                                                    |
| Priority                     | Priority for which rule to apply if their conditions are the same.                                                                                                                                                                                                      |
| Numeric/String/Boolean Value | <p>Depending on how you configure the <a data-mention href="control-parameters">control-parameters</a>, the field will have a different data type in its name.<br>This is where you will enter the expected Control Parameter for your asset to have.</p>               |
| Upper Limit                  | The maximum limit that this CP should realistically be, without being considered failing. See [process-variable](https://help.tillit.cloud/tillit/knowledge-base/setting-up-tillit/configuration/process-variable "mention") for an additional example of this concept. |
| Lower Limit                  | The minimal limit that this CP should realistically be, without being considered failing. See [process-variable](https://help.tillit.cloud/tillit/knowledge-base/setting-up-tillit/configuration/process-variable "mention") for an additional example of this concept. |

Click continue to go to the next step.

<figure><img src="https://352909507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrNT40XJFAFlAhUX8CcQS%2Fuploads%2Fgit-blob-367a12622b105fe55fe3e0b0d1a9ef7d1976116f%2Fimage.png?alt=media" alt="" width="420"><figcaption></figcaption></figure>

This is where you add the conditions for your rules. So how does this work?

Every time a new order starts **running** or on **a changeover start**, TilliT will immediately match your asset with a rule that apply.

### For example - Wheel Speed

After this recipe is LIVE. TilliT immediately starts checking for orders that:

* Have the [copy-of-attribute](https://help.tillit.cloud/tillit/knowledge-base/setting-up-tillit/configuration/copy-of-attribute "mention") Bottleneck with the value equal to True
* Glass Supplier of the order is TIL Bottle Export
* Asset(s) that are running the order belong to the "Fillers" Asset Class.

If there is an order that qualifies for those conditions. The target value that will be sent to that asset is 50 for the Wheel Speed they are expected to be running at. Other values configured such as Upper Limit, and Lower Limit will also be sent.

<figure><img src="https://352909507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrNT40XJFAFlAhUX8CcQS%2Fuploads%2Fgit-blob-1716f1ebc2de773bd4d89143ecff95acd55a261b%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

## Creating Phases

What happens when an asset needs to change the its control parameters values throughout production? That's where Phases come in.

You can send multiple values of the same Control Parameters with Phases.

{% hint style="warning" %}
All Rules created are automatically in Phase 1.
{% endhint %}

### Example: Different pressures for different phases

Using the Order Preview, we can see that there will be two values for the Control Paramters "Pressure" that will be sent to the assets that match the rules for this running order.

<figure><img src="https://352909507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrNT40XJFAFlAhUX8CcQS%2Fuploads%2Fgit-blob-3366a147d73022ae2f8fa3778e337eb9d6dc9f0c%2Fimage.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

However, if they were both in Phase 1, then only one will take precedence and show up.

{% hint style="warning" %}
All of these values are sent at the same time when a suitable order starts running. It is up to the machine to interpret the phases and configure those values accordingly.
{% endhint %}

<figure><img src="https://352909507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrNT40XJFAFlAhUX8CcQS%2Fuploads%2Fgit-blob-3366a147d73022ae2f8fa3778e337eb9d6dc9f0c%2Fimage.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

## Testing your Control Parameters

With this feature, you can test to see if your rules are going to be applied correctly as expected. This will pull all available Recipes and Rules to compare, not just the one opened in your user interface.

When a recipe is still a draft, denoted by the status bar on top of the screen or the presence of the "Promote to Live" button. You can then click on the Order Preview in order to test for a particularly order, which Rules' values will be sent to its asset(s)

<figure><img src="https://352909507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrNT40XJFAFlAhUX8CcQS%2Fuploads%2Fgit-blob-e36f3f767b5319d69e7c60f6e8c606eed2f58c3d%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Click on "Select an Order".

<figure><img src="https://352909507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrNT40XJFAFlAhUX8CcQS%2Fuploads%2Fgit-blob-6ce223e1cf5f3ad86b0b43464be4ec087e8033bf%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Then type to choose an Order you want to test the rules for.

<figure><img src="https://352909507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrNT40XJFAFlAhUX8CcQS%2Fuploads%2Fgit-blob-0f4d6c6b450330b11f57f324faf7a1dba121484b%2Fimage.png?alt=media" alt="" width="285"><figcaption></figcaption></figure>

You will then be able to see which Recipes and Rules will apply for this particular order, including the values that would be sent, the lower and upper limit.

<figure><img src="https://352909507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrNT40XJFAFlAhUX8CcQS%2Fuploads%2Fgit-blob-5a4c4024b180c6711d7ea0574ed2265ce6cd888e%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

## Publishing to Live

You must publish the recipe to LIVE, see top left corner, in order for the Recipe and its Rules to be computed.

<figure><img src="https://352909507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrNT40XJFAFlAhUX8CcQS%2Fuploads%2Fgit-blob-2adfa99571d5f1580df2a8c81ba44b2271052f3f%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

## Avoiding duplicating Rules

{% hint style="warning" %}
It is important to note that Recipes are simply a way to group the rules, it is not necessary to create the same rule for every single Recipe as rules from different Recipes can be sent.
{% endhint %}

### Example

You have a **default recipe** for the Blanching procedure. These include rules that generaly should be sent to the blanching machine under any orders.

However, sometimes, you have specific blanching Control Parameters values that you'd like to send to the blanching machine in the event of making that Product A.

This is when you should be creating a new recipe that includes **only** the specific rules for the Product A.

Let's see what this would look like in the Order Preview:<br>

<figure><img src="https://352909507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrNT40XJFAFlAhUX8CcQS%2Fuploads%2Fgit-blob-eb58823b4ec20d3ee052d9d0990950b1ca52c46e%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

The Rules that will be sent are:

* Default Temperature value from our Default Blanching Recipe
* Wheel Speed value from our Product A - Blanching Recipe

This saved you from having to creating Temperature rules over and over again in every recipe.

## Versioning

### When the recipe is live

When the recipe is live, you cannot edit the LIVE version, but need to create a new version. Click on "Create new version".

<figure><img src="https://352909507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrNT40XJFAFlAhUX8CcQS%2Fuploads%2Fgit-blob-40e8c8be28e388261da3a6f533cfa53513d0e5fd%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

After clicking on this, you will be shown a new recipe page that denotes as a Draft.

Note that you can change the name and all other details of the Recipe, except the "Recipe Key", which is set on creation. This lets the system know which Recipe to replace when you "Promote to Live".

{% hint style="warning" %}
Each Recipe Key can only have:

* 1 LIVE version
* 1 DRAFT version

What happens if you try to create a new version where a draft is already in place? It will lead you to the current draft.
{% endhint %}
