Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs for df lighting and tstat measures #249

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions national/housing_characteristics/options_lookup.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -4727,6 +4727,7 @@ fault_economizer_damper_fully_closed Fault nov fault_hvac_economizer_damper_stuc
fault_economizer_damper_fully_closed Fault dec fault_hvac_economizer_damper_stuck apply_measure=true econ_choice=all available economizer start_month=12 start_day=1 duration_days=31 damper_pos=0.0
fault_economizer_damper_fully_closed dummy_option_does_nothing fault_hvac_economizer_damper_stuck
thermostat_control_load_shed shed_full_baseline_15min upgrade_df_thermostat_control_load_shed demand_flexibility_objective=peak load peak_len=4 rebound_len=2 sp_adjustment=2.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak cambium_scenario=LRMER_MidCase_15
thermostat_control_load_shed shed_full_baseline_maxsavings_15min upgrade_df_thermostat_control_load_shed demand_flexibility_objective=peak load peak_len=4 rebound_len=2 sp_adjustment=2.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=max savings cambium_scenario=LRMER_MidCase_15
thermostat_control_load_shed shed_full_baseline_60min upgrade_df_thermostat_control_load_shed demand_flexibility_objective=peak load peak_len=4 rebound_len=2 sp_adjustment=2.0 num_timesteps_in_hr=1 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak cambium_scenario=LRMER_MidCase_15
thermostat_control_load_shed shed_bin_sample_15min upgrade_df_thermostat_control_load_shed demand_flexibility_objective=peak load peak_len=4 rebound_len=2 sp_adjustment=2.0 num_timesteps_in_hr=4 load_prediction_method=bin sample peak_lag=2 peak_window_strategy=center with peak cambium_scenario=LRMER_MidCase_15
thermostat_control_load_shed shed_bin_sample_60min upgrade_df_thermostat_control_load_shed demand_flexibility_objective=peak load peak_len=4 rebound_len=2 sp_adjustment=2.0 num_timesteps_in_hr=1 load_prediction_method=bin sample peak_lag=2 peak_window_strategy=center with peak cambium_scenario=LRMER_MidCase_15
Expand All @@ -4739,19 +4740,20 @@ thermostat_control_load_shed shed_full_baseline_15min_3hpeak upgrade_df_thermost
thermostat_control_load_shed shed_full_baseline_15min_norebound upgrade_df_thermostat_control_load_shed demand_flexibility_objective=peak load peak_len=4 rebound_len=0 sp_adjustment=2.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak cambium_scenario=LRMER_MidCase_15
thermostat_control_load_shed shed_full_baseline_15min_3cspa upgrade_df_thermostat_control_load_shed demand_flexibility_objective=peak load peak_len=4 rebound_len=2 sp_adjustment=3.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak cambium_scenario=LRMER_MidCase_15
thermostat_control_load_shift shift_full_baseline_15min upgrade_df_thermostat_control_load_shift peak_len=4 prepeak_len=2 sp_adjustment=1.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak
thermostat_control_load_shift shift_full_baseline_maxsavings_15min upgrade_df_thermostat_control_load_shift peak_len=4 prepeak_len=2 sp_adjustment=1.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=max savings
thermostat_control_load_shift shift_full_baseline_60min upgrade_df_thermostat_control_load_shift peak_len=4 prepeak_len=2 sp_adjustment=1.0 num_timesteps_in_hr=1 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak
thermostat_control_load_shift shift_full_baseline_15min_3hpeak upgrade_df_thermostat_control_load_shift peak_len=3 prepeak_len=2 sp_adjustment=1.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak
thermostat_control_load_shift shift_full_baseline_15min_1hprepeak upgrade_df_thermostat_control_load_shift peak_len=4 prepeak_len=1 sp_adjustment=1.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak
thermostat_control_load_shift shift_full_baseline_15min_2cspa upgrade_df_thermostat_control_load_shift peak_len=4 prepeak_len=2 sp_adjustment=2.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak
df_precooling precooling_12to4pm_yearround precooling cooling_adjustment=-4.0 starttime_cooling=11:59:00 endtime_cooling=15:59:00 cooling_startdate=01-01 cooling_enddate=12-31 auto_date=false alt_periods=false
lighting_load_shed light_shed_abs_30_15min upgrade_df_lighting_control demand_flexibility_objective=peak load peak_len=4 light_adjustment_method=absolute change light_adjustment=30.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak cambium_scenario=LRMER_LowRECost_15 cambium_scenario=LRMER_MidCase_15
lighting_load_shed light_shed_abs_30_maxsavings_15min upgrade_df_lighting_control demand_flexibility_objective=peak load peak_len=4 light_adjustment_method=absolute change light_adjustment=30.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=max savings cambium_scenario=LRMER_LowRECost_15 cambium_scenario=LRMER_MidCase_15
lighting_load_shed light_shed_abs_20_15min upgrade_df_lighting_control demand_flexibility_objective=peak load peak_len=4 light_adjustment_method=absolute change light_adjustment=20.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak cambium_scenario=LRMER_LowRECost_15 cambium_scenario=LRMER_MidCase_15
lighting_load_shed light_shed_abs_50_15min upgrade_df_lighting_control demand_flexibility_objective=peak load peak_len=4 light_adjustment_method=absolute change light_adjustment=50.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak cambium_scenario=LRMER_LowRECost_15 cambium_scenario=LRMER_MidCase_15
lighting_load_shed light_shed_rel_30_15min upgrade_df_lighting_control demand_flexibility_objective=peak load peak_len=4 light_adjustment_method=relative change light_adjustment=30.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak cambium_scenario=LRMER_LowRECost_15 cambium_scenario=LRMER_MidCase_15
lighting_load_shed light_shed_rel_30_maxsavings_15min upgrade_df_lighting_control demand_flexibility_objective=peak load peak_len=4 light_adjustment_method=relative change light_adjustment=30.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=max savings cambium_scenario=LRMER_LowRECost_15 cambium_scenario=LRMER_MidCase_15
lighting_load_shed light_shed_rel_20_15min upgrade_df_lighting_control demand_flexibility_objective=peak load peak_len=4 light_adjustment_method=relative change light_adjustment=20.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak cambium_scenario=LRMER_LowRECost_15 cambium_scenario=LRMER_MidCase_15
lighting_load_shed light_shed_rel_50_15min upgrade_df_lighting_control demand_flexibility_objective=peak load peak_len=4 light_adjustment_method=relative change light_adjustment=50.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak cambium_scenario=LRMER_MidCase_15 cambium_scenario=LRMER_LowRECost_15
lighting_load_shed light_shed_abs_30_15min upgrade_df_lighting_control demand_flexibility_objective=peak load peak_len=4 light_adjustment_method=absolute change light_adjustment=30.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak cambium_scenario=LRMER_MidCase_15
lighting_load_shed light_shed_abs_30_maxsavings_15min upgrade_df_lighting_control demand_flexibility_objective=peak load peak_len=4 light_adjustment_method=absolute change light_adjustment=30.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=max savings cambium_scenario=LRMER_MidCase_15
lighting_load_shed light_shed_abs_20_15min upgrade_df_lighting_control demand_flexibility_objective=peak load peak_len=4 light_adjustment_method=absolute change light_adjustment=20.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak cambium_scenario=LRMER_MidCase_15
lighting_load_shed light_shed_abs_50_15min upgrade_df_lighting_control demand_flexibility_objective=peak load peak_len=4 light_adjustment_method=absolute change light_adjustment=50.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak cambium_scenario=LRMER_MidCase_15
lighting_load_shed light_shed_rel_30_15min upgrade_df_lighting_control demand_flexibility_objective=peak load peak_len=4 light_adjustment_method=relative change light_adjustment=30.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak cambium_scenario=LRMER_MidCase_15
lighting_load_shed light_shed_rel_30_maxsavings_15min upgrade_df_lighting_control demand_flexibility_objective=peak load peak_len=4 light_adjustment_method=relative change light_adjustment=30.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=max savings cambium_scenario=LRMER_MidCase_15
lighting_load_shed light_shed_rel_20_15min upgrade_df_lighting_control demand_flexibility_objective=peak load peak_len=4 light_adjustment_method=relative change light_adjustment=20.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak cambium_scenario=LRMER_MidCase_15
lighting_load_shed light_shed_rel_50_15min upgrade_df_lighting_control demand_flexibility_objective=peak load peak_len=4 light_adjustment_method=relative change light_adjustment=50.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=center with peak cambium_scenario=LRMER_MidCase_15
lighting_emission light_emission_lowrecost15_15min upgrade_df_lighting_control demand_flexibility_objective=emission peak_len=4 light_adjustment_method=absolute change light_adjustment=30.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=max savings cambium_scenario=LRMER_LowRECost_15
lighting_emission light_emission_highrecost15_15min upgrade_df_lighting_control demand_flexibility_objective=emission peak_len=4 light_adjustment_method=absolute change light_adjustment=30.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=max savings cambium_scenario=LRMER_HighRECost_15
lighting_emission light_emission_midcase15_15min upgrade_df_lighting_control demand_flexibility_objective=emission peak_len=4 light_adjustment_method=absolute change light_adjustment=30.0 num_timesteps_in_hr=4 load_prediction_method=full baseline peak_lag=2 peak_window_strategy=max savings cambium_scenario=LRMER_MidCase_15
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def run(model, runner, user_arguments)
peak_lag = runner.getIntegerArgumentValue("peak_lag",user_arguments)
peak_window_strategy = runner.getStringArgumentValue("peak_window_strategy",user_arguments)
cambium_scenario = runner.getStringArgumentValue("cambium_scenario",user_arguments)
# apply_measure = runner.getBoolArgumentValue('apply_measure', user_arguments)

