Пример #1
0
        /// <summary>
        /// Create Experimental Run.
        /// Refactor Idea: This class should not hold mca/motor/thermometer at all. It should be pass along from DAQThread as arguments.
        /// </summary>
        /// <param name="mca"></param>
        /// <param name="motor"></param>
        /// <param name="thermometer"></param>
        /// <param name="runmode"></param>
        public ExperimentalRun(DT5780 mca, LinearMotor motor, DigitalThermometer thermometer, RunMode runmode = RunMode.Experiment)
        {
            this.mca = mca;
            this.thermometer = thermometer;
            this.motor = motor;
            Timeout = 60;
            MaxSample = 0;
            Log = new ExperimentLog();
            ClearData();
            RunMode = runmode;
            Channel0PeakFinder = new PeakFinder();
            Channel1PeakFinder = new PeakFinder();
            ExperimentStatus = ExperimentStatusEnum.Prepared;
            StartActionMap = new Dictionary<RunMode, DAQThread.OnSuccessfulStartDelegate>{
                {RunMode.Experiment, OnExperimentStart},
                {RunMode.Calibrate, OnCalibrationStart},
                {RunMode.Simulated, OnSimulationStart}
            };

            StopActionMap = new Dictionary<RunMode, DAQThread.OnSuccessfulStopDelegate>{
                {RunMode.Experiment, OnExperimentEnd},
                {RunMode.Calibrate, OnCalibrationEnd},
                {RunMode.Simulated, OnSimulationEnd}
            };

            UpdateActionMap = new Dictionary<RunMode, DAQThread.UpdateProgressDelegate>{
                {RunMode.Experiment, OnExperimentUpdate},
                {RunMode.Calibrate, OnCalibrationUpdate},
                {RunMode.Simulated, OnSimulationUpdate}
            };
            InitCommand();
            Channel0FittedDataPoints = new DataPoint[0];
            Channel1FittedDataPoints = new DataPoint[0];
        }
 public void ConnectTest()
 {
     DigitalThermometer sensor = new DigitalThermometer();
     bool foundone = sensor.ScanConnect();
     if(!foundone){
        Assert.Inconclusive("Cannot Connect to Digital Thermometer");
     }
     TemperatureData data = sensor.Read();
     Console.WriteLine(data);
 }
Пример #3
0
 public SettingMaker(DT5780 mca, LinearMotor motor, DigitalThermometer thermometer, ObservableCollection<MCASetting> mcasettings)
 {
     this.mca = mca;
     this.motor = motor;
     this.thermometer = thermometer;
     this.MCASettings = mcasettings;
     this.MCAData = new MCAData();
     TargetPosition = -15;
     MaxSample = 0;
     Timeout = -1;
     InitCommand();
 }
Пример #4
0
        /// <summary>
        /// Constructor
        /// </summary>
        public MainViewModel()
        {
            //if (System.Diagnostics.Debugger.IsAttached)
            //{
            //    App.Settings.Reset();
            //}
            MCA = new DT5780();
            LinearMotor = LinearMotorWrapper.LinearMotor.GetInstance();
            Thermometer = new DigitalThermometer();

            //DAQThread = new MCACalibrator.Threads.DAQThread(MCA);
            MotorStatus = new MotorStatus(LinearMotor);
            PeripheralConnection = new PeripheralConnection();
            LogEntries = new BindingList<LogEntry>();
            ExperimentalRuns = new ObservableCollection<ExperimentalRun>();
            QCData = new QCData();

            MCASettings = App.Settings.MCASettings;

            StartHVPoller();
            StartMotorPoller();
            StartPeripheralConnectionPoller();
            SetupCommand();

            MotorCommand = new MotorCommand(this);
            SettingMaker = new SettingMaker(MCA, LinearMotor, Thermometer, MCASettings);
        }
Пример #5
0
 public static ExperimentalRun DummyFilledData(DT5780 mca, LinearMotor motor, DigitalThermometer thermometer, double position = 0)
 {
     ExperimentalRun ret = ExperimentalRun.DummyEmptyData(mca, motor, thermometer, position);
     ret.FillWithDummyData();
     return ret;
 }
Пример #6
0
 public static ExperimentalRun DummyEmptyData(DT5780 mca, LinearMotor motor, DigitalThermometer thermometer, double position = 0)
 {
     ExperimentalRun ret = new ExperimentalRun(mca, motor, thermometer);
     ret.Log.Setting = MCASetting.LargeLYSOSetting();
     ret.Log.MotorPosition = position;
     return ret;
 }