Advertisement
Guest User

ex.py

a guest
Mar 25th, 2015
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. import sys
  2. import time
  3. from sys import argv
  4. t1input = 0
  5. t1output = 0
  6. t2input = '0'
  7. argv1 = "ex.csv"
  8. script, filename = argv, argv1
  9. f = open(filename, 'r')
  10. setstate = 'green'
  11.  
  12. while True:
  13.     for i, line in enumerate(f):
  14.         #print (line)[36:-4:]
  15.         abc1 =  (line)[36:-11:]
  16.         abc2 = float(abc1)
  17.         abc3 = int(abc2)
  18.         t1input = abc2
  19.         t2input = t1input/1
  20.         print "t1input = %s" % t1input
  21.         print "tank2 = %s" % t2input
  22.         if t2input != t1output:
  23.             if t2input <= (t1input/100)*25:
  24.                 setstate =  'red'  
  25.             elif t2input <= (t1input/100)*50:
  26.                 setstate = 'amber'
  27.             else:
  28.                 setstate = 'green'
  29.         print "state is %s" % setstate 
  30.         time.sleep(5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement