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 column.

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" ">" "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 second"

IF

  • "Machine Attributes" "spindle" ">" "Static Value" "Number" "100" "in last" "30 seconds"

THEN

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

In the last 30 seconds, if the spindle value was ever 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 Builder.

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" ">" "Static Value" "Number" "100" "since last output"

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 this answer your question?