npc0 commited on
Commit
b34dd4d
verified
1 Parent(s): b73333a

Create thermal_model.py

Browse files
Files changed (1) hide show
  1. thermal_model.py +266 -0
thermal_model.py ADDED
@@ -0,0 +1,266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Thermal Cooling Performance Model for Jacket-and-Denim Ensemble
3
+ ================================================================
4
+
5
+ This module implements a holistic thermal analysis model for evaluating
6
+ the passive cooling performance of a leather jacket and denim jeans combination.
7
+ Based on the IEEE paper "Thermal Overload: A Holistic Analysis of the
8
+ Jacket-and-Denim Heatsink Paradigm".
9
+
10
+ The model treats the human body as a parallel thermal network with:
11
+ - Upper body (jacket system): 3-zone parallel model
12
+ - Lower body (pants system): single-zone model
13
+
14
+ Author: Thermal Engineering Research Team
15
+ License: MIT
16
+ """
17
+
18
+ import math
19
+ from typing import Dict, Tuple
20
+ from dataclasses import dataclass
21
+
22
+
23
+ @dataclass
24
+ class ThermalResults:
25
+ """Data class to store thermal analysis results."""
26
+ # Upper body results
27
+ R_upper_equivalent: float
28
+ heat_dissipation_upper: float
29
+
30
+ # Lower body results
31
+ R_lower_total: float
32
+ heat_dissipation_lower: float
33
+
34
+ # Total system results
35
+ total_heat_dissipation: float
36
+ total_effective_resistance: float
37
+ thermal_efficiency: float
38
+ performance_status: str
39
+
40
+
41
+ class ThermalModel:
42
+ """
43
+ Thermal analysis model for jacket-and-denim ensemble.
44
+
45
+ This class implements a full-body thermal resistance network model
46
+ to evaluate the passive cooling performance of the iconic outfit.
47
+ """
48
+
49
+ def __init__(self):
50
+ """Initialize the thermal model with default parameters."""
51
+ # Default material properties (W/m路K)
52
+ self.k_leather = 0.15
53
+ self.k_cotton = 0.05
54
+ self.k_denim = 0.06
55
+ self.k_air = 0.026
56
+
57
+ # Default material thicknesses (m)
58
+ self.d_leather = 0.0015
59
+ self.d_cotton = 0.001
60
+ self.d_denim = 0.0015
61
+
62
+ # Default convection coefficients (W/m虏路K)
63
+ self.h_open = 15.0 # Open front zone (chimney effect)
64
+ self.h_loose = 6.0 # Loose fit zone
65
+ self.h_tight = 3.5 # Tight fit zone
66
+ self.h_lower = 5.0 # Lower body average
67
+
68
+ def calculate_cooling_performance(
69
+ self,
70
+ # Environmental & physiological parameters
71
+ T_skin: float = 33.5, # Skin temperature (掳C)
72
+ T_ambient: float = 26.0, # Ambient temperature (掳C)
73
+ A_total: float = 1.8, # Total surface area (m虏)
74
+
75
+ # Body region distribution
76
+ A_frac_upper: float = 0.6, # Upper body area fraction
77
+
78
+ # Material thermal conductivities (W/m路K)
79
+ k_leather: float = None,
80
+ k_cotton: float = None,
81
+ k_denim: float = None,
82
+ k_air: float = None,
83
+
84
+ # Material thicknesses (m)
85
+ d_leather: float = None,
86
+ d_cotton: float = None,
87
+ d_denim: float = None,
88
+ d_air_gap_upper: float = 0.01, # Upper body air gap
89
+ d_air_gap_lower: float = 0.005, # Lower body air gap
90
+
91
+ # Upper body geometry & convection parameters
92
+ f_open: float = 0.35, # Open front fraction
93
+ f_loose: float = 0.50, # Loose fit fraction
94
+ h_open: float = None,
95
+ h_loose: float = None,
96
+ h_tight: float = None,
97
+
98
+ # Lower body convection parameter
99
+ h_lower: float = None
100
+ ) -> ThermalResults:
101
+ """
102
+ Calculate the passive cooling performance of the full ensemble.
103
+
104
+ The model divides the body into two parallel thermal networks:
105
+ 1. Upper body (Jacket System): 3-zone parallel model
106
+ 2. Lower body (Pants System): single-zone model
107
+
108
+ Returns:
109
+ ThermalResults: Complete thermal analysis results
110
+ """
111
+
112
+ # Use instance defaults if parameters not provided
113
+ k_leather = k_leather or self.k_leather
114
+ k_cotton = k_cotton or self.k_cotton
115
+ k_denim = k_denim or self.k_denim
116
+ k_air = k_air or self.k_air
117
+
118
+ d_leather = d_leather or self.d_leather
119
+ d_cotton = d_cotton or self.d_cotton
120
+ d_denim = d_denim or self.d_denim
121
+
122
+ h_open = h_open or self.h_open
123
+ h_loose = h_loose or self.h_loose
124
+ h_tight = h_tight or self.h_tight
125
+ h_lower = h_lower or self.h_lower
126
+
127
+ # Validate inputs
128
+ if f_open + f_loose > 1.0:
129
+ raise ValueError("Upper body area fractions (f_open + f_loose) cannot exceed 1.0")
130
+
131
+ if T_skin <= T_ambient:
132
+ raise ValueError("Skin temperature must be higher than ambient temperature")
133
+
134
+ # --- Area Distribution ---
135
+ A_upper = A_total * A_frac_upper
136
+ A_lower = A_total * (1 - A_frac_upper)
137
+
138
+ # --- Calculate Base Thermal Resistances (m虏路K/W) ---
139
+ R_cond_leather = d_leather / k_leather
140
+ R_cond_cotton = d_cotton / k_cotton
141
+ R_cond_denim = d_denim / k_denim
142
+ R_cond_air_upper = d_air_gap_upper / k_air
143
+ R_cond_air_lower = d_air_gap_lower / k_air
144
+
145
+ R_conv_open = 1 / h_open
146
+ R_conv_loose = 1 / h_loose
147
+ R_conv_tight = 1 / h_tight
148
+ R_conv_lower = 1 / h_lower
149
+
150
+ # --- Upper Body Heat Transfer Analysis ---
151
+ # Calculate series resistance for each zone
152
+ R_zone_open = R_cond_cotton + R_conv_open
153
+ R_zone_loose = R_cond_cotton + R_cond_air_upper + R_cond_leather + R_conv_loose
154
+ R_zone_tight = R_cond_cotton + R_cond_leather + R_conv_tight
155
+
156
+ # Calculate equivalent resistance for upper body parallel network
157
+ f_tight = 1 - f_open - f_loose
158
+ inv_R_upper = (f_open / R_zone_open) + (f_loose / R_zone_loose) + (f_tight / R_zone_tight)
159
+ R_upper_equiv = 1 / inv_R_upper
160
+
161
+ # Calculate upper body heat dissipation
162
+ delta_T = T_skin - T_ambient
163
+ Q_upper = (A_upper * delta_T) / R_upper_equiv
164
+
165
+ # --- Lower Body Heat Transfer Analysis ---
166
+ # Calculate series resistance for lower body
167
+ R_lower_total = R_cond_denim + R_cond_air_lower + R_conv_lower
168
+
169
+ # Calculate lower body heat dissipation
170
+ Q_lower = (A_lower * delta_T) / R_lower_total
171
+
172
+ # --- Total System Performance ---
173
+ Q_total = Q_upper + Q_lower
174
+ R_total_effective = (A_total * delta_T) / Q_total
175
+
176
+ # Calculate thermal efficiency (compared to 100W TDP)
177
+ TDP_reference = 100.0
178
+ thermal_efficiency = (Q_total / TDP_reference) * 100
179
+
180
+ # Determine performance status
181
+ if Q_total >= TDP_reference:
182
+ performance_status = "PASS - Adequate cooling performance"
183
+ elif Q_total >= 0.9 * TDP_reference:
184
+ performance_status = "MARGINAL - Near thermal limit"
185
+ else:
186
+ performance_status = f"FAIL - {TDP_reference - Q_total:.1f}W thermal deficit"
187
+
188
+ return ThermalResults(
189
+ R_upper_equivalent=R_upper_equiv,
190
+ heat_dissipation_upper=Q_upper,
191
+ R_lower_total=R_lower_total,
192
+ heat_dissipation_lower=Q_lower,
193
+ total_heat_dissipation=Q_total,
194
+ total_effective_resistance=R_total_effective,
195
+ thermal_efficiency=thermal_efficiency,
196
+ performance_status=performance_status
197
+ )
198
+
199
+ def get_performance_summary(self, results: ThermalResults, TDP: float = 100.0) -> Dict[str, str]:
200
+ """
201
+ Generate a human-readable performance summary.
202
+
203
+ Args:
204
+ results: ThermalResults object from calculate_cooling_performance
205
+ TDP: Target thermal design power in watts
206
+
207
+ Returns:
208
+ Dictionary containing formatted summary strings
209
+ """
210
+ summary = {
211
+ "Upper Body Performance": f"{results.heat_dissipation_upper:.1f}W "
212
+ f"(R_eq = {results.R_upper_equivalent:.3f} m虏路K/W)",
213
+
214
+ "Lower Body Performance": f"{results.heat_dissipation_lower:.1f}W "
215
+ f"(R_total = {results.R_lower_total:.3f} m虏路K/W)",
216
+
217
+ "Total Heat Dissipation": f"{results.total_heat_dissipation:.1f}W",
218
+
219
+ "Thermal Efficiency": f"{results.thermal_efficiency:.1f}% of {TDP}W target",
220
+
221
+ "Performance Status": results.performance_status,
222
+
223
+ "Engineering Assessment": self._get_engineering_assessment(results, TDP)
224
+ }
225
+
226
+ return summary
227
+
228
+ def _get_engineering_assessment(self, results: ThermalResults, TDP: float) -> str:
229
+ """Generate engineering assessment based on results."""
230
+ Q_total = results.total_heat_dissipation
231
+
232
+ if Q_total >= TDP:
233
+ return ("System operates within thermal limits. "
234
+ "Passive cooling is sufficient for sustained operation.")
235
+ elif Q_total >= 0.95 * TDP:
236
+ return ("System operates at thermal edge. "
237
+ "Consider environmental optimization or brief duty cycles.")
238
+ elif Q_total >= 0.85 * TDP:
239
+ return ("Thermal deficit detected. "
240
+ "Active cooling or garment optimization recommended.")
241
+ else:
242
+ return ("Significant thermal bottleneck. "
243
+ "Major design modifications required for target TDP.")
244
+
245
+
246
+ def demo_calculation():
247
+ """Demonstration of the thermal model with default parameters."""
248
+ model = ThermalModel()
249
+ results = model.calculate_cooling_performance()
250
+ summary = model.get_performance_summary(results)
251
+
252
+ print("=" * 60)
253
+ print("THERMAL ANALYSIS: Jacket-and-Denim Heatsink Performance")
254
+ print("=" * 60)
255
+
256
+ for key, value in summary.items():
257
+ print(f"{key:.<25}: {value}")
258
+
259
+ print("\n" + "=" * 60)
260
+ print("Analysis complete. See full results above.")
261
+
262
+ return results, summary
263
+
264
+
265
+ if __name__ == "__main__":
266
+ demo_calculation()