Beispiel #1
0
actuator_client_address = os.environ["EX9132_ADDRESS"]
actuator_client_port = os.environ["EX9132_PORT_2"]
# http Connection Parameter
server_address = os.environ["WT_ADDRESS"]
server_port = os.environ["WT_PORT"]
# DB Connection parameter
db_name = os.environ["DB_NAME"]
db_host = os.environ["DB_HOST"]
db_port = os.environ["DB_PORT"]
db_user = os.environ["DB_USER"]
user_password = os.environ["USER_PASSWORD"]

s = Sensors(sensor_client_address, sensor_client_port,server_address, server_port)
a = Actuators(actuator_client_address, actuator_client_port)

dbi = DBInsert(db_name = db_name, db_host = db_host, db_port = db_port, db_user = db_user, user_password = user_password)

valve_open = 1.0
valve_closed = 0.0

try:
    while True:
        time_measurement = time.time()
        rtm1_0 = s.get_temperature_northeast()
        wt_3 = s.get_temperature_northwest()
        wt_2 = s.get_temperature_west()
        rtm1_1 = s.get_temperature_southwest()
        wt_0 = s.get_temperature_southeast()
        wt_1 = s.get_temperature_east()
        ex9024_level = a.get_valve_position()
        flowrate = s.get_flowrate()
    client_port = sensor_client_port, \
    server_address = server_address, \
    server_port = server_port, \
    serial_port = serial_port_sensors, \
    baudrate = baudrate_sensors, \
    parity = parity_sensors, \
    stopbits = stopbits_sensors, \
    bytesize = bytesize_sensors, \
    timeout = timeout_sensors)

a = Actuators(client_address = actuator_client_address, \
    client_port = actuator_client_port)

dbi = DBInsert(db_name = db_name, \
    db_host = db_host, \
    db_port = db_port, \
    db_user = db_user, \
    user_password = user_password)

valve_open = 1.0
valve_closed = 0.0

# Two point control of K004b
try:

    while True:

        time_measurement = time.time()
        time_new_loop = time_measurement + 60.0

        ltime = time.localtime(time_measurement)