Robust multi-input multi-output adaptive fuzzy terminal sliding mode control of deep brain stimulation in Parkinson’s disease: a simulation study

Deep brain stimulation (DBS) has become an effective therapeutic solution for Parkinson’s disease (PD). Adaptive closed-loop DBS can be used to minimize stimulation-induced side effects by automatically determining the stimulation parameters based on the PD dynamics. In this paper, by modeling the interaction between the neurons in populations of the thalamic, the network-level modulation of thalamic is represented in a standard canonical form as a multi-input multi-output (MIMO) nonlinear first-order system with uncertainty and external disturbances. A class of fast and robust MIMO adaptive fuzzy terminal sliding mode control (AFTSMC) has been presented for control of membrane potential of thalamic neuron populations through continuous adaptive DBS current applied to the thalamus. A fuzzy logic system (FLS) is used to estimate the unknown nonlinear dynamics of the model, and the weights of FLS are adjusted online to guarantee the convergence of FLS parameters to optimal values. The simulation results show that the proposed AFTSMC not only significantly produces lower tracking errors in comparison with the classical adaptive fuzzy sliding mode control (AFSMC), but also makes more robust and reliable outputs. The results suggest that the proposed AFTSMC provides a more robust and smooth control input which is highly desirable for hardware design and implementation.

In 19 , a nonlinear predictive control scheme based on an ARX model has been addressed to online adjustment of DBS amplitude and frequency. Su et al. proposed an adaptive feedback linearization (FL) algorithm to restore thalamic neurons relay reliability 7 . The major disadvantage of the proposed FL approach is that to design the control law the dynamics of a highly nonlinear computational model of PD are required. In 20,21 , a simple closedloop DBS based on linear delayed feedback has been suggested to effectively desynchronize a model of two neuronal populations of the subthalamic nucleus (STN) and the external segment of the globus pallidum (GPe). The aforementioned control works assumed that the dynamics of the model are known with unknown slowvarying system parameters. Moreover, these methods suffer from several issues, such as transient performance, unmodeled dynamics, the amount of offline training, and system stability issues in real applications with the external disturbances and uncertainties of the highly nonlinear computational model of PD being controlled.
Sliding mode control (SMC) is a robust and powerful control technique to handle the nonlinear uncertain system in the presence of bounded external disturbances [22][23][24] . Zhu et al. proposed a robust control technique based on SMC for control of membrane potential of a thalamic neuron in a thalamocortical computational model of BG network consisting of STN, GPe, internal segment of the globus pallidum (GPi), and TH 6 . The control objective was to design a DBS waveform to force the membrane potential of the thalamic neuron to track the normal firing pattern in real-time in a closed-loop manner using the feedback signal. The main limitation of the work is that to design the control pulses, the BG model dynamics should be assumed known. Moreover, the main drawback of the conventional SMC is that due to the linear switching of the manifolds the tracking error of the system converges to the origin asymptotically. To resolve the global asymptotic stability of conventional SMC, terminal sliding mode (TSM) control guarantees the finite-time convergence of the system states to the origin 24,25 . By using fractional-power terms instead of linear in switching surface of conventional SMC, the fast convergence of the TSM control in finite time is guaranteed. However, the main drawbacks of the discontinuous TSM are the singularity of the control input 26,27 and chattering problems 25,28 . In the singularity condition, the amplitude of the control input in some areas of the state space may increase infinitely to guarantee the ideal TSM motion. In chattering phenomena, the high-frequency unmodeled dynamics of the system may be occurred due to the discontinuous switching of the control input across the sliding surface.
To resolve all the above problems, in this paper, we present a fast adaptive fuzzy terminal sliding mode control (AFTSMC) to control the membrane potential of thalamic neuron populations in a BG-thalamic network model. The proposed controller generates an adaptive control signal (stimulation current applied to the TH) automatically to force the firing patterns of the Parkinsonian state to track the normal firing patterns. The main innovations of the work are as follows: • In 6 , the problem of robust control of a single thalamic neuron with uncertain external disturbance has been addressed. In contrast, in the current study, by modeling the interaction between the neurons in populations of the thalamic, the network-level modulation of thalamic is represented in a standard canonical form as the multi-input multi-output (MIMO) nonlinear first-order system with uncertainty and external disturbances. • To increase the speed of the controller outside the sliding surface and eliminate the chattering problem, a fast continuous TSM-type reaching term is designed to ensure the finite-time motion of the system states to the sliding manifold. • On the surface, a nonsingular continuous integral fractional-power surface is developed to ensure the bounded finite-time convergence of the tracking error. • A fuzzy logic system (FLS) is used to estimate the unknown nonlinear dynamics of the model embedded in the control input, and the weights of FLS are adjusted online to guarantee the convergence of FLS parameters to optimal values.
Simulation results are given to evaluate the performance of the proposed control method through the control of firing patterns of Parkinsonian state to track the normal state of the TH, and the results are compared with the adaptive fuzzy conventional SMC. The simulation results show the effectiveness of the proposed AFTSMC in deal with the uncertainty and external disturbances of ionic channels.

