# Time Constraints for Materials in Line Flows !!! info "Available from SMT Template version 3.1.0 onwards" ## Overview The Time Constraints for Sub-Materials feature enables the definition and enforcement of time constraints between process steps on **Line Flows**, ensuring sensitive materials are processed within allowed time windows between specific manufacturing steps. !!! note "Electronics use case: limiting time between reflows" The most obvious use case for this feature for the context of SMT lines is the enforcement of the maximum time spent between the reflow of the top side of the panel and the reflow of the bottom side of the PCB panel. Minimizing the time spent between these two steps is critical to ensure that not too much moisture is absorbed by the PCB before the second reflow process, which could lead to PCB delamination and/or component faults. ### Concept When a material performs a configured "From Operation" at a specific source step, a time constraint is created in the [SMTTimeConstraintTracker](../artifacts/tables.md#smttimeconstrainttracker) Generic Table which will be validated when the configured "To Operation" is performed at the configured target step. The time constraints are applicable across steps in the **same** or **different** line flows. The time constraints are configured in the [[timeconstraintscontext-st]] Smart Table, which allows flexible control of timing between key process events, rather than being limited to specific system actions. !!! note "Supported time constraint operations" The only operations that are supported for line flows are **TrackIn**, **TrackOut** and **Rework**. #### Time constraint types Time constraints can be defined to enforce: - A **maximum delay** between steps (e.g., to respect material floor life). - A **minimum delay** (e.g., to allow proper cooling or curing). #### Time constraint enforcement When a time constraint is violated, the following happens: - If a rule is associated to the time constraint, **execute the rule**. - **Block the "To Operation" from being performed** at the target step, preventing the Material from continuing in the process. #### Executing the time constraint rules In order to execute the **Time Limit Rule** or the **Warning Rule** when the **Warning Time** or **Time Limit** deadlines are missed, a timer called `SMTTimeConstraintTrackerTriggerActionsTimer` is triggered regularly. When the previously mentioned timer is triggered, the following events will happen: 1. The `SMTTimeConstraintTrackerTriggerActionsRule` rule is triggered, which will execute the [SMTTimeConstraintTrackerTriggerActions](../artifacts/dees.md#smttimeconstrainttrackertriggeractions) DEE 2. The [SMTTimeConstraintTrackerTriggerActions](../artifacts/dees.md#smttimeconstrainttrackertriggeractions) DEE will find all the time constraints that have rules that should be executed, and will create Integration Entries for every rule to be executed. The rules' time constraints will have their system states changes to either `PostWarning` or `PostTimeLimit` which indicate whether the **Time Limit Rule** or the **Warning Rule** have been triggered. - The Integration Entries will be of type `SMTExecuteTimeConstraintTrackerRule` and the event will be one of `SMTExecuteWarningLimitRule` or `SMTExecuteTimeLimitRule`, depending on which rule of the time constraint is meant to be executed. 3. The Integration Entries will execute the [SMTExecuteTimeConstraintTrackerRule](../artifacts/dees.md#smtexecutetimeconstrainttrackerrule) DEE, which will then execute the time constraint rule. #### Cleaning up closed time constraints When a time constraint is successfully passed, its system state becomes `Closed`. This time constraint will be automatically removed from the [SMTTimeConstraintTracker](../artifacts/tables.md#smttimeconstrainttracker) Generic Table via one of the following two mechanisms: - The corresponding material is terminated, which leads to the deletion of all rows in the MES that reference that material (including the time constraints). - The `SMTTimeConstraintTrackerPurgeClosedTimer` daily timer is triggered, which will remove all closed time constraints from the [SMTTimeConstraintTracker](../artifacts/tables.md#smttimeconstrainttracker) GT. !!! info "Preconditions" - The Step property `Enable Time Constraints` must be enabled in the steps where the time constraints will be created and validated. - The time constraints must be properly configured in the [[timeconstraintscontext-st]] Smart Table. - Any rule that is meant to be configured in a time constraint must have the scope `TimeConstraint`. ## Setting up time constraints Consider the scenario where the user wants to ensure that the time the PCB takes between leaving the **Solder Paste printing machine** and entering the **Reflow Oven** must not exceed 30 minutes. The user also wants to receive a warning if 25 minutes have passed and the PCB hasn't gone into the oven yet. ![SMT Diagram](images/timeconstraints/smtdiagram.png) ### Configure the steps Open the step where you want to use time constraints and select the Edit button. ![Press edit button](images/timeconstraints/stepviewpresseditbutton.png) Make sure the `Enable Time Constraints` toggle is on, and save the step. ![Enable Time Constraints](images/timeconstraints/enabletimeconstraints.png) !!! info "This must be done for every step where time constraints are created _or_ validated." ### Configure the warning rule Create a new rule with a scope of `TimeConstraint` and a DEE Action to suit your needs. ![Enable Time Constraints](images/timeconstraints/createrule.png) ??? note "SendNotification DEE Code" ```C# UseReference("", "Cmf.Foundation.Common.Exceptions"); UseReference("Cmf.Navigo.BusinessObjects.dll", "Cmf.Navigo.BusinessObjects"); UseReference("Cmf.SMT.Common.dll", "Cmf.SMT.Common.Abstractions"); var serviceProvider = (IServiceProvider)Input["ServiceProvider"]; ISMTUtilities smtUtilities = serviceProvider.GetService(); IEntityFactory entityFactory = serviceProvider.GetService(); smtUtilities.CreateNotificationAlert( $"Warning: {(string)Input["Material"]}", "Only 5 minutes until material can't be put in oven!", AssignmentType.Everyone, null, null, null, false ); ``` ### Configure the [[timeconstraintscontext-st]] Smart Table Go to the Administration menu and select Tables. ![Smart Table image](images/timeconstraints/st1.png) Select Smart Tables and then select the [[timeconstraintscontext-st]] table. ![Smart Table image](images/timeconstraints/st2.png) Select Add. ![Smart Table image](images/timeconstraints/st3.png) Configure the table according to the required context. ![Smart Table image](images/timeconstraints/st4.png) ![Smart Table image](images/timeconstraints/st5.png) The time constraint is now configured. ![Smart Table image](images/timeconstraints/st6.png) !!! info "The values in the _Multiplication Factor_ and _Remove on Pass_ columns of the ST are irrelevant" All the time constraints for line flows are _Remove on Pass_ by default. !!! warning "Time constraints are only created and validated for the topmost materials in the line flow (i.e. panels)" Please be mindful of this detail if you configure time constraints for a specific material. Applying a time constraint to a specific board in a panel will not work: apply the time constraint to the board's panel instead. ## Executing time constraints Consider the scenario of a panel going through an SMT line. Notice what happens to the [SMTTimeConstraintTracker](../artifacts/tables.md#smttimeconstrainttracker) Generic Table when the panel is tracked out of `SMT_Printing`: ![Generic Table](images/timeconstraints/gtonentry.png) A new time constraint is created which will be validated we track in to the `SMT_Oven` step. In this Generic Table you are able to edit, create and delete all the time constraints for materials in line flows. Notice now what happens to the [SMTTimeConstraintTracker](../artifacts/tables.md#smttimeconstrainttracker) GT when the material is tracked in to `SMT_Oven`: ![Generic Table](images/timeconstraints/gtclosedentry.png) The material was tracked in well before the time limit date and successfully passed the time constraint, as you can tell by the fact that the time constraint's system state is now `Closed`. ### Delayed panel scenario Now consider the exact same scenario, but now something happens to the panel that prevents it from being tracked in the oven in time. After 25 minutes, you will be presented with the following notification: ![Generic Table](images/timeconstraints/notification.png) After another 5 minutes you will no longer be able to track in the panel: ![Generic Table](images/timeconstraints/error.png) At this point, the panel should be removed from production. Alternatively if the decision is made to track in the material anyways, the time constraint blocking the track in must be removed from the [SMTTimeConstraintTracker](../artifacts/tables.md#smttimeconstrainttracker) Generic Table. ## Administration To use this feature, the timer `SMTTimeConstraintTrackerTriggerActionsTimer` must be configured with the appropriate recurrence (the default is once every 5 minutes). !!! warning "SMTTimeConstraintTrackerTriggerActionsTimer performance vs responsiveness" If the `SMTTimeConstraintTrackerTriggerActionsTimer` is set to execute very often (e.g. multiple times per minute), it will have a negative effect on the performance of the MES. One must also avoid setting the timer's recurrence too low: doing such a thing might lead to an unnecessarily large amount of time constraint rules being executed all at once.