Movatterモバイル変換


[0]ホーム

URL:


CN112675428B - Anti-epileptic electrical stimulation hardware-in-the-loop simulation system - Google Patents

Anti-epileptic electrical stimulation hardware-in-the-loop simulation system
Download PDF

Info

Publication number
CN112675428B
CN112675428BCN202011532349.1ACN202011532349ACN112675428BCN 112675428 BCN112675428 BCN 112675428BCN 202011532349 ACN202011532349 ACN 202011532349ACN 112675428 BCN112675428 BCN 112675428B
Authority
CN
China
Prior art keywords
signal
real
electrical stimulation
electroencephalogram
epileptic
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011532349.1A
Other languages
Chinese (zh)
Other versions
CN112675428A (en
Inventor
魏熙乐
赵美佳
周易非
常思远
伊国胜
王江
卢梅丽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianjin University
Original Assignee
Tianjin University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianjin UniversityfiledCriticalTianjin University
Priority to CN202011532349.1ApriorityCriticalpatent/CN112675428B/en
Publication of CN112675428ApublicationCriticalpatent/CN112675428A/en
Application grantedgrantedCritical
Publication of CN112675428BpublicationCriticalpatent/CN112675428B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Landscapes

Abstract

The invention relates to an anti-epileptic electrical stimulation hardware-in-loop simulation system, wherein: the simulation system comprises an epilepsia electroencephalogram real-time generator, a signal acquisition module, an electrical stimulation controller and an upper computer. The epilepsy electroencephalogram real-time generator converts an input electroencephalogram signal of an epileptic patient into an epilepsy sample discharge signal through a data drive identification strategy and embedded realization of a model, acquires and processes the signal, inhibits the epilepsy sample discharge of an individualized nerve cluster model through a PI closed-loop control strategy based on an unscented Kalman filter, adopts C language programming to realize the program flow of each module, compiles and downloads the program flow into a DSP, and finishes the communication between an upper computer and an electrical stimulation controller through a LabVIEW platform, and the upper computer is mainly used for data communication and waveform display to realize the display control effect. The simulation system has the advantages that the system realizes real-time simulation verification of an electrostimulation closed-loop control strategy, and has an important promotion effect on clinics of epilepsy closed-loop control.

Description

Translated fromChinese
抗癫痫电刺激硬件在环仿真系统Anti-epileptic electrical stimulation hardware-in-the-loop simulation system

技术领域technical field

本发明涉及生物医学工程技术,特别是一种抗癫痫电刺激硬件在环仿真系统。The invention relates to biomedical engineering technology, in particular to an anti-epileptic electrical stimulation hardware-in-the-loop simulation system.

背景技术Background technique

癫痫是世界上最常见的神经系统疾病之一,癫痫发作的特征是一大群神经元异常同步放电导致的脑电活动异常,可在患者脑电图中捕捉得到,并据此进行癫痫检测、定位和诊断。如今在全球有5千万癫痫患者,其中约1/4不能通过药物或外科手术得到有效治疗,这些癫痫称为难治性癫痫。抗癫痫药物在治疗过程中易产生耐药性、依赖性和副作用。手术切除局部病灶区虽然对局部癫痫有治疗效果,但手术治疗过程不可逆,还可能产生记忆损失、语言障碍等风险,也不适用于全脑发作癫痫。Epilepsy is one of the most common neurological diseases in the world. Epilepsy is characterized by abnormal brain electrical activity caused by abnormal synchronous discharge of a large group of neurons, which can be captured in the patient's EEG, and epilepsy detection and location can be performed accordingly and diagnosis. Today, there are 50 million epilepsy patients in the world, about 1/4 of which cannot be effectively treated by drugs or surgery. These epilepsy are called intractable epilepsy. Antiepileptic drugs are prone to drug resistance, dependence and side effects during treatment. Surgical resection of local lesions is effective in treating localized epilepsy, but the surgical treatment process is irreversible, and may also cause risks such as memory loss and language barriers, and is not suitable for generalized seizures.

针对难治性癫痫,电磁刺激疗法具有明显优势,其不会对特定脑区造成损毁,破坏性比手术治疗小,且没有抗癫痫药物和手术的副作用。目前,现有的电磁刺激方案多为开环刺激,在开环策略下,无法根据个体特异性以及病程发展实时调整参数,刺激优化十分困难。相比开环刺激而言,将能够反映癫痫状态且可观测的电生理信号作为反馈构建闭环的控制策略,对患者间个性化差异(脑结构、电极植入位置及脑状态等)具有鲁棒性,有助于提升临床抗癫痫发作的成功率。近年来,如何建立针对患者的个体化刺激-脑响应计算模型刻画刺激信号对神经活动的影响,在此基础上设计合适的闭环控制策略成为抗癫痫电刺激优化的重要科学问题。若将癫痫的闭环控制算法应用在患者身上,需要一种能模拟临床真实环境的硬件在环仿真系统,该系统的各项性能指标应与临床实验相同,从而广泛实时验证抗癫痫发作闭环控制器的控制效果。For intractable epilepsy, electromagnetic stimulation therapy has obvious advantages. It will not cause damage to specific brain regions, is less destructive than surgical treatment, and has no side effects of antiepileptic drugs and surgery. At present, most of the existing electromagnetic stimulation schemes are open-loop stimulation. Under the open-loop strategy, parameters cannot be adjusted in real time according to individual specificity and disease course development, and stimulation optimization is very difficult. Compared with open-loop stimulation, the closed-loop control strategy is constructed by using observable electrophysiological signals that can reflect the epileptic state as feedback, which is robust to individual differences between patients (brain structure, electrode implantation position, and brain state, etc.) It is helpful to improve the success rate of clinical anti-epileptic seizures. In recent years, how to establish an individualized stimulation-brain response calculation model for patients to describe the impact of stimulation signals on neural activity, and on this basis to design an appropriate closed-loop control strategy has become an important scientific issue in the optimization of antiepileptic electrical stimulation. If the closed-loop control algorithm of epilepsy is applied to patients, a hardware-in-the-loop simulation system that can simulate the real clinical environment is needed. The performance indicators of the system should be the same as those of clinical experiments, so as to widely and real-time verify the closed-loop controller for anti-epileptic seizures control effect.

硬件在环仿真技术是指在进行系统测试时,控制器是真实的,其余部分尽量模拟实际,无法模拟时采用实时的数字化模型来模拟控制器的外部环境,进行整个系统的测试及性能验证。目前用于神经控制工程领域里的硬件在环仿真平台较为罕见。Hardware-in-the-loop simulation technology means that during system testing, the controller is real, and the rest of the system is simulated as much as possible. If it cannot be simulated, a real-time digital model is used to simulate the external environment of the controller for testing and performance verification of the entire system. At present, the hardware-in-the-loop simulation platform used in the field of neural control engineering is relatively rare.

发明内容Contents of the invention

针对上述需要解决的问题,本发明的目的是提供一种抗癫痫电刺激硬件在环仿真系统,相比直接对患者进行实验而言,硬件在环仿真可模拟接近真实环境下的实验条件,能反复进行控制算法的验证工作,大大降低了临床实验的风险,对临床前优化电刺激具有重要推动作用。In view of the above-mentioned problems that need to be solved, the purpose of the present invention is to provide a hardware-in-the-loop simulation system for anti-epileptic electrical stimulation. Compared with directly conducting experiments on patients, the hardware-in-the-loop simulation can simulate experimental conditions close to the real environment, and can Repeated verification of the control algorithm greatly reduces the risk of clinical trials and plays an important role in promoting preclinical optimization of electrical stimulation.

为实现上述目的,本发明采用的技术方案是,提供一种抗癫痫电刺激硬件在环仿真系统,其特征是:该仿真系统还包括癫痫脑电实时发生器(2)、信号采集模块(18)、电刺激控制器(25)和上位机(38),In order to achieve the above object, the technical solution adopted by the present invention is to provide a hardware-in-the-loop simulation system for anti-epileptic electrical stimulation, which is characterized in that: the simulation system also includes a real-time epileptic EEG generator (2), a signal acquisition module (18 ), electric stimulation controller (25) and upper computer (38),

癫痫脑电实时发生器(2)用于通过癫痫患者脑电数据驱动辨识得到该癫痫脑电患者的生理模型中的个性化模型参数,进而将个性化模型参数加载到神经集群模型中,复现癫痫样放电信号(17);The epileptic EEG real-time generator (2) is used to obtain the personalized model parameters in the physiological model of the epileptic EEG patient through the driving identification of the EEG data of the epileptic patient, and then load the personalized model parameters into the neural cluster model to reproduce Epileptiform discharge signal (17);

信号采集模块(18)用于将癫痫脑电实时发生器(2)产生的放电信号(17)转换为与真实癫痫患者脑电信号具有相同幅频特性的模拟脑电信号,并将实时采集的模拟脑电信号转换为离散的数字信号,输出给电刺激控制器(25);The signal acquisition module (18) is used to convert the discharge signal (17) generated by the epileptic EEG real-time generator (2) into an analog EEG signal having the same amplitude-frequency characteristics as the real epileptic EEG signal, and the real-time collected EEG signal The analog EEG signal is converted into a discrete digital signal, which is output to the electrical stimulation controller (25);

电刺激控制器(25)用于获取信号采集模块输出的数字信号,并对该数字信号进行滤波处理后,使用无迹卡尔曼滤波器进行个性化神经集群模型参数辨识与估计,通过PI控制律计算出抗癫痫刺激信号,施加给癫痫脑电实时发生器(2),完成复现临床癫痫患者受到电刺激后的真实响应;The electrical stimulation controller (25) is used to obtain the digital signal output by the signal acquisition module, and after filtering the digital signal, use the unscented Kalman filter to identify and estimate the parameters of the personalized neural cluster model, and through the PI control law Calculate the anti-epileptic stimulation signal and apply it to the epileptic EEG real-time generator (2) to complete the reproduction of the real response of clinical epilepsy patients after receiving electrical stimulation;

上位机(38)包括人机交互界面(39),上位机(38)通过LabVIEW编程实现人机交互界面(39),并通过SCI串口通信模块(37)与电刺激控制器(25)进行数据交互,完成数据通信与波形显示。The upper computer (38) includes a human-computer interaction interface (39), and the upper computer (38) realizes the human-computer interaction interface (39) through LabVIEW programming, and transmits data through the SCI serial port communication module (37) and the electric stimulation controller (25). Interaction to complete data communication and waveform display.

所述癫痫脑电实时发生器(2)采用多个DSP芯片构成,每个DSP芯片负责两路癫痫脑电信号的复现,在每个DSP芯片内嵌入两路个性化神经集群模型(9),癫痫脑电实时发生器(2)输出的通道数与待研究的癫痫脑电导数对应,每个个性化神经集群模型均由一个无迹卡尔曼滤波器进行相应的脑电信号参数辨识。The epileptic EEG real-time generator (2) is composed of multiple DSP chips, each DSP chip is responsible for the reproduction of two epileptic EEG signals, and two individual neural cluster models (9) are embedded in each DSP chip , the number of channels output by the epilepsy EEG real-time generator (2) corresponds to the epilepsy EEG derivative to be studied, and each personalized neural cluster model is identified by an unscented Kalman filter for corresponding EEG signal parameters.

癫痫脑电实时发生器(2)共有八个输出通道,产生8路表现癫痫患者个体特异性的复现癫痫样放电信号(17),并通过相应的DSP芯片的AD模块,实时采集电刺激控制器(25)产生的抗癫痫刺激信号,复现临床患者受到电刺激后的真实响应。The epileptic EEG real-time generator (2) has a total of eight output channels, generating 8 channels of recurring epileptiform discharge signals (17) that represent the individual specificity of epilepsy patients, and through the AD module of the corresponding DSP chip, real-time acquisition of electrical stimulation control The antiepileptic stimulation signal generated by the device (25) reproduces the real response of clinical patients after receiving electrical stimulation.

信号采集模块(18)包括信号转换模块(19)和信号实时采集放大模块(24),信号转换模块使用四级分压跟随电路,采用四个低噪声双通道AD8606放大器作为电压跟随器,对癫痫脑电实时发生器(2)输出的模拟信号的幅值进行压缩,完成信号转换;The signal acquisition module (18) includes a signal conversion module (19) and a signal real-time acquisition amplification module (24). The signal conversion module uses a four-stage voltage divider follower circuit, and four low-noise dual-channel AD8606 amplifiers are used as voltage followers. The amplitude of the analog signal output by the EEG real-time generator (2) is compressed to complete the signal conversion;

所述脑电信号实时采集模块(24)采用ADS1299作为采集芯片,并选择ADS1299-FE套件作为信号实时采集放大模块(24),完成8路模拟信号的采集、放大、模数转换及与信号处理模块(26)的通信。Described EEG signal real-time acquisition module (24) adopts ADS1299 as the acquisition chip, and selects the ADS1299-FE suite as the signal real-time acquisition amplification module (24), completes the acquisition, amplification, analog-to-digital conversion and signal processing of 8-way analog signals Communication of modules (26).

与现有技术相比,本发明的有益效果是:Compared with prior art, the beneficial effect of the present invention is:

该仿真系统实现了针对癫痫患者进行电刺激闭环控制策略的实时仿真验证。基于数据驱动辨识了癫痫患者的个性化神经集群模型,结合硬件在环的思想设计了癫痫脑电实时发生器以及信号转换模块,复现了具有与患者脑电信号物理特性(幅值、时间尺度、噪声)相匹配的实时癫痫脑电,并设计了在环实时的电刺激控制器,实现了基于无迹卡尔曼滤波器在线辨识的PI控制策略,对癫痫闭环控制临床化具有重要推动作用。本研究创新的提出了一种抗癫痫电刺激硬件在环仿真系统,其具有以下几点优势:The simulation system realizes the real-time simulation verification of the closed-loop control strategy of electrical stimulation for epileptic patients. Based on the data-driven identification of the personalized neural cluster model of epilepsy patients, combined with the idea of hardware-in-the-loop, the epilepsy EEG real-time generator and signal conversion module were designed to reproduce the physical characteristics (amplitude, time scale) of the EEG signals of patients. , noise) matching real-time epilepsy EEG, and designed a real-time electrical stimulation controller in the loop, and realized the PI control strategy based on the unscented Kalman filter online identification, which has an important role in promoting the clinical application of epilepsy closed-loop control. This study innovatively proposed a hardware-in-the-loop simulation system for anti-epileptic electrical stimulation, which has the following advantages:

