A Closed-Loop Brain Stimulation Control System Design Based on Brain-Machine Interface for Epilepsy

In this study, a closed-loop brain stimulation control system scheme for epilepsy seizure abatement is designed by brain-machine interface (BMI) technique. In the controller design process, the practical parametric uncertainties involving cerebral blood flow, glucose metabolism, blood oxygen level dependence, and electromagnetic disturbances in signal control are considered. An appropriate transformation is introduced to express the system in regular form for design and analysis.,en, sufficient conditions are developed such that the sliding motion is asymptotically stable. Combining Caputo fractional order definition and neural network (NN), a finite time fractional order sliding mode (FFOSM) controller is designed to guarantee reachability of the sliding mode. ,e stability and reachability analysis of the closed-loop tracking control system gives the guideline of parameter selection, and simulation results based on comprehensive comparisons are carried out to demonstrate the effectiveness of proposed approach.


Introduction
Brain-machine interface (BMI) technology has a wide range of applications for various neural system diseases therapy. e purpose of brain-machine interface or brain-computer interface (BCI) is to decode motion-related neural signals into control signals for driving output to guide computer cursors, prosthetics, and other auxiliary equipment. e ultimate goal of research in this area is to rehabilitate patients who have paralyzed or lost their limbs due to neurological disease or trauma [1][2][3]. In the past ten years, advances in neural recording technology have greatly promoted the development of BMI technology and successfully carried out relevant human clinical experiments [4,5]. e development of BMI technology has greatly promoted the application of neuroscience in rehabilitation medicine [6]. Based on the above research basis, BMIs or BCIs technology has been widely used in multiple aspects, such as the closedloop brain-computer interface technique for the treatment of refractory epilepsy [7], wireless brain-computer interfacecontrolled exoskeleton [8], and the application in stroke rehabilitation [3]. erefore, the research on brain-machine interface technology has a very broad prospect.
Epilepsy is a serious neurological disease characterized by unprovoked recurrence and about 50 million people suffer from epilepsy in the world [9]. More than 30% of patients with epilepsy continue to relapse after receiving treatment even if much related research work has been carried out in many countries for the treatment of epilepsy [10]. Moreover, various aspects of social life of patients with epilepsy are seriously affected by epilepsy [11]. erefore, epilepsy has been considered as a serious public health problem [12]. According to some surveys, patients with epilepsy are more likely to be divorced and discriminated against [11,13]. At present, there are four types of seizure patterns: focal, systemic, comprehensive, and unknown [14]. Absence epilepsy (AE) is a form of systemic epilepsy, which has features including sudden arrest in activity, awareness, and responsiveness, and the body is possibly accompanied by some slight motor characteristics [15]. us, the research of absence epilepsy is significant and far-reaching. e most common treatment for epilepsy now remains in drug-assisted or surgical resection [16]. In some investigations, it has been shown that long-term service of epilepsy drugs may lead to liver decline or even damage due to epilepsy is a long-term chronic disease [17,18]. On the contrary, neurosurgical resection of the epileptic area cannot be applied to patients with systemic epilepsy [19,20]. erefore, it urgently needs an alternative method for absence epilepsy to solve the above problems due to limitations of the abovementioned drugs and surgical treatment [17][18][19][20].
e existing study shows that appropriate brain stimulation techniques can greatly reduce the frequency of seizures, that is, inhibit seizures [21][22][23][24][25]. Based on existing studies, it follows that brain stimulation is a promising treatment for epilepsy [21][22][23]. Brain stimulation for epilepsy has many methods, and open-loop brain stimulation and closed-loop brain stimulation are two typical stimulation methods [23]. Although open-loop brain stimulation is used more widely, compared with its effect, closed-loop brain stimulation can avoid the side effects of continuous stimulation brought and achieve the good effect of eliminating seizures [22][23][24]. When the closed-loop brain stimulation for epilepsy is carried out by BMI, the brain is connected to a computer for monitoring continuously the patient's EEG, which reflects the patient's neurological condition. After data processing and model analysis, stimulation therapy is then derived to alleviate or eliminate epilepsy symptoms.
us, different thalamic models are crucial in the study of seizures [26,27]. Cortical computational models of the thalamus have been developed [27][28][29][30] and the lumped model has been built [31]. e thalamic-cortical circuit computational model has also been developed [32]. Specially, Taylor has established a neural cluster model for seizures [33]. However, the closed-loop brain stimulation based on BMI for epilepsy is still in the early stages of research, and there is no mature and complete system design scheme, which motivates us to undergo this research.
erefore, based on the abovementioned achievements of seizure model, we will further study and explore the closed-loop control scheme of brain stimulation and then develop a new controller to promote the effectiveness of epilepsy seizure abatement.
With the development of seizures control technique, Taylor proposed a single-pulse stimulation control requiring optimal stimulation time and amplitude [33]. Considering the high nonlinearity, unmodeled dynamics, and ubiquitous disturbance in the nervous system, seizure oscillations, noise, and disturbance changes are not accurate; therefore, the method in [33] cannot deal with epilepsy seizures very well [34,35]. Based on the abovementioned problems, Ge proposed a robust closed-loop control which adapts to high nonlinearity, unmodeled dynamics, and ubiquitous disturbance of the nervous system and has stable control for seizures [20], but a slow convergence rate is its biggest drawback. e finite time sliding mode control technique can accelerate system convergence and is an effective strategy for nonlinear systems with high nonlinearity, unmodeled dynamics, and unknown disturbances [36][37][38][39]. Considering this problem, a finite time sliding mode controller is proposed with radial basis function neural networks and fractional order sliding manifold based on a well-established thalamocortical neural mass model. e designed closed-loop control system scheme based on BMI in this paper can guarantee the output of the thalamocortical system converge to the desired value more quickly and accurately.

