# CONNECT TO DEVICES try: if not args.debug: LDC = SerialObject(SerialInstruments['LDC501']) PID = SerialObject(SerialInstruments['SIM960'], wait=0.01) if not args.noosci: OSC = USBTMCObject(USBInstruments['LABOR']['vendorID'], USBInstruments['LABOR']['productID']) TEM = GPIOSensor(GPIOSensors['THERM_LAB']) PID.cmd("*CLS") print "Instrument (LDC):\n\t" + LDC.ask("*IDN?") print "Instrument (PID):\n\t" + PID.ask("*IDN?") if not args.noosci: print "Instrument (OSC):\n\t" + OSC.ask("*IDN?") if TEM.read() is None: raise ValueError() LDC.cmd("TOKN ON") LDC.cmd("LDON OFF;MODU OFF; RNGE LOW; SMOD CC; SIBW LOW; SYND 5") time.sleep(1) PID.cmd("TOKN ON; CONS OFF") PID.cmd("INPT INT;SETP 0.0;RAMP OFF") PID.cmd("AMAN PID;MOUT 0.0") PID.cmd("ULIM 10.0;LLIM -10.0") PID.cmd("APOL {0};GAIN {1:.4f}".format(INI_POLA, INI_PROP)) PID.cmd("INTG {0};DERV {1};OFST {2}".format(INI_INTG, INI_DERV, INI_OFST)) PID.cmd("PCTL ON;ICTL ON") PID.cmd("DCTL OFF;OCTL OFF") # (P,I,D,O)=(1,1,0,0) PID.cmd("SOUT; FPLC 50")
print "\tInstrument: " + str(sOsci.cmd_and_return("*IDN?")) OsciUSB.setup_acquire(sOsci, mode=args.acquire, num=args.samples) OsciUSB.setup_measurement_mean(sOsci, channels=[1, 2, 3], statistics=True, statistics_samples=10) print "" break except LIB.Exceptions.USBException as e: print e time.sleep(5.0) pass """ Initialize temperature sensor """ while True: print "\n", "initializing temperature sensor..." sTherm = GPIOSensor(GPIOSensors['THERM_LAB']) if sTherm.read() is None: continue print "" break """ START? """ if not args.service: cin = raw_input("\nBEGIN MEASUREMENT? [Y] ") if cin != "" and cin.upper() != "Y" and cin.upper() != "YES": sys.exit(0) """ Measurement loop