Ejemplo n.º 1
0
def read_sensors(n, time_start, wait_time):

    # Valve Definition and Classes
    vent_valve = Valve('Vent Valve', 'P8_12', 0, 'Solenoid', 0, 0)

    # Pressure Sensor Definition and Classes
    pressure_cold_flow = Sensor('pressure_cold_flow', 'pressure', 'P9_12',
                                'P9_14', 'P9_16', '000', '000', '000')

    pressure_list = []
    pressure_time_list = []

    for i in range(100):
        pressure, time_pres = pressure_cold_flow.read_sensor()
        pressure_list.append(pressure)
        pressure_time_list.append(time_pres + wait_time * n)

    current_time = 'Time Update: {} seconds'.format(time.time() - time_start)
    print(current_time)
    saved_data_combined = [pressure_list, pressure_time_list]
    export_data = zip_longest(*saved_data_combined, fillvalue='')

    with open('leak_data.csv', 'a', encoding="ISO-8859-1",
              newline='') as myfile:
        wr = csv.writer(myfile)
        wr.writerows(export_data)
    myfile.close()
Ejemplo n.º 2
0
    def startUp(self):
        if YAPI.RegisterHub('usb', YRefParam()) != YAPI.SUCCESS:
            sys.exit('Connection error: connection through USB failed')

        self.tiltSensorRight = Sensor()

        # bootstrap handlers
        for h in self.activeHandlers:
            self.tiltSensorRight.attachHandler(h())
        self.tiltSensorRight.startWatching()

        # start display update loop
        def loop():
            threading.Timer(.10, loop).start()

            # no-op here

        loop()
Ejemplo n.º 3
0
 def initDevice(self, comport, id):
     # Toevoegen van een nieuw device
     sleep(1)
     try:
         ser = Serial(comport, 19200, timeout=2)
         sleep(2)
         # Zolang er fout optreed stuur command "_INIT"
         while True:
             ser.write(b"_INIT\n")
             device_type = ser.readline().decode("UTF-8").strip('\n')
             if device_type != "_ERR":
                 break
         if device_type == "_MTR":
             # Device is een aansturing
             # Stuur command "_CONN" zolang er fout optreed
             while True:
                 ser.write(b"_CONN\n")
                 device_type = ser.readline().decode("UTF-8").strip('\n')
                 if device_type != "_ERR":
                     break
             # Maak nieuw aansturing (MotorControl) aan
             a = MotorControl(ser, id)
             self.motorControls.append(a)
         elif device_type == "_TEMP" or device_type == "_LGHT":
             # Maak nieuwe sensor aan
             sensor = Sensor(ser, device_type, id, self.sensors)
             if (self.loggedin):
                 self.sensorsWithoutGraph.append(sensor)
             self.sensors.append(sensor)
             ser.write(b"_CONN\n")
         else:
             # Als device type onbekend is,
             # voeg toe aan onbekende COM-porten
             self.other_com_ports.append(comport)
     except SerialException as E:
         print(E)
         # Als er een fout optreed,
         # voeg toe aan onbekende COM-porten
         self.other_com_ports.append(comport)
Ejemplo n.º 4
0
    def __init__(self, jsonfile, logfile, sipcallfile, optsUpdateUI=None):
        """ Init for the Worker class """

        print("{0}------------ INIT FOR DOOR SENSOR CLASS! ----------------{1}"
              .format(bcolors.HEADER, bcolors.ENDC))
        # Global Variables
        self.jsonfile = jsonfile
        self.logfile = logfile
        self.sipcallfile = sipcallfile
        self.settings = self.ReadSettings()
        self.limit = 10
        self.logtypes = 'all'

        # Stop execution on exit
        self.kill_now = False

        # Init Alarm
        self.mynotify = Notify(self.settings)
        self.mynotify.setupUpdateUI(optsUpdateUI)
        self.mynotify.setupSendStateMQTT()
        mylogs = Logs(self.logfile)
        self.getSensorsLog = mylogs.getSensorsLog
        self.writeLog("system", "Alarm Booted")
        mylogs.startTrimThread()

        # Event Listeners
        self.sensors = Sensor()
        self.sensors.on_alert(self.sensorAlert)
        self.sensors.on_alert_stop(self.sensorStopAlert)
        self.sensors.on_error(self.sensorError)
        self.sensors.on_error_stop(self.sensorStopError)
        self.sensors.add_sensors(self.settings)

        # Init MQTT Messages
        self.mynotify.on_disarm_mqtt(self.deactivateAlarm)
        self.mynotify.on_arm_mqtt(self.activateAlarm)
        self.mynotify.on_sensor_set_alert(self.sensorAlert)
        self.mynotify.on_sensor_set_stopalert(self.sensorStopAlert)
        self.mynotify.sendStateMQTT()
