Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
License: arXiv.org perpetual non-exclusive license
arXiv:2401.11031v1 [physics.acc-ph] 19 Jan 2024

Time-Delayed Koopman Network-Based Model Predictive Control for the FRIB RFQ

Jinyu Wan Facility for Rare Isotope Beams, Michigan State University, East Lansing, Michigan 48824, USA Shen Zhao Facility for Rare Isotope Beams, Michigan State University, East Lansing, Michigan 48824, USA Wei Chang Facility for Rare Isotope Beams, Michigan State University, East Lansing, Michigan 48824, USA Yue Hao Corresponding author: Yue Hao (email: haoy@frib.msu.edu) Facility for Rare Isotope Beams, Michigan State University, East Lansing, Michigan 48824, USA
Abstract

The radio-frequency quadrupole (RFQ) at the Facility for Rare Isotope Beams (FRIB) is a critical device to accelerate heavy ion beams from 12 keV/u to 0.5 MeV/u for state-of-the-art nuclear physics experiments. Efficient control of the RFQ resonance frequency detuning still remains a challenge because the temperature-sensitive frequency is solely control by a cooling water system, exhibiting complicated transport delay and nonlinearity in the heat transfer processes. In this work, we propose a long-short term memory (LSTM)-based Koopman network model that can simultaneously learn the time-delayed and non-delayed correlations hidden in the historical operating data. It is proven that the model can effectively predict the behavior of the RFQ resonance frequency using historical data as inputs. With this model, a model predictive control (MPC) framework based on the Newton-Raphson method is proposed and tested. We demonstrate that the MPC framework utilizing deep learning model is able to provide precise and rapid control for the RFQ frequency detuning, reducing the control time by half compared to the proportional–integral–derivative (PID) controller.

1 Introduction

The Facility for Rare Isotope Beams (FRIB) is a world-leading scientific user facility for nuclear physics research of rare isotopes, which started serving a global user community in May, 2022 [1]. The radio-frequency quadrupole (RFQ) at the FRIB is a 4-vane type cavity designed to accelerate heavy ion beams from 12 keV/u to 0.5 MeV/u for state-of-the-art nuclear physics experiments [2]. Due to the RF heating, thermal-induced frequency detuning can significantly shift the RFQ resonance frequency, diminishing quality of the accelerated beam [3]. The capacity to mitigate and control this frequency detuning is paramount to ensure the reliable operation of the entire accelerator system. However, the frequency is solely controlled by a cooling water system, giving rise to a complicated control challenge exacerbated by water transport delay and heat transfer time. Currently, proportional–integral–derivative (PID) controller is adopted in RFQ frequency control, which usually needs tens of minutes to minimize the frequency detuning. This is particularly evident during the RFQ startup phase [4]. The lengthy control time required by the PID controller serves as a compelling motivation for the application of model predictive control (MPC) [5].

MPC is a widely-used control strategy for optimizing the operation of dynamical systems. In MPC, control actions are usually chosen by optimizing a specific objective function obtained with an accurate predictive model, thereby offering the potential for faster and smoother control. To apply MPC to the RFQ frequency control, one of the foremost challenges is to construct a fast and accurate model. Due to the indirect and time-delayed nature of the water cooling control, coupled with the complicated variations in thermal expansion and contraction rates throughout the cavity geometry of the RFQ, it is exceptionally challenging to construct a comprehensive physics model for accurately predicting RFQ frequency variations based on control parameters [6]. In recent years, deep learning approaches have garnered significant attention across various domains of physics research, such as quantum physics, astrophysics, condensed matter physics, nuclear physics and accelerator physics [7, 8, 9, 10, 11]. Particularly, the application of deep learning-based Koopman operator that linearizes intricate nonlinear dynamics, has emerged as as a leading candidate for predicting nonlinear dynamical systems [12, 13, 14].

The Koopman operator theory is a fundamental concept in the field of nonlinear dynamical systems with a rich history dating back to 1930s [15]. The basic idea of the Koopman operator theory is providing alternative descriptions of dynamical systems, namely, observables, which can be advanced by an infinite-dimensional linear operator known as the Koopman operator. The predictable linearized systems obtained through the Koopman analysis facilitate straightforward estimation and control of complicated nonlinear dynamical systems [16]. The eigenvalues and eigenfunctions of the Koopman operator can contribute to the comprehension of important properties underlying nonlinear systems, such as ergodic and periodic partitions [17, 18, 19].

The linearization of a nonlinear system usually yields an infinite dimension linear system. It is still necessary to make finite-dimensional approximations in practical applications. Numerical methods, such as Dynamic Mode Decomposition (DMD) [20], extended DMD (eDMD) [21], and variational approach for conformation dynamics (VAC) [22], are often used to approximate the Koopman operator. However, these methods can be computationally intensive. In recent years, there has been a growing trend in utilizing machine learning techniques to efficiently discover representations of the Koopman operator from data. For example, in [12], a modified auto-encoder was used to linearize nonlinear systems, embedding the dynamics on a low-dimensional manifold, and in [13], a deep neural network was utilized to represent the Koopman operator, demonstrating its efficacy in reinforcement learning-based control. However, conventional Koopman operator and related deep learning-based variants are primarily applied to autonomous dynamical systems that evolve over time without external intervention or influence. Although some studies also explore controlled systems with external control inputs that can influence the system’s behavior, as demonstrated in [13], the control inputs are often assumed to have instantaneous impacts on the system, which may not be suitable for addressing the dynamics of a system subject to time delays in its control responses.

In this work, we develop a long-short term memory (LSTM)-based Koopman network [23]. The LSTM network, known as one of the most potent recurrent neural networks (RNNs) [24], is capable of embedding time-series data into a scalar representation by capturing essential temporal correlations and patterns hidden in the data. Unlike the auto-encoder structure in [12], we employ a similar technique in eDMD where the system behavior becomes a component of the observables for the Koopman operator. This structure avoids using an additional encoder to reproduce the prediction, which is particularly challenging in time series generation. The model is trained with historical operating data of the FRIB RFQ and tested with data collected after the training phase. We demonstrate the effectiveness of the model to accurately and rapidly predict the variance of the RFQ resonance frequency over time up to 300 seconds. With this trained model, we employ a Newton-Raphson [25] optimizer for the implementation of MPC to control the frequency of the RFQ, optimizing the frequency detuning to zero by adjusting two valves controlling the cooling water system. Compared to the PID controller, MPC can reduce the control time by approximately a factor of 2.

