Esempio n. 1
0
def save_db_parameter(Parameter):
    with app.app_context():
        db=get_db()
        db.execute('insert into parameter(update_time,time1,temperature1,time2,temperature2,time3,temperature3,time4,temperature4, co2_upper_limit,co2_lower_limit, cooling_start_temperature,cooling_stop_temperature,\
                    expect_humidity,humidity_influence_range_of_air_temperature,low_humidity_influence_on_air_temperature,high_humidity_influence_on_air_temperature,expect_light,light_influence_on_air_temperature_slope,high_light_influence_on_temperature,low_light_influence_on_temperature,frost_temperature,\
                    indoor_temperature_lower_limit,roof_vent_wind_speed_upper_limit,roof_vent_rain_upper_limit, heating_start_lowest_temperature,heating_stop_highest_temperature, month_to_open_thermal_screen,month_to_close_thermal_screen,time_to_open_thermal_screen,time_to_close_thermal_screen, temperature_to_open_side,\
                    wait_time_to_open_side,rain_upper_limit_to_close, upper_limit_light_to_open_shade_screen_out,upper_limit_light_to_open_shade_screen_in,soil_humidity_to_start_irrigation,soil_humidity_to_stop_irrigation,temperature_to_open_fogging,temperature_to_open_cooling_pad,\
                    month_to_open_lighting,month_to_close_lighting,period1_start_lighting,period1_stop_lighting,period2_start_lighting,period2_stop_lighting,radiation1_to_open_lighting,radiation2_to_open_lighting,roof_vent_open_time,side_vent_open_time,shade_screen_out_open_time,\
                    shade_screen_in_open_time,thermal_screen_open_time ) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',\
                    [get_current_time(),Parameter.get_time_1(),Parameter.get_temperature_1(),Parameter.get_time_2(),Parameter.get_temperature_2(),Parameter.get_time_3(),Parameter.get_temperature_3(),Parameter.get_time_4(),Parameter.get_temperature_4(),Parameter.get_co_2_upper_limit(),Parameter.get_co_2_lower_limit(),
                     Parameter.get_cooling_start_temperature(),Parameter.get_cooling_stop_temperature(),
                     Parameter.get_expect_humidity(),Parameter.get_humidity_influence_range_of_air_temperature(),Parameter.get_low_humidity_influence_on_air_temperature(),Parameter.get_high_humidity_influence_on_air_temperature(),Parameter.get_expect_light(),Parameter.get_light_influence_on_air_temperature_slope(),
                     Parameter.get_high_light_influence_on_temperature(),Parameter.get_low_light_influence_on_temperature(),Parameter.get_frost_temperature(),Parameter.get_indoor_temperature_lower_limit(),Parameter.get_roof_vent_wind_speed_upper_limit(),Parameter.get_roof_vent_rain_upper_limit(),
                     Parameter.get_heating_start_lowest_temperature(),Parameter.get_heating_stop_highest_temperature(),Parameter.get_month_to_open_thermal_screen(),Parameter.get_month_to_close_thermal_screen(),Parameter.get_time_to_open_thermal_screen(),Parameter.get_time_to_close_thermal_screen(),
                     Parameter.get_temperature_to_open_side(),
                     Parameter.get_wait_time_to_open_side(),
                     Parameter.get_rani_upper_limit_to_close(),
                     Parameter.get_upper_limit_light_to_open_shade_screen_out(),
                     Parameter.get_upper_limit_light_to_open_shade_screen_in(),
                     Parameter.get_soil_humidity_to_start_irrigation(),
                     Parameter.get_soil_humidity_to_stop_irrigation(),
                     Parameter.get_temperature_to_open_fogging(),
                     Parameter.get_temperature_to_open_cooling_pad(),
                     Parameter.get_month_to_open_lighting(),
                     Parameter.get_month_to_close_lighting(),
                     Parameter.get_period_1_start_lighting(),
                     Parameter.get_period_1_stop_lighting(),
                     Parameter.get_period_2_start_lighting(),
                     Parameter.get_period_2_stop_lighting(),
                     Parameter.get_radiation_1_to_open_lighting(),
                     Parameter.get_radiation_2_to_open_lighting(),
                     Parameter.get_roof_vent_open_time(),
                     Parameter.get_side_vent_time(),
                     Parameter.get_shade_screen_out_time(),
                     Parameter.get_shade_screen_in_time(),
                     Parameter.get_thermal_screen_open_time()
                     ])
        db.commit()
        print 'parameter save success'