#Testing file for oven class and problems! import serial import sys #call sys.exit() to exit program, useful for errors from OvenClass import OvenClass #Assign com ports and iD's nozzleCOM = 'COM2' resCOM = 'COM5' nozzleID = 1 reservoirID = 2 #Assign an oven object to nozzle and reservoir nozzle = OvenClass(nozzleCOM) reservoir = OvenClass(resCOM) #Use the functions to test them #nozzle.write_setpoint(200) nozzle.read_temperature() nozzle.read_setpoint() nozzle.read_iD() #reservoir.write_setpoint(100) reservoir.read_temperature() reservoir.read_setpoint() reservoir.read_iD() print('Nozzle temperature:') print(nozzle.temperature) print('Nozzle setpoint:') print(nozzle.setpoint)
#Useful variables newNozzleSetpoint = -1.0 newReservoirSetpoint = -1.0 maxNozzleTemperature = 575.0 maxReservoirTemperature = 375.0 totalTime = 0 timeInterval=300 #seconds #Assign com ports and iD's which are checked nozzleCOM='COM2' reservoirCOM='COM5' nozzleID=1 reservoirID=2 #Assign an oven object to nozzle and reservoir nozzle=OvenClass(nozzleCOM) reservoir=OvenClass(reservoirCOM) #Read current setpoints, temps, and iD numbers. Set reservoir newsetpoint for later reference nozzle.read_setpoint() nozzle.read_temperature() nozzle.read_iD() reservoir.read_setpoint() reservoir.read_temperature() reservoir.read_iD() newReservoirSetpoint=reservoir.setpoint #First step is always to check that the com ports are right so that the nozzle and reservoir aren't mixed! if nozzle.iD != nozzleID or reservoir.iD != reservoirID: print('COM Ports do not match controllers... BAD!') raw_input("Press enter to continue...")
#Testing file for oven class and problems! import serial import sys #call sys.exit() to exit program, useful for errors from OvenClass import OvenClass #Assign com ports and iD's nozzleCOM='COM2' resCOM='COM5' nozzleID=1 reservoirID=2 #Assign an oven object to nozzle and reservoir nozzle=OvenClass(nozzleCOM) reservoir=OvenClass(resCOM) #Use the functions to test them #nozzle.write_setpoint(200) nozzle.read_temperature() nozzle.read_setpoint() nozzle.read_iD() #reservoir.write_setpoint(100) reservoir.read_temperature() reservoir.read_setpoint() reservoir.read_iD() print('Nozzle temperature:') print(nozzle.temperature) print('Nozzle setpoint:')
#Useful variables newNozzleSetpoint = -1.0 newReservoirSetpoint = -1.0 maxNozzleTemperature = 575.0 maxReservoirTemperature = 375.0 totalTime = 0 timeInterval = 300 #seconds #Assign com ports and iD's which are checked nozzleCOM = 'COM2' reservoirCOM = 'COM5' nozzleID = 1 reservoirID = 2 #Assign an oven object to nozzle and reservoir nozzle = OvenClass(nozzleCOM) reservoir = OvenClass(reservoirCOM) #Read current setpoints, temps, and iD numbers. Set reservoir newsetpoint for later reference nozzle.read_setpoint() nozzle.read_temperature() nozzle.read_iD() reservoir.read_setpoint() reservoir.read_temperature() reservoir.read_iD() newReservoirSetpoint = reservoir.setpoint #First step is always to check that the com ports are right so that the nozzle and reservoir aren't mixed! if nozzle.iD != nozzleID or reservoir.iD != reservoirID: print('COM Ports do not match controllers... BAD!') raw_input("Press enter to continue...")
#Useful variables newNozzleSetpoint = -1 #Not currently implemented newReservoirSetpoint = -1 string = 'none' error = False errorMessage = 'None' #Assign com ports and iD's nozzleCOM = 'COM2' reservoirCOM = 'COM5' nozzleID = 1 reservoirID = 2 #Assign an oven object to nozzle and reservoir nozzle = OvenClass(nozzleCOM) reservoir = OvenClass(reservoirCOM) #Read current setpoints and temperatures, then display nozzle.read_setpoint() nozzle.read_temperature() reservoir.read_setpoint() reservoir.read_temperature() #First step is always to check that the com ports are right if nozzle.iD != nozzleID or reservoir.iD != reservoirID: print('COM Ports do not match controllers... BAD!') raw_input("Press enter to continue...") sys.exit() #Print current values
#Useful variables newNozzleSetpoint = -1 #Not currently implemented newReservoirSetpoint = -1 string = 'none' error = False errorMessage = 'None' #Assign com ports and iD's nozzleCOM='COM2' reservoirCOM='COM5' nozzleID=1 reservoirID=2 #Assign an oven object to nozzle and reservoir nozzle=OvenClass(nozzleCOM) reservoir=OvenClass(reservoirCOM) #Read current setpoints and temperatures, then display nozzle.read_setpoint() nozzle.read_temperature() reservoir.read_setpoint() reservoir.read_temperature() #First step is always to check that the com ports are right if nozzle.iD != nozzleID or reservoir.iD != reservoirID: print('COM Ports do not match controllers... BAD!') raw_input("Press enter to continue...") sys.exit()