2 Frequency control of the FRIB RFQ

Refer to caption
Figure 1: Schematic illustration of the water skid for wall temperature control. The variables, e.g., TIN0101, FEN0101 and PIN0101, represent water temperature, water flow and pressure measured at specific locations, respectively. CV1 to CV5 are valves controlling the water flow.

The FRIB RFQ comprises five longitudinal segments, each approximately one meter in length. Twenty-seven fixed slug tuners are positioned along the cavity to control the field profile and the cavity resonance frequency. The slug tuners are cut and fixed through a tuning algorithm to tune the RFQ resonance frequency to the target value, 80.5 MHz, with a low RF power [2]. After the slug tuners are fixed, the cooling water system becomes the sole mean for controlling the resonance frequency. Fig. 1 illustrates the closed-loop water skid used to control of the wall temperature. Similar to the wall skid, a vane skid is also designed. The two separate skids allow independent control for the wall and vane temperature.

As seen in Fig. 1, the cooling water is sourced from the chilled water supply and is delivered to the supply end of the RFQ. Then the used cooling water is collected at the return end of the RFQ, where it can be recycled. Five valves, specifically, CV1 to CV5, are employed to control the flow of the cooling water. Currently, only CV2 and CV3 are in active use for control, among which CV2 is more sensitive than CV3. In practical control process, CV3 is usually adjusted first, providing fine-tuning of the water flow. If the setting of CV3 reaches the upper or lower bound, CV2 will be tuned as coarse adjustment. Due to the nonlinear behavior of the valves and the complicated heat transfer process [26], the frequency control can be challenging in practice, which usually takes tens of minutes with a PID controller.

The operation of the cooling water system involves over 150 relevant variables in the system. The substantial number of variables presents a challenge to use all of them for constructing an effective deep learning model. To address this issue, based on expert’s input, we have ultimately selected a subset of variables considered most crucial to train our deep learning model. These chosen variables are listed in Table 1. Besides the variables of the water cooling system, the forward power, reflected power and electric field in the RFQ cavity are also included.

Table 1: Selected variables for deep learning model training.
Variable name Description
FE_LCW1:TI_N0104:T_RD:𝐹𝐸_𝐿𝐶𝑊1𝑇𝐼_𝑁0104:𝑇_𝑅𝐷FE\_LCW1:TI\_N0104:T\_RDitalic_F italic_E _ italic_L italic_C italic_W 1 : italic_T italic_I _ italic_N 0104 : italic_T _ italic_R italic_D Vane temperature Pos. 4
FE_LCW1:FE_N0103:F_RD:𝐹𝐸_𝐿𝐶𝑊1𝐹𝐸_𝑁0103:𝐹_𝑅𝐷FE\_LCW1:FE\_N0103:F\_RDitalic_F italic_E _ italic_L italic_C italic_W 1 : italic_F italic_E _ italic_N 0103 : italic_F _ italic_R italic_D Vane flow
FE_LCW2:TI_N0205:T_RD:𝐹𝐸_𝐿𝐶𝑊2𝑇𝐼_𝑁0205:𝑇_𝑅𝐷FE\_LCW2:TI\_N0205:T\_RDitalic_F italic_E _ italic_L italic_C italic_W 2 : italic_T italic_I _ italic_N 0205 : italic_T _ italic_R italic_D Wall temperature Pos. 5
FE_LCW2:TI_N0207:T_RD:𝐹𝐸_𝐿𝐶𝑊2𝑇𝐼_𝑁0207:𝑇_𝑅𝐷FE\_LCW2:TI\_N0207:T\_RDitalic_F italic_E _ italic_L italic_C italic_W 2 : italic_T italic_I _ italic_N 0207 : italic_T _ italic_R italic_D Wall temperature Pos. 7
FE_LCW2:PI_N0201:P_RD:𝐹𝐸_𝐿𝐶𝑊2𝑃𝐼_𝑁0201:𝑃_𝑅𝐷FE\_LCW2:PI\_N0201:P\_RDitalic_F italic_E _ italic_L italic_C italic_W 2 : italic_P italic_I _ italic_N 0201 : italic_P _ italic_R italic_D Wall pressure Pos. 1
FE_LCW2:PI_N0205:P_RD:𝐹𝐸_𝐿𝐶𝑊2𝑃𝐼_𝑁0205:𝑃_𝑅𝐷FE\_LCW2:PI\_N0205:P\_RDitalic_F italic_E _ italic_L italic_C italic_W 2 : italic_P italic_I _ italic_N 0205 : italic_P _ italic_R italic_D Wall pressure Pos. 5
FE_LCW1:CV_N0102:POS_RD_PLC:𝐹𝐸_𝐿𝐶𝑊1𝐶𝑉_𝑁0102:𝑃𝑂𝑆_𝑅𝐷_𝑃𝐿𝐶FE\_LCW1:CV\_N0102:POS\_RD\_PLCitalic_F italic_E _ italic_L italic_C italic_W 1 : italic_C italic_V _ italic_N 0102 : italic_P italic_O italic_S _ italic_R italic_D _ italic_P italic_L italic_C CV2𝐶𝑉2CV2italic_C italic_V 2 of vane skid
FE_LCW1:CV_N0103:POS_RD_PLC:𝐹𝐸_𝐿𝐶𝑊1𝐶𝑉_𝑁0103:𝑃𝑂𝑆_𝑅𝐷_𝑃𝐿𝐶FE\_LCW1:CV\_N0103:POS\_RD\_PLCitalic_F italic_E _ italic_L italic_C italic_W 1 : italic_C italic_V _ italic_N 0103 : italic_P italic_O italic_S _ italic_R italic_D _ italic_P italic_L italic_C CV3𝐶𝑉3CV3italic_C italic_V 3 of vane skid
FE_LCW2:CV_N0202:POS_RD_PLC:𝐹𝐸_𝐿𝐶𝑊2𝐶𝑉_𝑁0202:𝑃𝑂𝑆_𝑅𝐷_𝑃𝐿𝐶FE\_LCW2:CV\_N0202:POS\_RD\_PLCitalic_F italic_E _ italic_L italic_C italic_W 2 : italic_C italic_V _ italic_N 0202 : italic_P italic_O italic_S _ italic_R italic_D _ italic_P italic_L italic_C CV2𝐶𝑉2CV2italic_C italic_V 2 of wall skid
FE_LCW2:CV_N0203:POS_RD_PLC:𝐹𝐸_𝐿𝐶𝑊2𝐶𝑉_𝑁0203:𝑃𝑂𝑆_𝑅𝐷_𝑃𝐿𝐶FE\_LCW2:CV\_N0203:POS\_RD\_PLCitalic_F italic_E _ italic_L italic_C italic_W 2 : italic_C italic_V _ italic_N 0203 : italic_P italic_O italic_S _ italic_R italic_D _ italic_P italic_L italic_C CV3𝐶𝑉3CV3italic_C italic_V 3 of wall skid
FE_RFQ:RFC_D1005:E_RD_CAVS:𝐹𝐸_𝑅𝐹𝑄𝑅𝐹𝐶_𝐷1005:𝐸_𝑅𝐷_𝐶𝐴𝑉𝑆FE\_RFQ:RFC\_D1005:E\_RD\_CAVSitalic_F italic_E _ italic_R italic_F italic_Q : italic_R italic_F italic_C _ italic_D 1005 : italic_E _ italic_R italic_D _ italic_C italic_A italic_V italic_S Electric field
FE_RFQ:RFC_D1005:POWR_RD_FWDS:𝐹𝐸_𝑅𝐹𝑄𝑅𝐹𝐶_𝐷1005:𝑃𝑂𝑊𝑅_𝑅𝐷_𝐹𝑊𝐷𝑆FE\_RFQ:RFC\_D1005:POWR\_RD\_FWDSitalic_F italic_E _ italic_R italic_F italic_Q : italic_R italic_F italic_C _ italic_D 1005 : italic_P italic_O italic_W italic_R _ italic_R italic_D _ italic_F italic_W italic_D italic_S Forward power
FE_RFQ:RFC_D1005:POWR_RD_RFLS:𝐹𝐸_𝑅𝐹𝑄𝑅𝐹𝐶_𝐷1005:𝑃𝑂𝑊𝑅_𝑅𝐷_𝑅𝐹𝐿𝑆FE\_RFQ:RFC\_D1005:POWR\_RD\_RFLSitalic_F italic_E _ italic_R italic_F italic_Q : italic_R italic_F italic_C _ italic_D 1005 : italic_P italic_O italic_W italic_R _ italic_R italic_D _ italic_R italic_F italic_L italic_S Reflected power
FE_RFQ:RFC_D1005:FR_RD_ERR:𝐹𝐸_𝑅𝐹𝑄𝑅𝐹𝐶_𝐷1005:𝐹𝑅_𝑅𝐷_𝐸𝑅𝑅FE\_RFQ:RFC\_D1005:FR\_RD\_ERRitalic_F italic_E _ italic_R italic_F italic_Q : italic_R italic_F italic_C _ italic_D 1005 : italic_F italic_R _ italic_R italic_D _ italic_E italic_R italic_R Frequency detuning

