  For proton linear accelerators used in applications such as
accelerator-driven systems, due to the nature of the operation, it is essential
for the beam failure rate to be several orders of magnitude lower than usual
performance of similar accelerators. A fault-tolerant mechanism should be
mandatorily imposed in order to maintain short recovery time, high uptime and
extremely low frequency of beam loss. This paper proposes an innovative and
challenging way for compensation and rematch of cavity failure using fast
electronic devices and Field Programmable Gate Arrays (FPGAs) instead of
embedded computers to complete the computation of beam dynamics. A method of
building an equivalent model for the FPGA, with optimization using a genetic
algorithm, is shown. Results based on the model and algorithm are compared with
TRACEWIN simulation to show the precision and correctness of the mechanism.
