def _close_serial_connection(self): ''' Closes the serial connection Input: None Output: None ''' logging.debug(__name__ + ' : Closing serial connection') vpp43.close(self._vi)
def _close_serial_connection(self): ''' Close the serial connection Input: None Output: None ''' logging.debug(__name__ + ' : closing connection') vpp43.close(self._vi)
def _close_serial_connection(self): ''' Closes the serial connection Input: None Output: None ''' logging.debug('Closing serial connection') vpp43.close(self._vi)
def __init__(self, resource_name, timeout=10000): """ @timeout in milliseconds """ self._resource_name = resource_name self._timeout = timeout # Check model code to make sure we are using the right command language vi = vpp43.open(visa.resource_manager.session, resource_name) model_code = vpp43.get_attribute(vi, vpp43.VI_ATTR_MODEL_CODE) vpp43.close(vi) if model_code != self._model_code: raise OceanOpticsError('The spectrometer reported a different ' 'model code ({}) than the driver expected ' '({}).'.format(model_code, self._model_code)) self._vi = None # connection not currently open
def autodetect_spectrometer(resource_name, *args, **kwargs): """ Factory method which creates an appropriate instrument object, depending on the model code that the unit identifies itself with. """ vi = vpp43.open(visa.resource_manager.session, resource_name) model_code = vpp43.get_attribute(vi, vpp43.VI_ATTR_MODEL_CODE) vpp43.close(vi) if model_code == 4098: return USB2000(resource_name, *args, **kwargs) if model_code == 4100: return ADC1000(resource_name, *args, **kwargs) if model_code == 4106: return HR2000(resource_name, *args, **kwargs) if model_code == 4114: return HR4000(resource_name, *args, **kwargs) if model_code == 4118: return HR2000Plus(resource_name, *args, **kwargs) if model_code == 4120: return QE65000(resource_name, *args, **kwargs) if model_code == 4126: return USB2000Plus(resource_name, *args, **kwargs) if model_code == 4130: return USB4000(resource_name, *args, **kwargs) if model_code == 4134: return NIRQuest512(resource_name, *args, **kwargs) if model_code == 4136: return NIRQuest256(resource_name, *args, **kwargs) if model_code == 4138: return MayaPro(resource_name, *args, **kwargs) if model_code == 4140: return Maya(resource_name, *args, **kwargs) if model_code == 4160: return Torus(resource_name, *args, **kwargs) raise visa.VisaIOError(OO_ERROR_MODEL_NOT_FOUND)
def _close_serial_connection(self): vpp43.close(self._vi)
def close(self): vpp43.close(self._vi) self._vi = None
timePassed = 0 lastTime = 0 data = [] pidread = [] volts = 0 cur = 15 current = readValue(d) duration = setDuration() startmilli = current_milli_time() while timePassed < duration: print "Time Passed: ", timePassed currentRead = [] timePassed = int(time.time() - startTime) vRead = readValue(d) currentRead.append(vRead) print "Current reading: ", vRead currentRead.append(current_milli_time() - startmilli) # volts = getNewOutput(setpoint, volts, vRead) volts = 80 - p.update(vRead) print "PID value: ", volts currentRead.append(volts) table.append(currentRead) pidread.append(volts) result = setPSU(vi, volts, cur) print "Voltage setting: ", result result = setPSU(vi, 0, 0) writeToFile(table) makePlot(table) vpp43.close(vi) d.close()