Spaces:
Sleeping
Sleeping
| """ | |
| Main application file for HVAC Load Calculator | |
| This is the main entry point for the HVAC Load Calculator web application. | |
| It sets up the Streamlit interface and navigation between different pages. | |
| """ | |
| import streamlit as st | |
| import os | |
| import sys | |
| from pathlib import Path | |
| # Add the parent directory to sys.path to import modules | |
| sys.path.append(os.path.dirname(os.path.abspath(__file__))) | |
| # Import pages | |
| from pages.cooling_calculator import cooling_calculator | |
| from pages.heating_calculator import heating_calculator | |
| # Set page configuration | |
| st.set_page_config( | |
| page_title="HVAC Load Calculator", | |
| page_icon="🔥❄️", | |
| layout="wide", | |
| initial_sidebar_state="expanded" | |
| ) | |
| # Define main function | |
| def main(): | |
| """Main function for the HVAC Load Calculator web application.""" | |
| # Add custom CSS | |
| st.markdown(""" | |
| <style> | |
| .main-header { | |
| font-size: 2.5rem; | |
| color: #1E88E5; | |
| text-align: center; | |
| margin-bottom: 1rem; | |
| } | |
| .sub-header { | |
| font-size: 1.5rem; | |
| color: #424242; | |
| margin-bottom: 1rem; | |
| } | |
| .info-box { | |
| background-color: #E3F2FD; | |
| padding: 1rem; | |
| border-radius: 0.5rem; | |
| margin-bottom: 1rem; | |
| } | |
| </style> | |
| """, unsafe_allow_html=True) | |
| # Sidebar navigation | |
| st.sidebar.title("HVAC Load Calculator") | |
| st.sidebar.image("https://img.icons8.com/fluency/96/air-conditioner.png", width=100) | |
| # Navigation options | |
| page = st.sidebar.radio( | |
| "Select Calculator", | |
| ["Home", "Cooling Load Calculator", "Heating Load Calculator"] | |
| ) | |
| # Display selected page | |
| if page == "Home": | |
| display_home_page() | |
| elif page == "Cooling Load Calculator": | |
| cooling_calculator() | |
| elif page == "Heating Load Calculator": | |
| heating_calculator() | |
| # Footer | |
| st.sidebar.markdown("---") | |
| st.sidebar.info( | |
| "HVAC Load Calculator v1.0\n\n" | |
| "Based on ASHRAE calculation methods\n\n" | |
| "© 2025" | |
| ) | |
| def display_home_page(): | |
| """Display the home page.""" | |
| st.markdown('<h1 class="main-header">HVAC Load Calculator</h1>', unsafe_allow_html=True) | |
| st.markdown('<h2 class="sub-header">A Modern Tool for HVAC Design</h2>', unsafe_allow_html=True) | |
| # Introduction | |
| st.markdown(""" | |
| <div class="info-box"> | |
| <p>Welcome to the HVAC Load Calculator! This tool helps you calculate cooling and heating loads for buildings | |
| using the ASHRAE method. It's designed for educational purposes to help students understand the factors | |
| that influence HVAC load calculations.</p> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| # Features | |
| st.markdown("### Features") | |
| col1, col2 = st.columns(2) | |
| with col1: | |
| st.markdown(""" | |
| #### Cooling Load Calculator | |
| - Calculate sensible and latent cooling loads | |
| - Account for conduction, solar radiation, infiltration, and internal gains | |
| - Visualize load components with charts and tables | |
| - Export results for assignments | |
| """) | |
| with col2: | |
| st.markdown(""" | |
| #### Heating Load Calculator | |
| - Calculate peak heating loads | |
| - Account for conduction, infiltration, and ventilation | |
| - Estimate annual heating energy requirements | |
| - Visualize load components with charts and tables | |
| """) | |
| # How to use | |
| st.markdown("### How to Use") | |
| st.markdown(""" | |
| 1. Select either the Cooling Load Calculator or Heating Load Calculator from the sidebar | |
| 2. Fill in the required information in each step | |
| 3. Review any warnings that appear (you can proceed with warnings) | |
| 4. Calculate results and analyze the output | |
| 5. Export results for your assignments | |
| """) | |
| # Reference data | |
| st.markdown("### Reference Data") | |
| st.markdown(""" | |
| The calculator includes reference data for: | |
| - Building materials (walls, roofs, floors) | |
| - Glass types and shading coefficients | |
| - Climate data for various locations | |
| - Occupancy patterns and internal gains | |
| This data is based on ASHRAE standards and guidelines. | |
| """) | |
| # Get started button | |
| col1, col2, col3 = st.columns([1, 2, 1]) | |
| with col2: | |
| st.markdown("### Get Started") | |
| cooling_button = st.button("Go to Cooling Load Calculator") | |
| heating_button = st.button("Go to Heating Load Calculator") | |
| if cooling_button: | |
| st.session_state.page = "Cooling Load Calculator" | |
| st.experimental_rerun() | |
| if heating_button: | |
| st.session_state.page = "Heating Load Calculator" | |
| st.experimental_rerun() | |
| # Run the application | |
| if __name__ == "__main__": | |
| main() | |