# How to calculate 15 min power off duration?

## Recommended Posts

• MVP 2023

I'm faced with a task that I can not implement yet.
We have a chemical process that is controlled by a PLC (Samba). It lasts more than 24 hours.

If the power fails, then it's possible to continue it normally only for 15 minutes without energy.

After a switch-off period of more than 15 minutes, the process must be interrupted.
It is clear that I need to copy the clock values to the variable every minute, and then, after re-switching on the power, compare the time passed with the value of 15 minutes.

The question is how to calculate the shutdown duration, since the real-time clock goes to 00.00 and it is possible that the process can be shut off exactly at 24 hours and no crash will be recorded.
I have seen on the forum a way to determine the length if the distance meter is overflowing. If in my case operate time in seconds then may this method work?
Of course it is necessary to take into account the change of days in the calendar.
Is there an easier way?

##### Share on other sites

Hi Kratmel.

Could you use a small UPS on the PLC?

If it is only vital for 15 mins than a small unit would do.

You can use a digital input to detect if the plant power has gone off and start your timer.

Regards

Denis

##### Share on other sites

• MVP 2023

Hi Kratmel, Denis's idea is good, but I am also a little confused on what is being wanted.  If the need is simply to measure the length of time the power has been off, and not actually do anything else, you could easily implement this using UTC.

Store the current RTC to UTC reading every second.  Have a power up bit that activates a subroutine that compares the current UTC to your stored one, does maths that then displays results on a screen that tells you both the delay time and also flash an alert if it is over 15 minutes.

Or have a routine that always compares current UTC to the stored one, and if it goes over, or gets close etc does the same alert system.  But without things being dependent on a power-up.

cheers, Aus

##### Share on other sites

• MVP 2023

Chemical processes with which I am not very familiar use powerful power supplies.
Each of them is now controlled by the  Samba installed in a sealed box.
Everything that is programmed in it is a mode of operation that varies according to time.
The customer's request is to ensure that even a power cut is recorded as an alarm, but only when it exceeds 15 minutes.
This is the case in this production that the power supply network often disappears due to weather conditions.

However, the automation returns power and this power return process can last longer than the processing technology allows (powerfull generator started).
The idea of an uninterrupted power supply is good, however, does not meet the customer's technical requirements.

It should be kept in mind that turning off the power of the process may be caused by an accidental operator mistake to .
I am also surprised by the customers' task - but this problem is the last one that I should solve in this order.

Thanks to  Ausman, Sgull.

##### Share on other sites

• MVP 2023
16 hours ago, kratmel said:

The customer's request is to ensure that even a power cut is recorded as an alarm, but only when it exceeds 15 minutes.

Then Ausman's suggestion should work just fine.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×