Model and control problem
Model. The model of the BG-thalamic network simulated in this study is adopted from So et al. 11 . In this model, four neuronal populations (10 neurons for each population) are modeled for TH, STN, GPe, and GPi. The network topology and connections are shown in Fig. 1. For each neuron in GPe (GPi) population there exist two inhibitory inputs from GPe neurons and two excitatory inputs from STN neurons. Each GPi neuron inhibits a TH neuron, and each STN neuron is inhibited by two GPe neurons. Hence, the dynamic variations of the GPi population and its disturbances or uncertainties originated from the two populations GPe and STN, may directly or indirectly affect the TH. To model the state of Parkinson, the net bias current shown by I app is reduced to show the dopamine depletion in SNc. The value of I app for different populations at both healthy and PD conditions is provided in Table 1. The membrane potential dynamics of TH, STN, GPE, and GPi are modeled by the Hodgkin-Huxley (HH) equations as follows: (1) C m dv TH dt = −I L − I Na − I K − I T − I GPi→TH + I SMC + I dbs www.nature.com/scientificreports/ where in (1)-(4),v i , i ∈ {TH, STN, GPe, GPi} denotes the membrane potential of a single STN, TH, GPe, and GPi neuron respectively, C m = 1µFcm −2 indicates the membrane capacitance.I Na ,I K ,I Ca ,I T ,I ahp , and I L are the sodium current, potassium current, high-threshold calcium current, low-threshold calcium current, after hyperpolarization current, and leak current, respectively. The synaptic current between two neurons is denoted as follows: where α and β are representing pre and post-synaptic neurons, respectively. g α→β denotes the maximal synaptic conductance and E α→β denotes the reverse synaptic potential. The summation term over s j shows the presynaptic neurons current integration. The sensorimotor cortex (SMC) excitatory current to the TH is denoted by I SMC which is defined as follows: where H is a Heaviside step function.i SMC = 3.5uAcm −2 , 1 ρ SMC , and δ SMC = 5 ms are the amplitude, frequency, and duration of the pulse, respectively. Due to the non-regular nature of SMC input, the frequency of the pulse 1 ρ SMC is generated from a gamma distribution with an average rate of 14 Hz and a coefficient of variation of 0.2 19 . All the TH neurons in the population receive the SMC current with different initial voltages and the SMC pulse at each time forces them to fire. I dbs is the stimulation pulses delivered to the TH and designed in  Figure 1. The BG-thalamic network layout for normal and PD conditions. Healthiness or Parkinsonian state is modeled by applying a specific set of I app currents to GPi, GPe, and STN populations (grey and black arrows for Parkinson and healthy states, respectively). The interconnections between different neuronal populations are also depicted which shows different excitatory or inhibitory connections between neurons. Excitatory and inhibitory connections are shown by red and blue arrows, respectively. The sensorimotor cortex excitatory current to the TH is denoted by SMC. www.nature.com/scientificreports/ the control problem section. A detailed description of the model equations is provided in Appendix A of the Supplementary Materials. Simulation of the system including the BG-network model and adaptive fuzzy MIMO controller uses MAT-LAB R2020a for implementing and obtaining the adaptive continuous DBS pulses. The entire period of simulation is 1000 ms (sampling period, 0.01 ms for control updates). The root mean square (RMS) of the absolute tracking error (RMSE) is calculated to measure the tracking accuracy as follows: where v TH and v THd are the membrane potentials of each thalamic neuron for Parkinsonian and healthy states, respectively and T is the entire time of the simulation. Moreover, to quantify the performance of the stimulation pulses, the energy index is defined as the RMS of the control input in the following form 19 : Control problem. The BG-thalamic network model described in (1)-(4) is used as a PD model. To obtain the control input (DBS stimulation) using AFTSMC, the dynamics of thalamic neurons in (1) should be considered in the following canonical form: T is a measurable state vector (membrane potentials of thalamic neurons) and u = [u 1 , . . . , u m ] T indicates the control input (DBS pulses).d(t) denotes unknown bounded external perturbations and uncertainties of the system i.e., d(t) < υ , where υ is a nonnegative known value. The unknown vector functions f 1 (x, t) + d(t) and F 2 (x, t) are defined as Assumption 1 F 2 (x, t) is a positive definite matrix and a real parameter σ 0 > 0 is exists such that F 2 (x, t) > σ 0 I m , where I m is an m × m identity matrix.