1、系统能够复现与癫痫患者脑电信号在时域和频域上具有相同特性的模拟信号,并进行实时闭环控制;1. The system can reproduce analog signals with the same characteristics as EEG signals of epileptic patients in time domain and frequency domain, and perform real-time closed-loop control;

2、系统采用DSP芯片进行数据处理及传输,在实验过程中确保可靠的数据传输机制,满足大量数据交互的实时性和稳定性;2. The system uses DSP chips for data processing and transmission, ensuring a reliable data transmission mechanism during the experiment and meeting the real-time and stability of a large amount of data interaction;

3、癫痫脑电实时发生器和电刺激控制器中,使用的高速存储器均为DSP中的flash模块,该模块读写速度快,内部程序不会因重新上电而擦除,实现高速存储,系统具有存储大量数据与指令的内存空间、高性能易扩展的硬件资源(多功能外设接口、数字信号处理资源),保证算法的可实现性与执行效率。3. In the epilepsy EEG real-time generator and electrical stimulation controller, the high-speed memory used is the flash module in the DSP. This module has a fast reading and writing speed, and the internal program will not be erased due to power-on again, realizing high-speed storage. The system has a memory space for storing a large amount of data and instructions, high-performance and easy-to-expand hardware resources (multi-function peripheral interface, digital signal processing resources), to ensure the realizability and execution efficiency of the algorithm.

4.本发明采用模拟不同神经元集群间相互作用的集总参数模型。集总参数模型以“平均场近似”的思想对神经集群网络建模,神经集群模型中的子集群状态由兴奋性或抑制性平均膜电位及平均放电率描述;子集群之间的连接系数表示平均突触连接数;调整模型参数能够改变兴奋性神经元子集群和抑制性神经元子集群的相互作用,从而使模型产生节律振荡;神经集群模型的优势在于通过集群的节律变化模拟癫痫活动的节律特性,因此避免了微观模型中过大的计算量和较高的维度,适用于癫痫脑电状态的描述。避免使用微观层面的详细生物物理参数研究而带来的复杂、维度高,不能模拟更大规模电活动的难题。4. The present invention adopts a lumped parameter model that simulates the interaction between different neuron clusters. The lumped parameter model models the neural cluster network with the idea of "mean field approximation". The state of the subcluster in the neural cluster model is described by the excitatory or inhibitory average membrane potential and the average firing rate; the connection coefficient between the subclusters is represented The average number of synaptic connections; adjusting the model parameters can change the interaction between excitatory neuron sub-clusters and inhibitory neuron sub-clusters, so that the model produces rhythmic oscillations; the advantage of the neural cluster model is that it simulates epileptic activity through the rhythmic changes of the clusters Rhythmic properties, thus avoiding excessive computational load and high dimensionality in microscopic models, are suitable for the description of epileptic EEG states. Avoid the complex, high-dimensional, and inability to simulate larger-scale electrical activities brought about by the use of detailed biophysical parameter studies at the microscopic level.

神经集群模型的结构可以根据解剖学和电生理基础建立,本发明采用数据驱动策略从包含噪声的脑电信号中获取相应的模型参数。本发明将无迹卡尔曼滤波用于癫痫模型的参数辨识问题上,无迹卡尔曼滤波通过在线计算状态估计值,观测估计值,更新卡尔曼增益,完成对关键参数的估计过程。相比于最小二乘估计来辨识脑电信号来说,适用于辨识复杂的电生理活动,相对于粒子群算法辨识脑电信号来说,在数值仿真中不会消耗大量内存,本申请系统实现了硬件在环仿真平台的初步验证。The structure of the neural cluster model can be established based on anatomical and electrophysiological foundations, and the present invention adopts a data-driven strategy to obtain corresponding model parameters from noise-containing EEG signals. The invention uses the unscented Kalman filter to identify the parameters of the epilepsy model. The unscented Kalman filter calculates the estimated value of the state online, observes the estimated value, updates the Kalman gain, and completes the process of estimating key parameters. Compared with least squares estimation to identify EEG signals, it is suitable for identifying complex electrophysiological activities. Compared with particle swarm algorithm for identifying EEG signals, it will not consume a lot of memory in numerical simulation. The application system implements A preliminary verification of the hardware-in-the-loop simulation platform is carried out.

