Spaces:
Sleeping
Sleeping
Update app/internal_loads.py
Browse files- app/internal_loads.py +8 -5
app/internal_loads.py
CHANGED
@@ -705,9 +705,6 @@ def display_ventilation_infiltration_tab():
|
|
705 |
st.session_state.internal_loads_rerun_pending = True
|
706 |
|
707 |
def display_schedules_tab():
|
708 |
-
import streamlit as st
|
709 |
-
import uuid
|
710 |
-
import pandas as pd
|
711 |
|
712 |
st.subheader("Schedules Editor")
|
713 |
|
@@ -730,13 +727,19 @@ def display_schedules_tab():
|
|
730 |
editor_state = st.session_state.schedule_editor
|
731 |
schedules = st.session_state.project_data["internal_loads"]["schedules"]
|
732 |
|
|
|
|
|
|
|
|
|
|
|
733 |
# Handle template change
|
734 |
template_options = list(DEFAULT_SCHEDULE_TEMPLATES.keys())
|
735 |
selected_template = st.selectbox(
|
736 |
"Select Template",
|
737 |
options=["None"] + template_options,
|
738 |
-
index=template_options.index(editor_state.get("template",
|
739 |
-
if editor_state.get("template") in template_options else
|
|
|
740 |
help="Choose a base schedule to prefill values."
|
741 |
)
|
742 |
|
|
|
705 |
st.session_state.internal_loads_rerun_pending = True
|
706 |
|
707 |
def display_schedules_tab():
|
|
|
|
|
|
|
708 |
|
709 |
st.subheader("Schedules Editor")
|
710 |
|
|
|
727 |
editor_state = st.session_state.schedule_editor
|
728 |
schedules = st.session_state.project_data["internal_loads"]["schedules"]
|
729 |
|
730 |
+
# Get building type and map to schedule type for default template
|
731 |
+
building_type = st.session_state.project_data["building_info"].get("building_type", "Other")
|
732 |
+
schedule_type = DEFAULT_BUILDING_INTERNALS.get(building_type, DEFAULT_BUILDING_INTERNALS["Other"])["schedule_type"]
|
733 |
+
default_template = schedule_type if schedule_type in DEFAULT_SCHEDULE_TEMPLATES else "None"
|
734 |
+
|
735 |
# Handle template change
|
736 |
template_options = list(DEFAULT_SCHEDULE_TEMPLATES.keys())
|
737 |
selected_template = st.selectbox(
|
738 |
"Select Template",
|
739 |
options=["None"] + template_options,
|
740 |
+
index=template_options.index(editor_state.get("template", default_template)) + 1
|
741 |
+
if editor_state.get("template") in template_options else template_options.index(default_template) + 1
|
742 |
+
if default_template in template_options else 0,
|
743 |
help="Choose a base schedule to prefill values."
|
744 |
)
|
745 |
|