View Single Post
Old March 15th, 2019, 07:46 PM   #4
United States

Aabeck is offline
Aabeck's Avatar
Join Date: Feb 2013
Location: Detroit
Posts: 1,860
I did this on a laminating hot press to continue the cycle if the power was off less than 20 minutes and the hydraulic pressure was not lost. The customer specified it to abort the cycle if the power was off more than 20 minutes.

What I did was power the PLC by the UPS for the HMI computer. The PLC watched for the main power to drop and recorded that time. When the power came back on if the PLC was still running, or just restarted at the power coming back on was calculate the lost time.

Calculating the hours and minutes was fairly easy, but if the power dropped during a cycle that continued into the next day, maybe month and year, got complex.

If the power restores after midnight the next day see what day of the month it is, the number of days that month (leap year Feb's have 29) and the year to calculate how many days/hours/minutes the power was off.

Along with these calculations I just added a 20 minute timer to time out - as the UPS keeps the PLC running for almost an hour.
Never underestimate the quality of idiots that will be running your machines
  Reply With Quote