3 Method

3.1 Koopman operator theory

Consider a discrete autonomous nonlinear dynamical system,

xt+1=f(xt)subscript𝑥𝑡1𝑓subscript𝑥𝑡x_{t+1}=f(x_{t})italic_x start_POSTSUBSCRIPT italic_t + 1 end_POSTSUBSCRIPT = italic_f ( italic_x start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ) (1)
ϕt=ϕ(xt)subscriptitalic-ϕ𝑡italic-ϕsubscript𝑥𝑡\phi_{t}=\phi(x_{t})italic_ϕ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT = italic_ϕ ( italic_x start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ) (2)

where xtnsubscript𝑥𝑡superscript𝑛x_{t}\in\mathds{R}^{n}italic_x start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT represents the system behavior at time t𝑡titalic_t, f𝑓fitalic_f is a continuously differentiable nonlinear function, and ϕtmsubscriptitalic-ϕ𝑡superscript𝑚\phi_{t}\in\mathds{R}^{m}italic_ϕ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT represents a possible observable of xtsubscript𝑥𝑡x_{t}italic_x start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT. Koopman operator theory [15] provides an infinite-dimensional linear operator 𝒦𝒦\mathcal{K}caligraphic_K (Koopman operator) that can linearize the evolution of the observable ϕtsubscriptitalic-ϕ𝑡\phi_{t}italic_ϕ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT,

ϕt+1=𝒦ϕt.subscriptitalic-ϕ𝑡1𝒦subscriptitalic-ϕ𝑡\phi_{t+1}=\mathcal{K}\phi_{t}.italic_ϕ start_POSTSUBSCRIPT italic_t + 1 end_POSTSUBSCRIPT = caligraphic_K italic_ϕ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT . (3)

For controlled systems with external intervention or influence affecting the system state, it is common to extend the Koopman operator as [13]

ϕ(xt+1,ut+1)=𝒦ϕ(xt,ut)italic-ϕsubscript𝑥𝑡1subscript𝑢𝑡1𝒦italic-ϕsubscript𝑥𝑡subscript𝑢𝑡\phi(x_{t+1},u_{t+1})=\mathcal{K}\phi(x_{t},u_{t})italic_ϕ ( italic_x start_POSTSUBSCRIPT italic_t + 1 end_POSTSUBSCRIPT , italic_u start_POSTSUBSCRIPT italic_t + 1 end_POSTSUBSCRIPT ) = caligraphic_K italic_ϕ ( italic_x start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT , italic_u start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ) (4)

where utsubscript𝑢𝑡u_{t}italic_u start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT represents the external control vector at time t𝑡titalic_t.

The finite-dimensional representation of the Koopman operator is often approximated by DMD and eDMD [20, 21]. It is worth noting that in the eDMD, the observables ϕitalic-ϕ\phiitalic_ϕ are often represented as polynomials of the systems state x𝑥xitalic_x, which allows for the direct extraction of x𝑥xitalic_x at its first order.

3.2 LSTM-based Koopman network model