本发明完全利用癫痫患者的真实临床脑电数据驱动,使用数据驱动辨识策略——无迹卡尔曼滤波器辨识出个性化神经集群模型,建立反映不同患者个体差异的模型,搭建抗癫痫发作硬件在环仿真系统,完成抗癫痫电刺激硬件在环实验,对后期治疗癫痫具有重要意义。The present invention is fully driven by the real clinical EEG data of epilepsy patients, and uses the data-driven identification strategy - unscented Kalman filter to identify a personalized neural cluster model, establishes a model that reflects the individual differences of different patients, and builds anti-epileptic seizure hardware in The ring simulation system and the completion of the anti-epileptic electrical stimulation hardware-in-the-loop experiment are of great significance for the later treatment of epilepsy.

基于数据驱动辨识策略得到了癫痫患者的个性化神经集群模型,结合硬件在环的思想设计了癫痫脑电实时发生器以及信号转换模块(数模转换、四级分压跟随电路),复现了具有与患者脑电信号物理特性(幅值、时间尺度、噪声)相匹配的实时癫痫脑电。Based on the data-driven identification strategy, the personalized neural cluster model of epilepsy patients was obtained, and the epilepsy EEG real-time generator and signal conversion module (digital-to-analog conversion, four-stage voltage divider follower circuit) were designed in combination with the idea of hardware-in-the-loop. It has real-time epileptic EEG that matches the physical characteristics (amplitude, time scale, noise) of the patient's EEG signal.

本发明使用多个DSP,DSP是串行运算,DSP可以进行复杂的非线性运算,且可以完成高精度浮点运算,使用为C语言编程,开发效率更快。本发明根据系统计算性能和实时性方面对核心器件进行选型及各模块间接口的设计和搭建(DSP中DAC、ADC、SCI模块的使用),信号转换模块的PCB设计。由于信号处理模块(26)接收到信号实时采集放大模块(24)通过SPI传输的数字信号是微伏级脑电信号,信号中夹杂大量高频噪声及工频干扰,为保证信号的准确性,需要在信号处理模块(26)里设计实时数字滤波器去除高频干扰,选用巴特沃斯低通IIR数字滤波器进行滤波,提高系统的准确性。The invention uses a plurality of DSPs, and the DSPs are serial operations, and the DSPs can perform complex nonlinear operations, and can complete high-precision floating-point operations, and are programmed in C language, so that the development efficiency is faster. According to the calculation performance and real-time aspects of the system, the present invention selects core devices, designs and builds interfaces between modules (the use of DAC, ADC, and SCI modules in DSP), and designs PCBs for signal conversion modules. Because the signal processing module (26) receives the signal real-time acquisition and amplification module (24) the digital signal transmitted by SPI is a microvolt level EEG signal, mixed with a large amount of high-frequency noise and power frequency interference in the signal, in order to ensure the accuracy of the signal, A real-time digital filter needs to be designed in the signal processing module (26) to remove high-frequency interference, and a Butterworth low-pass IIR digital filter is selected for filtering to improve the accuracy of the system.

附图说明Description of drawings

图1为本发明的仿真系统结构示意图;Fig. 1 is the structural representation of simulation system of the present invention;

图2为本发明的癫痫患者脑电数据驱动辨识策略;Fig. 2 is the EEG data-driven identification strategy for epileptic patients of the present invention;

图3为本发明的个性化神经集群模型的嵌入式实现;Fig. 3 is the embedded realization of individualized neural cluster model of the present invention;

图4为本发明的信号转换模块的降压电路;Fig. 4 is the step-down circuit of the signal conversion module of the present invention;

图5为本发明的基于无迹卡尔曼滤波器的PI闭环控制策略框图;Fig. 5 is the PI closed-loop control strategy block diagram based on unscented Kalman filter of the present invention;

图6为本发明的人机交互界面。Fig. 6 is the human-computer interaction interface of the present invention.

图中:In the picture:

1.癫痫患者脑电信号 2.癫痫脑电实时发生器 3.数据预处理 4.数据截取 5.去除伪迹 6.消去均值 7.神经集群模型 8.无迹卡尔曼滤波器 9.个性化神经集群模型 10.模型的嵌入式实现 11.个性化神经集群模型参数初始化 12.生成高斯白噪声 13.AD模块14.模型微分方程求解 15.生成模拟癫痫样放电信号 16.循环计算 17.复现癫痫样放电信号 18.信号采集模块 19.信号转换模块 20.一级分压跟随电路 21.二级分压跟随电路22.三级分压跟随电路 23.四级分压跟随电路 24.信号实时采集放大模块 25.电刺激控制器 26.信号处理模块 27.控制器模块 28.参数期望值 29.误差信号 30.PI控制律 31.系统噪声 32.测量噪声 33.脑电信号测量值 34.模型输入 35.输入噪声 36.参数估计值37.SCI串口通信模块 38.上位机 39.人机交互界面 40.串口参数配置界面 41.VISA资源配置界面 42.波形显示界面1. EEG signal of epilepsy patients 2. Real-time generator of epilepsy EEG 3. Data preprocessing 4. Data interception 5. Removal of artifacts 6. Elimination ofmean value 7.Neural cluster model 8. Unscented Kalman filter 9. PersonalizationNeural cluster model 10. Embedded implementation of the model 11. Personalized neural clustermodel parameter initialization 12. Generate Gaussianwhite noise 13.AD module 14. Modeldifferential equation solution 15. Generate simulated epileptiform discharge signals 16.Cycle calculation 17. ComplexEpileptiform discharge signal 18.Signal acquisition module 19.Signal conversion module 20. One-level voltagedivision follower circuit 21. Two-level voltagedivision follower circuit 22. Three-level voltagedivision follower circuit 23. Four-level voltagedivision follower circuit 24. Signal Real-time acquisition andamplification module 25.Electric stimulation controller 26. Signal processing module 27.Controller module 28.Parameter expectation value 29.Error signal 30.PI control law 31.System noise 32.Measurement noise 33. EEGsignal measurement value 34.Model input 35.Input noise 36.Parameter estimation 37. SCIserial communication module 38.Host computer 39. Human-computer interaction interface 40. Serial portparameter configuration interface 41. VISAresource configuration interface 42. Waveform display interface

具体实施方式Detailed ways

下面结合附图对本发明的一种抗癫痫电刺激硬件在环仿真系统做进一步详细描述。A hardware-in-the-loop simulation system for anti-epileptic electrical stimulation of the present invention will be further described in detail below with reference to the accompanying drawings.

本发明的抗癫痫电刺激硬件在环仿真系统的设计思想是首先通过癫痫患者脑电信号(1)数据驱动,基于数据驱动辨识建立个性化神经集群模型,在DSP中使用四阶龙格库塔算法求解模型的微分方程,模拟出癫痫样放电信号,完成模型的嵌入式实现(10),输出复现癫痫样放电信号(17);然后信号转换模块(19)将癫痫脑电实时发生器(2)产生的复现癫痫样放电信号进行降压,转换为与真实脑电信号具有相同幅频特性的模拟脑电信号,复现临床采集的真实脑电信号;利用信号实时采集放大模块(24)实时采集微弱的模拟脑电信号,将连续变化的模拟脑电信号转换为离散的数字信号,使用高速数字通信接口完成与信号处理模块(26)的通信,信号处理模块(26)对采集的信号进行滤波消除高频干扰;控制器模块(27)通过基于关键生理参数——平均兴奋性突触增益反馈的PI控制律(30)计算出抗癫痫刺激信号,施加给癫痫脑电实时发生器(2);最后设计上位机的人机交互界面(39),控制器模块(27)中接收的多通道放电信号同时传输给上位机(38),并通过不同的波形图表显示在人机交互界面(39)上。The design concept of the anti-epileptic electrical stimulation hardware-in-the-loop simulation system of the present invention is firstly driven by the EEG signal (1) data of epileptic patients, based on the data-driven identification to establish a personalized neural cluster model, and using the fourth-order Runge-Kutta in DSP The algorithm solves the differential equation of the model, simulates the epileptiform discharge signal, completes the embedded implementation of the model (10), and outputs the recurring epileptiform discharge signal (17); then the signal conversion module (19) converts the epileptic EEG real-time generator ( 2) The generated recurring epileptiform discharge signal is decompressed, converted into an analog EEG signal with the same amplitude-frequency characteristics as the real EEG signal, and reproduces the real EEG signal collected clinically; the real-time acquisition and amplification module (24 ) collects weak analog EEG signals in real time, converts the continuously changing analog EEG signals into discrete digital signals, uses a high-speed digital communication interface to complete the communication with the signal processing module (26), and the signal processing module (26) is used for the collected The signal is filtered to eliminate high-frequency interference; the controller module (27) calculates the anti-epileptic stimulation signal through the PI control law (30) based on the key physiological parameter-average excitatory synaptic gain feedback, and applies it to the epileptic EEG real-time generator (2); finally design the human-computer interaction interface (39) of the upper computer, the multi-channel discharge signal received in the controller module (27) is transmitted to the upper computer (38) simultaneously, and is displayed in the human-computer interaction by different wave charts on the interface (39).

本申请中的个性化是指根据癫痫患者脑电信号数据驱动,辨识出了对应癫痫患者的生理模型中的个性化模型参数——平均兴奋性突触增益,把辨识出的平均兴奋性突触增益代入到DSP(癫痫脑电实时发生器)中的神经集群模型里,构建得到个性化神经集群模型(9),这里个性化模型参数的辨识也是用无迹卡尔曼滤波器进行,本申请中共两种无迹卡尔曼滤波器,一种用于个性化神经集群模型构建,一种用于闭环控制。Personalization in this application refers to identifying the individualized model parameters in the physiological model corresponding to epilepsy patients—the average excitatory synapse gain—based on the EEG signal data of epilepsy patients, and the identified average excitatory synapse gain The gain is substituted into the neural cluster model in the DSP (epilepsy EEG real-time generator), and a personalized neural cluster model (9) is constructed. Here, the identification of the personalized model parameters is also carried out with an unscented Kalman filter. Two unscented Kalman filters, one for personalized neural cluster model building and one for closed-loop control.

本发明抗癫痫电刺激硬件在环仿真系统包括癫痫脑电实时发生器2、信号采集模块18、电刺激控制器25以及上位机38,癫痫脑电实时发生器2将输入的癫痫患者脑电信号通过数据驱动辨识策略和模型的嵌入式实现,转化为复现癫痫样放电信号,并进行放电信号采集与处理,通过基于无迹卡尔曼滤波器的PI闭环控制策略(图5)抑制个性化神经集群模型的癫痫样放电,各模块的程序流程采用C语言编程实现,并编译下载到DSP中,通过LabVIEW平台完成上位机与电刺激控制器25的通讯,上位机主要用于数据通信与波形显示,实时显示控制效果。The anti-epileptic electrical stimulation hardware-in-the-loop simulation system of the present invention includes an epileptic EEG real-time generator 2, asignal acquisition module 18, anelectrical stimulation controller 25, and ahost computer 38. The epileptic EEG real-time generator 2 will input the EEG signals of epileptic patients Through the data-driven identification strategy and the embedded implementation of the model, it is converted into a recurring epileptiform discharge signal, and the discharge signal is collected and processed, and the personalized neural network is suppressed through the PI closed-loop control strategy based on the unscented Kalman filter (Figure 5). For the epileptic discharge of the cluster model, the program flow of each module is realized by programming in C language, compiled and downloaded to the DSP, and the communication between the host computer and theelectrical stimulation controller 25 is completed through the LabVIEW platform. The host computer is mainly used for data communication and waveform display , to display the control effect in real time.

