public void Dispose() { AllEventsHandler.Instance.Motion -= OnMotionPositionMeasured; AllEventsHandler.Instance.TimeTraceMeasurementsStateChanged -= OnTimeTraceMeasurementsStateChanged; this._Motor = null; this._Destination = 0.0; this._MeasureDevice = null; this._ValueThroughTheStructure = 0.0; }
public MeasureIV(double startVal, double endVal, double step, int numberOfAverages, double timeDelay, SourceMode deviceSourceMode, I_SMU device) { _StartValue = startVal; _EndValue = endVal; _Step = step; _NumberOfAverages = numberOfAverages; _TimeDelay = timeDelay; _sourceMode = deviceSourceMode; _Device = device; }
public MeasureTimeTrace(IMotion motor, double startPosition, double destination, I_SMU measureDevice, KEITHLEY_2601A_SourceMode sourceMode, KEITHLEY_2601A_MeasureMode measureMode, double valueThroughTheStructure) { _Motor = motor; _StartPosition = startPosition; _Destination = destination; _MeasureDevice = measureDevice; _SourceMode = sourceMode; _MeasureMode = measureMode; _ValueThroughTheStructure = valueThroughTheStructure; AllEventsHandler.Instance.TimeTraceMeasurementsStateChanged += OnTimeTraceMeasurementsStateChanged; AllEventsHandler.Instance.Motion += OnMotionPositionMeasured; }
public MeasureTimeTrace(IMotion motor, double startPosition, double destination, I_SMU measureDevice, KEITHLEY_2601A_SourceMode sourceMode, KEITHLEY_2601A_MeasureMode measureMode, double valueThroughTheStructure) { _Motor = motor; _StartPosition = startPosition; _Destination = destination; _MeasureDevice = measureDevice; _SourceMode = sourceMode; _MeasureMode = measureMode; _ValueThroughTheStructure = valueThroughTheStructure; AllEventsHandler.Instance.TimeTraceMeasurementsStateChanged += OnTimeTraceMeasurementsStateChanged; AllEventsHandler.Instance.Motion += OnMotionPositionMeasured; }
public I_SMU SetDevice() { bool areAllSettingsSet = _isBoardNumberSet && _isPrimaryAddressSet && _isSecondaryAddressSet && _isLimitModeSet && _isLimitValueVoltageSet && _isLimitValueCurrentSet && _isSelectedChannelSet; I_SMU _Device = null; if (areAllSettingsSet) { if ((_SelectedChannel == KEITHLEY_2602A_Channels.ChannelA) && (_LimitMode == KEITHLEY_2601A_LimitMode.Voltage)) { _Device = new GPIB_KEITHLEY_2602A_CHANNEL(_PrimaryAddress, _SecondaryAddress, _BoardNumber, KEITHLEY_2602A_Channels.ChannelA); _Device.SetVoltageLimit(_LimitValueVoltage); } else if ((_SelectedChannel == KEITHLEY_2602A_Channels.ChannelA) && (_LimitMode == KEITHLEY_2601A_LimitMode.Current)) { _Device = new GPIB_KEITHLEY_2602A_CHANNEL(_PrimaryAddress, _SecondaryAddress, _BoardNumber, KEITHLEY_2602A_Channels.ChannelA); _Device.SetCurrentLimit(_LimitValueCurrent); } else if ((_SelectedChannel == KEITHLEY_2602A_Channels.ChannelB) && (_LimitMode == KEITHLEY_2601A_LimitMode.Voltage)) { _Device = new GPIB_KEITHLEY_2602A_CHANNEL(_PrimaryAddress, _SecondaryAddress, _BoardNumber, KEITHLEY_2602A_Channels.ChannelB); _Device.SetVoltageLimit(_LimitValueVoltage); } else if ((_SelectedChannel == KEITHLEY_2602A_Channels.ChannelB) && (_LimitMode == KEITHLEY_2601A_LimitMode.Current)) { _Device = new GPIB_KEITHLEY_2602A_CHANNEL(_PrimaryAddress, _SecondaryAddress, _BoardNumber, KEITHLEY_2602A_Channels.ChannelB); _Device.SetCurrentLimit(_LimitValueCurrent); } return(_Device); } else { throw new Exception("Not all configurations set! Please set all the configurations and try again."); } }
private void on_cmdSaveSettingsClick(object sender, System.Windows.RoutedEventArgs e) { _Device = GetSettings(); this.Close(); }
private bool InitTimeTraceMeasurements() { #region SMU, rendering and save data configurations if (sourceDeviceConfiguration != null) { #region Chart rendering settings if (_TimeTraceLineGraph != null) { _experimentalTimeTraceDataSource.DetachPointReceiveEvent(); _TimeTraceLineGraph.Remove(); _CurrentTimeTrace.Clear(); } _CurrentTimeTrace = new List <PointD>(); _experimentalTimeTraceDataSource = new ExperimentalTimetraceDataSource(_CurrentTimeTrace); _experimentalTimeTraceDataSource.AttachPointReceiveEvent(); _TimeTraceLineGraph = new LineGraph(_experimentalTimeTraceDataSource); _TimeTraceLineGraph.AddToPlotter(chartTimeTrace); #endregion //Getting SMU device Device = sourceDeviceConfiguration.Keithley2602A_DeviceSettings.Device; #region Time trace measurement configuration var pAddress = sourceDeviceConfiguration.Keithley2602A_DeviceSettings.DeviceSettings.PrimaryAddress; var sAddress = sourceDeviceConfiguration.Keithley2602A_DeviceSettings.DeviceSettings.SecondaryAddress; var bNumber = sourceDeviceConfiguration.Keithley2602A_DeviceSettings.DeviceSettings.BoardNumber; var motor = new ORDINARY_MOTOR(pAddress, sAddress, bNumber); motor.FinalDestination = 0.0; Motor = motor; if (TimeTraceCurve != null) { TimeTraceCurve.Dispose(); } var ExperimentSettings = IV_And_TimeTraceViewModel.Instance; var valueThroughTheStructure = ExperimentSettings.TimeTraceMeasurementValueThrougtTheStructure; var isTimeTraceVoltageModeChecked = ExperimentSettings.IsTimeTraceMeasurementVoltageModeChecked; var isTimeTraceCurrentModeChecked = ExperimentSettings.IsTimeTraceMeasurementCurrentModeChecked; var selectedTimeTraceModeItem = (tabControlTimeTraceMeasurementParameters.SelectedItem as TabItem).Header.ToString(); switch (selectedTimeTraceModeItem) { case "Distance": { var motionStartPosition = ExperimentSettings.TimeTraceMeasurementMotionCurrentDestination; var motionFinalDestination = ExperimentSettings.TimeTraceMeasurementMotionFinalDestination; if (isTimeTraceVoltageModeChecked == true) { TimeTraceCurve = new MeasureTimeTrace(Motor, motionStartPosition, motionFinalDestination, Device, KEITHLEY_2601A_SourceMode.Voltage, KEITHLEY_2601A_MeasureMode.Resistance, valueThroughTheStructure); } else if (isTimeTraceCurrentModeChecked == true) { TimeTraceCurve = new MeasureTimeTrace(Motor, motionStartPosition, motionFinalDestination, Device, KEITHLEY_2601A_SourceMode.Current, KEITHLEY_2601A_MeasureMode.Resistance, valueThroughTheStructure); } } break; case "Distance (Repetitive)": { var motionRepetitiveStartPosition = ExperimentSettings.TimeTraceMeasurementDistanceRepetitiveStartPosition; var motionRepetitiveEndPosition = ExperimentSettings.TimeTraceMeasurementDistanceRepetitiveEndPosition; var numerCycles = ExperimentSettings.TimeTraceMeasurementDistanceRepetitiveNumberCycles; if (isTimeTraceVoltageModeChecked == true) { TimeTraceCurve = new MeasureTimeTrace(Motor, motionRepetitiveStartPosition, motionRepetitiveEndPosition, Device, KEITHLEY_2601A_SourceMode.Voltage, KEITHLEY_2601A_MeasureMode.Resistance, valueThroughTheStructure); } else if (isTimeTraceCurrentModeChecked == true) { TimeTraceCurve = new MeasureTimeTrace(Motor, motionRepetitiveStartPosition, motionRepetitiveEndPosition, Device, KEITHLEY_2601A_SourceMode.Current, KEITHLEY_2601A_MeasureMode.Resistance, valueThroughTheStructure); } } break; case "Time": { } break; case "Fixed R": { } break; default: break; } #endregion #region Saving Time Trace data into files var _TimeTraceFileNumber = String.Format("_{0}{1}{2}", (_TimeTraceFilesCounter / 100) % 10, (_TimeTraceFilesCounter / 10) % 10, _TimeTraceFilesCounter % 10); string newFileName = string.Empty; if (!string.IsNullOrEmpty(_SaveTimeTraceMeasuremrentFileName)) { _TimeTraceMeasurementLog = new TimeTraceMeasurementLog((new FileInfo(_SaveTimeTraceMeasuremrentFileName)).DirectoryName + "\\TimeTraceMeasurementLog.dat"); newFileName = _SaveTimeTraceMeasuremrentFileName.Insert(_SaveTimeTraceMeasuremrentFileName.LastIndexOf('.'), _TimeTraceFileNumber); ++_TimeTraceFilesCounter; } string sourceMode = string.Empty; if (!string.IsNullOrEmpty(_SaveTimeTraceMeasuremrentFileName)) { string fileName = (new FileInfo(newFileName)).Name; if (this.radioTimeTraceSourceVoltage.IsChecked == true) { sourceMode = "Source mode: Voltage"; } else if (this.radioTimeTraceSourceCurrent.IsChecked == true) { sourceMode = "SourceMode: Current"; } double micrometricBoltPosition = double.NaN; double.TryParse(this.textBoxTimeTraceMicrometricBoltPosition.Text, numberStyle, culture, out micrometricBoltPosition); string comment = this.textBoxTimeTraceComment.Text; _TimeTraceMeasurementLog.AddNewTimeTraceMeasurementLog(fileName, sourceMode, valueThroughTheStructure, comment); } SourceMode _sourceMode = SourceMode.Voltage; //Source mode is voltage by default if (sourceMode == "Source mode: Voltage") { _sourceMode = SourceMode.Voltage; } else if (sourceMode == "SourceMode: Current") { _sourceMode = SourceMode.Current; } if (_TimeTraceSingleMeasurement != null) { _TimeTraceSingleMeasurement.Dispose(); } _TimeTraceSingleMeasurement = new TimeTraceSingleMeasurement(newFileName, _sourceMode); #endregion return(true); } else { return(false); } #endregion }
/// <summary> /// Initializes the new I-V curve measurements /// </summary> /// <returns>true, if initialization succeed and false otherwise</returns> private bool InitIV_Measurements() { #region SMU, rendering and save data configurations //Checking the SMU settings if (sourceDeviceConfiguration != null) { #region Chart rendering settings //Initializing a new plot on I-V chart if (_IV_LineGraph != null) { //Detaching receive event from "old" data source _experimentalIV_DataSource.DetachPointReceiveEvent(); _IV_LineGraph.Remove(); } //Creating new plot and attaching it to the chart _CurrentIV_Curve = new List <PointD>(); _experimentalIV_DataSource = new ExperimentalIV_DataSource(_CurrentIV_Curve); _experimentalIV_DataSource.AttachPointReceiveEvent(); _IV_LineGraph = new LineGraph(_experimentalIV_DataSource); _IV_LineGraph.AddToPlotter(chartIV_Curves); #endregion //Getting SMU device Device = sourceDeviceConfiguration.Keithley2602A_DeviceSettings.Device; #region I-V measurement configuration var ExperimentSettings = IV_And_TimeTraceViewModel.Instance; var StartValue = ExperimentSettings.IV_MeasurementStartValue; var EndValue = ExperimentSettings.IV_MeasurementEndValue; var Step = ExperimentSettings.IV_MeasurementStep; var NumberOfAverages = ExperimentSettings.IV_MeasurementNumberOfAverages; var TimeDelay = ExperimentSettings.IV_MeasurementTimeDelay; SourceMode DeviceSourceMode = SourceMode.Voltage; if (this.radioIVSourceVoltage.IsChecked == true) { DeviceSourceMode = SourceMode.Voltage; } else if (this.radioIVSourceCurrent.IsChecked == true) { DeviceSourceMode = SourceMode.Current; } IV_Curve = new MeasureIV(StartValue, EndValue, Step, NumberOfAverages, TimeDelay, DeviceSourceMode, Device); #endregion #region Saving I-V data into files var _IV_FileNumber = String.Format("_{0}{1}{2}", (_IV_FilesCounter / 100) % 10, (_IV_FilesCounter / 10) % 10, _IV_FilesCounter % 10); string newFileName = string.Empty; if (!string.IsNullOrEmpty(_SaveIV_MeasuremrentFileName)) { _IV_MeasurementLog = new IV_MeasurementLog((new FileInfo(_SaveIV_MeasuremrentFileName)).DirectoryName + "\\IV_MeasurementLog.dat"); newFileName = _SaveIV_MeasuremrentFileName.Insert(_SaveIV_MeasuremrentFileName.LastIndexOf('.'), _IV_FileNumber); ++_IV_FilesCounter; } if (!string.IsNullOrEmpty(_SaveIV_MeasuremrentFileName)) { string fileName = (new FileInfo(newFileName)).Name; string sourceMode = string.Empty; if (this.radioIVSourceVoltage.IsChecked == true) { sourceMode = "Source mode: Voltage"; } else if (this.radioIVSourceCurrent.IsChecked == true) { sourceMode = "SourceMode: Current"; } double micrometricBoltPosition = double.NaN; double.TryParse(this.textBoxIV_MicrometricBoltPosition.Text, numberStyle, culture, out micrometricBoltPosition); string comment = this.textBoxIV_Comment.Text; _IV_MeasurementLog.AddNewIV_MeasurementLog(fileName, sourceMode, micrometricBoltPosition, comment); } if (_IV_SingleMeasurement != null) { _IV_SingleMeasurement.Dispose(); } _IV_SingleMeasurement = new IV_SingleMeasurement(newFileName); #endregion return(true); } else { MessageBox.Show("The device is not initialized.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error); return(false); } #endregion }
private bool InitTimeTraceMeasurements() { #region SMU, rendering and save data configurations if (sourceDeviceConfiguration != null) { #region Chart rendering settings if (_TimeTraceLineGraph != null) { _experimentalTimeTraceDataSource.DetachPointReceiveEvent(); _TimeTraceLineGraph.Remove(); _CurrentTimeTrace.Clear(); } _CurrentTimeTrace = new List<PointD>(); _experimentalTimeTraceDataSource = new ExperimentalTimetraceDataSource(_CurrentTimeTrace); _experimentalTimeTraceDataSource.AttachPointReceiveEvent(); _TimeTraceLineGraph = new LineGraph(_experimentalTimeTraceDataSource); _TimeTraceLineGraph.AddToPlotter(chartTimeTrace); #endregion //Getting SMU device Device = sourceDeviceConfiguration.Keithley2602A_DeviceSettings.Device; #region Time trace measurement configuration var pAddress = sourceDeviceConfiguration.Keithley2602A_DeviceSettings.DeviceSettings.PrimaryAddress; var sAddress = sourceDeviceConfiguration.Keithley2602A_DeviceSettings.DeviceSettings.SecondaryAddress; var bNumber = sourceDeviceConfiguration.Keithley2602A_DeviceSettings.DeviceSettings.BoardNumber; var motor = new ORDINARY_MOTOR(pAddress, sAddress, bNumber); motor.FinalDestination = 0.0; Motor = motor; if (TimeTraceCurve != null) { TimeTraceCurve.Dispose(); } var ExperimentSettings = IV_And_TimeTraceViewModel.Instance; var valueThroughTheStructure = ExperimentSettings.TimeTraceMeasurementValueThrougtTheStructure; var isTimeTraceVoltageModeChecked = ExperimentSettings.IsTimeTraceMeasurementVoltageModeChecked; var isTimeTraceCurrentModeChecked = ExperimentSettings.IsTimeTraceMeasurementCurrentModeChecked; var selectedTimeTraceModeItem = (tabControlTimeTraceMeasurementParameters.SelectedItem as TabItem).Header.ToString(); switch (selectedTimeTraceModeItem) { case "Distance": { var motionStartPosition = ExperimentSettings.TimeTraceMeasurementMotionCurrentDestination; var motionFinalDestination = ExperimentSettings.TimeTraceMeasurementMotionFinalDestination; if (isTimeTraceVoltageModeChecked == true) TimeTraceCurve = new MeasureTimeTrace(Motor, motionStartPosition, motionFinalDestination, Device, KEITHLEY_2601A_SourceMode.Voltage, KEITHLEY_2601A_MeasureMode.Resistance, valueThroughTheStructure); else if (isTimeTraceCurrentModeChecked == true) TimeTraceCurve = new MeasureTimeTrace(Motor, motionStartPosition, motionFinalDestination, Device, KEITHLEY_2601A_SourceMode.Current, KEITHLEY_2601A_MeasureMode.Resistance, valueThroughTheStructure); } break; case "Distance (Repetitive)": { var motionRepetitiveStartPosition = ExperimentSettings.TimeTraceMeasurementDistanceRepetitiveStartPosition; var motionRepetitiveEndPosition = ExperimentSettings.TimeTraceMeasurementDistanceRepetitiveEndPosition; var numerCycles = ExperimentSettings.TimeTraceMeasurementDistanceRepetitiveNumberCycles; if (isTimeTraceVoltageModeChecked == true) TimeTraceCurve = new MeasureTimeTrace(Motor, motionRepetitiveStartPosition, motionRepetitiveEndPosition, Device, KEITHLEY_2601A_SourceMode.Voltage, KEITHLEY_2601A_MeasureMode.Resistance, valueThroughTheStructure); else if (isTimeTraceCurrentModeChecked == true) TimeTraceCurve = new MeasureTimeTrace(Motor, motionRepetitiveStartPosition, motionRepetitiveEndPosition, Device, KEITHLEY_2601A_SourceMode.Current, KEITHLEY_2601A_MeasureMode.Resistance, valueThroughTheStructure); } break; case "Time": { } break; case "Fixed R": { } break; default: break; } #endregion #region Saving Time Trace data into files var _TimeTraceFileNumber = String.Format("_{0}{1}{2}", (_TimeTraceFilesCounter / 100) % 10, (_TimeTraceFilesCounter / 10) % 10, _TimeTraceFilesCounter % 10); string newFileName = string.Empty; if (!string.IsNullOrEmpty(_SaveTimeTraceMeasuremrentFileName)) { _TimeTraceMeasurementLog = new TimeTraceMeasurementLog((new FileInfo(_SaveTimeTraceMeasuremrentFileName)).DirectoryName + "\\TimeTraceMeasurementLog.dat"); newFileName = _SaveTimeTraceMeasuremrentFileName.Insert(_SaveTimeTraceMeasuremrentFileName.LastIndexOf('.'), _TimeTraceFileNumber); ++_TimeTraceFilesCounter; } string sourceMode = string.Empty; if (!string.IsNullOrEmpty(_SaveTimeTraceMeasuremrentFileName)) { string fileName = (new FileInfo(newFileName)).Name; if (this.radioTimeTraceSourceVoltage.IsChecked == true) { sourceMode = "Source mode: Voltage"; } else if (this.radioTimeTraceSourceCurrent.IsChecked == true) { sourceMode = "SourceMode: Current"; } double micrometricBoltPosition = double.NaN; double.TryParse(this.textBoxTimeTraceMicrometricBoltPosition.Text, numberStyle, culture, out micrometricBoltPosition); string comment = this.textBoxTimeTraceComment.Text; _TimeTraceMeasurementLog.AddNewTimeTraceMeasurementLog(fileName, sourceMode, valueThroughTheStructure, comment); } SourceMode _sourceMode = SourceMode.Voltage; //Source mode is voltage by default if (sourceMode == "Source mode: Voltage") _sourceMode = SourceMode.Voltage; else if (sourceMode == "SourceMode: Current") _sourceMode = SourceMode.Current; if (_TimeTraceSingleMeasurement != null) _TimeTraceSingleMeasurement.Dispose(); _TimeTraceSingleMeasurement = new TimeTraceSingleMeasurement(newFileName, _sourceMode); #endregion return true; } else { return false; } #endregion }
/// <summary> /// Initializes the new I-V curve measurements /// </summary> /// <returns>true, if initialization succeed and false otherwise</returns> private bool InitIV_Measurements() { #region SMU, rendering and save data configurations //Checking the SMU settings if (sourceDeviceConfiguration != null) { #region Chart rendering settings //Initializing a new plot on I-V chart if (_IV_LineGraph != null) { //Detaching receive event from "old" data source _experimentalIV_DataSource.DetachPointReceiveEvent(); _IV_LineGraph.Remove(); } //Creating new plot and attaching it to the chart _CurrentIV_Curve = new List<PointD>(); _experimentalIV_DataSource = new ExperimentalIV_DataSource(_CurrentIV_Curve); _experimentalIV_DataSource.AttachPointReceiveEvent(); _IV_LineGraph = new LineGraph(_experimentalIV_DataSource); _IV_LineGraph.AddToPlotter(chartIV_Curves); #endregion //Getting SMU device Device = sourceDeviceConfiguration.Keithley2602A_DeviceSettings.Device; #region I-V measurement configuration var ExperimentSettings = IV_And_TimeTraceViewModel.Instance; var StartValue = ExperimentSettings.IV_MeasurementStartValue; var EndValue = ExperimentSettings.IV_MeasurementEndValue; var Step = ExperimentSettings.IV_MeasurementStep; var NumberOfAverages = ExperimentSettings.IV_MeasurementNumberOfAverages; var TimeDelay = ExperimentSettings.IV_MeasurementTimeDelay; SourceMode DeviceSourceMode = SourceMode.Voltage; if (this.radioIVSourceVoltage.IsChecked == true) { DeviceSourceMode = SourceMode.Voltage; } else if (this.radioIVSourceCurrent.IsChecked == true) { DeviceSourceMode = SourceMode.Current; } IV_Curve = new MeasureIV(StartValue, EndValue, Step, NumberOfAverages, TimeDelay, DeviceSourceMode, Device); #endregion #region Saving I-V data into files var _IV_FileNumber = String.Format("_{0}{1}{2}", (_IV_FilesCounter / 100) % 10, (_IV_FilesCounter / 10) % 10, _IV_FilesCounter % 10); string newFileName = string.Empty; if (!string.IsNullOrEmpty(_SaveIV_MeasuremrentFileName)) { _IV_MeasurementLog = new IV_MeasurementLog((new FileInfo(_SaveIV_MeasuremrentFileName)).DirectoryName + "\\IV_MeasurementLog.dat"); newFileName = _SaveIV_MeasuremrentFileName.Insert(_SaveIV_MeasuremrentFileName.LastIndexOf('.'), _IV_FileNumber); ++_IV_FilesCounter; } if (!string.IsNullOrEmpty(_SaveIV_MeasuremrentFileName)) { string fileName = (new FileInfo(newFileName)).Name; string sourceMode = string.Empty; if (this.radioIVSourceVoltage.IsChecked == true) { sourceMode = "Source mode: Voltage"; } else if (this.radioIVSourceCurrent.IsChecked == true) { sourceMode = "SourceMode: Current"; } double micrometricBoltPosition = double.NaN; double.TryParse(this.textBoxIV_MicrometricBoltPosition.Text, numberStyle, culture, out micrometricBoltPosition); string comment = this.textBoxIV_Comment.Text; _IV_MeasurementLog.AddNewIV_MeasurementLog(fileName, sourceMode, micrometricBoltPosition, comment); } if (_IV_SingleMeasurement != null) _IV_SingleMeasurement.Dispose(); _IV_SingleMeasurement = new IV_SingleMeasurement(newFileName); #endregion return true; } else { MessageBox.Show("The device is not initialized.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error); return false; } #endregion }
public void Dispose() { AllEventsHandler.Instance.Motion -= OnMotionPositionMeasured; AllEventsHandler.Instance.TimeTraceMeasurementsStateChanged -= OnTimeTraceMeasurementsStateChanged; this._Motor = null; this._Destination = 0.0; this._MeasureDevice = null; this._ValueThroughTheStructure = 0.0; }