Refer to caption
Figure 2: Schematic diagram of an LSTM cell. xtsubscript𝑥𝑡x_{t}italic_x start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT is the network input at t𝑡titalic_tth time step. ftsubscript𝑓𝑡f_{t}italic_f start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT, itsubscript𝑖𝑡i_{t}italic_i start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT and otsubscript𝑜𝑡o_{t}italic_o start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT represent the forget gate, input gate and the output gate, respectively. σ𝜎\sigmaitalic_σ and tanh represent activation functions. htsubscript𝑡h_{t}italic_h start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT is the hidden state of the cell. C𝐶Citalic_C represents the cell state and C~~𝐶\widetilde{C}over~ start_ARG italic_C end_ARG is the updated cell state.
Refer to caption
Figure 3: Schematic representation of the LSTM-based Koopman network model. The whole model consists of a LSTM network, a dense network and a Koopman network. {v0,v1,,vn}subscript𝑣0subscript𝑣1subscript𝑣𝑛\{v_{0},v_{1},...,v_{n}\}{ italic_v start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_v start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT } and {u0,u1,,un}subscript𝑢0subscript𝑢1subscript𝑢𝑛\{u_{0},u_{1},...,u_{n}\}{ italic_u start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , italic_u start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_u start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT } represent time-series data of the environment variables and control actions, respectively. These time-series variables have time-delayed impacts on the final output. The non-delayed variables Pn,En,subscript𝑃𝑛subscript𝐸𝑛P_{n},E_{n},...italic_P start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT , italic_E start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT , … represent variables having instantaneous impacts on the final output. ϕn=ϕ1,n+ϕ2,nsubscriptitalic-ϕ𝑛subscriptitalic-ϕ1𝑛subscriptitalic-ϕ2𝑛\phi_{n}=\phi_{1,n}+\phi_{2,n}italic_ϕ start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT = italic_ϕ start_POSTSUBSCRIPT 1 , italic_n end_POSTSUBSCRIPT + italic_ϕ start_POSTSUBSCRIPT 2 , italic_n end_POSTSUBSCRIPT, representing a observable function, where ϕ1,nsubscriptitalic-ϕ1𝑛\phi_{1,n}italic_ϕ start_POSTSUBSCRIPT 1 , italic_n end_POSTSUBSCRIPT and ϕ2,nsubscriptitalic-ϕ2𝑛\phi_{2,n}italic_ϕ start_POSTSUBSCRIPT 2 , italic_n end_POSTSUBSCRIPT are the outputs of the LSTM network and the dense network, respectively. 𝒦𝒦\mathcal{K}caligraphic_K represent the Koopman network that advances {Fnp+1,,Fn,ϕn}subscript𝐹𝑛𝑝1subscript𝐹𝑛subscriptitalic-ϕ𝑛\{F_{n-p+1},...,F_{n},\phi_{n}\}{ italic_F start_POSTSUBSCRIPT italic_n - italic_p + 1 end_POSTSUBSCRIPT , … , italic_F start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT , italic_ϕ start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT }, where Fnsubscript𝐹𝑛F_{n}italic_F start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT is frequency detuning at time n𝑛nitalic_n.

In this work, our data-driven model is to predict the RFQ frequency detuning starting from time step n+1𝑛1n+1italic_n + 1 to n+p𝑛𝑝n+pitalic_n + italic_p for the control purpose. To address the control problems subject to time delays in its control responses, a LSTM network is used to embed the time-series data into a scalar representation. LSTM is a powerful variant of RNNs that overcomes stability challenges encountered in traditional RNNs, such as vanishing gradient, which makes it a practical choice for wide applications[23]. A typical LSTM cell consists of three gates controlling the information flow through the network, namely, input gate, forget gate and output gate (see in Fig. 2). The three gates allow the LSTM to selectively add or forget information, and let information pass through to the next cell, respectively. The architecture of an LSTM cell can be described as

ft=σ(Wf[ht1,xt]+bf)subscript𝑓𝑡𝜎subscript𝑊𝑓subscript𝑡1subscript𝑥𝑡subscript𝑏𝑓f_{t}=\sigma(W_{f}\cdot[h_{t-1},x_{t}]+b_{f})italic_f start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT = italic_σ ( italic_W start_POSTSUBSCRIPT italic_f end_POSTSUBSCRIPT ⋅ [ italic_h start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ] + italic_b start_POSTSUBSCRIPT italic_f end_POSTSUBSCRIPT ) (5)
it=σ(Wi[ht1,xt]+bi)subscript𝑖𝑡𝜎subscript𝑊𝑖subscript𝑡1subscript𝑥𝑡subscript𝑏𝑖i_{t}=\sigma(W_{i}\cdot[h_{t-1},x_{t}]+b_{i})italic_i start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT = italic_σ ( italic_W start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ⋅ [ italic_h start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ] + italic_b start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) (6)
C~t=tanh(WC[ht1,xt]+bC)subscript~𝐶𝑡tanhsubscript𝑊𝐶subscript𝑡1subscript𝑥𝑡subscript𝑏𝐶\widetilde{C}_{t}=\operatorname{tanh}(W_{C}\cdot[h_{t-1},x_{t}]+b_{C})over~ start_ARG italic_C end_ARG start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT = roman_tanh ( italic_W start_POSTSUBSCRIPT italic_C end_POSTSUBSCRIPT ⋅ [ italic_h start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ] + italic_b start_POSTSUBSCRIPT italic_C end_POSTSUBSCRIPT ) (7)
Ct=ftCt1+itC~tsubscript𝐶𝑡subscript𝑓𝑡subscript𝐶𝑡1subscript𝑖𝑡subscript~𝐶𝑡C_{t}=f_{t}C_{t-1}+i_{t}\widetilde{C}_{t}italic_C start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT = italic_f start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT italic_C start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT + italic_i start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT over~ start_ARG italic_C end_ARG start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT (8)
ot=σ(Wo[ht1,xt]+bo)subscript𝑜𝑡𝜎subscript𝑊𝑜subscript𝑡1subscript𝑥𝑡subscript𝑏𝑜o_{t}=\sigma(W_{o}\cdot[h_{t-1},x_{t}]+b_{o})italic_o start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT = italic_σ ( italic_W start_POSTSUBSCRIPT italic_o end_POSTSUBSCRIPT ⋅ [ italic_h start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ] + italic_b start_POSTSUBSCRIPT italic_o end_POSTSUBSCRIPT ) (9)
ht=ottanh(Ct)subscript𝑡subscript𝑜𝑡tanhsubscript𝐶𝑡h_{t}=o_{t}\operatorname{tanh}(C_{t})italic_h start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT = italic_o start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT roman_tanh ( italic_C start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ) (10)

where W𝑊Witalic_W and b𝑏bitalic_b represents weights and biases for the three gates. The information is propagated inside the cell, resulting in the cell state. The states are propagated ahead through the network.