Problem Statement
e structure of brain is shown in Figure 1. Deep brain stimulation (DBS) is an effective treatment of a variety of neuropsychiatric disorders, including medication intractable Parkinson's disease, epilepsy, primary dystonia, and essential tremor [1,2]. e DBS method mainly inserts the electrodes into a specific nucleus in the brain through stereotactic technology and microelectrode recording technology and suppresses the abnormal brain nucleus discharge by continuous high-frequency pulse electrical stimulation, thereby achieving the therapeutic effect. Since it is unreliable to utilize open-loop brain neural stimulation to eliminate the pathological spike-and-wave discharges in the absence of epilepsy seizures, it is required to seek a more comprehensive closed-loop stable control scheme. However, epilepsy seizure abatement based on the closed-loop control system has not been studied very well and the existing results are very few [11,20]. erefore, this paper focuses on a closed-loop control strategy for epilepsy seizure abatement based on DBS [18][19][20], which can adjust the stimulus signal in real time by the controller in the computer. Certainly, the connection between the brain and the computer can be wireless, as shown in Figure 2, or wired as Figure 3. e high-frequency pulse stimulation string in deep brain stimulation (DBS) can not only shorten the duration of seizures but also reduce the intensity of seizures [21][22][23][24][25], based on which a sliding mode control scheme is developed for epilepsy seizure abatement. It is assumed that there exists a cortical area exhibiting normal background activities before absence epilepsy seizures happen. e normal neural electrical signals collected by the recording electrodes are defined as the desired brain signal y d , and then a controller could be developed to force the brain cortical areas with pathological characteristics to behave in a similar way as the dynamics of the normal brain signal. e smaller the difference between the pathological brain signal dynamics y and the normal one y d , the better the effect of epilepsy seizure abatement. us, the seizure abatement problem can be transformed to a tracking control problem and our control target is to make abnormal brain activity signal y quickly and accurately track desired normal brain activity signal y d .
Considering extensive nonlinear term owing to uncertainties in cerebral blood flow, glucose metabolism, blood oxygen level dependence (BOLD), and electromagnetic disturbances, which may affect network connectivity and neural electrical signal, the interaction within the thalamocortical system of epilepsy is modeled by the following differential equations [20]: where is the control input variable, the output variable w ∈ R m , and the output ] T is the synthetic unknown effect of uncertainties and disturbances, and T is the known nonlinear terms given as follows: Noting that IN, TC, PY, and RE are all the state variables, representing the fractional firing activity in each neuronal population. τ i , τ t , τ e , and τ r are time scale constants mediated by different excitatory and inhibitory neurotransmitters. c ie , c te , c tr , c ee , c ei , c et , c re , c rt , and c rr are the connectivity strengths between different neuronal populations. While appropriate constants α and β are the linear activation function describing the thalamic subsystem, the appropriate constant ε > 0 describes the cortical dynamics. e specific meaning and values of the parameter used in this paper are given in [20]. e desired output y d ∈ R m can be measured from a normal minicolumn.
Under the condition of Assumption 1, there exists an invertible matrix T ∈ R 4×4 such that the coordinate transformation x � Tv holds, and then the matrix pair (A v , B v ) with respect to the new coordinate x have the following form: where A 11 ∈ R (4− m)×(4− m) and matrix B 2 ∈ R m×m is nonsingular. It is noticed that the matrix T can be obtained using basic matrix transformation theory. en, in the new coordinate system, system (1) is rewritten by _ 21 , and A 22 are appropriate matrices. e system output y ∈ R m is determined by simulated EEG and Complexity C ∈ R m×m is a positive definite invertible diagonal matrix, Note that |Λ| denotes the norm of Λ in this paper, where Λ is a matrix or a constant.