所述癫痫脑电实时发生器(2)包括个性化神经集群模型9、模型的嵌入式实现10、复现癫痫样放电信号17,癫痫脑电实时发生器(2)使用DSP——TMS320F28377DPTP作为微型控制单元(Micro Control Unit,MCU),复现患者在癫痫发作时大脑内神经元集群的生理活动,得到个性化神经集群模型(9),模型的嵌入式实现(10)通过在DSP中采用四阶龙格-库塔(Runge-Kutta)算法将非线性常微分方程——个性化神经集群模型的求解过程转化为差分方程的迭代计算,并通过4个DSP的8个DAC(Digital-to-Analog Converter,DAC)作为输出通道,产生8路表现癫痫患者个体特异性的复现癫痫样放电信号(17),输出到信号转换模块(19),并通过DSP芯片的ADC(Analog-to-Digital Converter,ADC)——AD模块,实时采集电刺激控制器(25)产生的抗癫痫刺激信号,复现临床患者受到电刺激后的真实响应。癫痫脑电实时发生器中有四个独立的DSP,同时进行工作,每个DSP用到2个DAC输出通道,每个DSP中均嵌入两个个性化神经集群模型,每个DSP负责两导脑电信号(癫痫信号)的个性化神经集群模型的构建,每个个性化神经集群模型均通过一个无迹卡尔曼滤波器进行相应的脑电信号参数辨识,复现出相应的癫痫样放电信号,癫痫脑电实时发生器共输出八路癫痫样放电信号,每路癫痫样放电信号均连接一个信号采集模块18,所有信号采集模块的输出信号均给到电刺激控制器中。The real-time epileptic EEG generator (2) includes a personalized neural cluster model 9, an embeddedimplementation 10 of the model, and a recurringepileptiform discharge signal 17. The epileptic EEG real-time generator (2) uses DSP——TMS320F28377DPTP as a miniature The control unit (Micro Control Unit, MCU) reproduces the physiological activities of neuron clusters in the brain of patients during epileptic seizures, and obtains a personalized neural cluster model (9), and the embedded implementation of the model (10) adopts four The order Runge-Kutta algorithm transforms the solution process of the nonlinear ordinary differential equation—personalized neural cluster model into the iterative calculation of the difference equation, and through 8 DACs (Digital-to- Analog Converter (DAC) is used as an output channel to generate 8 channels of epilepsy-like discharge signals (17) that show the individual specificity of epilepsy patients, output to the signal conversion module (19), and pass through the ADC (Analog-to-Digital Converter (ADC)——AD module, collects the anti-epileptic stimulation signal generated by the electrical stimulation controller (25) in real time, and reproduces the real response of clinical patients after receiving electrical stimulation. There are four independent DSPs in the epilepsy EEG real-time generator, working at the same time, each DSP uses 2 DAC output channels, each DSP is embedded with two personalized neural cluster models, each DSP is responsible for two brain The construction of a personalized neural cluster model of electrical signals (epilepsy signals), each personalized neural cluster model uses an unscented Kalman filter to identify the corresponding EEG signal parameters, and reproduces the corresponding epileptiform discharge signals, The epileptic EEG real-time generator outputs a total of eight epileptiform discharge signals, each of which is connected to asignal acquisition module 18, and the output signals of all signal acquisition modules are sent to the electrical stimulation controller.

所述信号转换模块(19),使用四级分压跟随电路,采用四个低噪声双通道AD8606放大器作为电压跟随器,对癫痫脑电实时发生器的输出通道DAC输出的模拟癫痫样放电信号的幅值进行压缩,完成信号转换,满足设计需要。Described signal conversion module (19), uses four-stage voltage divider follower circuit, adopts four low-noise dual-channel AD8606 amplifiers as voltage follower, to the analog epileptiform discharge signal of the output channel DAC output of epilepsy EEG real-time generator The amplitude is compressed to complete the signal conversion to meet the design needs.

所述信号实时采集放大模块(24)的芯片型号为ADS1299,包括ADS1299芯片及TI公司的ADS1299-FE套件,可完成8路模拟信号的采集、放大、模数转换及与信号处理模块(26)的通信,满足设计需要。本实施例中癫痫患者脑电信号(1)的脑电数据来源于PhysioNet,Ali Shoeb在波士顿儿童医院采集了22个癫痫患者的头皮脑电图,并将数据集上传至PhysioNet,采集的脑电信号为23导数据,采集频率是256Hz。The chip model of described signal real-time acquisition amplification module (24) is ADS1299, comprises the ADS1299-FE kit of ADS1299 chip and TI company, can complete the acquisition of 8 road analog signals, amplification, analog-to-digital conversion and signal processing module (26) communication to meet design needs. In this example, the EEG data of epilepsy patients' EEG signal (1) comes from PhysioNet. Ali Shoeb collected the scalp EEG of 22 epilepsy patients at Boston Children's Hospital, and uploaded the data set to PhysioNet. The collected EEG The signal is 23 channels of data, and the acquisition frequency is 256Hz.

本发明在环仿真系统构建中使用的真实癫痫患者脑电数据来自23导数据中有较为规律癫痫样放电的8导脑电信号,需要复现8路癫痫样放电信号。此外8路的设置能够满足DSP芯片的实时性要求,保证电刺激控制器在一个采样周期4ms(ADS1299)内能完成计算出一个控制周期内的控制信号(抗癫痫刺激信号)。The real EEG data of epilepsy patients used in the construction of the ring simulation system in the present invention comes from 8-channel EEG signals with relatively regular epileptiform discharges in the 23-channel data, and it is necessary to reproduce 8-channel epileptiform discharge signals. In addition, the 8-channel setting can meet the real-time requirements of the DSP chip, ensuring that the electrical stimulation controller can complete the calculation of the control signal (anti-epileptic stimulation signal) in a control cycle within a sampling cycle of 4ms (ADS1299).

所述电刺激控制器(25)也采用一个DSP实现,芯片型号为TMS320F28377DPTP,TMS320F28377DPTP的DAC输出模拟信号,通过SCI串口通信模块(37)与上位机(38)进行数据交互,满足设计需要。所述电刺激控制器(25)包括信号处理模块(26)与控制器模块(27),Described electric stimulation controller (25) also adopts a DSP to realize, and chip model is TMS320F28377DPTP, and the DAC output analog signal of TMS320F28377DPTP, carries out data interaction with upper computer (38) by SCI serial port communication module (37), satisfies the design requirement. The electrical stimulation controller (25) includes a signal processing module (26) and a controller module (27),

所述信号处理模块(26)接收到信号实时采集放大模块(24)通过SPI传输的数字信号,采集到的信号为微伏级脑电信号,信号中夹杂大量高频噪声及工频干扰,设计巴特沃斯低通无限长单位脉冲响应(Infinite Impulse Response,IIR)数字滤波器去除高频干扰,完成与信号采集模块(18)的通信以及对数据进行信号处理。The signal processing module (26) receives the signal real-time acquisition and amplification module (24) through the digital signal transmitted by SPI, and the collected signal is a microvolt-level EEG signal, which is mixed with a large amount of high-frequency noise and power frequency interference in the signal. The Butterworth low-pass Infinite Impulse Response (Infinite Impulse Response, IIR) digital filter removes high-frequency interference, completes communication with the signal acquisition module (18) and performs signal processing on the data.

所述控制器模块(27)包含无迹卡尔曼滤波器(8)和PI控制律(30),通过无迹卡尔曼滤波参数估计算法完成对关键生理参数——平均兴奋性突触增益的辨识;由参数估计值和期望值的偏差,通过增量式PI控制律实时调整刺激信号,输出抗癫痫刺激信号到向控制对象——癫痫脑电实时发生器(2),PI控制律(30)计算出控制信号,通过电刺激控制器的DAC输出抗癫痫刺激信号施加给个性化神经集群模型。The controller module (27) includes an unscented Kalman filter (8) and a PI control law (30), and completes the identification of key physiological parameters—the average excitatory synaptic gain through an unscented Kalman filter parameter estimation algorithm ;According to the deviation between the estimated value of the parameter and the expected value, the stimulation signal is adjusted in real time through the incremental PI control law, and the anti-epileptic stimulation signal is output to the control object—the real-time generator of epilepsy EEG (2), and the calculation of the PI control law (30) The control signal is output, and the anti-epileptic stimulation signal is output to the personalized neural cluster model through the DAC of the electrical stimulation controller.

所述人机交互界面(39)使用LabVIEW平台实现,通过VISA(Virtual InstrumentSoftware Architecture,虚拟仪器软件体系结构)库实现上位机(38)与DSP的SCI串口通信模块(37)进行数据交互,主要应用VISA串口配置、VISA读取、VISA写入等函数。在串口发送数据的最高位前加入数据标识位,上位机(38)通过识别数据标识位对8通道数据进行波形显示,实现与控制器模块(27)的实时通讯。Described human-computer interaction interface (39) uses LabVIEW platform to realize, realizes upper computer (38) and the SCI serial port communication module (37) of DSP to carry out data interaction by VISA (Virtual InstrumentSoftware Architecture, virtual instrument software architecture) storehouse, main application VISA serial port configuration, VISA read, VISA write and other functions. The data identification bit is added before the highest bit of the data sent by the serial port, and the upper computer (38) performs waveform display on the 8-channel data by identifying the data identification bit, so as to realize real-time communication with the controller module (27).

以下对本发明的抗癫痫电刺激硬件在环仿真系统的整体实现加以说明:The overall realization of the anti-epileptic electrical stimulation hardware-in-the-loop simulation system of the present invention is described below:

如图1所示,对本发明的仿真系统结构进行设计,选用TI公司的DSP——TMS320F28377DPTP芯片作为癫痫脑电实时发生器的MCU,癫痫患者脑电信号(1)通过数据驱动辨识策略建立个性化神经集群模型(9),并在DSP中采用四阶Runge-Kutta算法完成模型的嵌入式实现(10),复现癫痫样放电信号(17),信号转换模块(19)将癫痫脑电实时发生器(2)产生的模拟癫痫样放电信号进行降压,转换为与真实脑电信号具有相同幅频特性的模拟脑电信号,复现临床采集的真实脑电信号,利用信号实时采集放大模块(24)采集微弱的模拟脑电信号,并转换为离散的数字信号,使用DSP的高速数字通信接口完成与信号处理模块(26)的通信,并对采集的信号进行放大和滤波消除,控制器模块(27)通过基于平均兴奋性突触增益这一关键生理参数反馈的PI控制计算出抗癫痫刺激信号,施加给癫痫脑电实时发生器(2),并将接收的8通道放电信号通过SCI串口通信模块(37)传输给上位机(38),并通过不同的波形图表显示在人机交互界面(39)。本发明在环仿真系统构建后,可以用于后期的癫痫治疗,真实癫痫患者脑电信号直接输入到信号实时采集放大模块24中,再进入电刺激控制器25处理后直接作用于癫痫患者脑电,能将电刺激控制器用在临床实验上。As shown in Figure 1, the simulation system structure of the present invention is designed, and the DSP-TMS320F28377DPTP chip of TI Company is selected as the MCU of the epilepsy EEG real-time generator. The neural cluster model (9), and uses the fourth-order Runge-Kutta algorithm in the DSP to complete the embedded implementation of the model (10), reproduces the epileptiform discharge signal (17), and the signal conversion module (19) generates the epileptic EEG in real time The simulated epileptiform discharge signal generated by the device (2) is decompressed, converted into a simulated EEG signal having the same amplitude-frequency characteristics as the real EEG signal, reproducing the real EEG signal collected clinically, and using the signal to collect and amplify the module in real time ( 24) Gather weak analog EEG signals, and convert them into discrete digital signals, use the high-speed digital communication interface of DSP to complete the communication with the signal processing module (26), and amplify and filter the collected signals, and the controller module (27) Calculate the anti-epileptic stimulation signal through PI control based on the feedback of the key physiological parameter of average excitatory synaptic gain, apply it to the real-time generator of epilepsy EEG (2), and pass the received 8-channel discharge signal through the SCI serial port The communication module (37) is transmitted to the upper computer (38), and is displayed on the human-computer interaction interface (39) through different wave charts. After the ring simulation system is built, the present invention can be used for epilepsy treatment in the later stage. Real EEG signals of epilepsy patients are directly input into the signal real-time acquisition andamplification module 24, and then processed by theelectrical stimulation controller 25 to directly act on the EEG signals of epilepsy patients. , the electrical stimulation controller can be used in clinical experiments.

本发明实施例中用到的DSP均为TMS320F28377DPTP,癫痫脑电实时发生器用了4个TMS320F28377DPTP,电刺激控制器用了1个TMS320F28377DPTP。The DSPs used in the embodiment of the present invention are all TMS320F28377DPTP, the epilepsy EEG real-time generator uses 4 TMS320F28377DPTP, and the electrical stimulation controller uses 1 TMS320F28377DPTP.

如图2所示为癫痫患者脑电数据驱动辨识策略,首先为去除癫痫患者脑电信号(1)的噪声和伪迹,需要对脑电信号进行数据预处理(3),分别为数据截取(4)、去除伪迹(5)、消去均值(6),得到经过预处理的癫痫患者脑电数据。神经集群模型(7)可用于产生癫痫发作与不发作等多种状态的模拟脑电信号,其由锥体神经元子集群、抑制性中间神经元子集群与兴奋性中间神经元子集群组成,每个子集群由二阶线性传递函数和非线性Sigmoid函数(S(·))两个基本算子组成,神经集群模型(7)的动态特性由以下微分方程表示:Figure 2 shows the EEG data-driven identification strategy for patients with epilepsy. First, in order to remove the noise and artifacts of the EEG signal (1), the EEG signal needs to be preprocessed (3). 4), removing artifacts (5), eliminating the mean value (6), and obtaining preprocessed EEG data of epilepsy patients. The neural cluster model (7) can be used to generate simulated EEG signals in various states such as epileptic seizures and non-seizures. It is composed of pyramidal neuron subclusters, inhibitory interneuron subclusters and excitatory interneuron subclusters. Each sub-cluster consists of two basic operators, the second-order linear transfer function and the nonlinear Sigmoid function (S( )), and the dynamic characteristics of the neural cluster model (7) are expressed by the following differential equations:

Figure BDA0002852405820000071
Figure BDA0002852405820000071

式中:x(t)表示二阶线性传递函数的输出信号,x表示六个状态变量,六个状态变量满足式(1)的关系,“.”表示导数;C1,C2,C3,C4表示锥体神经元子集群与中间神经元子集群之间的平均突触连接数;A表示平均兴奋性突触增益,为神经集群模型(7)中具有生理意义的参数;a表示平均兴奋性时间常数;B表示平均抑制性突触增益;b表示平均抑制性时间常数。模型的输出方程为:In the formula: x(t) represents the output signal of the second-order linear transfer function, x represents six state variables, and the six state variables satisfy the relationship of formula (1), "." represents the derivative; C1 , C2 , C3 , C4 represents the average number of synaptic connections between the pyramidal neuron subcluster and the interneuron subcluster; A represents the average excitatory synaptic gain, which is a physiologically meaningful parameter in the neural cluster model (7); a represents Average excitatory time constant; B, average inhibitory synaptic gain; b, average inhibitory time constant. The output equation of the model is:

y(t)=x1(t)-x2(t) (2)y(t)=x1 (t)-x2 (t) (2)

式中:y(t)表示模拟脑电信号的锥体神经元子集群突触后膜电位。In the formula: y(t) represents the post-synaptic membrane potential of the subgroup of pyramidal neurons simulating the EEG signal.

其次使用无迹卡尔曼滤波器(8)整合患者脑电数据与神经集群模型(7),实时完成状态辨识和参数估计,在估计前需要对脑电数据进行线性变换,使脑电数据与神经集群模型输出信号的范围保持一致,最终得到个性化神经集群模型(9)。Secondly, the unscented Kalman filter (8) is used to integrate the patient's EEG data and the neural cluster model (7) to complete the state identification and parameter estimation in real time. The scope of the output signal of the cluster model is kept consistent, and finally a personalized neural cluster model is obtained (9).

无迹卡尔曼滤波器(8)对参数A的估计步骤如下:The estimation steps of the parameter A by the unscented Kalman filter (8) are as follows:

(1)对滤波器进行初始化:状态矢量估计的初始值为

Figure BDA0002852405820000072
可以设为0;状态协方差矩阵
Figure BDA0002852405820000073
的初始化如下所示:(1) Initialize the filter: the initial value of the state vector estimate is
Figure BDA0002852405820000072
Can be set to 0; state covariance matrix
Figure BDA0002852405820000073
The initialization of is as follows:

Figure BDA0002852405820000074
Figure BDA0002852405820000074

式中:Qr表示参数不确定性;Q表示过程噪声。In the formula: Qr represents the parameter uncertainty; Q represents the process noise.

(2)状态矢量预测:为了解决求解状态协方差矩阵平方根中,矩阵存在非正定情况,对前一时刻状态协方差矩阵做SVD分解,计算Sigma点X,如下所示:(2) State vector prediction: In order to solve the problem of non-positive definiteness in the square root of the state covariance matrix, SVD decomposition is performed on the state covariance matrix at the previous moment, and the Sigma point X is calculated, as follows:

Figure BDA0002852405820000075
Figure BDA0002852405820000075

式中:X是(nx+nq)×2(nx+nq)的矩阵;nX为模型状态个数;nq为待估计参数的个数;n表示模型状态个数与待估计参数的个数之和。将Sigma点X代入神经集群模型(7)的非线性状态方程f(即公式(1))中,经过加权,新的矢量点集Zn-1|n-1如下所示:In the formula: X is a matrix of (nx +nq )×2(nx +nq ); nX is the number of model states; nq is the number of parameters to be estimated; n represents the number of model states and the number of parameters to be estimated. The sum of the number of estimated parameters. Substituting the Sigma point X into the nonlinear state equation f of the neural cluster model (7) (that is, formula (1)), after weighting, the new vector point set Zn-1|n-1 is as follows:

Figure BDA0002852405820000081
Figure BDA0002852405820000081

式中:un为系统的输入。状态矢量预测值

Figure BDA0002852405820000082
如下所示:In the formula: un is the input of the system. state vector predictor
Figure BDA0002852405820000082
As follows:

Figure BDA0002852405820000083
Figure BDA0002852405820000083

状态协方差矩阵预测值

Figure BDA0002852405820000084
如下所示:State covariance matrix predictors
Figure BDA0002852405820000084
As follows:

Figure BDA0002852405820000085
Figure BDA0002852405820000085

(3)观测矢量预测:(3) Observation vector prediction:

Figure BDA0002852405820000086
Figure BDA0002852405820000086

式中:H表示观测矩阵;R为观测噪声。In the formula: H is the observation matrix; R is the observation noise.

(4)卡尔曼滤波器更新:对卡尔曼增益Kn进行更新:(4) Kalman filter update: update the Kalman gain Kn :

Figure BDA0002852405820000087
Figure BDA0002852405820000087

对状态矢量估计值

Figure BDA0002852405820000088
-进行更新:Estimating the state vector
Figure BDA0002852405820000088
- Make an update:

Figure BDA0002852405820000089
Figure BDA0002852405820000089

对状态协方差矩阵进行更新:Update the state covariance matrix:

Figure BDA00028524058200000810
Figure BDA00028524058200000810

(5)返回步骤(2)。(5) Return to step (2).

如图3所示为个性化神经集群模型的嵌入式实现,在癫痫脑电实时发生器(2)的DSP中使用四阶Runge-Kutta算法在线求解微分方程,并通过DSP的DAC实时输出模拟癫痫样放电信号,分为五部分:首先设定个性化神经集群模型中平均兴奋性突触增益值,将所有变量(高斯白噪声均值方差、模型中各参数)进行初始化,完成个性化神经集群模型参数初始化(11),然后为了模拟个性化神经集群模型中的外部输入,生成高斯白噪声(12),将DSP中AD模块(13)采集的刺激信号代入个性化神经集群模型的微分方程中,通过四阶Runge-Kutta数值积分算法进行模型微分方程求解(14),获得对应时刻的输出解,最后经循环计算(16)(随时间推移的计算),完成利用癫痫脑电实时发生器(2)的DSP中DAC将模型输出转换为表现节律性癫痫样放电的电压信号,即生成模拟癫痫样放电信号(15)。As shown in Figure 3, the embedded implementation of the personalized neural cluster model uses the fourth-order Runge-Kutta algorithm to solve the differential equation online in the DSP of the epilepsy EEG real-time generator (2), and simulates epilepsy through the real-time output of the DAC of the DSP The sample discharge signal is divided into five parts: firstly, the average excitatory synaptic gain value in the personalized neural cluster model is set, and all variables (Gaussian white noise mean variance, each parameter in the model) are initialized to complete the personalized neural cluster model Parameter initialization (11), then in order to simulate the external input in the personalized neural cluster model, generate Gaussian white noise (12), the stimulation signal that AD module (13) gathers in the DSP is substituted in the differential equation of the personalized neural cluster model, Through the fourth-order Runge-Kutta numerical integration algorithm to solve the model differential equation (14), the output solution at the corresponding time is obtained, and finally through the loop calculation (16) (calculation over time), the epilepsy EEG real-time generator (2 The DAC in the DSP of ) converts the model output into a voltage signal showing rhythmic epileptiform discharge, that is, generates a simulated epileptiform discharge signal (15).

如图4所示为信号转换模块(19)的降压电路,癫痫患者脑电信号的幅值范围是0-1600μV,为使平台复现癫痫患者真实的脑电信号,需要对信号幅值进行压缩。若直接对DSP中个性化神经集群模型的数字输出信号进行数字缩放,由于DAC输出的模拟信号范围是0-3.3V,数字量的范围是0-4095,缩小1000倍将严重影响数据精度,因此使用一级分压跟随电路(20)、二级分压跟随电路(21)、三级分压跟随电路(22)以及四级分压跟随电路(23),四个分压跟随电路完全一样且依次连接,其中,R1、R2、R3、R4、R5、R6、R7、R8为每一级分压跟随电路的电阻,Vin为输入电压,Vout为输出电压,它们的关系如下:As shown in Figure 4, it is the step-down circuit of the signal conversion module (19). The amplitude range of the EEG signal of epilepsy patients is 0-1600μV. In order to make the platform reproduce the real EEG signals of epilepsy patients, it is necessary to perform a compression. If the digital output signal of the personalized neural cluster model in the DSP is directly digitally scaled, since the range of the analog signal output by the DAC is 0-3.3V, and the range of the digital quantity is 0-4095, the reduction of 1000 times will seriously affect the data accuracy, so Using the one-level voltage division follower circuit (20), the second-level voltage division follower circuit (21), the third-level voltage division follower circuit (22) and the four-level voltage division follower circuit (23), the four voltage division follower circuits are exactly the same and Connect in sequence, where R1 , R2 , R3 , R4 , R5 , R6 , R7 , and R8 are the resistors of each stage of voltage division follower circuit, Vin is the input voltage, and Vout is the output voltage , their relationship is as follows:

Figure BDA0002852405820000091
Figure BDA0002852405820000091

为了提高电路的驱动能力并增强抗干扰特性,芯片选用ADI公司的低噪声双通道AD8606放大器,使用四个运算放大器作为电压跟随器完成信号转换。In order to improve the drive capability of the circuit and enhance the anti-interference characteristics, the chip uses ADI's low-noise dual-channel AD8606 amplifier, and uses four operational amplifiers as voltage followers to complete signal conversion.

如图5所示为基于无迹卡尔曼滤波器的PI闭环控制策略框图,为了完成对不可直接观测的平均兴奋性突触增益这一参数进行控制,在控制前对由测量噪声(32)和个性化神经集群模型输出信号构成的脑电信号测量值(33),并考虑系统中可能出现的输入噪声(35)的干扰,使用无迹卡尔曼滤波器(8)计算参数估计值(36),Figure 5 is a block diagram of the PI closed-loop control strategy based on the unscented Kalman filter. In order to complete the control of the parameter of the average excitatory synaptic gain that cannot be directly observed, the measurement noise (32) and The EEG signal measurement value (33) composed of the output signal of the personalized neural cluster model, and considering the interference of input noise (35) that may appear in the system, uses the unscented Kalman filter (8) to calculate the parameter estimation value (36) ,

控制器模块(27)采用PI控制律(30),根据参数期望值(28)和无迹卡尔曼滤波器(8)的参数估计值(36)间的误差信号(29)调整控制信号。在闭环控制策略中,控制器模块(27)的输出信号(也就是PI控制律的输出信号)作为抑制性外部输入输入到个性化神经集群模型中,同时将来自邻近或远处集群的传入动作电位的平均突触前脉冲密度作为模型输入(34),将抑制性外部输入和模型输入共同施加到个性化神经集群模型(9)中,无迹卡尔曼滤波器的输入是随机信号,因此,需要在个性化神经集群模型(9)加入系统噪声(31),才能让无迹卡尔曼滤波器有一个很好的辨识效果。The controller module (27) adapts the control signal according to the error signal (29) between the expected value of the parameter (28) and the estimated value (36) of the parameter of the unscented Kalman filter (8) using a PI control law (30). In the closed-loop control strategy, the output signal of the controller module (27) (that is, the output signal of the PI control law) is input into the personalized neural cluster model as an inhibitory external input, while the incoming input from the neighboring or distant clusters The average presynaptic pulse density of the action potential is used as the model input (34), and the inhibitory external input and the model input are jointly applied to the personalized neural cluster model (9). The input of the unscented Kalman filter is a random signal, so , it is necessary to add system noise (31) to the personalized neural cluster model (9), so that the unscented Kalman filter can have a good identification effect.

如图6所示的人机交互界面(39)使用NI公司的LabVIEW平台完成上位机(38)与控制器模块(27)间的数据通信以及数据的波形显示。人机交互界面(39)包括串口参数配置界面(40)、VISA资源配置界面(41)和波形显示界面(42),在串口参数配置界面(40)进行串口波特率、数据位和停止位的配置;VISA资源配置界面(41),读取控制器模块(27)通过SCI串口通信模块(37)输出给人机交互界面的信号,完成数据的读取与转化,图6中该界面包括:The human-computer interaction interface (39) shown in Figure 6 uses the LabVIEW platform of NI Company to complete the data communication between the upper computer (38) and the controller module (27) and the waveform display of data. The human-computer interaction interface (39) includes a serial port parameter configuration interface (40), a VISA resource configuration interface (41) and a waveform display interface (42), and the serial port baud rate, data bits and stop bits are performed on the serial port parameter configuration interface (40). The configuration of VISA resource configuration interface (41), reads the signal that controller module (27) is output to man-machine interface by SCI serial port communication module (37), completes the reading and conversion of data, and this interface includes among Fig. 6 :

端口号(com7,用来配置上位机和电刺激控制器25通信的端口,固定不变的)Port number (com7, the port used to configure the communication between the upper computer and theelectrical stimulation controller 25, fixed)

停止按钮(停止通信,停止读取通道数据)Stop button (stop communication, stop reading channel data)

读数窗口(当前时刻,接收的8位无符号整型数据(串口传输,一次传输8位数据,十进制表示,一个通道传8次,图中显示为单通道的数据,根据数据中的第一位判断类型,从0开始编号,0代表第一通道,1代表第二通道,依次类推,采样周期4ms,处理快,在4ms内完成所有八通道的采集),Reading window (at the current moment, the received 8-bit unsigned integer data (serial port transmission, 8-bit data is transmitted at a time, expressed in decimal, and one channel is transmitted 8 times, the figure shows single-channel data, according to the first digit in the data) Judgment type, numbered from 0, 0 represents the first channel, 1 represents the second channel, and so on, the sampling period is 4ms, the processing is fast, and the acquisition of all eight channels is completed within 4ms),

读取缓冲区(采集数据的64位浮点型数据(十六进制表示),在采集数据过程中数据时刻在变)Read buffer (64-bit floating-point data (hexadecimal representation) of the collected data, the data is changing all the time in the process of collecting data)

结果显示区(采集数据的模拟信号值,单位V));Result display area (analog signal value of collected data, unit V));

