Пример #1
0
def co2_control(Indoor, Parameter):
    global auto_co2
    if Indoor.get_co2() < Parameter.get_co_2_lower_limit():
        bi_state_relay_output("co2", "on")
        auto_co2 = "on"
    elif Indoor.get_co2() > Parameter.get_co_2_upper_limit():
        bi_state_relay_output("co2", "off")
        auto_co2 = "off"
Пример #2
0
def co2_control(Indoor, Parameter):
    global auto_co2
    if Indoor.get_co2() < Parameter.get_co_2_lower_limit():
        bi_state_relay_output("co2", "on")
        auto_co2 = "on"
    elif Indoor.get_co2() > Parameter.get_co_2_upper_limit():
        bi_state_relay_output("co2", "off")
        auto_co2 = "off"
Пример #3
0
def heating_control(Indoor, Parameter):  #ok
    if Indoor.get_temperature(
    ) < Parameter.get_heating_start_lowest_temperature():
        bi_state_relay_output("heating", "on")
    #         self.control.set_heating("on")
    elif Indoor.get_temperature(
    ) > Parameter.get_heating_stop_highest_temperature():
        bi_state_relay_output("heating", "on")
Пример #4
0
def cooling_pad_control(Indoor, Parameter):
    global auto_cooling_pad
    if float(Indoor.get_temperature()) > float(Parameter.get_temperature_to_open_cooling_pad()) + 1:
        bi_state_relay_output("cooling_pad", "on")
        auto_cooling_pad = "on"
    #         self.control.set_cooling_pad("on")
    elif float(Indoor.get_temperature()) < float(Parameter.get_temperature_to_open_cooling_pad()) - 1:
        bi_state_relay_output("cooling_pad", "off")
        auto_cooling_pad = "off"
Пример #5
0
def fogging_control(Indoor, Parameter):
    if float(Indoor.get_temperature()) > float(Parameter.get_temperature_to_open_fogging()) + 1:
        bi_state_relay_output("fogging", "on")
        auto_fogging = "on"
    #         Control.set_fogging("on")
    # if Control.get_thermal_screen()=="on"
    #    Control.set_thermal_screen("off")
    elif float(Indoor.get_temperature()) < float(Parameter.get_temperature_to_open_fogging()) - 1:
        bi_state_relay_output("fogging", "off")
        auto_fogging = "off"
Пример #6
0
def cooling_pad_control(Indoor, Parameter):
    global auto_cooling_pad
    if float(Indoor.get_temperature()) > float(
            Parameter.get_temperature_to_open_cooling_pad()) + 1:
        bi_state_relay_output("cooling_pad", "on")
        auto_cooling_pad = "on"
    #         self.control.set_cooling_pad("on")
    elif float(Indoor.get_temperature()) < float(
            Parameter.get_temperature_to_open_cooling_pad()) - 1:
        bi_state_relay_output("cooling_pad", "off")
        auto_cooling_pad = "off"
Пример #7
0
def fogging_control(Indoor, Parameter):
    if float(Indoor.get_temperature()) > float(
            Parameter.get_temperature_to_open_fogging()) + 1:
        bi_state_relay_output("fogging", "on")
        auto_fogging = "on"
    #         Control.set_fogging("on")
    # if Control.get_thermal_screen()=="on"
    #    Control.set_thermal_screen("off")
    elif float(Indoor.get_temperature()) < float(
            Parameter.get_temperature_to_open_fogging()) - 1:
        bi_state_relay_output("fogging", "off")
        auto_fogging = "off"
Пример #8
0
def lighting_control(Control, Outdoor, Parameter):
    global lighting_stop_time, lighting_stop_time2, lighting_stop_time3
    auto_lighting_1 = Control.get_lighting_1()
    auto_lighting_2 = Control.get_lighting_2()
    if auto_lighting_1 == "off" and auto_lighting_2 == "off":
        if get_current_month() > Parameter.get_month_to_open_lighting() and get_current_month() < Parameter.get_month_to_close_lighting():
            if get_current_time() > Parameter.get_period_1_start_lighting() and get_current_time() < Parameter.get_period_1_stop_lighting():
                if Outdoor.get_radiation() < Parameter.get_radiation_1_to_open_lighting():
                    #                         Control.set_lighting_1("on")
                    bi_state_relay_output("lighting_1", "on")
                    auto_lighting_1 = "on"
                    lighting_open_time = get_time()
            elif get_current_time() > Parameter.get_period_2_start_lighting() and get_current_time() < Parameter.get_period_2_stop_lighting():
                if Outdoor.get_radiation() < Parameter.get_radiation_2_to_open_lighting():
                    #                         Control.set_lighting_1("on")
                    bi_state_relay_output("lighting_2", "on")
                    auto_lighting_2 = "on"
                    lighting_open_time2 = get_time()

    elif auto_lighting_1 == "on" and auto_lighting_2 == "off":
        t1 = int(get_time() - lighting_open_time)
        t2 = int(get_time() - lighting_open_time2)
        if t1 > 1750 and t1 < 1850:
            bi_state_relay_output("ligting_2", "on")
            auto_lighting_2 = "on"
        #                 Control.set_lighting_2("on")
        if t2 > 1750 and t2 < 1850:
            #                 Control.set_lighting_2("on")
            bi_state_relay_output("ligting_2", "on")
            auto_lighting_2 = "on"
    elif auto_lighting_1 == "on" and auto_lighting_2 == "on":
        if get_current_time() > Parameter.get_period_1_start_lighting() and get_current_time() < Parameter.get_period_1_stop_lighting():
            if Outdoor.get_radiation() > Parameter.get_radiation_1_to_open_lighting():
                #                     Control.set_lighting_1("off")
                bi_state_relay_output("ligting_1", "off")
                auto_lighting_1 = "off"
                lighting_stop_time = get_time()
        elif get_current_time() > Parameter.get_period_2_start_lighting() and get_current_time() < Parameter.get_period_2_stop_lighting():
            if Outdoor.get_radiation() > Parameter.get_radiation_2_to_open_lighting():
                #                     Control.set_lighting_1("off")
                bi_state_relay_output("ligting_1", "off")
                auto_lighting_1 = "off"
                lighting_stop_time2 = get_time()
        else:
            #                 Control.set_lighting_1("off")
            bi_state_relay_output("ligting_1", "off")
            auto_lighting_1 = "off"
            lighting_stop_time3 = get_time()

    elif auto_lighting_1 == "off" and auto_lighting_2 == "on":
        t3 = get_time() - lighting_stop_time3
        t4 = get_time() - lighting_stop_time2
        t5 = get_time() - lighting_stop_time
        if t3 > 1750 and t3 < 1850:
            bi_state_relay_output("ligting_2", "off")
        #                 Control.set_lighting_2("off")
        if t4 > 1750 and t4 < 1850:
            bi_state_relay_output("ligting_2", "off")
        #                 Control.set_lighting_2("off")
        if t5 > 1750 and t5 < 1850:
            bi_state_relay_output("ligting_2", "off")
        #                 Control.set_lighting_2("off")
    else:
        bi_state_relay_output("ligting_2", "off")
        bi_state_relay_output("ligting_1", "off")