def leap_year?(year)
if (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)
Expand Down Expand Up @@ -423,35 +424,37 @@ def applicable_thermostats(model)
applicable_htg_thermostats = []
thermostats = model.getThermostatSetpointDualSetpoints
thermostats.each do |thermostat|
thermalzone = thermostat.to_Thermostat.get.thermalZone.get
clg_fueltypes = thermalzone.coolingFuelTypes.map(&:valueName).uniq
htg_fueltypes = thermalzone.heatingFuelTypes.map(&:valueName).uniq
# puts("### DEBUGGING: clg_fueltypes = #{clg_fueltypes}")
# puts("### DEBUGGING: htg_fueltypes = #{htg_fueltypes}")
if clg_fueltypes == ["Electricity"]
applicable_clg_thermostats << thermostat
end
if htg_fueltypes == ["Electricity"]
applicable_htg_thermostats << thermostat
if thermostat.to_Thermostat.get.thermalZone.is_initialized
thermalzone = thermostat.to_Thermostat.get.thermalZone.get
clg_fueltypes = thermalzone.coolingFuelTypes.map(&:valueName).uniq
htg_fueltypes = thermalzone.heatingFuelTypes.map(&:valueName).uniq
# puts("### DEBUGGING: clg_fueltypes = #{clg_fueltypes}")
# puts("### DEBUGGING: htg_fueltypes = #{htg_fueltypes}")
if clg_fueltypes == ["Electricity"]
applicable_clg_thermostats << thermostat
end
if htg_fueltypes == ["Electricity"]
applicable_htg_thermostats << thermostat
end
end
end
return applicable_clg_thermostats, applicable_htg_thermostats, thermostats.size
end

