Skip to content
Merged
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
98 changes: 98 additions & 0 deletions data/input/equipment_data.JSON
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,31 @@
}
}
},
{
"eq_id": "bo05",
"eq_type": "backup_heating",
"eq_subtype": "hot_water",
"eq_calc_type": "specific",
"model": "GenericBoiler",
"fuel": "natural_gas",
"capacity_W": 190500,
"dimensions": {
"length": 1.06,
"width": 0.833,
"height": 2.01
},
"operating_weight_g": 305000,
"electrical": {
"mca": 10,
"voltage": 120,
"phase": 1
},
"performance": {
"heating": {
"efficiency": 0.6
}
}
},
{
"eq_id": "ch01",
"eq_type": "chiller",
Expand Down Expand Up @@ -1009,6 +1034,7 @@
"awhp_use_cooling": false,
"awhp_sizing_priority": "heating",
"backup_heating": "bo03",
"fuel_switching": false,
"chiller": "ch02"
},
{
Expand All @@ -1026,6 +1052,7 @@
"awhp_use_cooling": false,
"awhp_sizing_priority": "heating",
"backup_heating": "res02",
"fuel_switching": false,
"chiller": "ch02"
},
{
Expand All @@ -1043,6 +1070,7 @@
"awhp_use_cooling": true,
"awhp_sizing_priority": "heating",
"backup_heating": "bo03",
"fuel_switching": false,
"chiller": "ch02"
},
{
Expand All @@ -1060,6 +1088,7 @@
"awhp_use_cooling": true,
"awhp_sizing_priority": "heating",
"backup_heating": "res02",
"fuel_switching": false,
"chiller": "ch02"
},
{
Expand All @@ -1077,6 +1106,7 @@
"awhp_use_cooling": true,
"awhp_sizing_priority": "heating",
"backup_heating": "res02",
"fuel_switching": false,
"chiller": "ch02"
},
{
Expand All @@ -1094,6 +1124,7 @@
"awhp_use_cooling": true,
"awhp_sizing_priority": "heating",
"backup_heating": "bo03",
"fuel_switching": false,
"chiller": "ch02"
},
{
Expand All @@ -1111,6 +1142,7 @@
"awhp_use_cooling": true,
"awhp_sizing_priority": "heating",
"backup_heating": "bo03",
"fuel_switching": false,
"chiller": "ch02"
},
{
Expand All @@ -1128,6 +1160,7 @@
"awhp_use_cooling": true,
"awhp_sizing_priority": "heating",
"backup_heating": "bo03",
"fuel_switching": false,
"chiller": "ch02"
},
{
Expand All @@ -1145,6 +1178,7 @@
"awhp_use_cooling": true,
"awhp_sizing_priority": "heating",
"backup_heating": "bo03",
"fuel_switching": false,
"chiller": "ch02"
},
{
Expand All @@ -1162,6 +1196,7 @@
"awhp_use_cooling": false,
"awhp_sizing_priority": "heating",
"backup_heating": "bo03",
"fuel_switching": false,
"chiller": "ch02"
},
{
Expand All @@ -1179,6 +1214,7 @@
"awhp_use_cooling": false,
"awhp_sizing_priority": "heating",
"backup_heating": "res02",
"fuel_switching": false,
"chiller": "ch02"
},
{
Expand All @@ -1196,6 +1232,7 @@
"awhp_use_cooling": true,
"awhp_sizing_priority": "heating",
"backup_heating": "res02",
"fuel_switching": false,
"chiller": "ch02"
},
{
Expand All @@ -1213,6 +1250,7 @@
"awhp_use_cooling": true,
"awhp_sizing_priority": "heating",
"backup_heating": "res02",
"fuel_switching": false,
"chiller": "ch02"
},
{
Expand All @@ -1230,6 +1268,7 @@
"awhp_use_cooling": true,
"awhp_sizing_priority": "heating",
"backup_heating": "res02",
"fuel_switching": false,
"chiller": "ch02"
},
{
Expand All @@ -1248,6 +1287,60 @@
"awhp_sizing_priority": "heating",
"backup_heating": "res02",
"chiller": "ch02"
},
{
"eq_scen_id": "eq_scenario_16",
"eq_scen_name": "90% Eff. Gas Boiler+AC Chiller",
"hr_wwhp": null,
"hr_wwhp_performance_model": "interpolate_HHWST",
"hr_wwhp_h_supply_t": 48.9,
"awhp": null,
"awhp_performance_model": "interpolate_HHWST_fixed",
"awhp_sizing_mode": "integer_sizing_peak_load",
"awhp_sizing_value": 1,
"awhp_redundancy": 1,
"awhp_h_supply_t": 38,
"awhp_use_cooling": false,
"awhp_sizing_priority": "heating",
"backup_heating": "bo02",
"fuel_switching": false,
"chiller": "ch02"
},
{
"eq_scen_id": "eq_scenario_17",
"eq_scen_name": "50% AWHP (H+C)+Gas Backup",
"hr_wwhp": null,
"hr_wwhp_performance_model": "interpolate_HHWST",
"hr_wwhp_h_supply_t": 48.9,
"awhp": "hp01",
"awhp_performance_model": "interpolate_HHWST_fixed",
"awhp_sizing_mode": "integer_sizing_peak_load",
"awhp_sizing_value": 0.5,
"awhp_redundancy": 1,
"awhp_h_supply_t": 38,
"awhp_use_cooling": true,
"awhp_sizing_priority": "heating",
"backup_heating": "bo02",
"fuel_switching": false,
"chiller": "ch02"
},
{
"eq_scen_id": "eq_scenario_18",
"eq_scen_name": "100% AWHP (H+C)+Fuel Switching",
"hr_wwhp": null,
"hr_wwhp_performance_model": "interpolate_HHWST",
"hr_wwhp_h_supply_t": 48.9,
"awhp": "hp01",
"awhp_performance_model": "interpolate_HHWST_fixed",
"awhp_sizing_mode": "integer_sizing_peak_load",
"awhp_sizing_value": 1,
"awhp_redundancy": 1,
"awhp_h_supply_t": 38,
"awhp_use_cooling": true,
"awhp_sizing_priority": "heating",
"backup_heating": "bo02",
"fuel_switching": true,
"chiller": "ch02"
}
],
"scenario_groups": [
Expand All @@ -1270,6 +1363,11 @@
"group_id": "hhw_supply_temps",
"group_name": "HHW Supply Temps",
"scenario_ids": ["eq_scenario_4", "eq_scenario_13", "eq_scenario_14", "eq_scenario_5", "eq_scenario_15"]
Comment thread
urwahah marked this conversation as resolved.
},
{
"group_id": "fuel_switching",
"group_name": "Dynamic Fuel Switching",
"scenario_ids": ["eq_scenario_16", "eq_scenario_17", "eq_scenario_4", "eq_scenario_18"]
}
]
}
10 changes: 8 additions & 2 deletions layout/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,10 @@ def build_equipment_table(
("awhp_sizing_mode", "AWHP Sizing Mode"),
("awhp_sizing_value", "AWHP Sizing Value"),
("awhp_redundancy", "AWHP Redundancy"),
("awhp_use_cooling", "AWHP Use Cooling"),
("awhp_use_cooling", "Use AWHP for Cooling"),
("awhp_sizing_priority", "AWHP Sizing Priority"),
("backup_heating", "Backup Heating"),
("fuel_switching", "Use Optimal Heating Fuel"),
("chiller", "Backup Cooling"),
]