Ejemplo n.º 5
0
    def startUp(self):
        if YAPI.RegisterHub('usb', YRefParam()) != YAPI.SUCCESS:
            sys.exit('Connection error: connection through USB failed')

        self.tiltSensorRight = Sensor()
        self.display = Display()

        # bootstrap handlers
        for h in self.activeHandlers:
            self.tiltSensorRight.attachHandler(h())
        self.tiltSensorRight.startWatching()

        # start display update loop
        def loop():
            threading.Timer(.10, loop).start()

            self.display.updateStatus()

            # for debugging, show data in the message row for now
            self.display.updateMessage('P:{} R:{}'.format(
                str(pitch), str(roll)))

        loop()
Ejemplo n.º 6
0
def insulation_test():

    # Data Frames for Saving
    pressure_list = ["Pressure"]
    pressure_time_list = ["time"]

    # Valve Definition and Classes
    actuator_prop = Valve('Actuator Propellant Valve', 'P8_13', 'P8_13',
                          'Prop', 4, 10)
    actuator_solenoid = Valve('Actuator Solenoid Valve', 'P8_12', 0,
                              'Solenoid', 0, 0)
    fill_valve = Valve('Fill Valve', 'P8_12', 0, 'Solenoid', 0, 0)
    vent_valve = Valve('Vent Valve', 'P8_12', 0, 'Solenoid', 0, 0)

    # Pressure Sensor Definition and Classes
    pressure_cold_flow = Sensor('pressure_cold_flow', 'pressure', 'P9_12',
                                'P9_14', 'P9_16', '000', '000', '000')

    # Temperature Sensor Definition and Classes
    temperature_fill_line = Sensor('temperature_fill_line', 'temperature',
                                   'P9_12', 'P9_14', 'P9_16', '000', '000',
                                   '000')
    temperature_empty_line = Sensor('temperature_empty_line', 'temperature',
                                    'P9_12', 'P9_14', 'P9_16', '000', '000',
                                    '000')

    saved_data_combined = [pressure_list, pressure_time_list]
    export_data = zip_longest(*saved_data_combined, fillvalue='')
    with open('insulation_data.csv', 'w', encoding="ISO-8859-1",
              newline='') as myfile:
        wr = csv.writer(myfile)
        wr.writerows(export_data)
    myfile.close()

    print('Welcome to the Team Daedalus: Insulation Test')
    input('Please Press Enter to Confirm Start')
    print('Starting System Check')
    print()
    print("\nVerifying Sensor and Valve Connections\n")
    while not pressure_cold_flow.verify_connection() and temperature_fill_line.verify_connection() \
            and temperature_empty_line.verify_connection():
        input("\nPress Enter to Start Verification Again:")
    print("\nAll Sensors are Functional\n")
    while not actuator_prop.verify_connection_valve and actuator_solenoid.verify_connection_valve and \
            fill_valve.verify_connection_valve and vent_valve.verify_connection_valve:
        input("\nPress Enter to Start Verification Again:")
    print("\nAll Valves are Functional\n")
    input("\nVerification Complete, Press Enter to Continue:\n")

    print()
    print('Closing All Valves')
    actuator_prop.close()
    actuator_solenoid.close()
    fill_valve.close()
    vent_valve.close()

    print(actuator_prop.get_state())
    print(actuator_solenoid.get_state())
    print(fill_valve.get_state())
    print(vent_valve.get_state())

    input('Press Enter to Open filling valve')
    print('Opening Fill Valve: Begin Filling Procedure')
    input('Press Enter to begin filling and Enter again to end filling')

    vent_valve.open()
    print(vent_valve.get_state())

    print('Press Enter When Desired Tank Ullage is Met')
    time.sleep(3)
    i = threading.Thread(target=get_input)
    i.start()

    while input_flag == 1:
        temp_fill = temperature_fill_line.read_sensor()
        temp_empty = temperature_empty_line.read_sensor()
        pressure = pressure_cold_flow.read_sensor()
        print(temp_fill[0], temp_empty[0], pressure[0])
        time.sleep(.1)
    vent_valve.close()
    print(vent_valve.get_state())
    final_pressure = pressure_cold_flow.read_sensor()

    print("Filling Completed: Current Pressure is...")
    print(final_pressure[0])
    input("Press Enter to Begin Leak Test")
    print('Beginning Leak Test')

    time_start = time.time()
    wait_time = 1
    n = 0

    k = threading.Thread(target=test_end_input)
    k.start()

    while test_flag == 1:
        read_sensors(n, time_start, wait_time)
        time.sleep(wait_time)
        n = n + 1

    print('done')
    print(time.time() - time_start)
    input('Press Enter to Open Valves and Depressurize Tank')
    actuator_prop.open()
    actuator_solenoid.open()
    fill_valve.open()
    vent_valve.open()

    actuator_prop.get_state()
    actuator_solenoid.get_state()
    fill_valve.get_state()
    vent_valve.get_state()