Controller Design for Epilepsy
In this position, some definitions and lemmas are introduced to derive the main results of this study.
e Caputo fractional calculus of the continuous integrable function f is uniformly defined as where m is the minimum integer larger than a, the definition of Γ(·) is Γ(q) � t 0 e − t t q− 1 dt, and d m /dt m represents for traditional differential. When a > 0, sign b D a t represents fractional order differential (FOD), while a < 0, it represents fractional order integral (FOI) on the interval [b, t]. FOD operation can change a special FOI, which possesses a certain characteristic of memory. For simplicity and convenience, symbol D a is used instead of 0 D a t in this paper.

Lemma 2. Consider the fractional order equation
where a ∈ (0, 1) is an arbitrary real constant, z ∈ R m is an unknown vector to be solved and z � [z 1 , . . . , z m ] T , and L denotes the constant diagonal matrix and en, the solution of equation (9) is where μ i is a positive constant.
Proof. See the proof of eorem III.2 in [41]. In this section, a sliding surface is designed for system (4) and the stability of the corresponding tracking control system is analyzed.
For system (4), assume that the desired output y d is differentiable. en, the tracking error e � y − y d , and its derivative with respect to time is  Figure 2: Closed-loop brain stimulation control system scheme based on BMI for epilepsy.  Complexity To make the dynamics of the thalamocortical system of epilepsy (4) to track the desired normal activities, namely, y ⟶ y d , a sliding mode surface will be developed to make the dynamical error system stable. e composite sliding surface for system (4) using fractional order sliding mode technique can be selected as follows: where s ∈ R m , λ 1 > 0, λ 2 > 0, and 0 < a 1 < 1 are designed constants, respectively.
Proof. During sliding motion s � 0, the following equation can be obtained from (12): where Under Lemma 2, the solution of the abovementioned equation is as follows: Consider the Lyapunov function candidate: en, the derivative of V 1 along the trajectory of system (13) is us, _ V 1 < 0 for t ∈ (0, ∞). It is shown that the sliding motion of system (11) corresponding to the sliding surface (12) is asymptotically stable, namely, lim t⟶∞ e i � lim t⟶∞ (y i − y id ) � 0. erefore, it is guaranteed that the output of system (4) tracks the desired signal after the system is driven to the designed sliding surface (12). Proof is completed.
Necessary conditions to ensure this sliding motion which is attained and maintained will further be developed. □ 3.2. Reachability Analysis. It is extremely important to track desired signal with the rapidity and accuracy [42,43], which determines the therapeutic effect. However, the conventional sliding mode control usually results in low precision and convergence rate problems. To solve these problems, a finite time fractional order sliding mode (FFOSM) control scheme for epilepsy seizure abatement is designed, as shown in Figure 4.
Considering the synthetic effect of uncertain change in cerebral blood flow, glucose metabolism, BOLD, electromagnetic disturbances, and upper bound of the synthetic effect may be unknown. en, the uncertainty term η 2 affected by external stimulation can be approximated by employing an ideal RBFNN as where W ∈ R 1×m is an ideal weight vector from the hidden layer to the output layer, φ(x) is the basis function, ϱ ∈ R m×1 is the approximation error vector, and ζ is an unknown positive constant. Let W be the estimation of W, and we have Let W � W − W be the weighting estimation error of W, and we have Assumption 3 (see [40]). e estimation error ϱ is normbounded as |ϱ| ≤ ζ, where ζ > 0 is an unknown constant.
Remark 1. Since ϱ should be very small when η 2 (x) approximate η 2 (x) well, along with the control command u bounded in any practical system, it is feasible to assume ϱ in (19) is norm-bounded. However, it is not required that the bound ζ is known.
For system (4), differentiating (12) and using (11), it follows that e fractional order controller can be designed as where B − 2 is the generalized inverse matrix of B 2 . a 1 , b 2 , k 2 , and k 3 are designed constants with 0 < a 1 , b 2 < 1, k 2 > 0, and k 3 > 0. I m ∈ R m×1 is an m-dimensional unit vector. Theorem 2. Consider the control system (11). On Assumptions 1-3, the fractional order sliding mode control law (21) can drive system (11) to the composite sliding mode surface (12) in finite time and maintain a sliding motion on it; thereafter, if the adaptive update laws are chosen as where ζ is the estimation of ζ, π w > 0 and π ζ > 0 are the designed constants.
Proof. e Lyapunov candidate function is chosen as Taking its time derivative, we have Substituting (21) into (25), one can obtain According to Assumption 3 and using (22) and (23), yields erefore, _ V ≤ 0, namely, s and the estimation errors W, ζ all converge to zero asymptotically.

