/**
         * Get the latest data from the Keithley 2220 PSU
         * */
        protected override InstrumentDataset getInstrumentData()
        {
            PSUDataset dat = new PSUDataset();

            if (psuDriver.initialized)
            {
                double[,] vals = new double[5, 1];


                vals[(int)PSUDataArrayIndices.CurrentChan1, 0] = psuDriver.getOutCurrent(0);

                vals[(int)PSUDataArrayIndices.CurrentChan2, 0] = psuDriver.getOutCurrent(1);

                vals[(int)PSUDataArrayIndices.VoltageChan1, 0] = psuDriver.getOutVoltage(0);

                vals[(int)PSUDataArrayIndices.VoltageChan2, 0] = psuDriver.getOutVoltage(0);

                //Convert from 100 nanoseconds to seconds
                vals[(int)PSUDataArrayIndices.Time, 0] = DateTime.Now.Ticks * 1e-7;

                dat.AddData(vals);

                return(dat);
            }
            else
            {
                return(null);
            }
        }
Exemple #2
0
        void psu_SaveData(object sender, InstrumentDatasetEventArgs e)
        {
            PSUDataset dat = (PSUDataset)(e.dataSet);

            double[,] data = dat.getLatestData();

            updateField(txtChannel1CurrentGet, (data[(int)PSUDataArrayIndices.CurrentChan1, 0]).ToString());
            updateField(txtChannel2CurrentGet, (data[(int)PSUDataArrayIndices.CurrentChan2, 0]).ToString());

            updateField(txtChannel1VoltageGet, (data[(int)PSUDataArrayIndices.VoltageChan1, 0]).ToString());
            updateField(txtChannel2VoltageGet, (data[(int)PSUDataArrayIndices.VoltageChan2, 0]).ToString());

            if (SettingsChangedUpdate != null)
            {
                PSUChangedUpdateEventArgs args = new PSUChangedUpdateEventArgs();
                args.settingsChanged = true;
                SettingsChangedUpdate(this, args);
            }
        }