# adding output variables (for debugging)
out_vars = [
'Lights Electricity Energy',
'Lights Electricity Rate',
'Zone Lights Electricity Energy',
'Zone Lights Electricity Rate',
'Schedule Value'
]
out_vars.each do |out_var_name|
ov = OpenStudio::Model::OutputVariable.new('ov', model)
ov.setKeyValue('*')
ov.setReportingFrequency('timestep')
ov.setVariableName(out_var_name)
end
# # adding output variables (for debugging)
# out_vars = [
# 'Lights Electricity Energy',
# 'Lights Electricity Rate',
# 'Zone Lights Electricity Energy',
# 'Zone Lights Electricity Rate',
# 'Schedule Value'
# ]
# out_vars.each do |out_var_name|
# ov = OpenStudio::Model::OutputVariable.new('ov', model)
# ov.setKeyValue('*')
# ov.setReportingFrequency('timestep')
# ov.setVariableName(out_var_name)
# end

############################################
# Applicability check
Expand Down Expand Up @@ -492,7 +495,13 @@ def applicable_thermostats(model)
return true
end
runner.registerInitialCondition("The building initially has #{nts} thermostats, of which #{applicable_clg_thermostats.size} are associated with electric cooling and #{applicable_htg_thermostats.size} are associated with electric heating.")


# # applicability: don't apply measure if specified in input
# if apply_measure == false
# runner.registerFinalCondition('Measure is not applied based on user input.')
# return true
# end

############################################
# Load prediction
############################################
Expand Down Expand Up @@ -585,7 +594,7 @@ def applicable_thermostats(model)
peak_schedule, peak_schedule_htg = peak_schedule_generation_oat(oat, peak_len, peak_lag=peak_lag, rebound_len=rebound_len, prepeak_len=0, season='all')
else
puts("### Predictive schedule...")
peak_schedule = peak_schedule_generation(annual_load, oat, peak_len, num_timesteps_in_hr=num_timesteps_in_hr, peak_window_strategy=peak_window_strategy, rebound_len=0, prepeak_len=0, season='all')
peak_schedule = peak_schedule_generation(annual_load, oat, peak_len, num_timesteps_in_hr=num_timesteps_in_hr, peak_window_strategy=peak_window_strategy, rebound_len=rebound_len, prepeak_len=0, season='all')
end
elsif demand_flexibility_objective == 'emission'
puts("### Creating peak schedule for emission reduction...")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ def test_models
assert(cambium_scenario.setValue('LRMER_LowRECost_30'))#
argument_map['cambium_scenario'] = cambium_scenario

# # set arguments:
# apply_measure = arguments[9].clone
# assert(apply_measure.setValue(true))#
# argument_map['apply_measure'] = apply_measure

# apply the measure to the model and optionally run the model
result = apply_measure_and_run(instance_test_name, measure, argument_map, osm_path, epw_path, run_model: true)

Expand Down
Loading