示例#1
0
#!/usr/bin/python3
import readWrite
from Set import Set
import addCards


if __name__== "__main__":
	readWrite.repopSave()
	temp = readWrite.load("testData.txt")
	f = temp[0]
	c = temp[1]	
	data = Set(f , c)
	addCards.addCards(data)
	readWrite.write("testData.txt", data.getf(), data.getc())
示例#2
0
				# 		print readDic[portObj.getPortNum()]
				# 		manipulatedDic[portObj.getConnectedTo()] = portObj.Ploop(setpoint, readDic[portObj.getPortNum()])     
				# print "P-Loop result: " + str(manipulatedDic)

				# for item in manipulatedDic:
				# 	portObj = device.getPortItem(item)
				# 	write(i, device, portObj, manipulatedDic[item])

				#---------------------------------------------------------------------------------------------
				# Writing 
				if p == 1:
					if i == 0:
						print "Writing to C1 ports"
						portobj = device.getPOrtItem(6)
						print portobj 
						write(i,device,portobj,0)
						print "C1 write attempted"

					if i==1:
						print "Writing to C2 ports"
						portobj = device.getPortITem(6)
						print portobj 
						write(i,device,portobj,0)
						print "C2 write attempted"
				#---------------------------------------------------------------------------------------------

			except ValueError:
				print "Except: " + str(ValueError)
			finally:
				device = device.getNext()
				i += 1
示例#3
0
                             'sqlite:///../database/database/rh.db')
            #----------------------------------------

            #Determining the correct output from the controller. ManipulatedDic should contain the value from the P-loop with the key being the port of the actuator that the sensor is paired with
            for item in range(1, numberOfConnectedPorts):
                portObj = device.getPortItem(item)
                if portObj.getControlled():
                    print readDic[portObj.getPortNum()]
                    manipulatedDic[portObj.getConnectedTo()] = portObj.Ploop(
                        setpoint, readDic[portObj.getPortNum()])
            print "P-Loop result: " + str(manipulatedDic)

            #Write the new output values to the controller.
            for item in manipulatedDic:
                portObj = device.getPortItem(item)
                write(i, device, portObj, manipulatedDic[item])
        except ValueError:
            print "Except: " + str(ValueError)
        finally:
            #gets the next device in the linked list
            device = device.getNext()
            i += 1

time.sleep(1.5)

print "Stopping applications..."
i = 0
device = deviceChain
while device != None:
    doStop(i)
    i += 1
			if i == 1:
				insertNewRow('controllertwo', temp, 'sqlite:///../database/database/rh.db')
			#----------------------------------------

			#Determining the correct output from the controller. ManipulatedDic should contain the value from the P-loop with the key being the port of the actuator that the sensor is paired with
			for item in range(1,numberOfConnectedPorts):
				portObj = device.getPortItem(item)
				if portObj.getControlled():
					print readDic[portObj.getPortNum()]
					manipulatedDic[portObj.getConnectedTo()] = portObj.Ploop(setpoint, readDic[portObj.getPortNum()])     
			print "P-Loop result: " + str(manipulatedDic)

			#Write the new output values to the controller.
			for item in manipulatedDic:
				portObj = device.getPortItem(item)
				write(i, device, portObj, manipulatedDic[item])
		except ValueError:
			print "Except: " + str(ValueError)
		finally:
			#gets the next device in the linked list
			device = device.getNext()
			i += 1

time.sleep(1.5)

print "Stopping applications..."
i = 0
device = deviceChain
while device != None:
	doStop(i)
	i += 1