Ejemplo n.º 7
0
def read_sensors(n, time_start, wait_time):

    # Valve Definition and Classes
    vent_valve = Valve('Vent Valve', 'P8_12', 0, 'Solenoid', 0, 0)
    actuator_prop = Valve('Actuator Propellant Valve', 'P8_4', 'P8_4', 'prop',
                          4, 10)
    actuator_solenoid = Valve('Actuator Solenoid Valve', 'P8_4', 0, 'solenoid',
                              0, 0)

    # Pressure Sensor Definition and Classes
    pressure_cold_flow = Sensor('pressure_cold_flow', 'pressure', 'P9_16',
                                'P9_16', 'P9_16', '000', '001', '010')
    pressure0 = Sensor('pressure_cold_flow', 'pressure', 'P9_16', 'P9_16',
                       'P9_16', '000', '000', '000')
    pressure2 = Sensor('pressure_cold_flow', 'pressure', 'P9_16', 'P9_16',
                       'P9_16', '010', '010', '010')
    pressure4 = Sensor('pressure_cold_flow', 'pressure', 'P9_16', 'P9_16',
                       'P9_16', '100', '100', '100')

    maximum_pressure = 640
    nominal_pressure = 500

    pressure_list = []
    pressure_time_list = []
    pressure0_list = []
    pressure2_list = []
    pressure4_list = []

    for i in range(1000):
        global counter
        pressure, time_pres = pressure_cold_flow.read_sensor()
        pres0, time_pres0 = pressure0.read_sensor()
        pres2, time_pres2 = pressure2.read_sensor()
        pres4, time_pres4 = pressure4.read_sensor()

        pressure_list.append(pressure)
        pressure_time_list.append(time_pres + wait_time * n)
        pressure0_list.append(pres0)
        pressure2_list.append(pres2)
        pressure4_list.append(pres4)

        if pressure >= maximum_pressure:
            counter = counter + 1
        else:
            counter = 0

        if counter >= 3:
            time_relief = time.process_time()
            actuator_solenoid.open()
            actuator_prop.partial_open()
            print('Pressure Exceeded Maximum: Opening Relief Valve')
            print(time_relief)
            while True:
                pres_relief = pressure_cold_flow.read_sensor()
                if pres_relief[0] < nominal_pressure:
                    time_relief_end = time.process_time()
                    print('Closing Relief Valve')
                    actuator_solenoid.close()
                    actuator_prop.close()
                    print(time_relief_end)
                    break

    current_time = 'Time Update: {} seconds'.format(time.time() - time_start)
    print(current_time)
    saved_data_combined = [pressure_list, pressure_time_list]
    export_data = zip_longest(*saved_data_combined, fillvalue='')

    with open('leak_data.csv', 'a', encoding="ISO-8859-1",
              newline='') as myfile:
        wr = csv.writer(myfile)
        wr.writerows(export_data)
    myfile.close()

    for z in range(21):
        pres_temp = pressure_cold_flow.read_sensor()
        print(pres_temp[0])
