Example #1
0
def update(temp_data):
    WUurl = "https://weatherstation.wunderground.com/weatherstation/updateweatherstation.php?"
    WU_station_id = os.getenv("WEATHER_UNDERGROUND_STATION_ID", "None")
    WU_station_pwd = os.getenv("WEATHER_UNDERGROUND_STATION_KEY", "None")
    WUcreds = "ID=" + WU_station_id + "&PASSWORD="******"&dateutc=now"
    action_str = "&action=updateraw"

    r = requests.get(
        WUurl + WUcreds + date_str + "&baromin=" +
        "{0:.2f}".format(util.hpa_to_in(temp_data['pressure_hpa'])) +
        "&tempf=" + "{0:.2f}".format(util.c_to_f(temp_data['temperature_c'])) +
        "&dewptf=" + "{0:.2f}".format(util.c_to_f(temp_data['dew_point_c'])) +
        "&humidity=" + "{0:.2f}".format(temp_data['humidity']) + action_str)
    print(r)
    return r.status_code
Example #2
0
  experiment_model_2.iterate(ext_temp)
  experiment_model_3.iterate(ext_temp)
  price_mwh = pricedata.price(d)
  control_cost = control_model.power_cost(price_mwh)
  experiment_cost = experiment_model.power_cost(price_mwh)
  experiment_cost_2 = experiment_model_2.power_cost(price_mwh)
  experiment_cost_3 = experiment_model_3.power_cost(price_mwh)
  if greedy_strategy.current_swing > 0:
    total_cost_control += control_cost
    total_cost_experiment += experiment_cost
    total_cost_experiment_2 += experiment_cost_2
    total_cost_experiment_3 += experiment_cost_3
  if max_temp_control < control_model.temp:
    max_temp_control = control_model.temp
  if max_temp_exp < experiment_model.temp:
    max_temp_exp = experiment_model.temp
  if max_temp_exp_2 < experiment_model_2.temp:
    max_temp_exp_2 = experiment_model_2.temp
  if max_temp_exp_3 < experiment_model_3.temp:
    max_temp_exp_3 = experiment_model_3.temp

  #if i % 20 == 0:
    #print "%s, %.2f, %.2f, %.2f, %.2f" % (d, \
    #  util.c_to_f(control_model.temp), util.c_to_f(experiment_model.temp), \
    #  util.c_to_f(experiment_model_2.temp), util.c_to_f(experiment_model_3.temp)) 

print "Control market cost: ", total_cost_control, util.c_to_f(max_temp_control)
print "Curtailed with Precharging: ", total_cost_experiment, util.c_to_f(max_temp_exp)
print "Harsh curtailment: ", total_cost_experiment_2, util.c_to_f(max_temp_exp_2)
print "Curtailed, no precharging: ", total_cost_experiment_3, util.c_to_f(max_temp_exp_3)
Example #3
0
File: test.py Project: sweis/thermo
control_model.temp = util.f_to_c(78)
control_model.therm.state = 1
i = 0
while control_model.therm.state:
  #print i, util.c_to_f(control_model.temp)
  i+=1
  control_model.iterate(util.f_to_c(85))


no_cooling_model = Model(thermostat = NoThermostat(), time_step_in_hours = timestep, internal_temp_celcius = util.f_to_c(68))
no_cooling_model_2 = Model(thermostat = NoThermostat(), time_step_in_hours = timestep, internal_temp_celcius = util.f_to_c(68))
no_cooling_model_3 = Model(thermostat = NoThermostat(), time_step_in_hours = timestep, internal_temp_celcius = util.f_to_c(68))

i = 0
while no_cooling_model.temp < util.f_to_c(85) and i < 420:
  print i, util.c_to_f(no_cooling_model.temp)
  i+=1
  no_cooling_model.iterate(util.f_to_c(85))

#for i in range(0, 200):
#  print "%d, %s, %s, %s" % (i, util.c_to_f(no_cooling_model.temp), util.c_to_f(no_cooling_model_2.temp), util.c_to_f(no_cooling_model_3.temp))
#  no_cooling_model.iterate(util.f_to_c(85))
#  no_cooling_model_2.iterate(util.f_to_c(85))
#  no_cooling_model_3.iterate(util.f_to_c(95))

#for i in range(1, tempdata.timespan):
  #ext_temp = tempdata.external_temp(i)
  #no_cooling_model.iterate(ext_temp)
  #control_model.iterate(ext_temp)
  #control_model_2.iterate(ext_temp)
  #print "%s, %.1f, %.1f, %.1f, %.1f" % (tempdata.steptime_to_date(i), util.c_to_f(ext_temp), \