Fig. 3 shows the schematic diagram of our model. The time-series inputs of the model consist of the historical data of selected relevant variables {v0,v1,,vn}subscript𝑣0subscript𝑣1subscript𝑣𝑛\{v_{0},v_{1},...,v_{n}\}{ italic_v start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_v start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT } collected prior to the control action, including environment variables such as water temperature, water flow, and water pressure, and the frequency detuning itself. Additionally, previous control actions u0,u1,,unsubscript𝑢0subscript𝑢1subscript𝑢𝑛u_{0},u_{1},...,u_{n}italic_u start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , italic_u start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_u start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT, as well as future control actions {un+1,un+2,,un+p}subscript𝑢𝑛1subscript𝑢𝑛2subscript𝑢𝑛𝑝\{u_{n+1},u_{n+2},...,u_{n+p}\}{ italic_u start_POSTSUBSCRIPT italic_n + 1 end_POSTSUBSCRIPT , italic_u start_POSTSUBSCRIPT italic_n + 2 end_POSTSUBSCRIPT , … , italic_u start_POSTSUBSCRIPT italic_n + italic_p end_POSTSUBSCRIPT } are also included. We extend the sequence {v0,v1,,vn}subscript𝑣0subscript𝑣1subscript𝑣𝑛\{v_{0},v_{1},...,v_{n}\}{ italic_v start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_v start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT } from length n𝑛nitalic_n to n+p𝑛𝑝n+pitalic_n + italic_p by duplicating these variables at the n𝑛nitalic_nth time step, ensuring that both environment variables and control actions can be used as inputs for the same LSTM network. This duplication also enforces the importance of the variables at the n𝑛nitalic_nth time step in the training. Alternatively, the extended portion can be filled with 0 if the enforcement is not needed.

It is worth noting that in the complicated RFQ system, not all variables exhibit time-delayed responses to the RFQ frequency. Some internal variables, such as forward power of the cavity, evidently have instantaneous impacts on the RFQ frequency. Experience shows it is less advantageous to include historical data of these variables because the change of them typically occurs in a short period of time, causing an immediate impact on the frequency. Therefore, we only use the data of these quick-responding variables at time step n𝑛nitalic_n, and process them with a dense neural network. This approach reduces complexity of the LSTM network, offering the potential for faster training and, more critically, faster predictions, which is essential for the practical implementation of MPC.

With the LSTM network and the dense network, an observable function ϕnsubscriptitalic-ϕ𝑛\phi_{n}italic_ϕ start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT is obtained. Inspired by the polynomial observable function often utilized in eDMD, we combine ϕnsubscriptitalic-ϕ𝑛\phi_{n}italic_ϕ start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT with historical frequency detuning {Fnp+1,,Fn}subscript𝐹𝑛𝑝1subscript𝐹𝑛\{F_{n-p+1},...,F_{n}\}{ italic_F start_POSTSUBSCRIPT italic_n - italic_p + 1 end_POSTSUBSCRIPT , … , italic_F start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT } to construct a new observable function {Fnp+1,,Fn,ϕn}subscript𝐹𝑛𝑝1subscript𝐹𝑛subscriptitalic-ϕ𝑛\{F_{n-p+1},...,F_{n},\phi_{n}\}{ italic_F start_POSTSUBSCRIPT italic_n - italic_p + 1 end_POSTSUBSCRIPT , … , italic_F start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT , italic_ϕ start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT }, where p𝑝pitalic_p is the size of a look-back window. A Koopman operator 𝒦𝒦\mathcal{K}caligraphic_K represented by a single-layer non-bias neural network acts on the new observable function to advance the observable by p𝑝pitalic_p time steps, resulting in the predicted frequency detuning {Fn+1,,Fn+p}subscript𝐹𝑛1subscript𝐹𝑛𝑝\{F_{n+1},...,F_{n+p}\}{ italic_F start_POSTSUBSCRIPT italic_n + 1 end_POSTSUBSCRIPT , … , italic_F start_POSTSUBSCRIPT italic_n + italic_p end_POSTSUBSCRIPT }.

3.3 Model predictve control

With the LSTM-based Koopman network model, we will demonstrate the implementation of MPC for the RFQ frequency control in Section 4.3. An MPC controller typically consists of a predictive model and an optimizer. The optimizer is used to optimize the objective function, i.e., frequency detuning in this scenario, by adjusting the control actions. It is important to choose an appropriate optimizer for MPC, as it directly affects the efficiency and effectiveness of the controller. In the exploration of different optimization algorithms, including least squares, genetic algorithms and the Newton-Raphson method, the Newton-Raphson method standing out for its high efficiency and dependability is ultimately chosen for optimizing the frequency detuning.

We denote the frequency detuning controlled by the control action 𝐮𝐮\mathbf{u}bold_u as F(𝐮)𝐹𝐮F(\mathbf{u})italic_F ( bold_u ). When the control action is changed by Δ𝐮Δ𝐮\Delta\mathbf{u}roman_Δ bold_u, the new value of F(𝐮+Δ𝐮)𝐹𝐮Δ𝐮F(\mathbf{u}+\Delta\mathbf{u})italic_F ( bold_u + roman_Δ bold_u ) can be written as

F(𝐮+Δ𝐮)F(𝐮)+F(𝐮)Δ𝐮+12Δ𝐮TH(𝐮)Δ𝐮𝐹𝐮Δ𝐮𝐹𝐮𝐹𝐮Δ𝐮12Δsuperscript𝐮𝑇𝐻𝐮Δ𝐮F(\mathbf{u}+\Delta\mathbf{u})\approx F(\mathbf{u})+\nabla F(\mathbf{u})\Delta% \mathbf{u}+\frac{1}{2}\Delta\mathbf{u}^{T}H(\mathbf{u})\Delta\mathbf{u}italic_F ( bold_u + roman_Δ bold_u ) ≈ italic_F ( bold_u ) + ∇ italic_F ( bold_u ) roman_Δ bold_u + divide start_ARG 1 end_ARG start_ARG 2 end_ARG roman_Δ bold_u start_POSTSUPERSCRIPT italic_T end_POSTSUPERSCRIPT italic_H ( bold_u ) roman_Δ bold_u (11)

where F(𝐮)𝐹𝐮\nabla F(\mathbf{u})∇ italic_F ( bold_u ) is the gradient of F𝐹Fitalic_F at 𝐮𝐮\mathbf{u}bold_u, and H(𝐮)𝐻𝐮H(\mathbf{u})italic_H ( bold_u ) is the Hessian matrix of F𝐹Fitalic_F at 𝐮𝐮\mathbf{u}bold_u. To find a local minimum of F(𝐮)𝐹𝐮F(\mathbf{u})italic_F ( bold_u ), we can solve the following equation to make the gradient of Eq. (11) to be zero.