Remark 2.
e normal sliding mode control (SMC) technique has just been applied in the controller design for epilepsy seizure abatement [20]. Instead of normal sliding mode (NSM) control in [20], a fractional order sliding mode (FOSM) technique is adopted in eorem 2, which will provide more accurate tracking and control performance before and after reaching sliding mode surface.
Remark 3. In [44], an integer order sliding mode (IOSM) control scheme based on exponential approaching law is  6 Complexity developed. Although the finite time fractional order sliding mode (FFOSM) in this paper also adopts the power exponential approaching law, different from [44], this controller combining fractional order sliding mode control with neural networks (NN-FFOSM) technique can provide higher tracking precision and control performance.
Remark 4. In [40], a fractional order sliding mode controller is designed based on neural networks. Compared with [40], a finite time approaching law is employed instead of constant velocity one in this paper. Combined with finite-time characteristics, the NN-FFOSM controller can drive the system to reach the sliding mode surface in finite time from arbitrary initial states. erefore, eorem 2 can be considered as an extension and promotion of [40] and can guarantee output y tracks the desired signal y d in shorter time.

Simulation
As an illustrative example, the thalamocortical model (1) with uncertainties and disturbances is employed for the study of the NN-FFOSM controller. To verify the effectiveness of the proposed controller scheme, the simulation results are carried out by utilizing three comparisons between NN-NSM in [20], IOSM in [44], NN-FOSM in [40], and our NN-FFOSM controller in this section. According to the expected dominant frequency around 12 Hz, the desired output is set as yd(t) 1 � 0.2 + 0.02 sin(75.36t) ( 1 this normal brain signal was provided by China-Japan Union Hospital of Jilin University), while the frequency of output y(t) 2 ( 2 this abnormal brain discharge signal was provided by China-Japan Union Hospital of Jilin University) is around 3 Hz when patient's absence epilepsy seizures happen. e other relevant parameters of the thalamocortical model are referred to [20]. After basic transformation, system (1) is transformed into closed-loop control system (4) in the new coordinate system, and the transformation matrix T and its inverse matrix are as follows: Regarding the model uncertainties, for simulation purpose, it is assumed that there are 10% parameter variations for the pyramidal neuronal population PY and specific relay nucleus TC with respect to their nominal values due to blood flow change of the cerebral cortex. e unknown disturbance is assumed as d(t), which includes randomly distributed pulses d p (t) and a Gaussian noise d n (t) with standard deviation 0.01 and mean 0. Simulation time duration is 15 seconds in total and simulation step is 0.01 second. During the simulation, two abnormal brain nucleus discharge scenarios are implemented as follows.
In Case 1, the controller does not work until 5s and continues to work until the end of the simulation: where d p (t) is small pulses injected, which is used to simulate a series of electrocardiographic (ECG) disturbance signals and the heart rate is supposed as 80 beats per minute. In Case 2, the controller works at the beginning and continues until the end of the simulation: where d p (t) is randomly distributed pulses injected, which is used to simulate large electromyographic (EMG) disturbance signals of blinking. Parameters used in fractional order sliding mode control based on neural networks of eorems 1 and 2 are listed in Table 1. According to [20], the sliding mode surface of normal sliding mode based on neural networks (NN-NSM) should be s � λ 2 e. Meanwhile, referring to [44], the sliding manifold of integer order sliding mode (IOSM) can be chosen as s � λ 1 _ e + λ 2 e + λ 3 e, λ 3 � 0.02. Correspondingly, parameters concerning parts of three methods are also the same. e control objective is to maintain the output y of the thalamocortical model to track the desired output y d . e following simulation results are to be carried out and discussed using different tracking controllers.
In following figures, the randomly distributed pulse d p (t) is shown in red solid line, the output y(t) and tracking error e(t) of system is in blue solid line, and the desired trajectory y d (t) is in dark dashed line. Moreover, the right side of each simulation figure is occupied by the results of NN-FFOSM, while the left side is occupied by the results of NN-NSM, IOSM, or NN-FOSM.

