How can we help?

Using Custom Variables with Math Operations

You are here:
< All Topics


Imagine a scenario where a counter is needed to track the total amount of time a machine has been in cycle. Each time the machine goes into cycle we want to start a timer, and then each time the machine stops we want to pause the timer.

  1. Create a custom variable that will store the value. Go to the DataXchange tab → Variable → PCS Custom. In this example we will name the variable “cycle_counter”.
  2. Create an expression to track when the cycle stops. This will be in the body of the expression:

([PCSDB.general_equipment_status] !=[PCSDB.CYCLING]) AND ([PCSDB.prev_general_equipment_status] =[PCSDB.CYCLING])

The target for this expression will be the Scytec PCS Database and a result updating the newly created PCSDB custom variable “cycle_counter”:

[PCSDB.send_custom_variable_value] {cycle_counter} == ([PCSDB.custom_variable_value]{cycle_counter} PLUS [PCSDB.prev_general_equipment_status_time])

Note that parentheses () are placed around the portion of the expression to ensure it is evaluated first.

Now that the counter expression is built we need to trigger some sort of event when the counter hits a limit. Let’s say we want to send an email after the machine has run for 50 hours, which would be 180,000 seconds.

  1. Create the following expression:

[PCSDB.custom_variable_time] {cycle_counter} > 180000)

Set the target to email, and the desired email template selected.

  1. Create a duplicate of the previous expression. The first expression will trigger the email, while the second will reset the cycle_counter variable to zero. Use this target for the second expression:

[PCSDB.send_custom_variable_value] {cycle_counter} == 0

Another option is to set the value to NULL for reporting and charting purposes. See here for information on running reports for custom variables. To set the cycle_counter value to NULL use the following target:

[PCSDB.send_custom_variable_value] {cycle_counter}

The Script Source feature can also be integrated as well to use this counter information in any way you could possibly want.

For example, the limit used to trigger an event can be pulled from a CMMS, and the target could automatically open a work order in the CMMS.

Contact your local reseller for more information.

Other Links

More information on PCSDB Custom Variables

Table of Contents