Beispiel #1
0
# Modbus Connection Parameter
sensor_client_address = os.environ["EX9132_ADDRESS"]
sensor_client_port = os.environ["EX9132_PORT_1"]
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()
stopbits_sensors = os.environ["SPN1_STOPBITS"]
bytesize_sensors = os.environ["SPN1_BYTESIZE"]
timeout_sensors = os.environ["SPN1_TIMEOUT"]

# 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(client_address = sensor_client_address, \
    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
baudrate_sensors = os.environ["SPN1_BAUDRATE"]
parity_sensors = os.environ["SPN1_PARITY"]
stopbits_sensors = os.environ["SPN1_STOPBITS"]
bytesize_sensors = os.environ["SPN1_BYTESIZE"]
timeout_sensors = os.environ["SPN1_TIMEOUT"]

import logging
logging.basicConfig()
log = logging.getLogger()
log.setLevel(logging.DEBUG)

s = Sensors(client_address = sensor_client_address, \
    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)

s.get_temperature_northwest()
s.get_temperature_northeast()
s.get_temperature_east()
s.get_temperature_west()
s.get_temperature_southwest()
s.get_temperature_southeast()
s.get_flowrate_radiator()
from sensors_actuators_k004b.sensors import Sensors
import os

client_address_sensors = os.environ["EX9132_ADDRESS"]
client_port_sensors = os.environ["EX9132_PORT_1"]
server_address = os.environ["WT_ADDRESS"]
server_port = os.environ["WT_PORT"]

s = Sensors(client_address_sensors, client_port_sensors, server_address, server_port)

k = 0

while k < 5:

    print s.get_sensor_1()
 
    print s.get_sensor_2()
    
    print s.get_sensor_3()

    print s.get_sensor_4()

    print s.get_sensor_5()

    print s.get_sensor_6()

    k += 1

del s
Beispiel #5
0
# Modbus Connection Parameter - Port 1 Sensor, Port 2 Actuator
sensor_client_address = os.environ["EX9132_ADDRESS"]
sensor_client_port = os.environ["EX9132_PORT_1"]
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"]

#Infozwecke
#print server_address
#print server_port 

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

valve_open = 1.0
valve_closed = 0.0


# Rudimentaere Steuerung

try:

    while True:

        rtm1_0 = s.get_sensor_1()
        wt_3 = s.get_sensor_2()
        wt_2 = s.get_sensor_3()