File size: 8,257 Bytes
91ba325 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# HVAC Calculator Technical Documentation
## System Architecture
The HVAC Calculator is built using a modular architecture with the following components:
1. **User Interface Layer**: Streamlit-based web interface
2. **Application Layer**: Core calculation and processing logic
3. **Data Layer**: Data models, reference data, and persistence
### Component Diagram
```
+----------------------------------+
| User Interface |
| +----------------------------+ |
| | Streamlit Web App | |
| +----------------------------+ |
+----------------------------------+
|
v
+----------------------------------+
| Application Layer |
| +------------+ +------------+ |
| | Calculation | | Data | |
| | Engine | | Processing | |
| +------------+ +------------+ |
| +------------+ +------------+ |
| |Visualization| | Data | |
| | Components | | Validation | |
| +------------+ +------------+ |
+----------------------------------+
|
v
+----------------------------------+
| Data Layer |
| +------------+ +------------+ |
| | Models | | Reference | |
| | | | Data | |
| +------------+ +------------+ |
| +------------+ +------------+ |
| | Climate | | Data | |
| | Data | | Persistence| |
| +------------+ +------------+ |
+----------------------------------+
```
## Technology Stack
- **Frontend**: Streamlit (Python-based web framework)
- **Backend**: Python 3.10+
- **Data Processing**: Pandas, NumPy
- **Visualization**: Plotly, Matplotlib
- **Data Export**: OpenPyXL, XlsxWriter
- **Testing**: Python unittest framework
## Module Descriptions
### App Module
The `app` module contains the Streamlit application components:
- `main.py`: Main application entry point and navigation
- `building_info_form.py`: Building information input form
- `component_selection.py`: Component selection interface
- `results_display.py`: Results display module
- `data_validation.py`: Data validation module
- `data_persistence.py`: Data persistence module
- `data_export.py`: Data export module
### Data Module
The `data` module contains data models and reference data:
- `building_components.py`: Building component data models
- `reference_data.py`: Reference data for materials and construction types
- `climate_data.py`: ASHRAE 169 climate data module
- `ashrae_tables.py`: ASHRAE tables implementation (CLTD, SCL, CLF)
### Utils Module
The `utils` module contains utility functions and calculation engines:
- `component_library.py`: Component library with preset and custom components
- `u_value_calculator.py`: U-value calculator for material assemblies
- `shading_system.py`: Shading system for windows
- `area_calculation_system.py`: Area calculation and validation system
- `psychrometrics.py`: Psychrometric calculations for air properties
- `heat_transfer.py`: Shared heat transfer calculation functions
- `cooling_load.py`: Cooling load calculations (CLTD/CLF method)
- `heating_load.py`: Heating load calculations (steady-state method)
- `component_visualization.py`: Hierarchical component visualization
- `scenario_comparison.py`: Scenario comparison visualization
- `psychrometric_visualization.py`: Psychrometric visualization
- `time_based_visualization.py`: Time-based visualization
### Tests Module
The `tests` module contains test cases:
- `test_calculator.py`: Comprehensive tests for calculator components
## Data Flow
1. **User Input**: User enters building information, climate data, and component details
2. **Data Validation**: Input data is validated for completeness and correctness
3. **Calculation**: Cooling and heating loads are calculated using ASHRAE methods
4. **Visualization**: Results are visualized using various charts and tables
5. **Export**: Results can be exported in various formats (CSV, Excel, JSON)
## Calculation Methods
### Cooling Load Calculation
The cooling load calculation uses the CLTD/CLF method from ASHRAE:
1. **Walls and Roofs**: Uses Cooling Load Temperature Difference (CLTD) method
- Q = U × A × CLTD
- CLTD values are adjusted for latitude, month, and time of day
2. **Windows**: Uses Solar Cooling Load (SCL) method
- Q = U × A × CLTD + A × SC × SCL
- SCL values are adjusted for latitude, month, and time of day
3. **Internal Gains**: Uses Cooling Load Factor (CLF) method
- Q = q × CLF
- CLF values are adjusted for zone type and hours of operation
4. **Infiltration and Ventilation**: Uses sensible and latent heat equations
- Q_sensible = ρ × Q × cp × ΔT
- Q_latent = ρ × Q × hfg × Δw
### Heating Load Calculation
The heating load calculation uses the steady-state method:
1. **Building Envelope**: Uses steady-state conduction
- Q = U × A × ΔT
- ΔT is the difference between indoor and outdoor design temperatures
2. **Infiltration and Ventilation**: Uses sensible heat equation
- Q = ρ × Q × cp × ΔT
3. **Internal Gains**: Considered as heat sources that offset heating load
- Q_heating = Q_envelope - Q_internal
## Data Models
### Building Component Models
All building components inherit from a base `Component` class:
```python
class Component:
id: str
name: str
component_type: ComponentType
u_value: float
area: float
```
Specific component types extend this base class:
- `Wall`: Adds orientation, wall_type, and wall_group
- `Roof`: Adds orientation, roof_type, and roof_group
- `Floor`: Adds floor_type
- `Window`: Adds orientation, shgc, vt, window_type, glazing_layers, gas_fill, and low_e_coating
- `Door`: Adds orientation and door_type
### Climate Data Model
The climate data model includes:
- Climate zones
- Design conditions (summer and winter)
- Monthly temperature data
- Solar radiation data
### Reference Data
Reference data includes:
- Wall types and properties
- Roof types and properties
- Floor types and properties
- Window types and properties
- Door types and properties
- Material properties (conductivity, density, specific heat)
## Persistence and Export
### Data Persistence
- Projects are saved in JSON format with a `.hvac` extension
- All component data is properly serialized, including enums and complex objects
- Project history is maintained in the session state for quick access to previous work
### Data Export
- CSV export provides individual tables for different components and results
- Excel export creates a comprehensive report with multiple sheets
- JSON scenario export preserves all calculation results and input data
- Batch export creates a ZIP file containing all scenarios
## Deployment
### Local Deployment
To run the application locally:
1. Install the required dependencies:
```
pip install streamlit pandas numpy plotly matplotlib openpyxl xlsxwriter
```
2. Run the Streamlit application:
```
cd hvac_calculator
streamlit run app/main.py
```
### Hugging Face Space Deployment
To deploy to Hugging Face Space:
1. Create a new Space on Hugging Face
2. Select Streamlit as the Space SDK
3. Upload the application files
4. Configure the `requirements.txt` file
5. Set the app file to `app/main.py`
## Performance Considerations
- The application is designed to run efficiently in a web browser
- Calculation methods are optimized for speed and accuracy
- Large datasets (e.g., ASHRAE tables) are loaded only when needed
- Visualizations use efficient rendering techniques
## Security Considerations
- All data processing is done client-side
- No sensitive data is transmitted to external servers
- Project files are stored locally on the user's computer
- No authentication is required for basic usage
## Future Enhancements
- Additional calculation methods (e.g., Heat Balance Method)
- Support for more complex building geometries
- Integration with BIM software
- Enhanced 3D visualization
- Cloud-based project storage
- Collaborative editing features
## Conclusion
This technical documentation provides an overview of the HVAC Calculator's architecture, components, and implementation details. For more information, please refer to the code documentation and user guide.
|