上位机(38)通过数据标识位判断数据类别(8通道,包括通道1~通道8,8通道分别对应选择的8导真实癫痫患者脑电数据对应的控制效果),将数据传至波形显示界面(42),完成对8通道数据进行波形显示,最后借助VISA库中的清零函数清除读取缓冲区中的数据。人机交互界面能实时显示,观察控制效果。The upper computer (38) judges the data category (8 channels, includingchannel 1 tochannel 8, respectively corresponding to the control effect corresponding to the selected 8-channel real epilepsy patient EEG data) through the data identification bit, and transmits the data to the waveform display interface (42), complete the waveform display of the 8-channel data, and finally clear the data in the read buffer by means of the clearing function in the VISA library. The man-machine interface can be displayed in real time to observe the control effect.

本发明仿真系统具有以下优点:The simulation system of the present invention has the following advantages:

(1)本发明为模拟接近真实环境下针对癫痫患者的电刺激优化实验,反复验证控制算法并降低人体实验的风险,提出了基于硬件在环的实时仿真方案,开发了一套抗癫痫电刺激控制策略的验证和优化系统;(1) This invention proposes a real-time simulation scheme based on hardware-in-the-loop, and develops a set of anti-epileptic electrical stimulation in order to simulate the optimization experiment of electrical stimulation for epileptic patients in a close to real environment, repeatedly verify the control algorithm and reduce the risk of human experimentation Validation and optimization systems for control strategies;

