public double MeasureVoltage() { _SetReadingFormat(SenseMode.Voltage); _SetMeasurementAutoRange(SenseMode.Voltage, true); var res = 0.0; var success = double.TryParse(_driver.RequestQuery(":READ?"), out res); if (success) { //_SetMeasurementRange(res, SenseMode.Voltage); return(res); } else { return(double.NaN); } }
public double MeasureVoltage() { if (_currentMeasureFunction != Keithley26xxBMeasureFunctions.MEASURE_DCVOLTS) { _currentMeasureFunction = Keithley26xxBMeasureFunctions.MEASURE_DCVOLTS; _display.smuX.measure.func = Keithley26xxBMeasureFunctions.MEASURE_DCVOLTS; } var response = _driver.RequestQuery(string.Format("MeasureVoltage_smu{0}({1}, {2}, {3})", ChannelIdentifier, _currentAveraging, _currentNPLC.ToString(CultureInfo.InvariantCulture), _currentDelay.ToString(CultureInfo.InvariantCulture))); var result = 0.0; var success = double.TryParse(response, NumberStyles.Float, CultureInfo.InvariantCulture, out result); if (success) { return(result); } else { throw new Exception("Can't read voltage!"); } }
private double _queryMotor(string query) { while (true) { var responce = _driver.RequestQuery(query); double result; if (!responce.Contains("OK")) { if (double.TryParse(responce, NumberStyles.Float, NumberFormatInfo.InvariantInfo, out result)) { return(result); } } } }
/// <summary> /// This function switches the display to the user screen (the text set by display.settext()), and then returns /// values to indicate the cursor's row and column position and cursor style. /// Columns are numbered from left to right on the display. /// </summary> /// <returns>row, column, style = display.getcursor()</returns> public double[] GetCursor() { var result = new double[3]; _driver.SendCommandRequest("cursorRow, cursorColumn, cursorStyle = display.getcursor()"); var response = _driver.RequestQuery("print(cursorRow, cursorColumn, cursorStyle)").Split("\r\n\t, ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); var _isRowReadingSucceed = double.TryParse(response[0], NumberStyles.Float, CultureInfo.InvariantCulture, out result[0]); var _isColumnReadingSucceed = double.TryParse(response[1], NumberStyles.Float, CultureInfo.InvariantCulture, out result[1]); var _isStyleReadingSucceed = double.TryParse(response[2], NumberStyles.Float, CultureInfo.InvariantCulture, out result[2]); if (_isRowReadingSucceed && _isColumnReadingSucceed && _isStyleReadingSucceed) { return(result); } else { throw new Exception("The reading from device was incorrect!"); } }