#Compares distance to port and asks to close if too close
        open = True
        for x in listOfPorts:
            port = d.Decimal(x[0]),d.Decimal(x[1])
            distanceToPort = haversine.distance(currentPosition,port)
            if distanceToPort < d.Decimal(x[2]):
                open = False
#            if distanceToPort > d.Decimal(x[2]):
#                open = True
#            print x[3],distanceToPort

        #opens valve
        if open == True and lastState != "True":
            print "Opening Valve"
            lastState = "True"
            valve.open_evsco_valve()

        #closes valve
        if open == False and lastState != "False":
            print "Closing Valve"
            lastState = "False"
            valve.close_evsco_valve()
            
    #if socket can't connect
    except:
        print "Something aint right\n"
#        sys.exit(0)
#        pass
        if lastState != "unk" or firstStart == "True":
            valve.open_evsco_valve()
            lastState = "unk"
Exemplo n.º 2
0
#!/usr/bin/env python
import EvscoValveControl as q
import time
q.close_evsco_valve()
time.sleep(2)
q.open_evsco_valve()

Exemplo n.º 3
0
#!/usr/bin/env python
import EvscoValveControl as q
import time
q.close_evsco_valve()
#time.sleep(2)
#q.open_evsco_valve()

        #Compares distance to port and asks to close if too close
        open = True
        for x in listOfPorts:
            port = d.Decimal(x[0]), d.Decimal(x[1])
            distanceToPort = haversine.distance(currentPosition, port)
            if distanceToPort < d.Decimal(x[2]):
                open = False
#            if distanceToPort > d.Decimal(x[2]):
#                open = True
#            print x[3],distanceToPort

#opens valve
        if open == True and lastState != "True":
            print "Opening Valve"
            lastState = "True"
            valve.open_evsco_valve()

        #closes valve
        if open == False and lastState != "False":
            print "Closing Valve"
            lastState = "False"
            valve.close_evsco_valve()

    #if socket can't connect
    except:
        print "Something aint right\n"
        #        sys.exit(0)
        #        pass
        if lastState != "unk" or firstStart == "True":
            valve.open_evsco_valve()
            lastState = "unk"
Exemplo n.º 5
0
#!/usr/bin/env python
import time
import EvscoValveControl as q

q.open_evsco_valve()
Exemplo n.º 6
0
#!/usr/bin/env python
import time
import EvscoValveControl as q



q.open_evsco_valve()