Comparisons between NN-NSM and NN-FFOSM.
Comparisons of performances using the normal sliding mode (NN-NSM) controller of [20]       Complexity 9 distributed small pulses in Case 1. e difference between NN-NSM and NN-FFOSM is that the latter has a fractional order term in sliding manifold, and it is not included in NN-NSM. Adjusting the fractional order in the sliding manifold can improve system dynamics as well as robustness. Adding fractional derivative terms can improve the parameters adaptation process such that the errors utilizing NN-FFOSM converge to zero more quickly and accurately, which is proved in Figures 5-8.

Comparisons between IOSM and NN-FFOSM.
Control performance and input dynamic using integer order sliding mode (IOSM) in [44] and NN-FFOSM controller in eorem 2 are presented in  signal tracking target, it can be seen from comparison of the tracking error in Figure 10 that the error using NN-FFOSM asymptotically converges to 0 while there are obvious oscillations in the tracking error using IOSM. It follows that NN-FFOSM controller has better effects to eliminate the pathological spike-and-wave discharges than IOSM. e main difference between IOSM and RBFNN-FFOSM is that the NN-FFOSM has an adjustable fractional order factor in the design of sliding manifold, and neural networks technique is also introduced in the FFOSM controller to estimate the disturbances and uncertainties. e adaptive estimation of the nonlinear term can online change the robust gain according to different situations and thus offset the influence caused by disturbances and uncertainties. It is proved that the accuracy of the NN-FFOSM controller is satisfactory.

Comparisons between NN-FOSM and NN-FFOSM.
In [40], NN-FOSM is developed based on a constant velocity approaching law, which is carried out to restrain pathological spike-and-wave discharges firstly. en, NN-FFOSM in eorem 2 by means of the finite time power exponential approaching law is verified as well. Both have better robust characteristics and tracking accuracy. Furthermore,   Complexity equation (12) expresses the same sliding manifold of NN-FOSM and NN-FFOSM. Due to the similarities and differences between two approaches, their simulation results and control performance are evaluated here. Figures 13 and  14 manifest tracking error adaptation of system (4) in Case 1 and Case 2, respectively. It is revealed that the system signal error using NN-FFOSM converges to its desired value faster than while using NN-FOSM, which indicates the effect of finite time function factor on convergence of the system. eir energy consumption is depicted in Figures 15 and 16. Meanwhile, it can also be observed from Figure 14 the steady state error of NN-FFOSM is in the order of magnitude 10 −4 , while the steady state error of NN-FOSM is in 10 −3 . erefore, it can be concluded that the NN-FFOSM can accelerate the parameters adaptation process and improve tracking precision by adding finite time term in the NN-FOSM controller.
Remark 5. Compared with the work in [34,35], it is clear to see that there is high-frequency switching in the control signals (e.g., Figure 11) which is well-known chattering in sliding mode control. Chattering may result in unnecessary mechanical wear and tear on the actuator component. However, one way of overcoming this drawback in real application is to introduce a boundary layer around sliding surface (see reference [45]).

Conclusion
In this paper, the problem of tracking control against disturbances and uncertainties is investigated for epilepsy seizure abatement by using brain-machine interfaces technique. Firstly, the control system for epilepsy therapy is designed, and the external device connected to brain detects the abnormal brain spike discharge in patients with epilepsy and converts it into control signals to achieve stimulation therapy for the brain. en, the synthesis effect of parametric uncertainties is considered. To obtain the estimated value of the synthesis effect of disturbance and uncertainty, the radial basis function neural network is introduced and adaptive estimators are also designed. Based on the estimation information, a novel finite time fractional order sliding mode controller is proposed to adjust the signal of the brain stimulation tracking control system of epilepsy. Meanwhile, the stability and reachability of the closed-loop control system are analyzed. Finally, simulation results are fully compared and verified to demonstrate the effectiveness of the presented control scheme.

Data Availability
e data used to support the findings of this study are available from the corresponding author upon request.