(2)基于数据驱动辨识了癫痫患者的个性化神经集群模型,结合硬件在环的思想设计了癫痫脑电实时发生器以及信号转换模块(数模转换、降压电路),复现了具有与患者脑电信号物理特性(幅值、时间尺度、噪声)相匹配的实时癫痫脑电;(2) Based on the data-driven identification of the personalized neural cluster model of epilepsy patients, combined with the idea of hardware-in-the-loop, the epilepsy EEG real-time generator and signal conversion module (digital-to-analog conversion, step-down circuit) were designed to reproduce the same Real-time epileptic EEG matching the physical characteristics (amplitude, time scale, noise) of the patient's EEG signal;

(3)设计了在环实时的电刺激控制器,实现了基于无迹卡尔曼滤波器在线辨识的PI控制策略,该系统提供了抗癫痫闭环控制的实时仿真验证平台。(3) An in-loop real-time electrical stimulation controller is designed, and a PI control strategy based on unscented Kalman filter online identification is realized. This system provides a real-time simulation verification platform for anti-epileptic closed-loop control.

本发明为述及之处适用于现有技术。The present invention applies to the prior art as stated.

Claims (10)

1. An anti-epileptic electrical stimulation hardware-in-the-loop simulation system is characterized in that: the simulation system also comprises an epilepsia electroencephalogram real-time generator (2), a signal acquisition module (18), an electrical stimulation controller (25) and an upper computer (38),
the epilepsia electroencephalogram real-time generator (2) is used for obtaining personalized model parameters in a physiological model of an epilepsia electroencephalogram patient through electroencephalogram data drive identification of the epilepsia patient, and further loading the personalized model parameters into a nerve cluster model to reproduce an epilepsia-like discharge signal (17);
the signal acquisition module (18) is used for converting a discharge signal (17) generated by the epilepsia electroencephalogram real-time generator (2) into a simulated electroencephalogram signal with the same amplitude-frequency characteristic as an electroencephalogram signal of a real epilepsia patient, converting the simulated electroencephalogram signal acquired in real time into a discrete digital signal and outputting the discrete digital signal to the electrical stimulation controller (25);
the electrical stimulation controller (25) is used for acquiring the digital signal output by the signal acquisition module, performing filtering processing on the digital signal, performing parameter identification and estimation on an individual neural cluster model by using an unscented Kalman filter, calculating an anti-epileptic stimulation signal through a PI control law, and applying the anti-epileptic stimulation signal to the epileptic electroencephalogram real-time generator (2) to finish reproducing the real response of a clinical epileptic patient after being electrically stimulated;
the upper computer (38) comprises a human-computer interaction interface (39), the human-computer interaction interface (39) is realized by the upper computer (38) through LabVIEW programming, and data interaction is carried out with the electrical stimulation controller (25) through the SCI serial port communication module (37) to complete data communication and waveform display.
2. The antiepileptic electrical stimulation hardware-in-the-loop simulation system according to claim 1, wherein: the epilepsy electroencephalogram real-time generator (2) is composed of a plurality of DSP chips, each DSP chip is responsible for reproduction of two paths of epilepsy electroencephalograms, two paths of personalized neural cluster models (9) are embedded into each DSP chip, the number of channels output by the epilepsy electroencephalogram real-time generator (2) corresponds to the derivative of the epilepsy electroencephalogram to be researched, and each personalized neural cluster model is identified by a corresponding electroencephalogram parameter through an unscented Kalman filter.
3. The antiepileptic electrical stimulation hardware-in-the-loop simulation system of claim 2, wherein: the epilepsia electroencephalogram real-time generator (2) has eight output channels in total, generates 8 paths of recurrent epilepsia-like discharge signals (17) which represent the individual specificity of an epileptic patient, and acquires anti-epilepsia stimulation signals generated by the electrical stimulation controller (25) in real time through the AD module of the corresponding DSP chip, thereby replicating the real response of a clinical patient after being electrically stimulated.
4. The antiepileptic electrical stimulation hardware-in-the-loop simulation system of claim 3, wherein: the signal acquisition module (18) comprises a signal conversion module (19) and a signal real-time acquisition amplification module (24), the signal conversion module uses a four-stage voltage division follower circuit, four low-noise two-channel AD8606 amplifiers are used as voltage followers, and the amplitude of an analog signal output by the epilepsia electroencephalogram real-time generator (2) is compressed to complete signal conversion;
the electroencephalogram signal real-time acquisition module (24) adopts ADS1299 as an acquisition chip, and selects an ADS1299-FE suite as a signal real-time acquisition and amplification module (24) to complete acquisition, amplification, analog-to-digital conversion of 8 paths of analog signals and communication with the signal processing module (26).
5. The antiepileptic electrical stimulation hardware-in-the-loop simulation system of claim 4, wherein: input voltage V of signal conversion modulein And an output voltage Vout The relationship between them is:
Figure FDA0002852405810000021
6. the antiepileptic electrical stimulation hardware-in-the-loop simulation system of claim 4, wherein: the electrical stimulation controller (25) comprises a signal processing module (26) and a controller module (27), wherein the signal processing module (26) is responsible for communicating with the signal real-time acquisition and amplification module (24) and filtering and eliminating acquired signals; the controller module (27) comprises an unscented Kalman filter (8) and a PI control law (30), completes the parameter identification of the unscented Kalman filtering data-driven personalized model, adjusts stimulation signals in real time by using the proportional integral PI control law, outputs anti-epileptic stimulation signals to the epileptic electroencephalogram real-time generator (2), and meanwhile, the controller module (27) performs data interaction with an upper computer (38).
7. The antiepileptic electrical stimulation hardware-in-the-loop simulation system of claim 2, wherein: the embedded implementation process of the personalized neural cluster model is as follows: a differential equation is solved on line by using a fourth-order Runge-Kutta algorithm in a DSP, and a simulated epileptic discharge signal is output in real time through a DAC of the DSP and is divided into five parts: firstly, setting an average excitatory synapse gain value in an individualized nerve cluster model, initializing all variables to complete parameter initialization (11) of the individualized nerve cluster model, then substituting a stimulation signal acquired by an AD module (13) in a DSP into a differential equation of the individualized nerve cluster model in order to simulate external input in the individualized nerve cluster model to generate white Gaussian noise (12), solving the model differential equation through a fourth-order Runge-Kutta numerical integration algorithm (14) to obtain an output solution at a corresponding moment, and finally, circularly calculating (16) to complete conversion of the output of the individualized nerve cluster model into a voltage signal representing rhythmic epileptic discharge by using a DAC in the DSP, namely generating an analog epileptic discharge signal (15).
8. The antiepileptic electrical stimulation hardware-in-the-loop simulation system of claim 2, wherein: the human-computer interaction interface (39) comprises a serial port parameter configuration interface (40) which is used for being communicated with the electric stimulation controller (25) to set, a VISA (visual sense access architecture) resource configuration interface (41) which is used for reading and converting data and a waveform display interface (42), and the serial port parameter configuration interface (40) is used for configuring a serial port baud rate, a data bit and a stop bit; the VISA resource configuration interface (41) includes:
a port number, a stop button, a reading window, a reading buffer area, a data acquisition interface and a data acquisition interface which are used for configuring the communication between the upper computer and the electrical stimulation controller,
A result display area for collecting analog signal values of the data;
and the upper computer (38) judges the data type through the data identification bit, transmits the data of the corresponding channel to a waveform display interface (42), completes the waveform display of the data of the 8 channels, and finally clears the data in the reading buffer zone by means of a clear function in the VISA library.
9. The antiepileptic electrical stimulation hardware-in-the-loop simulation system of claim 6, wherein: the electrical stimulation controller (25) adopts a PI closed-loop control strategy based on an unscented Kalman filter, and the specific process is as follows: in order to control the parameter of the average excitatory synaptic gain which can not be directly observed, the method comprises the steps of calculating a parameter estimation value (36) by using an unscented Kalman filter (8) before control on an electroencephalogram signal measurement value (33) formed by measurement noise (32) and an output signal of a personalized neural cluster model and considering the interference of input noise (35) which possibly occurs in the system,
the controller module (27) adopts a PI control law (30) and adjusts a control signal according to an error signal (29) between a parameter expected value (28) and a parameter estimated value (36) of the unscented Kalman filter (8);
in closed-loop control, the output signal of the PI control law is input as an inhibitory external input into the personalized neural cluster model, while the average pre-synaptic pulse density of afferent action potentials from neighboring or distant clusters is used as a model input (34), and the inhibitory external input and the model input are applied together into the personalized neural cluster model (9), thereby realizing closed-loop control.
10. The antiepileptic electrical stimulation hardware-in-the-loop simulation system according to claim 1, wherein: the electroencephalogram data of the electroencephalogram signal (1) of the epileptic is derived from PhysioNet.
CN202011532349.1A2020-12-232020-12-23 Anti-epileptic electrical stimulation hardware-in-the-loop simulation systemActiveCN112675428B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202011532349.1ACN112675428B (en)2020-12-232020-12-23 Anti-epileptic electrical stimulation hardware-in-the-loop simulation system

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202011532349.1ACN112675428B (en)2020-12-232020-12-23 Anti-epileptic electrical stimulation hardware-in-the-loop simulation system

