Exemplo n.º 1
0
        protected override bool StartTest()
        {
            bool retValue            = false;
            var  stimulatingPressure = P_STIMULATE.Calculate();

            try
            {
                DeviceManager.Execute(CPARDevice.CreatePulseProgram(0, NO_OF_STIMULI, T_ON, T_OFF, stimulatingPressure, P_STATIC));
                DeviceManager.Execute(SECOND_CUFF ? CPARDevice.CreatePulseProgram(1, NO_OF_STIMULI, T_ON, T_OFF, stimulatingPressure, P_STATIC) :
                                      CPARDevice.CreateEmptyProgram(1));
                StartDevice(StartStimulation.StopCriterion.STOP_CRITERION_ON_BUTTON);
                Log.Debug("TS STARTED [NO: {0}, T_ON: {1}, T_OFF: {2}", NO_OF_STIMULI, T_ON, T_OFF);

                result = new TemporalSummationResult(NO_OF_STIMULI)
                {
                    Name        = Name,
                    ID          = ID,
                    Index       = Index,
                    Conditioned = false,
                    T_OFF       = T_OFF,
                    T_ON        = T_ON,
                    NominalStimulatingPressure = stimulatingPressure
                };

                initializing = true;
                retValue     = true;
            }
            catch (Exception e)
            {
                Log.Debug(e.Message);
            }

            return(retValue);
        }
        private void Stimulate()
        {
            if (result != null)
            {
                if (currentStimulus < result.Responses.Length)
                {
                    var r = result.Responses[currentStimulus];

                    DeviceManager.Execute(CPARDevice.CreatePulseProgram(0, 1, r.T_ON, r.T_OFF, r.Pressure, P_STATIC));
                    DeviceManager.Execute(SECOND_CUFF ? CPARDevice.CreatePulseProgram(1, 1, r.T_ON, r.T_OFF, r.Pressure, P_STATIC) :
                                          CPARDevice.CreateEmptyProgram(1));
                    ForceStartDevice(ForceStartStimulation.StopCriterion.STOP_CRITERION_ON_BUTTON);
                    Log.Debug("TS STARTED [NO: {0}, T_ON: {1}, T_OFF: {2}", currentStimulus, r.T_ON, r.T_OFF);
                    initializing = true;
                }
            }
        }