F(𝐮)+H(𝐮)Δ𝐮=0𝐹𝐮𝐻𝐮Δ𝐮0\nabla F(\mathbf{u})+H(\mathbf{u})\Delta\mathbf{u}=0∇ italic_F ( bold_u ) + italic_H ( bold_u ) roman_Δ bold_u = 0 (12)

Thus we can obtain

Δ𝐮=H(𝐮)1F(𝐮)Δ𝐮𝐻superscript𝐮1𝐹𝐮\Delta\mathbf{u}=-H(\mathbf{u})^{-1}\nabla F(\mathbf{u})roman_Δ bold_u = - italic_H ( bold_u ) start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT ∇ italic_F ( bold_u ) (13)

With the predictive model, we can easily obtain the approximated gradient and Hessian matrix with the following numerical method,

f(𝐮)[f(𝐮+ϵ𝐞1)f(𝐮ϵ𝐞1)2ϵ,,f(𝐮+ϵ𝐞n)f(𝐮ϵ𝐞n)2ϵ]T𝑓𝐮superscript𝑓𝐮italic-ϵsubscript𝐞1𝑓𝐮italic-ϵsubscript𝐞12italic-ϵ𝑓𝐮italic-ϵsubscript𝐞𝑛𝑓𝐮italic-ϵsubscript𝐞𝑛2italic-ϵ𝑇\nabla f(\mathbf{u})\approx\left[\frac{f(\mathbf{u}+\epsilon\mathbf{e}_{1})-f(% \mathbf{u}-\epsilon\mathbf{e}_{1})}{2\epsilon},\ldots,\frac{f(\mathbf{u}+% \epsilon\mathbf{e}_{n})-f(\mathbf{u}-\epsilon\mathbf{e}_{n})}{2\epsilon}\right% ]^{T}∇ italic_f ( bold_u ) ≈ [ divide start_ARG italic_f ( bold_u + italic_ϵ bold_e start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ) - italic_f ( bold_u - italic_ϵ bold_e start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ) end_ARG start_ARG 2 italic_ϵ end_ARG , … , divide start_ARG italic_f ( bold_u + italic_ϵ bold_e start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT ) - italic_f ( bold_u - italic_ϵ bold_e start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT ) end_ARG start_ARG 2 italic_ϵ end_ARG ] start_POSTSUPERSCRIPT italic_T end_POSTSUPERSCRIPT (14)
Hij(𝐮)f(𝐮+ϵ(𝐞i+𝐞j))f(𝐮+ϵ𝐞i)f(𝐮+ϵ𝐞j)+f(𝐮)ϵ2subscript𝐻𝑖𝑗𝐮𝑓𝐮italic-ϵsubscript𝐞𝑖subscript𝐞𝑗𝑓𝐮italic-ϵsubscript𝐞𝑖𝑓𝐮italic-ϵsubscript𝐞𝑗𝑓𝐮superscriptitalic-ϵ2H_{ij}(\mathbf{u})\approx\frac{f(\mathbf{u}+\epsilon(\mathbf{e}_{i}+\mathbf{e}% _{j}))-f(\mathbf{u}+\epsilon\mathbf{e}_{i})-f(\mathbf{u}+\epsilon\mathbf{e}_{j% })+f(\mathbf{u})}{\epsilon^{2}}italic_H start_POSTSUBSCRIPT italic_i italic_j end_POSTSUBSCRIPT ( bold_u ) ≈ divide start_ARG italic_f ( bold_u + italic_ϵ ( bold_e start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT + bold_e start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) ) - italic_f ( bold_u + italic_ϵ bold_e start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) - italic_f ( bold_u + italic_ϵ bold_e start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) + italic_f ( bold_u ) end_ARG start_ARG italic_ϵ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG (15)

where 𝐮=[u1,u2,,un]T𝐮superscriptsubscript𝑢1subscript𝑢2subscript𝑢𝑛𝑇\mathbf{u}=[u_{1},u_{2},\ldots,u_{n}]^{T}bold_u = [ italic_u start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_u start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , … , italic_u start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT ] start_POSTSUPERSCRIPT italic_T end_POSTSUPERSCRIPT is the control action, ϵitalic-ϵ\epsilonitalic_ϵ is a small scalar perturbation, and 𝐞isubscript𝐞𝑖\mathbf{e}_{i}bold_e start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT is the unit vector in the direction of the i𝑖iitalic_i-th control action. Utilizing the numerically derived gradient and Hessian, we can calculate the parameter updates Δ𝐮Δ𝐮\Delta\mathbf{u}roman_Δ bold_u for optimizing frequency detuning by employing Equation (13).

4 Results

4.1 Data preparation and model training

To construct the LSTM-based Koopman model for predicting RFQ frequency detuning, we have selected 13 relevant variables as listed in Table 1, as well as the frequency detuning itself, as input variables. Variables associated with the cooling water system, such as water temperature, pressure and flow, are considered time-delayed variables. The open voltages of flow control valves, namely CV2 and CV3 for the wall skid, are adjustable control variables. Alongside these, we include non-delayed variables, i.e., the forward power, reflected power, and electric field of the RFQ cavity.

We have collected operating data on the selected variables for two and a half months at FRIB. Through an interpolation algorithm, all the variables are synchronized to the same timestamps with a time interval of five seconds. Based on various tests, we ultimately set the duration of input for our model to be 300 seconds, and the predicted time horizon is also 300 seconds. The data we collected is split into two parts. To evaluate the model’s performance for predicting future frequency detuning, the data order remains unshuffled. The first 80% of the data is used for training and the remaining 20% is used for validation and testing purposes.

As shown in Fig. 3, an LSTM network, a dense network, and a Koopman network are constructed with Keras [27]. By combining the outputs of the LSTM network and the dense network, the observable function is obtained. The observable function is then advanced by the Koopman network and thus the frequency detuning is predicted ahead of time. A critical parameter for this model is the dimension of the observable function. An adequately high observable dimension is important for the model to linearize this complicated nonlinear dynamical system. However, a high observable dimension can slow down the computation through the network, resulting in undesirably slow prediction for MPC. In this work, we set the observable dimension as 64, which strikes a balance between good accuracy and fast prediction time. The number of cells in the LSTM layer and the number of neurons in the dense network are also set to 64 to ensure the consistency of the data shape. The loss function is the mean squared error between the prediction and the ground truth. The Adam [28] optimizer is used to train the model with a training rate of 0.001 and a training batch size of 512. The training process takes nearly an hour on a GeForce RTX 4070 Graphics Card. The prediction for a single sample takes ~0.04 seconds on the same device.

4.2 Model evaluation