Ejemplo n.º 8
0
def leak_test():
    global input_flag, counter
    time_duration = 36000

    # Data Frames for Saving
    pressure_list = ["Pressure"]
    pressure_time_list = ["time"]
    pressure0_list = ["Pressure0"]
    pressure2_list = ["Pressure2"]
    pressure4_list = ["Pressure4"]

    # Valve Definition and Classes
    actuator_prop = Valve('Actuator Propellant Valve', 'P8_4', 'P8_4', 'prop',
                          4, 20)
    actuator_solenoid = Valve('Actuator Solenoid Valve', 'P8_4', 0, 'solenoid',
                              0, 0)
    fill_valve = Valve('Fill Valve', 'P8_8', 0, 'solenoid', 0, 0)
    vent_valve = Valve('Vent Valve', 'P8_45', 0, 'solenoid', 0, 0)

    actuator_solenoid.open()
    actuator_prop.open()
    fill_valve.open()

    # Pressure Sensor Definition and Classes
    pressure_cold_flow = Sensor('pressure_cold_flow', 'pressure', 'P9_16',
                                'P9_16', 'P9_16', '000', '010', '100')
    pressure0 = Sensor('pressure_cold_flow', 'pressure', 'P9_16', 'P9_16',
                       'P9_16', '000', '000', '000')
    pressure2 = Sensor('pressure_cold_flow', 'pressure', 'P9_16', 'P9_16',
                       'P9_16', '010', '010', '010')
    pressure4 = Sensor('pressure_cold_flow', 'pressure', 'P9_16', 'P9_16',
                       'P9_16', '100', '100', '100')

    saved_data_combined = [
        pressure_list, pressure_time_list, pressure0_list, pressure2_list,
        pressure4_list
    ]
    export_data = zip_longest(*saved_data_combined, fillvalue='')
    with open('leak_data.csv', 'w', encoding="ISO-8859-1",
              newline='') as myfile:
        wr = csv.writer(myfile)
        wr.writerows(export_data)
    myfile.close()

    print('Welcome to the Team Daedalus: Leak Test')
    input('Please Press Enter to Confirm Start')
    print('Starting System Check')
    print()
    print("\nVerifying Sensor and Valve Connections\n")
    while not pressure_cold_flow.verify_connection():
        input("\nPress Enter to Start Verification Again:")
    print("\nAll Sensors are Functional\n")
    while not actuator_prop.verify_connection_valve and actuator_solenoid.verify_connection_valve and \
            fill_valve.verify_connection_valve and vent_valve.verify_connection_valve:
        input("\nPress Enter to Start Verification Again:")
    print("\nAll Valves are Functional\n")
    input("\nVerification Complete, Press Enter to Continue:\n")

    print()
    print('Closing All Valves')
    actuator_solenoid.close()
    actuator_prop.close()
    fill_valve.close()
    vent_valve.close()

    print(actuator_prop.get_state())
    print(actuator_solenoid.get_state())
    print(fill_valve.get_state())
    print(vent_valve.get_state())

    input('Press Enter to Open filling valve')
    print('Opening Fill Valve: Begin Filling Procedure')
    input('Press Enter to begin filling and Enter again to end filling')
    fill_valve.open()

    print(fill_valve.get_state())
    print(vent_valve.get_state())

    print('Press Enter When Desired Pressure is Met')
    time.sleep(3)
    i = threading.Thread(target=get_input)
    i.start()
    maximum_pressure = 640
    nominal_pressure = 500

    while input_flag == 1:
        a = pressure0.read_sensor()
        b = pressure2.read_sensor()
        c = pressure4.read_sensor()
        e = pressure_cold_flow.read_sensor()
        d = [e[0], a[0], b[0], c[0]]

        if e[0] >= maximum_pressure:
            counter = counter + 1
        else:
            counter = 0

        if counter >= 3:
            time_relief = time.process_time()
            actuator_prop_relief = Valve('Actuator Propellant Valve', 'P8_4',
                                         'P8_4', 'prop', 4, 10)
            actuator_solenoid.open()
            actuator_prop_relief.partial_open()
            print('Pressure Exceeded Maximum: Opening Relief Valve')
            print(time_relief)
            while True:
                pres_relief = pressure_cold_flow.read_sensor()
                if pres_relief[0] < nominal_pressure:
                    time_relief_end = time.process_time()
                    print('Closing Relief Valve')
                    actuator_solenoid.close()
                    actuator_prop_relief.close()
                    print(time_relief_end)
                    break
        print(d)
        time.sleep(.2)
    fill_valve.close()
    vent_valve.close()
    print(fill_valve.get_state())
    print(vent_valve.get_state())
    final_pressure = pressure_cold_flow.read_sensor()

    print("Filling Completed: Current Pressure is...")
    print(final_pressure[0])
    input("Press Enter to Begin Leak Test")
    print('Beginning Leak Test')

    input_flag = 1
    time_start = time.time()
    wait_time = 300
    n = 0

    while time.time() - time_start < time_duration:
        read_sensors(n, time_start, wait_time)
        time.sleep(wait_time)
        n = n + 1

    print('done')
    print(time.time() - time_start)
    input('Press Enter to Open Actuator at 20%')
    actuator_solenoid.open()
    actuator_prop.partial_open()

    input('Press Enter to Open All Valves')
    fill_valve.open()
    actuator_solenoid.open()
    actuator_prop.open()

    actuator_prop.get_state()
    actuator_solenoid.get_state()
    fill_valve.get_state()
    vent_valve.get_state()
