You should use a power protection device, such as an uninterruptible power supply, with your power-handling program. . performing the following three basic functions: Preventing hardware damage typically caused by surges and spikes. Many UPS models continually condition incoming power as well.
[PDF Version]