###### Abstract  
An online automatic feedback system has been successfully installed and commissioned at the BL08U1A Soft X-ray Spectromicroscopy Beamline of Shanghai Synchrotron Radiation Facility, which can monitor the incident X-ray beam in real time by measuring the blade-edge signals of the exit slit and automatically adjust the elliptical cylindrical mirror parameters to achieve beam calibration and maintain the optimal X-ray flux of the sample. This work provides a comprehensive description of the hardware composition, system implementation, feedback logic, function and software design, system optimization and commission, as well as the online experimental results supported by the system. The experimental results demonstrated that the online automatic feedback system is capable of effectively maintaining the optimal X-ray beam flux for X-ray absorption spectroscopy experiments. Its success can provide valuable technique assistance for the design, construction and optimization of similar systems at various beamlines in synchrotron sources in the future. s +
Footnote †: journal:  
article  
[color=gray!20,] [color=gray!20,] [color=gray! sources and free electron lasers (FEL). Similarly, maintaining optimal X-ray flux is critical for beamline operation and achieving high-quality experimental results in synchrotron light sources. However, when the beamline operates continuously throughout the day to support different experiments, a large number of experimental conditions change, which leads to varying degrees of disruption to the final X-ray flux at the experimental end station. For example, different users and experiments may need the beamline mirror position, undulator or other insertion device (ID) gap value, or monochromator and grating parameters to be adjusted in order to achieve the requested X-ray energy, which may cause a decrease in the light flux. For example, the energy range of the Fe element XAFS is about 690-740 eV, and the X-ray flux at 735 eV is about 22% lower than the maximum flux at 690 eV based on real experimental measurements at the BL08U1A beamline of the SSRF. Furthermore, an upgrade in the insertion devices, an unstable electron beam orbit, and beam injection in the storage ring can also impact the beam flux [2]. Since most synchrotron sources operate 24 h a day, the thermal expansion and contraction of optical components and the 24 h day/night temperature cycle [3] may cause the photon beams to drift. Sometimes, due to an unstable beam current, operators may need to enlarge the exit slit to achieve a high X-ray flux in imaging experiments, despite the cost of reduced spatial resolution. Therefore, it is crucial to maintain optimal X-ray flux before and during the experiments automatically. To automatically align the beam position and maintain maximum light flux, plenty of beamlines have developed stabilization systems, including orbit correction and optical correction systems. Orbit correction systems [4; 5; 6; 7; 8] typically use beam position monitors (BPMs) [9] and corrector magnets to constrain the beam to its working position, while optical correction systems usually use vertical and horizontal plane mirrors, monochromators [10; 11] and detectors to stabilize and maximize light flux. Both orbit and optical correction systems can be implemented as feed forwards (FFs) or feedbacks (FBs). FF correction depends on the physics model of the beamlines or on records of the relationship between the beam property and beamline settings for every ID gap [12]. The National Institute of General Medical Sciences and the National Cancer Institute (GM/CA) MX beamlines at the Advanced Photon Source (APS) perform vertical and horizontal scans to recenter the beam under certain conditions [13]. However, such a record takes a long time to measure and cannot be frequently recalibrated after machine drift due to the limited machine study time in light sources. The deviation of FF algorithms increases over time and requires a feedback system to compensate for such deviations.