  For the PIP-II Injector Test (PI-Test) at Fermilab, a four-vane radio
frequency quadrupole (RFQ) is designed to accelerate a 30-keV, 1-mA to 10-mA,
H- beam to 2.1 MeV under both pulsed and continuous wave (CW) RF operation. The
available headroom of the RF amplifiers limits the maximum allowable detuning
to 3 kHz, and the detuning is controlled entirely via thermal regulation. Fine
control over the detuning, minimal manual intervention, and fast trip recovery
is desired. In addition, having active control over both the walls and vanes
provides a wider tuning range. For this, we intend to use model predictive
control (MPC). To facilitate these objectives, we developed a dedicated control
framework that handles higher-level system decisions as well as executes
control calculations. It is written in Python in a modular fashion for easy
adjustments, readability, and portability. Here we describe the framework and
present the first control results for the PI-Test RFQ under pulsed and CW
operation.