Пример #9
0
def heating_control(Indoor, Parameter):  #ok
    if Indoor.get_temperature() < Parameter.get_heating_start_lowest_temperature():
        bi_state_relay_output("heating", "on")
    #         self.control.set_heating("on")
    elif Indoor.get_temperature() > Parameter.get_heating_stop_highest_temperature():
        bi_state_relay_output("heating", "on")
Пример #10
0
def lighting_control(Control, Outdoor, Parameter):
    global lighting_stop_time, lighting_stop_time2, lighting_stop_time3
    auto_lighting_1 = Control.get_lighting_1()
    auto_lighting_2 = Control.get_lighting_2()
    if auto_lighting_1 == "off" and auto_lighting_2 == "off":
        if get_current_month() > Parameter.get_month_to_open_lighting(
        ) and get_current_month() < Parameter.get_month_to_close_lighting():
            if get_current_time() > Parameter.get_period_1_start_lighting(
            ) and get_current_time() < Parameter.get_period_1_stop_lighting():
                if Outdoor.get_radiation(
                ) < Parameter.get_radiation_1_to_open_lighting():
                    #                         Control.set_lighting_1("on")
                    bi_state_relay_output("lighting_1", "on")
                    auto_lighting_1 = "on"
                    lighting_open_time = get_time()
            elif get_current_time() > Parameter.get_period_2_start_lighting(
            ) and get_current_time() < Parameter.get_period_2_stop_lighting():
                if Outdoor.get_radiation(
                ) < Parameter.get_radiation_2_to_open_lighting():
                    #                         Control.set_lighting_1("on")
                    bi_state_relay_output("lighting_2", "on")
                    auto_lighting_2 = "on"
                    lighting_open_time2 = get_time()

    elif auto_lighting_1 == "on" and auto_lighting_2 == "off":
        t1 = int(get_time() - lighting_open_time)
        t2 = int(get_time() - lighting_open_time2)
        if t1 > 1750 and t1 < 1850:
            bi_state_relay_output("ligting_2", "on")
            auto_lighting_2 = "on"
        #                 Control.set_lighting_2("on")
        if t2 > 1750 and t2 < 1850:
            #                 Control.set_lighting_2("on")
            bi_state_relay_output("ligting_2", "on")
            auto_lighting_2 = "on"
    elif auto_lighting_1 == "on" and auto_lighting_2 == "on":
        if get_current_time() > Parameter.get_period_1_start_lighting(
        ) and get_current_time() < Parameter.get_period_1_stop_lighting():
            if Outdoor.get_radiation(
            ) > Parameter.get_radiation_1_to_open_lighting():
                #                     Control.set_lighting_1("off")
                bi_state_relay_output("ligting_1", "off")
                auto_lighting_1 = "off"
                lighting_stop_time = get_time()
        elif get_current_time() > Parameter.get_period_2_start_lighting(
        ) and get_current_time() < Parameter.get_period_2_stop_lighting():
            if Outdoor.get_radiation(
            ) > Parameter.get_radiation_2_to_open_lighting():
                #                     Control.set_lighting_1("off")
                bi_state_relay_output("ligting_1", "off")
                auto_lighting_1 = "off"
                lighting_stop_time2 = get_time()
        else:
            #                 Control.set_lighting_1("off")
            bi_state_relay_output("ligting_1", "off")
            auto_lighting_1 = "off"
            lighting_stop_time3 = get_time()

    elif auto_lighting_1 == "off" and auto_lighting_2 == "on":
        t3 = get_time() - lighting_stop_time3
        t4 = get_time() - lighting_stop_time2
        t5 = get_time() - lighting_stop_time
        if t3 > 1750 and t3 < 1850:
            bi_state_relay_output("ligting_2", "off")
        #                 Control.set_lighting_2("off")
        if t4 > 1750 and t4 < 1850:
            bi_state_relay_output("ligting_2", "off")
        #                 Control.set_lighting_2("off")
        if t5 > 1750 and t5 < 1850:
            bi_state_relay_output("ligting_2", "off")
        #                 Control.set_lighting_2("off")
    else:
        bi_state_relay_output("ligting_2", "off")
        bi_state_relay_output("ligting_1", "off")