Refer to caption
Figure 4: Frequency detuning for selected testing samples. The black dots within 0-300s represent the historical frequency of detuning. The blue and red dots within 300-600s represent the measured frequency detuning and the predicted frequency detuning, respectively.
Refer to caption
Figure 5: Detailed comparison for the testing sample in Fig. 4(k). (a) shows the variations of frequency detuning. Note that the predicted frequency detuning is split into three part, where each part represents a single prediction obtained with the LSTM-based Koopman network model. (b) and (c) show the changes in the valve settings and the cavity power over time, respectively.

To demonstrate our LSTM-based Koopman network model, Fig. 4 shows the model predictions for some selected testing samples. It is found that the model prediction remains reliable not only when the operation is stable with low-frequency detuning, e.g., Fig. 4(a, b, d, e, f, g, h, l), but also works effectively in case with significant frequency detuning, e.g., Fig. 4(c, i, j). The results indicate that the model effectively learns the latent time-series correlations hidden in the data, enabling accurate predictions of frequency-detuning trends for most test data across extended time horizons of up to 300 seconds. This holds true, especially, for the significantly detuning cases, which is of particular concern in the RFQ operation.

However, it is still observed that there are a few cases where the prediction deviates significantly from the historical data, e.g., Fig. 4(k). To further investigate the reason for these false predictions, we locate the false prediction observed in Fig. 4(k) and present the changes of variables in the preceding and subsequent time period in Fig. 5. Since the environment variables and the electric field remain stable at this time, only the changes of the settings of CV2 and CV3, and the changes of forward power and reflected power are presented.

Fig. 5 shows that a quick change of forward power occurs at ~450s, causing a significant frequency detuning in a short period of time. The model prediction becomes unreliable after the quick change happens, exhibiting a large divergence from the measured frequency. It is reasonable because while predicting the frequency detuning within 300-600s, the input of the model is the data collected within 0-300s. Therefore, the model cannot anticipate such a quick change of forward power occurring after 300s and will not give a relevant response in the prediction. This issue can be a limitation for models with mixed time-delayed and non-delayed variables. Fortunately, forward power is not a variable that changes often. The changes in forward power often result from changes in setting point or cavity trips followed by quick recovery, which usually happens in a short period of time. As a result, the RFQ forward power is stable throughout most instances. Results in Fig. 5 indicate the prediction becomes reliable when the forward power becomes stable again.

4.3 Demonstration of model predictive control

To demonstrate the implementation of MPC, we select the significantly detuning sample in Fig. 4(k) as an example to control. Learned from Fig. 5, the model prediction is reliable after 600s. Thus we start the control at 600s. The optimization variables are time-series control actions of CV2 and CV3 within 600-900s, and the optimization objective is to minimize the frequency detuning within 600-900s, i.e., mint=300600WtFt2minsuperscriptsubscript𝑡300600subscript𝑊𝑡superscriptsubscript𝐹𝑡2\operatorname{min}\sum_{t=300}^{600}W_{t}F_{t}^{2}roman_min ∑ start_POSTSUBSCRIPT italic_t = 300 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 600 end_POSTSUPERSCRIPT italic_W start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT italic_F start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT, where Ftsubscript𝐹𝑡F_{t}italic_F start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT represents frequency detuning at time t𝑡titalic_t and W𝑊Witalic_W is the weight. The changes of frequency detuning are evaluated with the LSTM-based Koopman network model.

The optimization process is subject to two key constraints. First, the valve settings must remain within a reasonable range of [0, 80]. Second, any changes in the valve settings from one time step to the subsequent time step cannot exceed 1.0, which prevents abrupt and substantial changes that may damage the devices. The initial solution for the Newton-Raphson optimizer is the set points of CV2 and CV3 at 600s in Fig. 5. Considering the fact that the model become less reliable over extended periods, we choose to promptly apply the optimizer to adjust control actions, despite its capability for long-term prediction. The time interval of implementing the MPC controller is set to be five seconds, which is the same as the time interval of the model prediction. The calculation of an optimization iteration takes  0.2s on a personal laptop, which is fast enough to ensure the implementation of online optimization with a time interval of five seconds.

Refer to caption
Figure 6: Optimization process of the Newton-Raphson method. The solid lines represent the predicted frequency detuning over a 300-second span. Each line originates from a distinct starting time, corresponding to a separate iteration of the optimization process. The evolution of the results indicates the application and subsequent effect of the optimized control actions determined in the preceding iterations. The color from blue to red represents the iteration from initial iterations to later ones.

Fig. 6 shows the evolution of the optimization. The results indicate the effectiveness of our Newton-Raphson optimizer in achieving precise control of CV2 and CV3 within only about 20 iterations, effectively eliminating the frequency detuning in ~350 seconds. Compared to the PID controller, the MPC controller reduces control time by nearly 50%. A key advantage of the MPC controller is its ability to simultaneously adjust CV2 and CV3, as illustrated in Fig. 7. This concurrent manipulation exploits the complex interactions between multiple valves learned by the model to achieve more effective control. Furthermore, the MPC controller responds more swiftly to the frequency detuning due to its capacity for long-term prediction. In contrast, the PID controller must wait for a delayed response from the system, which is usually slower than MPC.

Refer to caption
Figure 7: Comparion of control actions given by the PID controller and the MPC. The solid lines represent the control actions given by the PID controller, and the dashed lines represent the control actions given by the Newton-Raphson optimizer. Red and blue lines represent CV2 and CV3, respectively.

5 Conclusion

A novel LSTM-based Koopman network model is proposed to address the frequency detuning control problem for the FRIB RFQ. The LSTM network and dense network incorporated into the model demonstrate the capacity to learn both time-delayed and non-delayed correlations hidden in the data, resulting in a high-dimensional observable function. With a Koopman network, the evolution of the observable function is linearized, and the future behavior of the system states can be easily obtained without training an additional decoder. We demonstrate the model can effectively predict the behaviors of the RFQ resonance frequency up to 300 seconds within a short period of ~0.04 seconds.

With the well-trained RFQ frequency model, an MPC framework is proposed. The MPC is based on a Newton-Raphson optimizer that optimizes the RFQ frequency detuning by adjusting the control actions of two water flow control valves. This MPC framework, powered by the LSTM-based Koopman network, exhibits a notable advantage compared to the PID controller. With the assistance of the model’s rapid prediction capability, the optimizer can simultaneously adjust the two valves that takes advantage of the intricate interplay between them. The control time for eliminating the frequency detuning is reduced by half with MPC compared to using the PID controller.