Publications (2)

Publication NumberPublication Date
CN112675428A CN112675428A (en)2021-04-20
CN112675428Btrue CN112675428B (en)2023-02-28

Family

ID=75450803

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202011532349.1AActiveCN112675428B (en)2020-12-232020-12-23 Anti-epileptic electrical stimulation hardware-in-the-loop simulation system

Country Status (1)

CountryLink
CN (1)CN112675428B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN113282009B (en)*2021-05-202022-07-01天津大学 Parkinson's closed-loop neuromodulation hardware-in-the-loop test system
CN114042249B (en)*2021-11-162024-06-04天津工业大学Method for comparing and analyzing regulation and control effects of HF-EMF magnetic stimulation in different modes on hippocampal epileptic discharge activity
CN114521904B (en)*2022-01-252023-09-26中山大学 A brain electrical activity simulation method and system based on coupled neuron groups
CN115430070A (en)*2022-09-192022-12-06河北医科大学第二医院Closed-loop ultrasonic simulation method, system and device
CN116224829B (en)*2023-02-032023-10-20广东工业大学Digital twinning-based surgical robot puncture sampling operation semi-physical simulation method

Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN104112066A (en)*2014-08-182014-10-22天津大学Epilepsy state closed-loop control experiment platform based on FPGA
CN104173044A (en)*2014-08-152014-12-03浙江大学医学院附属第二医院Closed-loop system used for epilepsy treatment
CN104375878A (en)*2014-11-242015-02-25天津大学FPGA simulation system for modulating hippocampus network rhythm through weak electromagnetic stimulation
CN109875553A (en)*2019-03-272019-06-14北京脑陆科技有限公司A kind of extensive epilepsy automatic detection early warning based on EEG equipment and treatment intelligence system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
WO2007075477A2 (en)*2005-12-192007-07-05University Of FloridaClosed-loop state-dependent seizure prevention systems

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN104173044A (en)*2014-08-152014-12-03浙江大学医学院附属第二医院Closed-loop system used for epilepsy treatment
CN104112066A (en)*2014-08-182014-10-22天津大学Epilepsy state closed-loop control experiment platform based on FPGA
CN104375878A (en)*2014-11-242015-02-25天津大学FPGA simulation system for modulating hippocampus network rhythm through weak electromagnetic stimulation
CN109875553A (en)*2019-03-272019-06-14北京脑陆科技有限公司A kind of extensive epilepsy automatic detection early warning based on EEG equipment and treatment intelligence system

Also Published As

Publication numberPublication date
CN112675428A (en)2021-04-20

Similar Documents

PublicationPublication DateTitle
CN112675428B (en) Anti-epileptic electrical stimulation hardware-in-the-loop simulation system
CN114533086B (en)Motor imagery brain electrolysis code method based on airspace characteristic time-frequency transformation
CN114521904B (en) A brain electrical activity simulation method and system based on coupled neuron groups
Donati et al.Neuromorphic bioelectronic medicine for nervous system interfaces: from neural computational primitives to medical applications
CN113282009B (en) Parkinson's closed-loop neuromodulation hardware-in-the-loop test system
US10820816B2 (en)System for a brain-computer interface
WO2020118797A1 (en)Prosthesis control method, apparatus, system and device, and storage medium
Feng et al.Building and training a deep spiking neural network for ECG classification
CN111370093B (en)Simulation device for DBS stimulation under Alzheimer's symptom state based on closed-loop iterative control
CN105718655A (en)Closed loop neural stimulation simulation system for Parkinson state
CN117398112A (en)Nerve regulation and control system and method
CN113112017B (en)Electroencephalogram grading and prognosis FPGA decoding system based on neural manifold
Sanchez et al.Technology and signal processing for brain-machine interfaces
Constantine et al.Bci system using a novel processing technique based on electrodes selection for hand prosthesis control
Chang et al.A data driven experimental system for individualized brain stimulation design and validation
CN117322890B (en) A generative multi-channel EEG modeling method based on neuron population model
Joublin et al.A columnar model of somatosensory reorganizational plasticity based on Hebbian and non-Hebbian learning rules
Al-Shueli et al.Improved signal processing methods for velocity selective neural recording using multi-electrode cuffs
CN114816076A (en)Brain-computer interface computing processing and feedback system and method
CN113558637B (en)Music perception brain network construction method based on phase transfer entropy
HaghiEnergy-Efficient and Robust Algorithms for Biomedical Applications
CN116263580A (en) A hardware-in-the-loop real-time simulation system for programmable closed-loop electrophysiological experiments
GawaliFrom Neurons to Networks: The Impact of Neuromorphic Computing on BCI Development
CN120388685B (en) An AI-powered intelligent control system for treating mental illness based on multimodal microwaves
VrijenhoekReal-Time Detection and Classification of Purkinje-Cell Neural Activity

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp