def __init__(self, name, heat_transfer_coefficient = 1, pressure_drop_Pa = 500, a_volume_m3 = 10, b_volume_m3 = 10, contact_area_m2 = physics.medium_heat_exchanger_area_m2, a_pipe_size_m2 = physics.medium_pipe_size_m2, b_pipe_size_m2 = physics.medium_pipe_size_m2, connector_lengths_m = 0.5, height_m=5.0, base_height_m=0): component.__init__(self, name) self.a_volume_m3 = a_volume_m3 self.b_volume_m3 = b_volume_m3 self.a_fluid = self._add_fluid(fluid(name+".a", self.a_volume_m3 / (height_m/2), height_m, base_height_m)) self.b_fluid = self._add_fluid(fluid(name+".b", self.b_volume_m3 / (height_m/2), height_m, base_height_m)) self.a_in = self.a_fluid.add_port(port("a_in", self.a_fluid, a_pipe_size_m2, connector_lengths_m, height_m)) self.a_out = self.a_fluid.add_port(port("a_out", self.a_fluid, a_pipe_size_m2, connector_lengths_m, height_m)) self.b_in = self.b_fluid.add_port(port("b_in", self.b_fluid, b_pipe_size_m2, connector_lengths_m, height_m)) self.b_out = self.b_fluid.add_port(port("b_out", self.b_fluid, b_pipe_size_m2, connector_lengths_m, height_m)) self.contact_area_m2 = contact_area_m2 self.heat_transfer_coefficient = heat_transfer_coefficient self.pressure_drop_Pa = pressure_drop_Pa
def __init__(self, name, length_m = 1, area_m2 = physics.medium_pipe_size_m2, height_m=0): component.__init__(self, name) self.length_m = length_m self.area_m2 = area_m2 self.volume_m3 = area_m2 * length_m self.fluid = self._add_fluid(fluid(name, self.area_m2, length_m, height_m - length_m / 2.0)) self.in_port = self.fluid.add_port(port("in", self.fluid, area_m2, length_m/2.0, height_m)) self.out_port = self.fluid.add_port(port("out", self.fluid, area_m2, length_m/2.0, height_m))
def __init__(self, int_select): self.dev = Device(mode='b', interface_select = int_select, auto_detach=False, device_id = 'Dual RS232-HS' ) self.write_port_l = 0x80 self.read_port_l = 0x81 self.write_port_h = 0x82 self.read_port_h = 0x83 self.port_l = port(self.dev,self.write_port_l, self.read_port_l) self.port_h = port(self.dev,self.write_port_h, self.read_port_h)
def __init__(self, name, length_m = 20.0, start_height_m = 0.0, end_height_m = 0.0, area_m2 = physics.medium_pipe_size_m2): component.__init__(self, name) self.length_m = length_m self.area_m2 = area_m2 self.volume_m3 = area_m2 * length_m base_h = min(start_height_m, end_height_m) h = max(start_height_m, end_height_m) - base_h # TODO: Better area for pipe, base on slope self.fluid = self._add_fluid(fluid(name, self.area_m2, h, base_h)) self.in_port = self.fluid.add_port(port("in_port", self.fluid, area_m2, length_m/2.0, start_height_m)) self.out_port = self.fluid.add_port(port("out_port", self.fluid, area_m2, length_m/2.0, end_height_m))
def __init__(self, name, max_pressure_Pa = physics.medium_pump_pressure_Pa, height_m = 1, base_height_m = 0, area_m2 = physics.medium_pipe_size_m2, pump_length_m = 2): component.__init__(self, name) self.length_m = pump_length_m self.area_m2 = area_m2 self.volume_m3 = self.area_m2 * self.length_m self.fluid = self._add_fluid(fluid(name, self.volume_m3, height_m, base_height_m)) self.in_port = self.fluid.add_port(port("in", self.fluid, area_m2, pump_length_m/2.0, height_m)) self.out_port = self.fluid.add_port(port("out", self.fluid, area_m2, pump_length_m/2.0, height_m)) self.max_pressure_Pa = max_pressure_Pa self.adjust_power(0.5)
def __init__(self, name, length_m=1, area_m2=physics.medium_pipe_size_m2, height_m=0): component.__init__(self, name) self.length_m = length_m self.area_m2 = area_m2 self.volume_m3 = area_m2 * length_m self.fluid = self._add_fluid( fluid(name, self.area_m2, length_m, height_m - length_m / 2.0)) self.in_port = self.fluid.add_port( port("in", self.fluid, area_m2, length_m / 2.0, height_m)) self.out_port = self.fluid.add_port( port("out", self.fluid, area_m2, length_m / 2.0, height_m))
def main(): print('start') do_connect() sleep_ms(10000) sensor1 = Ultrasonic(14, 13) p = port(2) led = machine.Pin(0, machine.Pin.OUT) led.value(0) while True: # (tem,hum) = medirTemHum() # displaytem(tem,hum) tem = 'TEST1' hum = 'TEST2' temp = oneWire() dist = sensor1.distance_in_cm() print("Sensor1 (Metric System)", dist, "cm") envioMQTT(SERVER, TOPIC1, str(temp)) envioMQTT(SERVER, TOPIC2, str(dist)) #envioMQTT(SERVER,TOPIC2,()) # recepcionMQTT() sleep_ms(5000) led.value(1) sleep_ms(5000) led.value(0)
def __init__(self, name, length_m=20.0, start_height_m=0.0, end_height_m=0.0, area_m2=physics.medium_pipe_size_m2): component.__init__(self, name) self.length_m = length_m self.area_m2 = area_m2 self.volume_m3 = area_m2 * length_m base_h = min(start_height_m, end_height_m) h = max(start_height_m, end_height_m) - base_h # TODO: Better area for pipe, base on slope self.fluid = self._add_fluid(fluid(name, self.area_m2, h, base_h)) self.in_port = self.fluid.add_port( port("in_port", self.fluid, area_m2, length_m / 2.0, start_height_m)) self.out_port = self.fluid.add_port( port("out_port", self.fluid, area_m2, length_m / 2.0, end_height_m))
def __init__(self, name, heat_transfer_coefficient=1, pressure_drop_Pa=500, a_volume_m3=10, b_volume_m3=10, contact_area_m2=physics.medium_heat_exchanger_area_m2, a_pipe_size_m2=physics.medium_pipe_size_m2, b_pipe_size_m2=physics.medium_pipe_size_m2, connector_lengths_m=0.5, height_m=5.0, base_height_m=0): component.__init__(self, name) self.a_volume_m3 = a_volume_m3 self.b_volume_m3 = b_volume_m3 self.a_fluid = self._add_fluid( fluid(name + ".a", self.a_volume_m3 / (height_m / 2), height_m, base_height_m)) self.b_fluid = self._add_fluid( fluid(name + ".b", self.b_volume_m3 / (height_m / 2), height_m, base_height_m)) self.a_in = self.a_fluid.add_port( port("a_in", self.a_fluid, a_pipe_size_m2, connector_lengths_m, height_m)) self.a_out = self.a_fluid.add_port( port("a_out", self.a_fluid, a_pipe_size_m2, connector_lengths_m, height_m)) self.b_in = self.b_fluid.add_port( port("b_in", self.b_fluid, b_pipe_size_m2, connector_lengths_m, height_m)) self.b_out = self.b_fluid.add_port( port("b_out", self.b_fluid, b_pipe_size_m2, connector_lengths_m, height_m)) self.contact_area_m2 = contact_area_m2 self.heat_transfer_coefficient = heat_transfer_coefficient self.pressure_drop_Pa = pressure_drop_Pa
def __init__(self, name, max_pressure_Pa=physics.medium_pump_pressure_Pa, height_m=1, base_height_m=0, area_m2=physics.medium_pipe_size_m2, pump_length_m=2): component.__init__(self, name) self.length_m = pump_length_m self.area_m2 = area_m2 self.volume_m3 = self.area_m2 * self.length_m self.fluid = self._add_fluid( fluid(name, self.volume_m3, height_m, base_height_m)) self.in_port = self.fluid.add_port( port("in", self.fluid, area_m2, pump_length_m / 2.0, height_m)) self.out_port = self.fluid.add_port( port("out", self.fluid, area_m2, pump_length_m / 2.0, height_m)) self.max_pressure_Pa = max_pressure_Pa self.adjust_power(0.5)
def __init__(self, name, height_m=-2.0, pipe_size_m2=physics.large_pipe_size_m2, pipe_length_m=20.0, river_temperature_C=18.0): component.__init__(self, name) self.height_m = height_m self.river_water = self._add_fluid( fluid(name, 100, 10, -5, 0.5, True, True, river_temperature_C)) self.port = self.river_water.add_port( port("river", self.river_water, pipe_size_m2, pipe_length_m, height_m))
def add_port(self, name, area_m2 = 0.25, length_m = 0.5, relative_height_m = 0): return self.fluid.add_port(port(name, self.fluid, area_m2, length_m, relative_height_m))
def scanport(url): port.port(url)
def __init__(self, name, height_m=-2.0, pipe_size_m2=physics.large_pipe_size_m2, pipe_length_m=20.0, river_temperature_C=18.0): component.__init__(self, name) self.height_m = height_m self.river_water = self._add_fluid(fluid(name, 100, 10, -5, 0.5, True, True, river_temperature_C)) self.port = self.river_water.add_port(port("river", self.river_water, pipe_size_m2, pipe_length_m, height_m))
def add_port(self, name, area_m2=0.25, length_m=0.5, relative_height_m=0): return self.fluid.add_port( port(name, self.fluid, area_m2, length_m, relative_height_m))
def port(self): print "Port Activity opened @ %.19s"%(datetime.now()) self.por = tk.Toplevel(self.parent) self.app=port(self.por)