Assumption 2
The desired trajectory x d i (t),i = 1, . . . , m is a known (membrane potentials of thalamic neurons in normal condition) continuous function which its first-order dynamics are exist for measurement.
If the tracking error of the PD model is considered as e i = x d i − x i , then, to implement AFTSMC the nonsingular continuous sliding surface is designed as follows: where sig(e i (t)) η = |e i (t)| η sign(e i (t)) , σ and η are positive design parameters that satisfy σ > 0, 1 < η < 2 . If the initial system states are away from the switching surface, a fast reaching law is designed to guarantee the finite-time motion of the system states to the sliding manifold as follows: where the matrices K 1 = diag(k 11 , . . . , k 1m ) > 0 m×m and K 2 = diag(k 21 , . . . , k 2m ) > 0 m×m are design control gains and 1 < ρ 1 < 3, 0 < ρ 2 < 1 . The first dynamic of the sliding surface vector is The equivalent control input is designed as follows: is given as follows: www.nature.com/scientificreports/ where α 1 , α 2 > 0 and 1 ≥ 1, 0 < 2 < 1 , then, its settling time is given by where F(a, b; c; z) indicates Gauss's hypergeometric function 29 . The settling time of the Lemma 1 is proved in Appendix B of the Supplementary Materials.

Lemma 2
If a 1 , a 2 , . . . , a n are all positive parameters, and 0 < p ≤ 2 , then the following inequality always maintains 30 : The nonlinear MIMO model defined in (9) with its Assumptions 1 and 2 is considered. The terminal switching manifold and reaching law are chosen as (12) and (13), respectively, and the control input is defined by (15). If the system states are away from the switching manifold, the dynamics of the model converge to the switching manifold s i = 0 in a finite time.
The proof is given in Appendix C of the Supplementary Materials. When the states reached the sliding surface ( s = 0 ), the dynamics of (4) has a globally finite-time stable attractor in e i = 0 31 , so that the convergence time t r is finite with any condition x i (t r i ) and is calculated as follows: Adaptive fuzzy terminal sliding mode control (AFTSMC). In real applications of closed-loop DBS systems, the dynamics of functions f 1 (x, t) + d(t) and F 2 (x, t) are unavailable and the control input (15) cannot exist. In the current study, to resolve the problem, FLS is applied to estimate these unknown dynamics (see ) , respectively, the following modified control input (15) is written: where ε 0 is a very small positive number. If the inverse of F 2 (x, ψ t f 2 ) cannot exist, the regularized form of (20) can always be well defined. Furthermore, a corrective control term is added to the main control input for compensating the effect of approximation errors in the following form: where u eq (t) is given in (18) and u c (t) is proposed as follows: where σ 0 > 0, and ϒ is an adjustable parameter designed with the following equation: In (22) and (23), u 0 (t) is as follows: Theorem 2 Consider the nonlinear model of the system (9) with nonlinear time-varying dynamics f 1 (x, t), d(t) and F 2 (x, t) , which are estimated with (S.23) and (S. 24), and the Assumptions 1 and 2 hold. The control signal is selected as (21) and the adaptive rules are considered as (S.30), (S. 31), and (23). Thus, the following results are proven: www.nature.com/scientificreports/ (1) The parameter vectors ψ t f 1 and ψ t f 2 converge to ψ * f 1 and ψ * f 2 asymptotically.
, then, the finite-time convergence of tracking error to the origin is guaranteed.
, then, the sliding variable converges to the neighborhood of zero as follows: where k 1 and k 2 denote the minimum eigenvalues of matrices K 1 and K 2 , respectively. By virtue of (25) and (26), the region �s� ≤ δ = min(δ 1 , δ 2 ) will be achieved in finite time. Then, the tracking error converges to a boundary layer in a finite time.
The proof is given in Appendix E of the Supplementary Materials. (25) and (26), the larger selection of control gains K 1 and K 2 results in a smaller boundary region δ . But, by increasing the value of these parameters, the amplitude of the control signal (DBS pulses) will increase so that the control input may not be implemented.