Ejemplo n.º 9
0
    def test_bad_sensorType(self):
        with self.assertRaises(Exception) as context:
            Sensor("bad value")

        self.assertEqual('sensorType must be in {"temperature", "humidity"}',
                         str(context.exception))
Ejemplo n.º 10
0
def getRules(filename):
    threading.Timer(5.0, getRules, [filename]).start()
    return RuleList(filename)

try:
    ruleList = getRules(ruleFilename).rl
    if ruleList is not None:
        for rule in ruleList:
            print rule.sensor

    rad = SensorRadio()
    while(True):
        buff = rad.listen()
        print buff
        if buff is not None:
            newsensor = Sensor(buff[0], buff[1], buff[3])
            if any(oldsensor.idx == newsensor.idx for oldsensor in sensors):
                for oldsensor in sensors:
                    if oldsensor.idx == newsensor.idx:
                        oldsensor.value = newsensor.value
                        print 'Already in list. Update the values'
                        time.sleep(1)
            else:
                sensors.append(newsensor)
        listToJson(sensors)
        time.sleep(1)

except KeyboardInterrupt:
    print 'Got interrupt from keyboard'
    GPIO.cleanup()
    pS.on()

    sta_if = WLAN(STA_IF)
    while not sta_if.isconnected():
        pass
    pS.off()

    s = socket.socket()  # Create socket
    #ad = socket.getaddrinfo('000.000.000.000', 4444)[0][-1]  # Change your IP and Port here
    s.connect(ad)
    ss = wrap_socket(s)  # Wrap as a ssl socket
    #ss.write("aPASSWORD".encode())  # Set your password here
    ss.write("tu".encode())
    pS.on()
    irSender = Sender()
    sens = Sensor(ss, irSender)
    while True:
        data = ss.read(1).decode()  # Read one byte
        pS.off()
        if data is "q":
            ss.write("q".encode())
            utime.sleep(0.4)
            break
        elif (ord(data) >= 97 and ord(data) <= 122) or ord(data) == 10:
            irSender.got_data(data)
        sleep(0.1)
        pS.on()
    ss.close()
    s.close()
except Exception as e:
    print("Fehler", e)
Ejemplo n.º 12
0
def leak_test():
    global input_flag
    global counter

    # Valve Definition and Classes
    actuator_prop = Valve('Actuator Propellant Valve', 'P8_4', 'P8_4', 'prop',
                          4, 20)
    actuator_solenoid = Valve('Actuator Solenoid Valve', 'P8_4', 0, 'solenoid',
                              0, 0)
    fill_valve = Valve('Fill Valve', 'P8_8', 0, 'solenoid', 0, 0)
    vent_valve = Valve('Vent Valve', 'P8_45', 0, 'solenoid', 0, 0)

    actuator_solenoid.open()
    actuator_prop.partial_open()
    time.sleep(2)

    # Pressure Sensor Definition and Classes
    pressureall = Sensor('pressure_cold_flow', 'pressure', 'P9_16', 'P9_16',
                         'P9_16', '000', '010', '100')
    pressure0 = Sensor('pressure_cold_flow', 'pressure', 'P9_16', 'P9_16',
                       'P9_16', '000', '000', '000')
    pressure2 = Sensor('pressure_cold_flow', 'pressure', 'P9_16', 'P9_16',
                       'P9_16', '010', '010', '010')
    pressure4 = Sensor('pressure_cold_flow', 'pressure', 'P9_16', 'P9_16',
                       'P9_16', '100', '100', '100')

    print('Welcome to the Team Daedalus: Leak Test')
    input('Please Press Enter to Confirm Start')
    print('Starting System Check')
    print()
    input("\nVerification Complete, Press Enter to Continue:\n")

    print()
    print('Closing All Valves')
    actuator_solenoid.close()
    actuator_prop.close()
    fill_valve.close()
    vent_valve.close()

    print(actuator_prop.get_state())
    print(actuator_solenoid.get_state())
    print(fill_valve.get_state())
    print(vent_valve.get_state())

    input('Press Enter to Open filling valve')
    print('Opening Fill Valve: Begin Filling Procedure')
    input('Press Enter to begin filling and Enter again to end filling')
    fill_valve.open()

    print(fill_valve.get_state())
    print(vent_valve.get_state())

    print('Press Enter When Desired Pressure is Met')
    time.sleep(3)
    i = threading.Thread(target=get_input)
    i.start()

    maximum_pressure = 10000
    nominal_pressure = 500

    while input_flag == 1:
        a = pressure0.read_sensor()
        b = pressure2.read_sensor()
        c = pressure4.read_sensor()
        e = pressureall.read_sensor()
        d = [e[0], a[0], b[0], c[0]]

        if e[0] >= maximum_pressure:
            counter = counter + 1
        else:
            counter = 0

        if counter >= 3:
            time_relief = time.process_time()
            vent_valve.open()
            print('Pressure Exceeded Maximum: Opening Relief Valve')
            print(time_relief)
            while True:
                pres_relief = pressureall.read_sensor()
                if pres_relief[0] < nominal_pressure:
                    time_relief_end = time.process_time()
                    print('Closing Relief Valve')
                    vent_valve.close()
                    print(time_relief_end)
                    break

        print(d)
        time.sleep(.2)
    fill_valve.close()
    vent_valve.close()
    print(fill_valve.get_state())
    print(vent_valve.get_state())

    input('Press Enter to Open Actuator at 10%')
    actuator_solenoid.open()
    actuator_prop.partial_open()

    input('Press Enter to Open Vent Valve')
    vent_valve.open()

    input('Enter all Other Valves')
    vent_valve.close()
    time.sleep(1)
    fill_valve.open()
    actuator_solenoid.open()
    actuator_prop.open()

    actuator_prop.get_state()
    actuator_solenoid.get_state()
    fill_valve.get_state()
    vent_valve.get_state()
    input('Press Enter to End and Close all valves')
    vent_valve.close()
    fill_valve.close()
    actuator_solenoid.close()
    actuator_prop.close()
