This project implements a real time closed-loop stimulation platform and GUI It is based on Simulink Real Time
************ To RUN using GUI ************
-
Start MATLAB2016b Make sure to have all required toolboxes (e.g.: Simulink real-Time)
-
To RUN GUI: GUIClosedLoopConsole('PatientName','patientTEST')
Step by Step to RUN and Compile Decider Models
************ To RUN using GUI ************
-
Start MATLAB (tested version is MATLAB2016b) Make sure to have all required toolboxes (Simulink real-Time, optimization toolbox)
-
Edit patient name and run script: runClosedLoopPhysiology.m
or 2. add ClosedLoopStimulation to path and To RUN GUI: GUIClosedLoopConsole('PatientName','patientTEST')
************ To COMPILE ( Simulink Real-Time Compiler ) ************
-
Run initializationScript Example to Compile: initializationScript('SIMULATION', [], 'THETA','SMOOTHBANDPOWER','REALTIME','CONTINUOUS','REFERENTIAL')
-
Open Simulink Model
-
Press BUILD button
NOTE: if building ClosedLoopStimXpcTarget on your computer you would get an error of "could not find target" - that is the expected behavior
************ Models ************ Important Models:
For simulation: ClosedLoopStim_SimulatedInput.slx
For BlackRock NSPs: ClosedLoopStimXpcTarget.slx
Main block for computation: Simulink/ClosedLoopControl.slx
****** Additional important Functions ******
-
Functions to create simulated data from your own EEG: script_createSimDataFromNEVfile.m from NS3 data script_createSimDataFromRealData.m from .mat MATLAB data
-
Look at: initializationScript.m to see the structure of sInputData
******* Configuration Files ******** Default Configuration files are located on folder: Configuration/Physiology
******* Test Data ******** Testing Data to play with the Simulink model located on folder: ExampleData
Have fun! Rina Zelmann