Simulation results
In this section, the results of the proposed AFTSMC to control the membrane potentials of the TH in Parkinsonian state are reported and evaluated. The closed-loop diagram of the proposed robust AFTSMC for control of Parkinsonian state is illustrated in Fig. 2. The control input is a continuous adaptive DBS current applied to the TH so that a DBS waveform forces the membrane potential of the thalamic neuron to track the normal firing pattern in real-time in a closed-loop manner using the feedback signal. The fuzzy systems used to estimate f 1 (x, ψ t f 1 ) and F 2 (x, ψ t f 2 ) have the membrane potentials of thalamic neurons as input. For each state variable x = v TH 1 , . . . , v TH 10 T two Gaussian-type membership functions were defined as follows: where  Figure 3 shows the results of the thalamic firing pattern for neuron 1 in response to SMC excitatory current to the TH for healthy and Parkinsonian. In the healthy state, as the SMC excitatory current pulses applied with a gamma distribution with an average rate of 14 Hz, the thalamic neuron responds to the input successfully, while in Parkinsonian state, due to the reduction of net bias applied currents to the populations of STN, GPe, and GPi, the spiking behavior of the neuron in the presence of the applied input current may be suppressed and the neuron failed to respond normally. The response of the TH neuron in the healthy state is considered as the desired pattern and the main objective is to design and generate the control input (adaptive continuous DBS pulses) automatically to force the firing patterns of the Parkinsonian state to track the normal firing patterns.

Robust closed-loop control of DBS pulses.
In this section, the results of controlling the firing patterns of Parkinsonian state through the proposed AFTSMC are evaluated. The control parameters (i.e., σ , η, ρ 1 , ρ 2 , ε 0 , κ f 1 , κ f 2 , κ 0 , σ 0 , ϒ ) are selected with the trial-and-error process to reach the minimum tracking error with high accuracy and kept fixed during external disturbances and time-varying uncertainty simulations. www.nature.com/scientificreports/ Figure 4 shows the results of the tracking for neuron 1 using the proposed AFTSMC (Fig. 4a) in comparison with the classical adaptive fuzzy sliding mode control (AFSMC). The results show that RMSE is 0.13 mv and 0.15 mv for AFTSMC and classical AFSMC, respectively. The controller rapidly and automatically adjusted the level of stimulation signals to track the desired trajectory with the fast convergence speed. The membrane potential converges to the desired trajectory before 4 ms approximately. Figure 5 shows the membrane potential, control input, and absolute tracking error for individual cells of the TH populations. The bright bars in the chart of the membrane potential show the spiking activity of the thalamic cells in response to the input current of the sensorimotor cortex. The mean RMSE for 10 neurons of the TH is 0.15 mv and 0.19 mv for AFTSMC and classical AFSMC, respectively.  www.nature.com/scientificreports/

Effects of system uncertainty (parameters variations).
In this section, to evaluate the performance of the proposed controller to handle time-varying uncertainty, the values of the system parameters were varied randomly about their nominal values during 1000 ms simulation. All model parameters which are presented in the supplementary tables are considered in this analysis. These parameters include maximal ionic conductance ( g L , g Na , g K , g T , g Ca , g ahp ), reverse ionic potential ( E L , E Na , E K , E T , E Ca ), maximum synaptic conductance ( g STN→GPe , g STN→GPi , g GPe→STN , g GPe→GPe , g GPe→GPi , g GPi→TH ), and reverse synaptic potentials ( E STN→GPe , E STN→GPi , E GPe→STN , E GPe→GPe , E GPe→GPi , E GPi→TH ). The variations were randomly acquired with the uniform distribution by passing the random sequences to the low-pass filter (fourth-order Butterworthtype) with the cutoff frequency of 0.025 Hz. Figure 6 shows the results of the tracking under 50% time-varying uncertainty of the parameters. The control input of AFTSMC is continuous without any chattering and singularity (RMSE, 0.46 mv). In contrast, due to the discontinuity of the classical AFSMC (RMSE, 0.75 mv) across  www.nature.com/scientificreports/ the sliding surface, the control input generates high switching control activity which may excite unmodeled neglected dynamics of the BG-network, thus causing chattering. Figure 7 shows the membrane potential, control input, and absolute tracking error for individual cells of the TH populations. The averages of RMSE and Energy using AFTSMC and AFSMC over 10 trials of the simulation as a function of parameter variations from 0 to 50% are depicted in Fig. 8. Increasing the upper bound of the uncertainty caused more consumption of Energy and larger tracking error. The standard deviation (SD) and mean of RMSE and Energy generated using the AFSMC method were higher than that by the proposed AFTSMC. This indicates that the proposed AFTSMC method can provide robust control of DBS pulses with respect to the AFSMC. The results of the one-way ANOVA test show that the tracking performance and energy of the controllers AFTSMC and AFSMC were significantly different (p < 0.01).

Effects of external disturbances and uncertainty.
To evaluate the performance of the proposed AFTSMC to reject the external disturbance in the presence of uncertainty, the following external current is added to the dynamics of (1) for each TH neuron as the ionic channels disturbances:  www.nature.com/scientificreports/ Figure 9 shows the results of the tracking for neuron 1 using the proposed AFTSMC in comparison with the classical AFSMC. The results show that RMSE is 0.43 mv and 0.85 mv for AFTSMC and classical AFSMC, respectively. Figure 10 shows the membrane potential, control input, and absolute tracking error during the entire period of simulation for individual cells of the TH populations. The averages of RMSE and Energy using AFTSMC and AFSMC over 10 trials of the simulation as a function of parameter variations from 0 to 50% in the presence of external disturbance are indicated in Fig. 11. The parameters SD and mean of RMSE and Energy generated using the AFSMC method were higher than that by the proposed AFTSMC. The results of the one-way analysis of variance (ANOVA) test show that the tracking performance and energy of the controllers AFTSMC and AFSMC were significantly different (p < 0.01).