Expand Down Expand Up @@ -998,7 +999,7 @@ def edit_equipment_modal():
[
dmc.Switch(
id="edit-awhp-use-cooling",
label="Use heat pump also for cooling",
label="Use AWHP for cooling",
mt="xs",
),
dmc.Select(
Expand Down Expand Up @@ -1050,6 +1051,11 @@ def edit_equipment_modal():
),
],
),
dmc.Switch(
id="edit-fuel-switching",
label="Use optimal heating fuel",
mt="xs",
),
dmc.Text(
id="edit-scenario-error",
size="xs",
Expand Down
3 changes: 2 additions & 1 deletion layout/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,10 @@ def get_value(self, path: str):
("awhp_sizing_mode", "AWHP Sizing Mode"),
("awhp_sizing_value", "AWHP Sizing Value"),
("awhp_redundancy", "AWHP Redundancy"),
("awhp_use_cooling", "AWHP Use Cooling"),
("awhp_use_cooling", "Use AWHP for Cooling"),
("awhp_sizing_priority", "AWHP Sizing Priority"),
("backup_heating", "Backup Heating"),
("fuel_switching", "Use Optimal Heating Fuel"),
("chiller", "Chiller"),
]

Expand Down
40 changes: 38 additions & 2 deletions pages/equipment_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,7 @@ def reset_equipment(n_clicks, initial_data):
Output("edit-awhp-sizing-priority", "value"),
Output("edit-backup-heating-select", "data"),
Output("edit-backup-heating-select", "value"),
Output("edit-fuel-switching", "checked"),
Output("edit-chiller-select", "data"),
Output("edit-chiller-select", "value"),
Output("edit-scenario-error", "children"),
Expand All @@ -698,7 +699,7 @@ def open_edit_modal(edit_clicks, equipment_data, unit_mode):
pre-filling all editable fields.
"""
if not any(edit_clicks or []):
return (no_update,) * 21
return (no_update,) * 22

if not equipment_data:
return (
Expand All @@ -720,6 +721,7 @@ def open_edit_modal(edit_clicks, equipment_data, unit_mode):
None,
[],
None,
False,
[],
None,
"No equipment data.",
Expand All @@ -730,7 +732,7 @@ def open_edit_modal(edit_clicks, equipment_data, unit_mode):

triggered = callback_context.triggered
if not triggered:
return (no_update,) * 21
return (no_update,) * 22

prop_id = triggered[0]["prop_id"]
id_str = prop_id.split(".")[0]
Expand All @@ -757,6 +759,7 @@ def open_edit_modal(edit_clicks, equipment_data, unit_mode):
None,
[],
None,
False,
[],
None,
"Failed to parse button id.",
Expand Down Expand Up @@ -787,6 +790,7 @@ def open_edit_modal(edit_clicks, equipment_data, unit_mode):
None,
[],
None,
False,
[],
None,
f"Scenario {eq_scen_id!r} not found.",
Expand Down Expand Up @@ -849,6 +853,7 @@ def open_edit_modal(edit_clicks, equipment_data, unit_mode):
redundancy = scenario.get("awhp_redundancy", 1)
use_cooling = scenario.get("awhp_use_cooling", False)
sizing_priority = scenario.get("awhp_sizing_priority") or "heating"
fuel_switching = scenario.get("fuel_switching", False)

backup_heating_val = scenario.get("backup_heating")
chiller_val = scenario.get("chiller")
Expand All @@ -872,6 +877,7 @@ def open_edit_modal(edit_clicks, equipment_data, unit_mode):
sizing_priority,
backup_heating_options,
backup_heating_val,
fuel_switching,
chiller_options,
chiller_val,
"",
Expand All @@ -897,6 +903,7 @@ def open_edit_modal(edit_clicks, equipment_data, unit_mode):
State("edit-awhp-use-cooling", "checked"),
State("edit-awhp-sizing-priority", "value"),
State("edit-backup-heating-select", "value"),
State("edit-fuel-switching", "checked"),
State("edit-chiller-select", "value"),
State("equipment-store", "data"),
State("unit-toggle", "value"),
Expand All @@ -918,6 +925,7 @@ def save_edit_scenario(
use_cooling,
sizing_priority,
backup_heating_val,
fuel_switching,
chiller_val,
equipment_data,
unit_mode,
Expand Down Expand Up @@ -969,6 +977,7 @@ def save_edit_scenario(
redundancy = 1

use_cooling = bool(use_cooling)
fuel_switching = bool(fuel_switching)

scenarios = equipment_data["equipment_scenarios"]
updated = False
Expand All @@ -990,6 +999,7 @@ def save_edit_scenario(
new_scen["awhp_use_cooling"] = use_cooling
new_scen["awhp_sizing_priority"] = sizing_priority
new_scen["backup_heating"] = backup_heating_val
new_scen["fuel_switching"] = fuel_switching
new_scen["chiller"] = chiller_val
new_scenarios.append(new_scen)
updated = True
Expand Down Expand Up @@ -1177,6 +1187,32 @@ def update_sizing_priority(use_cooling, sizing_mode):
return disabled


@callback(
Output("edit-fuel-switching", "disabled"),
Output("edit-fuel-switching", "checked", allow_duplicate=True),
Input("edit-awhp-select", "value"),
Input("edit-backup-heating-select", "value"),
State("edit-fuel-switching", "checked"),
State("equipment-store", "data"),
prevent_initial_call=True,
)
def update_fuel_switching(awhp_id, backup_heating_id, fuel_switching, equipment_data):
"""Enable/disable fuel switching input and update value when AWHP or backup heating selection changes."""
# get backup heating fuel
equipment_list = equipment_data.get("equipment", []) if equipment_data else []
backup_heating = next((e for e in equipment_list if e.get("eq_id") == backup_heating_id), None)
backup_heating_fuel = backup_heating.get("fuel", "") if backup_heating else ""

# Disable input if AWHP is not selected, or if backup heating option is electric
awhp_selected = awhp_id and awhp_id != "None"
disabled = (not awhp_selected) or (backup_heating_fuel != "natural_gas")

# Set value to unchecked if disabled condition is met, otherwise preserve last value
checked = False if disabled else fuel_switching

return (disabled, checked)


# helper to build equipment options for Selects


Expand Down
Loading