Custom Variable Ignore Tool Change
Previous Topic  Next Topic 


Ignore Short Cycle Ends


There are times when an evaluation of an expression should only be true after a certain amount of time.  In order to accomplish this a custom variable can be used to track the amount of time a particular expression has been true.


A Custom Variable can be created and then the Custom Variable Value and Custom Variable Time PCSDB variables can be used to track how long a particular scenario has been true. 


Scenario:

A piece of equipment has frequent short periods of time where the cycle stops for 10 to 20 seconds such as tool changes.  These short stops should be ignored, therefore the machine stops will be tracked with a custom variable.  Now, with this solution, an end cycle will only be entered when the custom variable time is greater than 30 seconds eliminating all of the short stops.


In this case the desired Cycle End expression used will be unchanged.  However, rather than the Target being PCSDB.send_end_cycle{} the target will be a Custom Variable.


The first step is to create the custom variable.  On the ribbon bar go to the DataXchange tab and select the Custom button in the Variables section and then select PCS Database from the drop down. For this example, create a custom variable named cycle_stop.


Next, if not already connected, connect to the desired DataXchange Service by pressing the Connect button in the ribbon bar and selecting the name of the DX Service.  Now press the Expression button in the ribbon bar and select Create Expressions.  Select the current Cycle End expression and then press the Modify button on the form and change the Result from [PCSDB.send_end_cycle]{cycle_status} to [PCSDB.custom_variable_value]{cycle_stop} where cycle_status is the associated cycle status such as 101.

 

Using the Target this way DataXchange will just reset the time stamp associated with the custom variable when a cycle end occurs.  The next step will be to create a new expression to read the custom variable time and if it's greater than our desired time of 30 seconds DataXchange will then trigger the actual cycle end.


Now create a new expression that is identical to the original cycle end and append the following to the expression.


AND ([PCSDB.custom_variable_time]{cycle_stop} >= 30) AND ([PCSDB.prev_custom_variable_time]{cycle_stop} < 30)


and set the Result to use the cycle end command.

[PCSDB.send_end_cycle]{cycle_status}

where cycle_status is the associated cycle status such as 101.


The final step is to assign the new expression to the equipment.