Discussion and conclusions
In the current paper, a class of fast and robust MIMO control scheme based on AFTSMC has been presented for control of membrane potential of thalamic neuron populations in the BG-thalamic network model through continuous adaptive DBS pulses. In the previous work 6 , a robust SMC was proposed for modulation of Parkinsonian state with uncertain disturbance. A property of the classical SMC is the convergence of the tracking error to the origin in an infinite time. Moreover, in the previous work 6 , to design the control input the membrane potential of the thalamic neuron being controlled should be assumed known. In the current study, to resolve the limitation of globally asymptotic stabilization of classical SMC and speed up the convergence time in both reaching and sliding phases of the motion, an AFTSMC control has been proposed to guarantee the global stability of the closed-loop system with the fast speed. Another problem is the modeling of the complexity of the neuron  www.nature.com/scientificreports/ populations in TH. From a simulation point of view, in 6 , a single-input single-output (SISO) framework was developed for robust control of a single thalamic neuron with uncertain external disturbance. In contrast, in this paper, the interaction between 10 neurons of the TH is represented as the MIMO nonlinear dynamic system and a class of MIMO control framework (centralized structure) is developed for controlling the BG system. Centralized controller structure requires a complex mathematical model of the BG dynamics in the control law designation and calculation. But, in real applications of robust closed-loop DBS systems, the challenge is the reduction of computational order of the system and easy implementation of the closed-loop system. One solution to cope with this limitation is the decentralized design of the system. In a decentralized control scheme, a system is divided into a set of subsystems in which an independent controller is used to control each subsystem. The controller of each subsystem is designed based on feedback measurements of the membrane potential of each isolated neuron of the TH. The external disturbance of each subsystem is considered as a model of the interaction between the subsystems and estimated online with the FLS. The real implementation of the proposed closed-loop controller in decentralized and centralized forms to evaluate the performance and real-time speed of each structure in PD patients through robust adaptive control of DBS using AFTSMC is considered as future research. While computational modeling and simulation provide affordable tools to test and develop effective approaches before clinical trials, many methodological assumptions based on these computational models may not hold in real practical applications. Uncertainty and external disturbance are unavoidable elements of the brain neural networks, including ion channels and synaptic connections 32 . Furthermore, other sources of uncertainty,  www.nature.com/scientificreports/ such as day-to-day and subject-to-subject variability, or possible inaccurate electrode targeting may increase the mismatch between the real control platform and the simulation-based designed controller. Hence, the control approaches purely depending on an accurate BG model, such as the feedback linearization method employed in 7 , would not be an ideal option for practical implementation. To take into account this issue, we evaluated the effects of uncertainty and disturbances on the performance of the proposed controller in a well quantitative manner by increasing the level of uncertainty from 0 to 50 percent with and without external disturbance circumstances. Although increasing uncertainty and/or disturbance negatively affected the control performance of both AFSMC and AFTSMC, the proposed AFTSMC significantly outperforms the classic AFSMC and its superior performance was statistically demonstrated. The proposed AFTSMC not only produced lower tracking errors but also made more robust and reliable outputs. Based on these results, the robustness against model uncertainty and disturbance can be considered as the most significant achievement of this study. This stability makes the proposed AFTSMC a reliable option for implementing in real applications.
In the current study, from a simulation point of view, a robust continuous adaptive control input (DBS current to the TH) could efficiently force the membrane potential of TH neuron populations to track the pattern of healthy subjects in Parkinsonian state without considering the frequency and parameters of the stimulation (pulse amplitude (PA) and pulse width (PW)) 6,7 . In a real DBS platform, it can be seen that the stimulator can generate charge-balanced, biphasic current pulses 20,33,34 with interphase delay, and both PA and PW of stimulation signal are individually or simultaneously adjusted by the AFTSMC to track the healthy patterns of the TH. The proposed controller has the ability of online adaptation to handle the subject and day-to-day variations or the environment changes. Another challenge in a real DBS platform is continuous stimulation with constant frequency. It may lead to increase side effects and battery usage. The optimal control strategy is of interest for current DBS technology to improve the energy efficiency for increasing the battery lifetime 35,36 . We considered this practical issue in our simulation by evaluating the energy index. The results demonstrated that under uncertainty and/or disturbance circumstances, the energy required for classic AFSMC will be highly variable, while the proposed AFTSMC energy index showed very stable values. Further considering the practical perspective, the control input resulted from classic AFSMC showed high switching activity, which makes it hard to achieve energy efficiency 37 . In contrast, the proposed AFTSMC provides a more robust and smooth control input which is highly desirable for hardware design and implementation.