The invention discloses controller redundancy and a switching method. The method is used for the redundancy switching logic between an industrial controller main
machine and a spare
machine. Calculation and output synchronization between the main
machine and the spare machine is guaranteed, and rapid undisturbed switching is achieved when the main machine fails. A switching circuit is composed of two pairs of GPIO control lines and a 100M
Ethernet. Through recognition of low level states, pulse
signal states and high level states of IOs, the
normal state or the failure state of the opposite end controller main machine or the spare machine is obtained, and the
normal state or the failure state of the main machine or the spare machine of an opposite end controller can be obtained in a communication mode when the hardware switching circuit fails, so that arbitration and switching of the main machine and the spare machine are achieved. The design method of state machines is adopted, the operation states of the controller are summarized to be five states that the main machine is normal, the main machine fails, the spare machine is normal, the spare machine fails, and opposite ends are powered off, and the arbitration treatment of the main machine and the spare machine is achieved through matrixes of the state machines. The hardware switching circuit and redundant communication serve as connecting signals between redundancy devices, reliability of redundancy switching control is greatly enhanced, and stable operation of an
industrial control system can be effectively guaranteed.