Custom Variable Start Cycle
Previous Topic  Next Topic 


End a Downtime and Start a Cycle


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:

DataXchange has been configured to track downtimes such as Setup and Maintenance and to ignore machine cycles while in one of these downtimes.  This is desirable since cycles used to prove out a setup or due to maintenance should be ignored.  However, if the operator forgets to end the downtime before production begins then productions cycles are also not captured. 


A solution here is to track when a cycle start occurs and if the equipment has been cycling for a certain amount of time while the specific downtime codes are active the downtime can be ended automatically. 


In this case the desired Cycle Start expression will be unmodified.  A new Cycle Start expression will be created and the Target will be a Custom Variable.  A new Downtime End expression will be created that will also look at the Custom Variable Time to determine if it should evaluate to True ending the downtime.


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


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.  Create a new Cycle Start expression and set the Target to [PCSDB.send_custom_variable_value]{cycle_start}.  The Cycle Start expression can be the same as the current Cycle Start expression being used.


Using the Target this way DataXchange will just reset the time stamp associated with the custom variable when a cycle start 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 5 minutes DataXchange will then trigger a downtime end and the cycle will then start automatically.


Create a new expression that looks to see if the machine is in any type of cycle, and the current planned downtime is active, and the downtime has been active for greater than 5 minutes. 


([PCSDB.general_equipment_status] = [PCSDB.CYCLING]) AND ([PCSDB.current_pdt_status_code]{202}) AND ([PCSDB.custom_variable_time]{cycle_start} >= 300) AND ([PCSDB.prev_custom_variable_time]{cycle_start} < 300)

where 202 is the downtime such as Setup.  If we want this to work for multiple downtimes then multiple can be entered with an OR statement, or an Equipment Status Group can be used.  The time is tracked in seconds therefore 300 is used for 5 minutes.


Next, set the Target to use the planned downtime end any command.

[PCSDB.send_planned_DT_end_any]


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