def __init__(self, powersupplyAddress, labjackHandle, dacName, largeFieldGain, smallFieldGain): # assign the correct port address to a powersupply objectsupply self.supply = powersupply.PowerSupply(powersupplyAdress) self.dacName = dacName # preliminary calibration data: self.largeFieldGain = LargeFieldGain self.smallFieldGain = smallFieldGain self.voltageGain = 250 # voltage gain (V/A) # power supply current command limits self.maxPowerSupplyCurrent = 0.9999 # A self.minPowerSupplyCurrent = 0.0010 # A self.minPowerSupplyCurrentStep = 0.0001 # A #Maximum possible field to be produced by coil self.appliedMaxField = fieldGain.n * maxPowerSupplyCurrent #minimum possible field to be produced by coil self.appliedMinField = fieldGain.n * minPowerSupplyCurrent self.fieldValue = 0 # keeps the last field value the coil was set to self.setLargeCoilField = 0 # lets the coil keep track of what it was last set to self.setSmallCoilField = 0 return(self)
def __init__(self, root, number, config): super().__init__(root, borderwidth=3, relief=GROOVE) self.root = root self.noutputs = 4 self.rows = [] self.cols = ['#', 'U', 'I', 't', 'Sample Name', '', ''] self.time_remaining = [0] * self.noutputs self.ps = powersupply.PowerSupply() self.number = number self.config = config self.targetTimes = [0] * self.noutputs self.startTimes = [0] * self.noutputs # unit conversion setup voltage_unit = StringVar(self) voltage_unit.set(config["voltunit"]) voltage_units = {"V": 1.0, "mV": 0.001} current_unit = StringVar(self) current_unit.set(config["currunit"]) current_units = {"A": 1.0, "mA": 0.001, "µA": 0.000001} time_unit = StringVar(self) time_unit.set(config["timeunit"]) time_units = {"h": 60.0, "min": 1.0, "s": 1.0 / 60} self.units = { self.cols[1][0]: voltage_units, self.cols[2][0]: current_units, self.cols[3][0]: time_units } self.unitvars = { self.cols[1][0]: voltage_unit, self.cols[2][0]: current_unit, self.cols[3][0]: time_unit } self.units_optionMenus = {} # this list is necessary, if we want to recalculate the values in the entries after the unit has changed. self.currently_used_units = [ voltage_unit.get(), current_unit.get(), time_unit.get() ] self.build()
def __init__(self, powersupplyAddress, largeCoilFieldGain): # assign the correct port address to a powersupply objectsupply self.supply = powersupply.PowerSupply(powersupplyAddress) # calibration dependant data: self.largeCoilFieldGain = largeCoilFieldGain.n # T/A # power supply current command limits self.maxPowerSupplyCurrent = 0.9990 # A self.minPowerSupplyCurrent = 0.0020 # A # Maximum and minimum possible field that can be produced by the coil. self.appliedMaxField = self.largeCoilFieldGain * self.maxPowerSupplyCurrent self.appliedMinField = self.largeCoilFieldGain * self.minPowerSupplyCurrent # innitalize field value containers self.largeCoilCurrent = self.supply.current() # Amps #print(self.largeCoilCurrent, type(self)) self.largeCoilField = self.largeCoilCurrent * self.largeCoilFieldGain # total field # research type casting later.... self.coilField = self.largeCoilField return
import numpy as np import sys # used to handle the exceptions in the try -> except statements import powersupply # import the library for testing # Setup the powersupply serial ports! try: # these two are for the horizontal field adustment xCoil = powersupply.PowerSupply('/dev/tty.usbserial-FTBZ1G1B') yCoil = powersupply.PowerSupply('/dev/tty.usbserial-FTBYZZIN') # this one stays locked at a value to keep the laser centered on the sensor zCoil = powersupply.PowerSupply( '/dev/tty.usbserial-FTFBPHDT' ) # assign the correct port the the z powersupply except: print("Error: %s, value: %s, exception: %s" % sys.exc_info()) # catch the exception and print it out! print( 'Error setting up serial device. Please check the serial port adresses in the setup function.' ) try: # open the ports! xCoil.openPort() yCoil.openPort() zCoil.openPort() print(zCoil.current()) print('---') print(zCoil.current(7.2))
import sys sys.path.append("./PowerSupplyControl/") import powersupply import numpy as np import time import uncertainties as u from labjack import ljm # import labjack library import matplotlib.pyplot as plt # analog input to read from the labjack analogInputName = 'AIN0' # assign the correct port address to each supply xCoil = powersupply.PowerSupply('/dev/tty.usbserial-FTBZ1G1B') yCoil = powersupply.PowerSupply('/dev/tty.usbserial-FTBYZZIN') zCoil = powersupply.PowerSupply('/dev/tty.usbserial-FTFBPHDT') # preliminary calibration data: xFieldGain = u.ufloat(42.24e-6, 0.08e-6) # T/A yFieldGain = u.ufloat(45.99e-6, 0.09e-6) # T/A zFieldGain = u.ufloat(132.16e-6, 0.08e-6) # T/A # field to current gain for the adustment coils (extrapolated from the large coil calibration) xAFieldGain = xFieldGain / 25 # T/A yAFieldgain = yFieldGain / 20 # T/A # power supply current command limits maxPowerSupplyCurrent = 0.9999 # A minPowerSupplyCurrent = 0.0010 # A # preliminary rough estimate feild values