コード例 #1
0
import time


def exit(ser=None, code=0):
	if not ser is None:
		ser.cmd("LDON OFF")
		time.sleep(1)
	sys.exit(code)

# LDC501_SCAN_LIMITS
min_I, max_I = 100., 230.					# float [mA]
min_steps, max_steps = 10, 1000000			# int
min_dwelltime, max_dwelltime = 6*ms, 1.0	# float [s]

# connect to device
ser = SerialObject(SerialInstruments['LDC501'])
try:
	print "Instrument: " + ser.cmd_and_return("*IDN?")

	ser.cmd("TOKN ON")
	ser.cmd("LDON OFF")
	ser.cmd("MODU OFF;RNGE LOW;SMOD CC")
	ser.cmd("SYND 5")
	time.sleep(1)

	print "LD_I_LM: {0}".format(ser.cmd_and_return("SILM?"))
	print "LD_V_LM: {0}".format(ser.cmd_and_return("SVLM?"))

	cin = raw_input("I_lower [120]: ")
	try: cin = float(cin) 
	except ValueError: cin = 120
コード例 #2
0
ファイル: SIM960_PI_Sweep.py プロジェクト: nEDM-TUM/HVSetup
INI_INTG_L, INI_INTG_U = 1.0E+0, 2.5E+3
INI_N_STEPS_PROP, INI_N_STEPS_INTG = 101, 26
INI_INTERMEDIATE_STEPS = 10

PID_PROP_RANGE = np.linspace(INI_PROP_L, INI_PROP_U, INI_N_STEPS_PROP)
PID_INTG_RANGE = np.linspace(INI_INTG_L, INI_INTG_U, INI_N_STEPS_INTG)
PID_MAP_PI = itertools.product(PID_PROP_RANGE, PID_INTG_RANGE)

#
# ___MAIN___
#

# 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")
コード例 #3
0
ファイル: SerialIO.py プロジェクト: nEDM-TUM/HVSetup
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Christian Velten'

from LIB.SerialInstrument import SerialObject, SerialInstruments

import serial
import sys
import time

instrument = [{
    'address': '/dev/ttyUSB0',
    'baudrate': 9600,
    'parity': serial.PARITY_NONE,
    'stopbits': serial.STOPBITS_TWO,
    'bytesize': serial.EIGHTBITS,
    'rtscts': False
	}]

# connect to device
ser = SerialObject(instrument[0])

ser.cmd("AMPL 4VP")
print ser.ask("*IDN?")

time.sleep(1)