Ejemplo n.º 13
0
 def try_bricklet(self, uid, device_identifier, position):
     if device_identifier == 26:
         for x in ["relay_a", "relay_b"]:
             s = Sensor(self.controller, x, uid)
             self.relays[s.uid] = s
Ejemplo n.º 14
0
"""
Some example usage of the Sensor class
"""

from sensors import Sensor

temperatureSensor = Sensor("temperature")
reading = temperatureSensor.getReading()
reading2 = temperatureSensor.getReading()
reading3 = temperatureSensor.getReading()
print(reading)
print(reading['value'])
print(reading2['value'])
print(reading3['value'])
Ejemplo n.º 15
0
 def try_bricklet(self, uid, device_identifier, position):
     if device_identifier == 26:
         s = Sensor(self.controller, "dualrelay", uid)
         for instance in ["0", "1"]:
             self.relays[s.uid + instance] = s
Ejemplo n.º 16
0
 def test_reading(self):
     temperatureSensor = Sensor("temperature")
     reading = temperatureSensor.getReading()
     self.assertTrue(reading['value'] >= 0 and reading['value'] <= 100)
Ejemplo n.º 17
0
 def __init__(self):
     self.lmotor = Motor(4, 0x09, 1)
     self.rmotor = Motor(4, 0x09, 2)
     self.camera = Camera()
     self.sensor = Sensor()
Ejemplo n.º 18
0
from sensors import Sensor
from valve import Valve
import front_end

percentage = 100

# Valve Definition and Classes
lox_main = Valve('LOX Propellant Valve', 'P8_13', 'P8_13', 'Prop', 4,
                 percentage)
lox_vent = Valve('LOX Vent Valve', 'P8_12', 0, 'Solenoid', 0, 0)
met_vent = Valve('Methane Vent Valve', 'P8_12', 0, 'Solenoid', 0, 0)
p_valve = Valve('Pressurant Valve', 'P8_12', 0, 'Solenoid', 0, 0)

# Pressure Sensor Definition and Classes
pressure_cold_flow = Sensor('pressure_cold_flow', 'pressure', 'P9_12', 'P9_14',
                            'P9_16', '000', '000', '000')

# Temperature Sensor Definition and Classes
temperature_fill_line = Sensor('temperature_fill_line', 'temperature', 'P9_12',
                               'P9_14', 'P9_16', '000', '000', '000')
temperature_empty_line = Sensor('temperature_empty_line', 'temperature',
                                'P9_12', 'P9_14', 'P9_16', '000', '000', '000')

print(
    "Before Test Start: Verify Electronic Connections and Follow Safety Procedures\n"
)
print("------------------------------------------")
print("\nProject Daedalus: Powerhead Hardware/Software Test\n")
print("""\

                   ._ o o
Ejemplo n.º 19
0
from sensors import Sensor
from sensors import Sensors
from wheels import Wheel
from wheels import MockWheel
from wheels import Wheels
import RPi.GPIO as GPIO
from runtime import Runtime
from processor import Processor

GPIO.setmode(GPIO.BOARD)

sensor1 = Sensor(11, 13)
sensor3 = Sensor(15, 16)
sensor5 = Sensor(18, 19)
sensor6 = Sensor(21, 22)
sensor8 = Sensor(23, 24)
sensor10 = Sensor(26, 29)

leftMotor = Wheel(5, 3, 7, 7)
rightMotor = Wheel(8, 10, 12, 1)
# rightMotor = MockWheel("rightWheel")

zrobot_runtime = Runtime(
    Sensors([sensor1, sensor3, sensor5, sensor6, sensor8, sensor10]),
    Processor(), Wheels(leftMotor, rightMotor))
zrobot_runtime.start()