integfile = 'lastInteg.txt' #name of the file where last integrator array is kept. pifile = 'PIparams.txt' #where PI parameters are kept and can be modified on the fly mancontrolfile = 'manual_valve.txt' #used for manual control of valve positions ser = serial.Serial('/dev/ttyUSB1') # open USB-serial port if (not ser.isOpen()): print 'Error: Serial Port Not Open' ser.flushInput() ser.flushOutput() ser.baudrate = 9600 ser.timeout = 0.1 #sets timeout of the serial port counter = SignalDelay + 1 #so that data is outputted on the first loop WriteCounter = SignalDelay + 1 #so that data is written on the first loop errors_count = 0 #initial number of errors notifier = email_notifier.notifier() notifier.set_recepients( ['*****@*****.**', '*****@*****.**', '*****@*****.**']) officialnotifier = email_notifier.notifier() officialnotifier.set_recepients([ '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**' ]) class Valves(): def __init__(self): self.previousSignal = zeros(ControlledValves) self.newSignal = zeros(ControlledValves) def sign(x):
pifile = 'PIparams.txt'#where PI parameters are kept and can be modified on the fly mancontrolfile = 'manual_valve.txt' #used for manual control of valve positions ser = serial.Serial('/dev/ttyUSB1') # open USB-serial port if(not ser.isOpen()): print 'Error: Serial Port Not Open' ser.flushInput() ser.flushOutput() ser.baudrate = 9600; ser.timeout = 0.1; #sets timeout of the serial port counter = SignalDelay+1 #so that data is outputted on the first loop WriteCounter = SignalDelay+1 #so that data is written on the first loop errors_count = 0 #initial number of errors notifier = email_notifier.notifier() notifier.set_recepients(['*****@*****.**','*****@*****.**','*****@*****.**']) officialnotifier = email_notifier.notifier() officialnotifier.set_recepients(['*****@*****.**','*****@*****.**','*****@*****.**','*****@*****.**']) class Valves(): def __init__(self): self.previousSignal = zeros(ControlledValves) self.newSignal = zeros(ControlledValves) def sign(x): if(x > 0.01): return 1 if(x < -0.01): return -1 else:
pifile = 'PIparams.txt'#where PI parameters are kept and can be modified on the fly mancontrolfile = 'manual_valve.txt' #used for manual control of valve positions ser = serial.Serial('/dev/ttyUSB0') # open USB-serial port if(not ser.isOpen()): print 'Error: Serial Port Not Open' ser.flushInput() ser.flushOutput() ser.baudrate = 9600; ser.timeout = 0.1; #sets timeout of the serial port counter = SignalDelay+1 #so that data is outputted on the first loop WriteCounter = SignalDelay+1 #so that data is written on the first loop errors_count = 0 #initial number of errors notifier = email_notifier.notifier() notifier.set_recepients('[email protected],[email protected],[email protected]') class Valves(): def __init__(self): self.previousSignal = zeros(ControlledValves) self.newSignal = zeros(ControlledValves) def ApplyValveSignal(self,incoming_signal): self.newSignal = self.testResponseChange(incoming_signal) self.communicateSend() return self.newSignal #for for test in response to minimize valve motion and reduce wear and tear def testResponseChange(self,signal): for i in range(len(signal)):