How To Create Your First Machine Trigger
  • 16 Nov 2022
  • 6 Minutes to read
  • Contributors

How To Create Your First Machine Trigger


Article Summary

How To Create Your First Machine Trigger

Use Machine Triggers to update the history of every machine in the Machine Monitoring feature

In this article, you will learn:

  • How to use Machine Triggers to change state of the machine
  • The full list of actions that you can use in Machine Triggers

Once you have set up Attributes and Machine Types you are ready to update the history of a machine based on the value of OPC UA fields.

In other words, you will want to create a history like this for every machine:

This guide will show you how to build the history above. In the machine history, every row in the Table is defined by a change in state of the machine. You can see the different states on the far left Field.

Here is how the data flows into machine triggers:

  1. An OPC UA field shares an output.
  2. That output is mapped to an attribute on the page for that individual machine.
  3. The attribute is used in machine trigger logic.

Updating the State of the Machine

On the page for each individual Machine Type, you can define multiple Machine Triggers that will update the state of the machine (or any field).

Here's an example of machine states for one type of machine:

To create a machine trigger, click the Edit button at the top right of the Machine Type page.

Click on the + sign in the top right of the Machine Triggers section.

Then, you will need to add a When statement to define when the state should be updated. There are two types of When statements:

  1. Based on the value of the last output from a specific OPC UA field.
  2. Time-based i.e. "in the last 5 seconds".

Here's an example of the first condition:

When

  • "Machine" outputs: "specific attribute" "Spindle"

If

  • "Machine Attributes" "spindle" "current value" ">" "Static Value" "Number" "100" "since last output"

Then

  • "Set Activity History" field: "State" value: "Enum" "Running"

For every machine that has this type, this Trigger will look at the last value of an OPC UA field that is tied to the "spindle" attribute. If that value is greater than 100, the machine will enter the "Running" state (or continue being in that state)

Here's an example that uses timing:

When

  • "timer fires" "every 30 seconds"

If

  • "Machine Attributes" "spindle" "current value" ">" "Static Value" "Number" "100" "now"

Then

  • "Set Activity History" field: "State" value: "Enum" "Running"

If the spindle value is greater than 100, then the machine state will change to "Running".

This trigger is evaluated every second. Within a second of the value rising above 100, the machine state will change to "Running" and stay there until 30 consecutive seconds pass without a value greater than 100 (30 consecutive values)

Changing The Value of a Field (ie Defect Count, Part Count)

By changing the state, you automatically add a new row to the Activity History for each machine. But, you can also update each individual field for the machine and group it with that particular status.

For example, you might have a machine Trigger that updates the machine status between "Running", "Idle", and "Stopped".

Then, you might have a separate trigger that updates the "Part Count" when an OPC UA field changes its value.

You can update the "Part Count" field just like you might update a variable in the Trigger Editor in the App Editor.

Here are the different fields you can update:

  • State
  • Downtime Reason
  • Program
  • Ideal Run Rate
  • Defect Count
  • Part Count

These fields are automatically updated:

  • Start Time
  • End Time
  • Duration

There are two actions in a machine trigger that can update these fields:

  • Create Machine State: Set the value of the State field.
  • Data Manipulation: Gives the option to: Clear, Decrement, Increment, or Store a value to a field.

In the following example, "part_counter" is a Boolean Attribute that would be updated when the machine finished a part and updated the resulting OPC UA field.

If

  • "Machine Attributes" "Spindle" "current value" ">" "Static Value" "Number" "100" "now"

Then

  • "Data Manipulation" "Increment" field: "Part Count" value: "Static Value" "1"

This would update the "Part Count" field for the current status that the machine is in and it would be immediately reflected in the Activity History.

Further Reading


Did you find what you were looking for?

You can also head to community.tulip.co to post your question or see if others have faced a similar question!


Was this article helpful?