Beispiel #1
0
        public Keithley2400ViewModel(IKeithley2400Model keithley2400)
        {
            _keithley2400 = keithley2400;

            _startVoltage     = 0.0;
            _finalVoltage     = 0.0;
            _currentLimit     = 0.0;
            _incrementVoltage = 0.0;
        }
Beispiel #2
0
        public void Multiscan(IKeithley2400Model keithley2400,
                              IWayneKerr4300Model wayneKerr4300,
                              ICVEnvironment cvEnv,
                              CancellationToken token)
        {
            _keithley2400  = keithley2400;
            _wayneKerr4300 = wayneKerr4300;

            WriteComment(DateTime.Now.ToString());
            string senseMode = "KT24 sensing mode is " + keithley2400.SerialSafeRead(":SYSTem:RSENse?");

            WriteComment(senseMode);
            WriteComment(Description);

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            string f_setstring = ":MEAS:FREQ "; // WK AC probe frequency setup prefix
            string v_setstring = ":MEAS:LEV ";  // WK AC probe amplitude setup prefix

            string setstring = v_setstring += wayneKerr4300.Amplitude.ToString();

            wayneKerr4300.SerialSafeWriteWithDelay(setstring);     // Measuring AC amplitude now also set to operator defined value

            setstring  = ":SENS:CURR:PROT ";
            setstring += keithley2400.CurrentLimit.ToString();
            keithley2400.SerialSafeWriteWithDelay(setstring);            //Now set the Keithley 2400 I limit to configuration value

            int i = 0;

            foreach (double test_frequency in Frequencies)
            {
                if (token.IsCancellationRequested)
                {
                    break;
                }
                string setfrequency = f_setstring + test_frequency.ToString();
                wayneKerr4300.SerialSafeWriteWithDelay(setfrequency);
                Thread.Sleep(2000);     // WK needs a HUGE delay in setting the frequency.
                                        // Without this pause, either the Frequency in not set as requested
                                        // Or the WK times-out when asking for the frequency.

                C_V_Scan(token);
                i++;
            }
            stopWatch.Stop();
            var    elapsed         = stopWatch.Elapsed;
            string completdMessage = $"CV Test Completed: Elapsed time {elapsed.Hours:00}:{elapsed.Minutes:00}:{elapsed.Seconds:00}:{elapsed.Milliseconds / 10:00} ";

            return; // End task;
        }
Beispiel #3
0
        public CVTesterViewModel(IKeithley2400ViewModel keithley2400ViewModel,
                                 IWayneKerr4300ViewModel wayneKerr4300ViewModel,
                                 CVTester cvTester)
        {
            _cvScan            = new CVScan();
            _cvtester          = cvTester;
            _cvtester.Closing += CloseProgram;
            Keithley           = keithley2400ViewModel;
            WayneKerr          = wayneKerr4300ViewModel;
            _wayneKerr         = WayneKerr.GetModel();
            _keithley          = Keithley.GetModel();

            _serialPortManagerSelector = new SerialPortManagerSelector(new SerialPortManager(),
                                                                       new SerialPortEmulatorManager());

            _cvConfiguration      = new CVConfiguration();
            _cvScan.Monitor       = MonitorMessageDelegate;
            _monitorStringBuilder = new StringBuilder();
            FrequencyList         = new ObservableCollection <double>();
            _shortCircuitActive   = false;
            _openCircuitActive    = false;
            _devicesDiscovered    = false;
            Executing             = false;
            Emulate = false;

            SaveConfigCommand = new DelegateCommand(ExecuteSaveConfig, CanExecuteSaveConfig)
                                .ObservesProperty <string>(() => ConfigurationFile);

            AddFrequencyCommand = new DelegateCommand(ExecuteAddFrequency, CanExecuteAddFrequency).ObservesProperty(() => NewFrequency);

            DeleteSelectedFrequenciesCommand = new DelegateCommand <ICollection <object> >(ExecuteDeleteSelectedFrequencies, CanExecuteDeleteSelectedFrequencies);

            DiscoveryCommand = new DelegateCommand(ExecuteDiscovery, CanExecuteDiscovery)
                               .ObservesProperty <bool>(() => Emulate)
                               .ObservesProperty <string>(() => KeithleyEmulationFile)
                               .ObservesProperty <string>(() => WayneKerrEmulationFile);

            ShortCircuitTestCommand = new DelegateCommand(ExecuteShortCircuitTest, CanExecuteShortCircuitTest)
                                      .ObservesProperty <bool>(() => Emulate)
                                      .ObservesProperty <bool>(() => Executing)
                                      .ObservesProperty <bool>(() => ShortCircuitActive)
                                      .ObservesProperty <bool>(() => DevicesDiscovered)
                                      .ObservesProperty <string>(() => ResultsFileName);


            OpenCircuitTestCommand = new DelegateCommand(ExecuteOpenCircuitTest, CanExecuteOpenCircuitTest)
                                     .ObservesProperty <bool>(() => Emulate)
                                     .ObservesProperty <bool>(() => Executing)
                                     .ObservesProperty <bool>(() => DevicesDiscovered)
                                     .ObservesProperty <bool>(() => OpenCircuitActive)
                                     .ObservesProperty <string>(() => ResultsFileName);


            CVTestCommand = new DelegateCommand(ExecuteCVTest, CanExecuteCVTest)
                            .ObservesProperty <bool>(() => Emulate)
                            .ObservesProperty <bool>(() => Executing)
                            .ObservesProperty <bool>(() => DevicesDiscovered)
                            .ObservesProperty <string>(() => ResultsFileName);

            StopCVTestCommand = new DelegateCommand(StopCVTest, CanExecuteStopCVTest)
                                .ObservesProperty <bool>(() => Executing);
        }