The process shown in this paper provides a general framework for MPC design to handle the mixture of delayed and non-delayer control knobs. Therefore we foresee the potential of applying the proposed method to a much broader application in complicated control problems across various scientific and industrial domains.

6 Acknowledgement

7 Code availability

References

  • [1] A. Gade and B. M. Sherrill. NSCL and FRIB at Michigan State University: Nuclear science at the limits of stability. Physica Scripta, 91(5):053003, 2016.
  • [2] H Ren, E Pozdeyev, D Morris, S Zhao, P Morrison, R Walker, N Bultman, M Konrad, X Rao, J Brandon, et al. Commissioning of the FRIB RFQ. Journal of Physics: Conference Series, 1067(5):052010, 2018.
  • [3] Jing Wang, Jian-Long Huang, Yuan He, Xiao-Qi Zhang, Zhou-Li Zhang, and Ai-Min Shi. Multi-physics analysis of the RFQ for Injector Scheme II of C-ADS driver linac. Chinese Physics C, 38(10):107005, 2014.
  • [4] J Zeng, QZ Xing, L Du, XL Guan, SX Zheng, WQ Guan, and J Li. Cooling design for the FRIB RFQ cavity at Michigan State University. In 5th Int. Particle Accelerator Conf.(IPAC’14), pages 3271–3273, Dresden, Germany, 2014.
  • [5] James B Rawlings. Tutorial overview of model predictive control. IEEE control systems magazine, 20(3), 2000.
  • [6] JP Edelen, AL Edelen, D Bowring, BE Chase, J Steimel, SG Biedron, and SV Milton. First Principles Modeling of RFQ Cooling System and Resonant Frequency Responses for Fermilab’s PIP-II Injector Test. IEEE Transactions on Nuclear Science, 64(2):800–808, 2017.
  • [7] Juan Carrasquilla and Roger G Melko. Machine learning phases of matter. Nature Physics, 13(5):431–434, 2017.
  • [8] Jun Gao, Lu-Feng Qiao, Zhi-Qiang Jiao, Yue-Chi Ma, Cheng-Qiu Hu, Ruo-Jing Ren, Ai-Lin Yang, Hao Tang, Man-Hong Yung, and Xian-Min Jin. Experimental machine learning of quantum states. Physical review letters, 120(24):240501, 2018.
  • [9] Auralee Edelen, Nicole Neveu, Matthias Frey, Yannick Huber, Christopher Mayes, and Andreas Adelmann. Machine learning for orders of magnitude speedup in multiobjective optimization of particle accelerator systems. Physical Review Accelerators and Beams, 23(4):044601, 2020.
  • [10] Francisco Villaescusa-Navarro, Daniel Anglés-Alcázar, Shy Genel, David N Spergel, Rachel S Somerville, Romeel Dave, Annalisa Pillepich, Lars Hernquist, Dylan Nelson, Paul Torrey, et al. The camels project: Cosmology and astrophysics with machine-learning simulations. The Astrophysical Journal, 915(1):71, 2021.
  • [11] Amber Boehnlein, Markus Diefenthaler, Nobuo Sato, Malachi Schram, Veronique Ziegler, Cristiano Fanelli, Morten Hjorth-Jensen, Tanja Horn, Michelle P Kuchera, Dean Lee, et al. Colloquium: Machine learning in nuclear physics. Reviews of Modern Physics, 94(3):031003, 2022.
  • [12] Bethany Lusch, J Nathan Kutz, and Steven L Brunton. Deep learning for universal linear embeddings of nonlinear dynamics. Nature communications, 9(1):4950, 2018.
  • [13] Enoch Yeung, Soumya Kundu, and Nathan Hodas. Learning deep neural network representations for koopman operators of nonlinear dynamical systems. In 2019 American Control Conference (ACC), pages 4832–4839, 2019.
  • [14] Yiqiang Han, Wenjian Hao, and Umesh Vaidya. Deep learning of koopman representation for control. In 2020 59th IEEE Conference on Decision and Control (CDC), pages 1890–1895, 2020.
  • [15] Bernard O Koopman. Hamiltonian systems and transformation in hilbert space. Proceedings of the National Academy of Sciences, 17(5):315–318, 1931.
  • [16] Alexandre Mauroy, Y Susuki, and I Mezić. Koopman operator in systems and control. Springer, 2020.
  • [17] Igor Mezić. Spectral properties of dynamical systems, model reduction and decompositions. Nonlinear Dynamics, 41:309–325, 2005.
  • [18] Marko Budišić, Ryan Mohr, and Igor Mezić. Applied koopmanism. Chaos: An Interdisciplinary Journal of Nonlinear Science, 22(4), 2012.
  • [19] Igor Mezić. Analysis of fluid flows via spectral properties of the koopman operator. Annual review of fluid mechanics, 45:357–378, 2013.
  • [20] Clarence W Rowley, Igor Mezić, Shervin Bagheri, Philipp Schlatter, and Dan S Henningson. Spectral analysis of nonlinear flows. Journal of fluid mechanics, 641:115–127, 2009.
  • [21] Qianxiao Li, Felix Dietrich, Erik M Bollt, and Ioannis G Kevrekidis. Extended dynamic mode decomposition with dictionary learning: A data-driven adaptive spectral decomposition of the koopman operator. Chaos: An Interdisciplinary Journal of Nonlinear Science, 27(10), 2017.
  • [22] Frank Noé and Feliks Nuske. A variational approach to modeling slow processes in stochastic dynamical systems. Multiscale Modeling & Simulation, 11(2):635–655, 2013.
  • [23] Greg Van Houdt, Carlos Mosquera, and Gonzalo Nápoles. A review on the long short-term memory model. Artificial Intelligence Review, 53:5929–5955, 2020.
  • [24] Yong Yu, Xiaosheng Si, Changhua Hu, and Jianxun Zhang. A review of recurrent neural networks: Lstm cells and network architectures. Neural computation, 31(7):1235–1270, 2019.
  • [25] M.A. Crisfield. A faster modified newton-raphson iteration. Computer Methods in Applied Mechanics and Engineering, 20(3):267–278, 1979.
  • [26] Dan Morris, John Brandon, M Konrad, T Larter, H Maniar, E Pozdeyev, H Ren, S Zhao, N Bultman, K Davidson, et al. Rf system for frib accelerator. Proc. of IPAC2018, Vancouver, BC, Canada, 2018.
  • [27] François Chollet et al. Keras. https://keras.io, 2015.
  • [28] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.