Skip to main content

Automatic Breaks

This article focuses on how to configure automatic breaks with the rules engine.

This configuration tries to take into account every possible scenario to improve your data collection, reduce your operators workload, while keeping the data as close as possible from what really happens in your factory.

This article assumes that you have knowledge of the rules engine, rules conditions and Machine State configuration.
Automatic breaks are an advanced configuration feature.

Study case

This article is build on an example and follows the steps to configure from start to finish.

In our example factory, shifts are 8 hours long from 8:00 to 16:00 to 00:00 to 8:00.
Lunch breaks are at 12:00/20:00/4:00 and are 1 hour long.
Small breaks are at 10:00/14:00/18:00/22:00/2:00/6:00 and are 15 minutes long.

Special cases

The basic approach to configure an automatic break would be to create a prefill stop cause at every break with either a Lunch stop cause or a Break stop cause.
However, what if your operator works 5 minutes more? What if there is a rush of production and lunch are reduced to 30 minutes? And if your machine does not work for X reason for a whole day, you have to consider creating a normal OFF event at the end of every break. Those are all cases that this configuration takes into account.

Step 1: Setup the variable "break_status"

Later in the configuration, the rules will have to know in which time slot you are in: production, small break or lunch.
For this, we create a variable named break_status defined like this:

  • 1 = normal production time
  • 2 = small 15 minutes breaks
  • 3 = long lunch breaks

Let's create 3 Variable actions that will be used in step 2, to switch between break status.

Step 2: Configure the variable break_status

On this second step, we have to create a rule that sets the variable to either 1, 2 or 3 with a Scheduled trigger. Please read the full Step 2 before diving in the configuration.

In our example, we have 3 lunch breaks and 6 small breaks. Since we have to configure a rule for the start and the end of every breaks, this means 18 rules to configure.

Here is how to configure the triggers for the 12:00 to 13:00 lunch breaks rules:

Here is the example of a full rule, using our action created in Step 1:

Rule 12h00

Now that you know how to configure a rule for a break, you juste have to do 16 more.

tip

Creating one rule for each start/end of a break can be long and confusing. For that, we can use the Cron String at its full capacity to lower the number of rules you have to create.

See below to understand what a Cron String is and how to use it.

Reduce the number of rules you have to create

The inner workings of the Scheduled trigger is using what is called a Cron String.
This is a format used in Unix systems to plan repetitive tasks: its a way to code a sentence like "Do something every Friday of Febuary at 6AM".
We created an interface so it's easier to use but you can still see the string below the form in a read only input.
Let's see how we can use it to our advantage in this configuration.

For our automatic break configuration, we need to code four "sentences":

  • At 12:00, 20:00 and 04:00 every day do: start of lunch breaks (break_status to 3)
  • At 13:00, 21:00 and 05:00 every day do: end of lunch breaks (break_status to 1)
  • At 10:00/14:00/18:00/22:00/2:00/6:00 every day do: start of small breaks (break_status to 2)
  • At 10:15/14:15/18:15/22:15/2:15/6:15 every day do: end of small breaks (break_status to 1)

If we configure it like that, we only need 4 rules compared to 18 previously.

Here is what the string represents, taken from the Cron Wikipedia page:

 ┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of the month (1 - 31)
│ │ │ ┌───────────── month (1 - 12)
│ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday)
│ │ │ │ │
│ │ │ │ │
* * * * *

Let's see it with some example (play with the interface to see it change):
Every day at 12:00: 0 12 * * *
Every day at 13:00: 0 13 * * *
Every Monday at 12:00: 0 12 * * 1
Every day of the week except Sunday (0) at 15:30: 30 15 * * 1,2,3,4,5,6

We can notice that the comma can add days selection. It works exactly the same for hours:
Every day at 12:00, 20:00 and 04:00: 0 4,12,20 * * *
Select Repeat "None" at the top of your Scheduled trigger, and create your 4 rules for your 4 "sentences".

tip
  • At 12:00, 20:00 and 04:00 every day: 0 4,12,20 * * *
  • At 13:00, 21:00 and 05:00 every day: 0 5,13,21 * * *
  • At 10:00/14:00/18:00/22:00/2:00/6:00 every day: 0 2,6,10,14,18,22 * * *
  • At 10:15/14:15/18:15/22:15/2:15/6:15 every day: 15 2,6,10,14,18,22 * * *

If the configuration is not clear enough with a complex Cron String, stick to creating a rule for each break status change. It can sometimes be easier, especially if you don't have that many breaks and/or machines.

Step 3: Configure the machine stop causes

This final step is to configure the prefilled stop cause and avoid configuration misteps with your previously configured Machine State.

You have to repeat this step for every machine you want to configure automatic breaks on.

We assume, to keep the example concise, that you chose to configure with the Cron Strings. If not, you will have to create as much rules as you just did: 18 instead of 4 for this example. For EACH machine, you want to add automatic break configuration.

danger

As said before, this configuration tries to take into account every possible scenario to improve your data collection, reduce your operators workload, while keeping the data as close as possible from what really happens in your factory.

Keeping the data as true as possible needs a lot of configuration. Cutting corners in this configuration could lower the data accuracy.

ON or OFF at break time?

This part is about the breaks scheduled time and when to not create an OFF event.

As stated previously, we need to create 4 more scheduled rules for each machine, with the same trigger times.
We could ask ourselves: if my scheduled rule triggers at 12:00, why create an other that will trigger at 12:00 too? Why do we not put a prefill machine status action for each machine to our rules previously created to handle break_status?
Because otherwise we would not answer this question: What if your operator works 5 minutes more?

Indeed, the copies of our 4 scheduled rules have a condition: is my machine OFF?

This answers two problems:

  • We do not want to create an OFF event at 12:00 if you operator still works at 12:05
  • We do not want to have a lunch break lasting 20 minutes after 13:00 if the operator is late. We want to create a default OFF event to keep our data true.

First, create two OFF prefilled machine state actions for lunch and small breaks:

Action lunch Action small

Then add a condition in your 4 scheduled rules: is my machine OFF? ($machine_state == false)

Finally, add the respective actions to your 4 rules like this:

  • At 12:00, 20:00 and 04:00 every day do: Machine State to OFF - Lunch break
  • At 13:00, 21:00 and 05:00 every day do: Machine State to OFF (default)
  • At 10:00/14:00/18:00/22:00/2:00/6:00 every day do: Machine State to OFF - Small break
  • At 10:15/14:15/18:15/22:15/2:15/6:15 every day do: Machine State to OFF (default)

Break overview

Configure the Machine State OFF during a break

This final part configures when the machine is going OFF during a break. It answers the question: What if your operator stops the machine 5 minutes after the scheduled break and you "missed" the scheduled prefill stop cause event?

For that we need to add 2 rules to your basic Machine State configuration that listens to the Machine State variable going to false. This gives us 3 rules that listens to your state going false: production time OFF, lunch break OFF and small break OFF.

What differentiate thoses 3 rules, is that each of these rules have a condition according to the value of break_status. Each rule has the same trigger but a different condition.

Use the actions we created previously with a value trigger listening to the Machine State variable going false to get this:

Rule condition

Do the same for the lunch break (break_status == 3) and don't forget to add a condition to your previous Machine State OFF rule.

Conclusion

You now know how to configure automatic breaks in your app. Beware of the effect of misconfigured rules.