Example #1
0
tariff.add_dr_period("2013-09-27 14:00:00", "2013-09-27 16:15:00")

my_load_shape.set_tariff(tariff)

# ----- build the baseline to use as a reference for performance ----- #
event_baseline = my_load_shape.baseline(weighting_days=14,
                                        modeling_interval=900,
                                        step_size=900)

# ----- calculate the performance summary for the event period ----- #
event_performance = my_load_shape.event_performance(DR_EVENT_START, DR_EVENT_END)

# ----- calculate the performance summary for the whole day ----- #
event_day_performance = my_load_shape.event_performance(DR_EVENT_DAY_START, DR_EVENT_DAY_END)

out = { "power_data": {} }
out["name"]                   = "DR Event - %s" % DR_EVENT_DAY_START
out["building"]               = BUILDING_NAME
out["event_start_at"]         = DR_EVENT_START
out["event_end_at"]           = DR_EVENT_END
out["dr_event_stats"]         = event_performance
out["dr_event_day_stats"]     = event_day_performance
out["power_data"]["actual"]   = my_load_shape.actual_data(DR_EVENT_DAY_START, DR_EVENT_DAY_END, step_size=900)
out["power_data"]["baseline"] = my_load_shape.baseline_data(DR_EVENT_DAY_START, DR_EVENT_DAY_END, step_size=900)

# ----- write output to file ----- #
file_name = path.join(EXAMPLES_DIR, "output", "dr-event-example.json")
write_json(data=out, file_name=file_name )

print "DR EVENT EXAMPLE COMPLETE"
    sq_ft=BUILDING_SQ_FT)

# ----- add exclusions as necessary ----- #
my_load_shape.add_exclusion("2013-09-23 00:00:00", "2013-09-24 00:00:00")
my_load_shape.add_exclusion("2013-09-27 00:00:00", "2013-09-28 00:00:00")
my_load_shape.add_named_exclusion("US_HOLIDAYS")

# ----- generate a 7 day baseline ----- #
seven_day_baseline = my_load_shape.baseline(start_at=WEEK_START,
                                            end_at=WEEK_END,
                                            weighting_days=14,
                                            modeling_interval=900,
                                            step_size=900)

# ----- assemble a payload summarizng the seven day baseline ----- #
out = {"power_data": {}}
out["building"] = BUILDING_NAME
out["baseline_start_at"] = WEEK_START
out["baseline_end_at"] = WEEK_END
out["error_stats"] = my_load_shape.error_stats
out["power_data"]["actual"] = my_load_shape.actual_data(WEEK_START, WEEK_END)
out["power_data"]["baseline"] = my_load_shape.baseline_data(
    WEEK_START, WEEK_END)

# ----- write output to file ----- #
file_name = path.join(EXAMPLES_DIR, "output",
                      "seven-day-baseline-example.json")
write_json(data=out, file_name=file_name)

print "SEVEN DAY BASELINE EXAMPLE COMPLETE"
    # tariff_schedule=tariff_schedule
    timezone="America/Los_Angeles",
    temp_units="F",
    sq_ft=BUILDING_SQ_FT,
)

# ----- add exclusions as necessary ----- #
my_load_shape.add_exclusion("2013-09-23 00:00:00", "2013-09-24 00:00:00")
my_load_shape.add_exclusion("2013-09-27 00:00:00", "2013-09-28 00:00:00")
my_load_shape.add_named_exclusion("US_HOLIDAYS")

# ----- generate a 7 day baseline ----- #
seven_day_baseline = my_load_shape.baseline(
    start_at=WEEK_START, end_at=WEEK_END, weighting_days=14, modeling_interval=900, step_size=900
)

# ----- assemble a payload summarizng the seven day baseline ----- #
out = {"power_data": {}}
out["building"] = BUILDING_NAME
out["baseline_start_at"] = WEEK_START
out["baseline_end_at"] = WEEK_END
out["error_stats"] = my_load_shape.error_stats
out["power_data"]["actual"] = my_load_shape.actual_data(WEEK_START, WEEK_END)
out["power_data"]["baseline"] = my_load_shape.baseline_data(WEEK_START, WEEK_END)

# ----- write output to file ----- #
file_name = path.join(EXAMPLES_DIR, "output", "seven-day-baseline-example.json")
write_json(data=out, file_name=file_name)

print "SEVEN DAY BASELINE EXAMPLE COMPLETE"