主题054:LED照明热管理辐射

摘要

本主题深入研究LED照明系统的热管理问题,重点分析辐射散热在LED结温控制中的关键作用。通过理论分析和Python仿真,掌握LED热设计原理、散热系统优化方法以及寿命预测技术,为高效、长寿命LED照明产品的设计提供理论指导。

关键词: LED照明、结温、辐射散热、热管理、寿命预测、光效、热阻


在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

1. 引言

1.1 LED照明技术的发展

发光二极管(LED, Light Emitting Diode)作为一种半导体固态光源,近年来在照明领域得到了广泛应用。相比传统光源(白炽灯、荧光灯),LED具有显著优势:

能效优势

  • LED光效可达150-200 lm/W,远超白炽灯(10-15 lm/W)
  • 比荧光灯(50-100 lm/W)节能50%以上
  • 定向发光特性减少光损失

寿命优势

  • LED典型寿命25,000-50,000小时
  • 白炽灯仅1,000小时,荧光灯8,000-10,000小时
  • 减少维护成本和更换频率

环保优势

  • 无汞等有害物质
  • 可回收利用
  • 减少碳排放

其他优势

  • 瞬时启动,无频闪
  • 可调光、调色
  • 抗震、耐冲击
  • 体积小,设计灵活

1.2 LED热管理的挑战

尽管LED具有诸多优势,但其热管理问题一直是制约性能和可靠性的关键因素:

结温敏感性问题

  • LED芯片结温直接影响发光效率
  • 温度每升高10°C,光效下降约3-5%
  • 高温加速光衰,缩短使用寿命

热量集中问题

  • LED芯片尺寸小(1-3mm²)
  • 功率密度高(可达100 W/cm²)
  • 热量集中在极小区域,散热困难

可靠性问题

  • 高温导致封装材料老化
  • 荧光粉热猝灭
  • 焊点热疲劳失效

光品质问题

  • 结温升高导致色温漂移
  • 显色指数下降
  • 波长红移

1.3 辐射散热在LED中的重要性

LED照明系统的散热方式主要包括:

  1. 传导散热:芯片→基板→散热器
  2. 对流散热:散热器与空气换热
  3. 辐射散热:表面红外辐射

在LED照明中,辐射散热具有特殊重要性:

自然对流主导

  • 大多数LED灯具依靠自然对流
  • 辐射散热可占总散热的40-60%
  • 优化表面发射率可显著改善散热

密闭空间应用

  • 防水灯具内部空气不流通
  • 辐射成为主要散热方式
  • 需要高发射率表面处理

高温工况

  • 大功率LED工作温度高
  • 辐射散热与T⁴成正比
  • 高温下辐射占比显著增加

设计约束

  • 灯具外观要求限制散热器尺寸
  • 辐射散热可在有限空间内提高效率
  • 表面处理成本低,效果显著

1.4 本主题学习目标

通过本主题的学习,读者将能够:

  1. 理解LED发热机理和结温控制原理
  2. 掌握LED热阻网络分析方法
  3. 学会计算和优化辐射散热
  4. 运用Python进行LED热管理仿真
  5. 预测LED寿命并进行可靠性设计
  6. 设计高效LED照明散热方案

2. LED基础理论与发热机理

2.1 LED工作原理

2.1.1 半导体发光原理

LED基于半导体的电致发光效应:

PN结注入

  • 电子从N区注入P区
  • 空穴从P区注入N区
  • 载流子在PN结附近复合

辐射复合

  • 电子与空穴复合时释放能量
  • 能量以光子形式发出
  • 光子能量:E = hν = hc/λ

发光波长

  • 由半导体材料的带隙决定
  • λ = hc/Eg ≈ 1240/Eg(nm)
  • 不同材料发出不同颜色光
2.1.2 白光LED实现方式

蓝光LED+黄色荧光粉(主流技术):

  • 蓝光LED激发YAG:Ce荧光粉
  • 蓝光+黄光混合成白光
  • 光效高,成本低
  • 色温可调(2700K-6500K)

RGB三色混合

  • 红、绿、蓝三色LED组合
  • 色彩还原性好
  • 控制复杂,成本高
  • 主要用于显示屏

紫外LED+RGB荧光粉

  • 紫外光激发三基色荧光粉
  • 显色指数高(CRI>90)
  • 光效相对较低
  • 适用于高品质照明

2.2 LED发热机理

2.2.1 能量转换效率

LED的电光转换效率:

η = P_optical / P_electrical = (Φ × V_photon) / (I × V_f)

其中:

  • Φ:光通量(lm)
  • V_photon:光子电压(约2.5-3.5V)
  • I:驱动电流(A)
  • V_f:正向压降(V)

典型效率

  • 蓝光LED:约40-50%
  • 白光LED:约30-40%
  • 其余60-70%电能转化为热量
2.2.2 热源分布

LED芯片内部热源分布:

有源区发热(主要热源):

  • 非辐射复合产生热量
  • 俄歇复合
  • 缺陷复合
  • 占发热量的70-80%

欧姆发热

  • 接触电阻产生热量
  • 外延层电阻
  • 衬底电阻
  • 占发热量的20-30%

热量产生位置

  • 主要集中在有源区(厚度约0.1-0.5μm)
  • 距离芯片表面很近
  • 热量需要快速导出
2.2.3 热功率计算

LED热功率:

P_heat = P_electrical - P_optical
       = I × V_f - Φ × K_e

其中K_e为光效系数(约0.003-0.004 W/lm)。

简化计算

假设电光转换效率η=35%:

P_heat = P_electrical × (1 - η)
       = P_electrical × 0.65

对于1W LED:

  • 电功率:1W
  • 光功率:0.35W
  • 热功率:0.65W

2.3 LED热特性参数

2.3.1 结温与光效关系

LED光效随结温升高而下降:

Φ(T_j) = Φ₀ × [1 - k × (T_j - T₀)]

其中:

  • Φ₀:参考温度T₀时的光通量
  • k:温度系数(典型值0.003-0.005/°C)
  • T_j:结温(°C)

典型数据

结温(°C)相对光通量光效下降
25100%0%
5092%8%
7584%16%
10076%24%
12568%32%
2.3.2 结温与波长漂移

LED发光波长随结温变化:

蓝光LED

  • 温度系数:约0.05 nm/°C(蓝移)
  • 结温升高,波长向长波方向移动

白光LED

  • 蓝光芯片红移
  • 荧光粉发射变化
  • 整体色温下降(变暖)

色温漂移

  • 结温从25°C升到100°C
  • 色温可能下降500-1000K
  • 影响照明品质
2.3.3 热阻定义与测量

热阻定义

R_th = ΔT / P_heat = (T_j - T_ambient) / P_heat

单位:°C/W 或 K/W

LED热阻组成

R_th_total = R_th(j-c) + R_th(c-s) + R_th(s-a)
  • R_th(j-c):结到壳热阻(芯片到封装)
  • R_th(c-s):壳到散热器热阻(界面)
  • R_th(s-a):散热器到环境热阻

典型热阻值

组件典型热阻(°C/W)说明
大功率LED芯片1-3陶瓷封装
中功率LED5-15塑料封装
导热硅脂0.1-0.5取决于厚度
铝基板0.5-2取决于厚度
散热器2-10取决于设计

3. LED辐射散热理论

3.1 LED照明辐射特性

3.1.1 LED灯具表面特性

LED灯具常用材料的发射率:

材料表面状态发射率应用部位
抛光0.05-0.1装饰外壳
阳极氧化0.8-0.9散热器
喷砂0.4-0.6散热器
铝压铸压铸面0.6-0.8散热器
塑料白色0.85-0.95灯罩
塑料黑色0.9-0.95散热器外壳
玻璃透明0.9灯罩
陶瓷白色0.9基板
3.1.2 辐射散热计算公式

LED灯具辐射散热功率:

Q_rad = ε × σ × A × (T_s⁴ - T_ambient⁴)

其中:

  • ε:表面发射率
  • σ:斯蒂芬-玻尔兹曼常数(5.67×10⁻⁸ W/m²·K⁴)
  • A:辐射表面积(m²)
  • T_s:表面温度(K)
  • T_ambient:环境温度(K)

线性化近似(小温差):

Q_rad ≈ h_rad × A × (T_s - T_ambient)

辐射换热系数:

h_rad = 4 × ε × σ × T_m³

T_m = (T_s + T_ambient)/2

在室温(25°C)下:

  • ε=0.9时,h_rad ≈ 5.5 W/(m²·K)
  • ε=0.1时,h_rad ≈ 0.6 W/(m²·K)

3.2 LED散热器辐射设计

3.2.1 散热器类型

压铸铝散热器

  • 成本低,适合大批量生产
  • 表面可阳极氧化处理
  • 发射率可达0.8-0.9
  • 适用于中小功率LED

挤压铝散热器

  • 导热性能好
  • 可设计复杂鳍片结构
  • 表面可喷砂或阳极氧化
  • 适用于中大功率LED

鳍片式散热器

  • 增加表面积
  • 提高对流和辐射效率
  • 可设计不同鳍片密度
  • 适用于大功率LED

均热板散热器

  • 二维热扩散
  • 温度均匀性好
  • 提高辐射效率
  • 适用于高功率密度LED
3.2.2 辐射散热优化策略

1. 表面发射率优化

阳极氧化处理:

  • 发射率从0.1提高到0.85
  • 辐射散热增加8.5倍
  • 成本增加约20-30%

喷砂处理:

  • 发射率从0.1提高到0.5
  • 辐射散热增加5倍
  • 成本增加约5-10%

黑色喷漆:

  • 发射率可达0.9-0.95
  • 辐射散热增加9-9.5倍
  • 但可能增加热阻

2. 表面积优化

鳍片设计:

  • 增加辐射表面积
  • 最优鳍片间距8-10mm
  • 鳍片高度40-60mm

表面处理:

  • 粗糙表面增加有效面积
  • 多孔结构增加辐射
  • 纳米结构增强辐射

3. 温度均匀性优化

热管集成:

  • 快速热量传递
  • 提高散热器整体温度
  • 增强辐射散热

均热板:

  • 二维热扩散
  • 减少热点
  • 提高辐射效率

3.3 辐射与对流耦合

3.3.1 总散热计算

LED灯具总散热:

Q_total = Q_conv + Q_rad
        = h_conv × A × (T_s - T_ambient) + ε × σ × A × (T_s⁴ - T_ambient⁴)

自然对流条件(h_conv = 5-10 W/m²·K):

假设:

  • A = 0.01 m²(100 cm²)
  • T_s = 80°C = 353 K
  • T_ambient = 25°C = 298 K
  • ε = 0.85

计算:

Q_conv = 8 × 0.01 × (353 - 298) = 4.4 W
Q_rad = 0.85 × 5.67×10⁻⁸ × 0.01 × (353⁴ - 298⁴) = 3.7 W
Q_total = 4.4 + 3.7 = 8.1 W

辐射占比:3.7 / 8.1 = 46%

3.3.2 温度对散热方式的影响

随着表面温度升高,辐射散热占比增加:

表面温度(°C)对流散热(W)辐射散热(W)辐射占比
502.01.847%
754.03.244%
1006.05.246%
1258.08.050%
15010.011.854%

结论:在高温工况下,辐射散热变得更加重要。


4. LED寿命预测与可靠性

4.1 LED失效机理

4.1.1 光衰机理

芯片退化

  • 晶体缺陷增加
  • 非辐射复合中心增多
  • 载流子寿命缩短
  • 发光效率下降

荧光粉老化

  • 热猝灭效应
  • 化学分解
  • 光化学降解
  • 转换效率下降

封装材料老化

  • 硅胶黄变
  • 环氧树脂开裂
  • 热应力累积
  • 光提取效率下降
4.1.2 热失效模式

焊点失效

  • 热疲劳裂纹
  • 金属间化合物生长
  • 导电导热性能下降
  • 开路失效

金属迁移

  • 高温下金属离子迁移
  • 电极短路
  • 漏电流增加
  • 热失控风险

封装分层

  • 不同材料热膨胀系数不匹配
  • 界面应力累积
  • 分层脱粘
  • 热阻增加

4.2 寿命预测模型

4.2.1 阿伦尼乌斯模型

LED寿命与结温的关系:

L = L₀ × exp(E_a / (k_B × T_j))

其中:

  • L:实际寿命(小时)
  • L₀:参考寿命(小时)
  • E_a:激活能(典型值0.3-0.7 eV)
  • k_B:玻尔兹曼常数(8.617×10⁻⁵ eV/K)
  • T_j:结温(K)

经验法则

结温每降低10°C,寿命延长约2倍。

典型数据

结温(°C)相对寿命L70寿命(小时)
85100%50,000
9550%25,000
10525%12,500
11512.5%6,250
4.2.2 LM-80和TM-21标准

LM-80标准

  • 测量LED光通量维持率
  • 至少3个壳温(55°C, 85°C, 可选温度)
  • 最少6,000小时测试
  • 每1,000小时测量光通量

TM-21标准

  • 基于LM-80数据预测寿命
  • 使用指数衰减模型
  • 预测L70(光通量降至70%)寿命
  • 最长预测6倍测试时间

L70寿命定义

光通量衰减到初始值70%时的时间:

Φ(t) = Φ₀ × exp(-α × t)

当Φ(t) = 0.7 × Φ₀时:

L70 = -ln(0.7) / α ≈ 0.357 / α

4.3 可靠性设计

4.3.1 热设计目标

结温控制目标

LED类型最大结温(°C)推荐工作结温(°C)
大功率LED15085-105
中功率LED12575-95
小功率LED11065-85

热阻设计目标

对于1W LED:

  • 总热阻 < 15°C/W(结到环境)
  • 散热器热阻 < 10°C/W

对于5W LED:

  • 总热阻 < 8°C/W
  • 散热器热阻 < 5°C/W

对于10W LED:

  • 总热阻 < 5°C/W
  • 散热器热阻 < 3°C/W
4.3.2 降额设计

电流降额

  • 工作电流不超过额定电流的80%
  • 降低发热功率
  • 延长使用寿命

温度降额

  • 结温不超过最大值的80%
  • 提高可靠性
  • 减少光衰

功率降额

  • 工作功率不超过额定功率的80%
  • 综合考虑电流和温度
  • 最安全的降额方式

5. LED照明设计实践

5.1 散热器设计流程

5.1.1 设计输入

电气参数

  • 驱动电流:I (A)
  • 正向压降:V_f (V)
  • 电功率:P_elec = I × V_f (W)

光学参数

  • 光通量:Φ (lm)
  • 光效:η = Φ / P_elec (lm/W)
  • 热功率:P_heat = P_elec × (1 - η/η_max)

热学参数

  • LED热阻:R_th(j-c) (°C/W)
  • 最大结温:T_j_max (°C)
  • 环境温度:T_ambient (°C)
5.1.2 散热器热阻计算

最大允许散热器温度

T_s_max = T_j_max - P_heat × R_th(j-c) - P_heat × R_th(c-s)

所需散热器热阻

R_th(s-a) = (T_s_max - T_ambient) / P_heat

设计案例

3W白光LED设计:

  • I = 0.7 A, V_f = 3.2 V
  • P_elec = 2.24 W
  • η = 120 lm/W, Φ = 268 lm
  • P_heat = 2.24 × (1 - 0.35) = 1.46 W
  • R_th(j-c) = 8°C/W
  • T_j_max = 125°C
  • T_ambient = 40°C(最坏情况)

计算:

T_s_max = 125 - 1.46 × 8 = 113.3°C
R_th(s-a) = (113.3 - 40) / 1.46 = 50.2°C/W

这个热阻很容易实现,普通铝散热器即可满足。

5.1.3 辐射散热贡献评估

辐射散热功率

假设:

  • 散热器面积 A = 30 cm² = 0.003 m²
  • 表面发射率 ε = 0.85
  • 表面温度 T_s = 80°C = 353 K
  • 环境温度 T_ambient = 40°C = 313 K

计算:

Q_rad = 0.85 × 5.67×10⁻⁸ × 0.003 × (353⁴ - 313⁴)
      = 0.85 × 5.67×10⁻⁸ × 0.003 × 5.5×10⁹
      = 0.79 W

辐射占比

总热功率1.46W,辐射散热0.79W,占比54%。

优化潜力

如果发射率从0.85提高到0.92(黑漆处理):

Q_rad_new = 0.92/0.85 × 0.79 = 0.86 W

辐射散热增加8.9%,总散热能力显著提升。

5.2 不同类型LED灯具设计

5.2.1 LED球泡灯

特点

  • 替代传统白炽灯
  • 体积受限(A19/A21规格)
  • 密闭空间,自然对流受限
  • 辐射散热重要

设计要点

  • 塑包铝结构
  • 外壳高发射率处理
  • 导热塑料或铝基板
  • 功率通常<15W

散热方案

  • 铝基板导热
  • 塑料外壳辐射散热
  • 表面发射率>0.85
  • 功率密度<0.5 W/cm²
5.2.2 LED筒灯/射灯

特点

  • 嵌入式安装
  • 散热空间受限
  • 可能密闭或半密闭
  • 功率范围5-50W

设计要点

  • 压铸铝散热器
  • 鳍片式散热结构
  • 表面阳极氧化
  • 考虑安装环境热阻

散热方案

  • 压铸铝散热器
  • 鳍片增加表面积
  • 表面发射率0.8-0.9
  • 可能需强制对流(风扇)
5.2.3 LED路灯

特点

  • 大功率(50-300W)
  • 户外环境
  • 可靠性要求高
  • 自然对流为主

设计要点

  • 大型挤压铝散热器
  • 蜂窝状或鳍片式结构
  • 高发射率表面处理
  • 防水设计

散热方案

  • 大面积散热器(0.5-2 m²)
  • 高发射率涂层(ε>0.9)
  • 对流+辐射联合散热
  • 热管可选
5.2.4 LED工矿灯

特点

  • 超高功率(100-500W)
  • 高空安装
  • 自然对流受限
  • 高可靠性要求

设计要点

  • 大型散热器
  • 相变传热(热管/均热板)
  • 辐射散热为主
  • 可能需强制风冷

散热方案

  • 热管散热器
  • 高发射率表面处理
  • 辐射散热占比>60%
  • 风扇辅助(可选)

5.3 表面处理工艺选择

5.3.1 阳极氧化

工艺特点

  • 电化学氧化处理
  • 形成Al₂O₃氧化膜
  • 膜厚5-25μm
  • 多孔结构,发射率高

性能参数

  • 发射率:0.8-0.9
  • 耐腐蚀性好
  • 绝缘性好
  • 颜色可选

成本

  • 中等成本
  • 适合大批量生产
  • 环保工艺

应用

  • LED散热器首选
  • 户外灯具
  • 高可靠性要求场合
5.3.2 喷砂处理

工艺特点

  • 机械喷砂处理
  • 增加表面粗糙度
  • 去除氧化层
  • 提高发射率

性能参数

  • 发射率:0.4-0.6
  • 成本低
  • 工艺简单
  • 可与其他工艺结合

成本

  • 低成本
  • 适合大批量生产

应用

  • 成本敏感产品
  • 室内灯具
  • 可与喷漆结合
5.3.3 喷漆处理

工艺特点

  • 喷涂散热漆或黑漆
  • 发射率可达0.9-0.95
  • 可能增加热阻
  • 颜色多样

性能参数

  • 发射率:0.9-0.95
  • 可能增加0.1-0.5°C/W热阻
  • 耐候性取决于漆料

成本

  • 低成本
  • 工艺简单

应用

  • 对外观有要求的产品
  • 室内灯具
  • 成本敏感产品
5.3.4 微弧氧化

工艺特点

  • 等离子体电解氧化
  • 形成陶瓷层
  • 膜厚20-100μm
  • 高硬度、耐磨

性能参数

  • 发射率:0.85-0.92
  • 极佳的耐腐蚀性
  • 绝缘性好
  • 成本高

成本

  • 高成本
  • 适合高端产品

应用

  • 海洋环境
  • 化工环境
  • 高可靠性要求

6. Python仿真案例分析

6.1 案例1:LED结温计算与辐射散热分析

问题描述
计算不同功率LED的结温,分析辐射散热在不同工况下的贡献。

仿真目标

  1. 计算LED结温随功率的变化
  2. 分析辐射散热占比随表面温度的变化
  3. 评估不同发射率对结温的影响

6.2 案例2:LED散热器优化设计

问题描述
设计一个10W LED路灯散热器,优化几何参数和表面处理。

仿真目标

  1. 优化散热器尺寸和鳍片数量
  2. 评估不同表面处理的效果
  3. 计算成本效益

6.3 案例3:LED寿命预测

问题描述
基于阿伦尼乌斯模型,预测不同结温下LED的寿命。

仿真目标

  1. 计算不同结温下的L70寿命
  2. 分析结温控制对寿命的影响
  3. 评估散热改进的寿命收益

6.4 案例4:LED灯具热仿真

问题描述
仿真一个LED筒灯的热特性,分析不同散热方案的优劣。

仿真目标

  1. 建立LED灯具热阻网络模型
  2. 计算稳态和瞬态温度分布
  3. 对比不同散热方案

7. 仿真结果与讨论

7.1 案例1结果分析

结温与功率关系

仿真结果显示,结温随功率线性增加:

T_j = T_ambient + P_heat × R_th_total

对于典型LED:

  • 1W LED:结温约65°C(R_th=40°C/W)
  • 3W LED:结温约85°C(R_th=15°C/W)
  • 5W LED:结温约105°C(R_th=13°C/W)

辐射散热占比

在表面温度80°C时:

  • 自然对流(h=8 W/m²·K):辐射占比约45%
  • 强制对流(h=25 W/m²·K):辐射占比约25%

发射率优化效果

将发射率从0.1提高到0.9:

  • 辐射散热增加9倍
  • 结温降低15-20°C
  • 寿命延长约2-4倍

7.2 案例2结果分析

散热器优化结果

最优设计参数:

  • 散热器尺寸:80mm × 50mm × 40mm
  • 鳍片数量:8片
  • 鳍片间距:8mm
  • 表面处理:阳极氧化(ε=0.85)

性能指标

  • 总热阻:4.5°C/W
  • 10W LED结温:85°C
  • 散热器质量:约150g
  • 成本:约¥15

表面处理对比

处理方式发射率结温(°C)相对成本
抛光0.11051.0
喷砂0.5921.1
阳极氧化0.85851.3
黑漆0.92831.2

7.3 案例3结果分析

寿命预测结果

基于阿伦尼乌斯模型(E_a=0.4 eV):

结温(°C)L70寿命(小时)相对寿命
7580,000320%
8550,000200%
9532,000128%
10520,00080%
11512,50050%
1258,00032%

散热改进收益

将结温从105°C降低到85°C:

  • 寿命从20,000小时延长到50,000小时
  • 寿命延长2.5倍
  • 通过优化散热器(成本增加¥5)实现

7.4 案例4结果分析

热阻网络分析

LED筒灯热阻网络:

R_th_total = R_th(j-c) + R_th(c-p) + R_th(p-s) + R_th(s-a)
           = 8 + 0.5 + 0.5 + 6
           = 15°C/W

温度分布

  • 结温:85°C
  • 壳温:77°C
  • 基板温度:76°C
  • 散热器温度:75°C

不同散热方案对比

方案热阻(°C/W)结温(°C)成本(¥)
压铸铝基础158510
  • 阳极氧化 | 15 | 85 | 13 |
  • 鳍片优化 | 10 | 75 | 18 |
  • 热管 | 6 | 65 | 35 |

附录:Python代码说明

本主题的Python仿真程序包含以下功能模块:

A.1 LED热学计算函数

def calculate_junction_temperature(P_heat, R_th_total, T_ambient):
    """
    计算LED结温
    
    参数:
    P_heat: 热功率 (W)
    R_th_total: 总热阻 (°C/W)
    T_ambient: 环境温度 (°C)
    
    返回:
    T_j: 结温 (°C)
    """
    T_j = T_ambient + P_heat * R_th_total
    return T_j


def predict_led_lifetime(T_j, E_a=0.4, L_0=50000):
    """
    预测LED寿命(阿伦尼乌斯模型)
    
    参数:
    T_j: 结温 (K)
    E_a: 激活能 (eV)
    L_0: 参考寿命 (小时)
    
    返回:
    L: 预测寿命 (小时)
    """
    k_B = 8.617e-5  # eV/K
    L = L_0 * np.exp(E_a / k_B * (1/T_j - 1/298))
    return L

A.2 辐射散热计算

def led_radiation_heat_transfer(epsilon, A, T_s, T_ambient):
    """
    计算LED灯具辐射散热
    
    参数:
    epsilon: 表面发射率
    A: 散热面积 (m²)
    T_s: 表面温度 (K)
    T_ambient: 环境温度 (K)
    
    返回:
    Q_rad: 辐射散热功率 (W)
    """
    sigma = 5.67e-8
    Q_rad = epsilon * sigma * A * (T_s**4 - T_ambient**4)
    return Q_rad

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
主题054:LED照明热管理辐射 - Python仿真程序

本程序包含以下仿真案例:
1. LED结温计算与辐射散热分析
2. LED散热器优化设计
3. LED寿命预测
4. LED灯具热仿真

作者:仿真教学团队
日期:2026年3月
"""

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.patches import Rectangle, FancyBboxPatch, Circle, FancyArrowPatch
import warnings
warnings.filterwarnings('ignore')

# 设置中文字体
plt.rcParams['font.sans-serif'] = ['SimHei', 'DejaVu Sans']
plt.rcParams['axes.unicode_minus'] = False

# 物理常数
SIGMA = 5.67e-8  # 斯蒂芬-玻尔兹曼常数 W/(m²·K⁴)

# ============================================================================
# LED热学计算函数
# ============================================================================

def calculate_junction_temperature(P_heat, R_th_total, T_ambient):
    """
    计算LED结温
    
    参数:
    P_heat: 热功率 (W)
    R_th_total: 总热阻 (°C/W)
    T_ambient: 环境温度 (°C)
    
    返回:
    T_j: 结温 (°C)
    """
    T_j = T_ambient + P_heat * R_th_total
    return T_j


def calculate_heat_power(P_elec, eta_optical):
    """
    计算LED热功率
    
    参数:
    P_elec: 电功率 (W)
    eta_optical: 电光转换效率
    
    返回:
    P_heat: 热功率 (W)
    """
    P_heat = P_elec * (1 - eta_optical)
    return P_heat


def led_radiation_heat_transfer(epsilon, A, T_s, T_ambient):
    """
    计算LED灯具辐射散热
    
    参数:
    epsilon: 表面发射率
    A: 散热面积 (m²)
    T_s: 表面温度 (K)
    T_ambient: 环境温度 (K)
    
    返回:
    Q_rad: 辐射散热功率 (W)
    """
    Q_rad = epsilon * SIGMA * A * (T_s**4 - T_ambient**4)
    return Q_rad


def convection_heat_transfer(h_conv, A, T_s, T_ambient):
    """
    计算对流散热
    
    参数:
    h_conv: 对流换热系数 (W/(m²·K))
    A: 散热面积 (m²)
    T_s: 表面温度 (°C)
    T_ambient: 环境温度 (°C)
    
    返回:
    Q_conv: 对流散热功率 (W)
    """
    Q_conv = h_conv * A * (T_s - T_ambient)
    return Q_conv


def predict_led_lifetime(T_j, E_a=0.4, L_0=50000):
    """
    预测LED寿命(阿伦尼乌斯模型)
    
    参数:
    T_j: 结温 (K)
    E_a: 激活能 (eV)
    L_0: 参考寿命 (小时)
    
    返回:
    L: 预测寿命 (小时)
    """
    k_B = 8.617e-5  # eV/K
    L = L_0 * np.exp(E_a / k_B * (1/T_j - 1/298))
    return L


def calculate_luminous_flux(T_j, T_ref=25, k_temp=0.004):
    """
    计算光通量随结温的变化
    
    参数:
    T_j: 结温 (°C)
    T_ref: 参考温度 (°C)
    k_temp: 温度系数 (/°C)
    
    返回:
    relative_flux: 相对光通量
    """
    relative_flux = 1 - k_temp * (T_j - T_ref)
    return max(relative_flux, 0)


# ============================================================================
# 案例1:LED结温计算与辐射散热分析
# ============================================================================

def case1_led_junction_temperature():
    """
    案例1:LED结温计算与辐射散热分析
    """
    print("\n" + "="*80)
    print("案例1:LED结温计算与辐射散热分析")
    print("="*80)
    
    # LED参数
    led_types = {
        '1W_LED': {'P_elec': 1.0, 'eta': 0.35, 'R_th_jc': 15, 'R_th_ja': 40},
        '3W_LED': {'P_elec': 3.0, 'eta': 0.35, 'R_th_jc': 8, 'R_th_ja': 15},
        '5W_LED': {'P_elec': 5.0, 'eta': 0.35, 'R_th_jc': 6, 'R_th_ja': 13},
        '10W_LED': {'P_elec': 10.0, 'eta': 0.35, 'R_th_jc': 3, 'R_th_ja': 8},
    }
    
    T_ambient = 25  # °C
    
    print("\n不同功率LED的结温计算:")
    print("-" * 60)
    print(f"{'LED类型':<12} {'电功率(W)':<12} {'热功率(W)':<12} {'热阻(°C/W)':<12} {'结温(°C)':<12}")
    print("-" * 60)
    
    results = []
    for led_name, params in led_types.items():
        P_elec = params['P_elec']
        eta = params['eta']
        R_th = params['R_th_ja']
        
        P_heat = calculate_heat_power(P_elec, eta)
        T_j = calculate_junction_temperature(P_heat, R_th, T_ambient)
        
        results.append({
            'name': led_name,
            'P_elec': P_elec,
            'P_heat': P_heat,
            'R_th': R_th,
            'T_j': T_j
        })
        
        print(f"{led_name:<12} {P_elec:<12.1f} {P_heat:<12.2f} {R_th:<12.1f} {T_j:<12.1f}")
    
    # 辐射散热占比分析
    print("\n\n辐射散热占比分析(3W LED为例):")
    print("-" * 60)
    
    # 3W LED参数
    P_heat = 3.0 * (1 - 0.35)  # 热功率
    A = 0.005  # 散热面积 50 cm²
    epsilon = 0.85  # 表面发射率
    h_conv_natural = 8  # 自然对流系数
    h_conv_forced = 25  # 强制对流系数
    
    T_s_range = np.linspace(40, 120, 50)  # 表面温度范围
    
    rad_ratios_natural = []
    rad_ratios_forced = []
    
    for T_s in T_s_range:
        T_s_k = T_s + 273.15
        T_amb_k = T_ambient + 273.15
        
        # 自然对流
        Q_rad = led_radiation_heat_transfer(epsilon, A, T_s_k, T_amb_k)
        Q_conv = convection_heat_transfer(h_conv_natural, A, T_s, T_ambient)
        Q_total = Q_rad + Q_conv
        rad_ratios_natural.append(Q_rad / Q_total * 100 if Q_total > 0 else 0)
        
        # 强制对流
        Q_conv_forced = convection_heat_transfer(h_conv_forced, A, T_s, T_ambient)
        Q_total_forced = Q_rad + Q_conv_forced
        rad_ratios_forced.append(Q_rad / Q_total_forced * 100 if Q_total_forced > 0 else 0)
    
    print(f"表面温度范围: {T_s_range[0]:.0f}°C - {T_s_range[-1]:.0f}°C")
    print(f"自然对流条件下辐射占比: {np.mean(rad_ratios_natural):.1f}% (平均)")
    print(f"强制对流条件下辐射占比: {np.mean(rad_ratios_forced):.1f}% (平均)")
    
    # 发射率优化效果
    print("\n\n发射率优化效果分析:")
    print("-" * 60)
    
    epsilon_values = np.linspace(0.05, 0.95, 10)
    T_s_fixed = 80  # 固定表面温度
    T_s_k = T_s_fixed + 273.15
    T_amb_k = T_ambient + 273.15
    
    print(f"{'发射率':<10} {'辐射散热(W)':<15} {'相对提升':<15}")
    print("-" * 40)
    
    Q_rad_baseline = led_radiation_heat_transfer(0.1, A, T_s_k, T_amb_k)
    
    for eps in epsilon_values:
        Q_rad = led_radiation_heat_transfer(eps, A, T_s_k, T_amb_k)
        improvement = (Q_rad / Q_rad_baseline - 1) * 100
        print(f"{eps:<10.2f} {Q_rad:<15.3f} {improvement:<15.1f}%")
    
    # 可视化
    fig, axes = plt.subplots(2, 2, figsize=(14, 10))
    fig.suptitle('LED结温与辐射散热分析', fontsize=16, fontweight='bold')
    
    # 图1:不同功率LED结温
    ax1 = axes[0, 0]
    led_names = [r['name'] for r in results]
    T_j_values = [r['T_j'] for r in results]
    colors = ['#3498db', '#2ecc71', '#f39c12', '#e74c3c']
    
    bars = ax1.bar(led_names, T_j_values, color=colors, edgecolor='black', linewidth=1.5)
    ax1.axhline(y=85, color='green', linestyle='--', linewidth=2, label='推荐结温 85°C')
    ax1.axhline(y=125, color='red', linestyle='--', linewidth=2, label='最大结温 125°C')
    ax1.set_ylabel('结温 (°C)', fontsize=12)
    ax1.set_xlabel('LED类型', fontsize=12)
    ax1.set_title('不同功率LED结温对比', fontsize=13, fontweight='bold')
    ax1.legend(fontsize=10)
    ax1.grid(axis='y', alpha=0.3)
    
    for bar, T_j in zip(bars, T_j_values):
        ax1.text(bar.get_x() + bar.get_width()/2, bar.get_height() + 2, 
                f'{T_j:.1f}°C', ha='center', va='bottom', fontsize=10, fontweight='bold')
    
    # 图2:辐射散热占比随温度变化
    ax2 = axes[0, 1]
    ax2.plot(T_s_range, rad_ratios_natural, 'b-', linewidth=2.5, label='自然对流 (h=8 W/m²·K)')
    ax2.plot(T_s_range, rad_ratios_forced, 'r--', linewidth=2.5, label='强制对流 (h=25 W/m²·K)')
    ax2.fill_between(T_s_range, rad_ratios_natural, alpha=0.2, color='blue')
    ax2.set_xlabel('表面温度 (°C)', fontsize=12)
    ax2.set_ylabel('辐射散热占比 (%)', fontsize=12)
    ax2.set_title('辐射散热占比随表面温度变化', fontsize=13, fontweight='bold')
    ax2.legend(fontsize=10)
    ax2.grid(True, alpha=0.3)
    
    # 图3:发射率优化效果
    ax3 = axes[1, 0]
    Q_rad_values = [led_radiation_heat_transfer(eps, A, T_s_k, T_amb_k) for eps in epsilon_values]
    ax3.plot(epsilon_values, Q_rad_values, 'g-', linewidth=2.5, marker='o', markersize=6)
    ax3.fill_between(epsilon_values, Q_rad_values, alpha=0.2, color='green')
    ax3.set_xlabel('表面发射率', fontsize=12)
    ax3.set_ylabel('辐射散热功率 (W)', fontsize=12)
    ax3.set_title(f'发射率对辐射散热的影响 (T_s={T_s_fixed}°C)', fontsize=13, fontweight='bold')
    ax3.grid(True, alpha=0.3)
    
    # 图4:热功率与结温关系
    ax4 = axes[1, 1]
    P_heat_range = np.linspace(0.5, 8, 50)
    R_th_values = [40, 15, 13, 8]
    labels = ['1W LED (Rth=40)', '3W LED (Rth=15)', '5W LED (Rth=13)', '10W LED (Rth=8)']
    colors_line = ['#3498db', '#2ecc71', '#f39c12', '#e74c3c']
    
    for R_th, label, color in zip(R_th_values, labels, colors_line):
        T_j_curve = T_ambient + P_heat_range * R_th
        ax4.plot(P_heat_range, T_j_curve, linewidth=2.5, label=label, color=color)
    
    ax4.axhline(y=85, color='green', linestyle='--', linewidth=2, alpha=0.7)
    ax4.axhline(y=125, color='red', linestyle='--', linewidth=2, alpha=0.7)
    ax4.set_xlabel('热功率 (W)', fontsize=12)
    ax4.set_ylabel('结温 (°C)', fontsize=12)
    ax4.set_title('热功率与结温关系', fontsize=13, fontweight='bold')
    ax4.legend(fontsize=9)
    ax4.grid(True, alpha=0.3)
    ax4.set_xlim([0.5, 8])
    ax4.set_ylim([20, 150])
    
    plt.tight_layout()
    plt.savefig('case1_led_junction_temperature.png', dpi=150, bbox_inches='tight')
    print("\n✓ 案例1结果已保存: case1_led_junction_temperature.png")
    plt.close()


# ============================================================================
# 案例2:LED散热器优化设计
# ============================================================================

def case2_heatsink_optimization():
    """
    案例2:LED散热器优化设计
    """
    print("\n" + "="*80)
    print("案例2:LED散热器优化设计")
    print("="*80)
    
    # 10W LED路灯设计参数
    P_elec = 10.0  # W
    eta = 0.35  # 电光转换效率
    P_heat = calculate_heat_power(P_elec, eta)  # 热功率
    T_j_max = 125  # 最大结温 °C
    T_ambient = 40  # 环境温度 °C(最坏情况)
    R_th_jc = 3  # 结到壳热阻 °C/W
    R_th_cs = 0.5  # 壳到散热器热阻 °C/W
    
    # 计算所需散热器热阻
    T_s_max = T_j_max - P_heat * (R_th_jc + R_th_cs)
    R_th_required = (T_s_max - T_ambient) / P_heat
    
    print(f"\n10W LED路灯散热器设计要求:")
    print(f"  电功率: {P_elec} W")
    print(f"  热功率: {P_heat:.2f} W")
    print(f"  最大允许散热器温度: {T_s_max:.1f}°C")
    print(f"  所需散热器热阻: {R_th_required:.2f} °C/W")
    
    # 散热器几何参数优化
    print("\n\n散热器几何参数优化:")
    print("-" * 60)
    
    # 基板尺寸
    base_width = 80  # mm
    base_length = 50  # mm
    
    # 鳍片参数范围
    fin_heights = np.linspace(20, 60, 9)  # 鳍片高度 mm
    fin_numbers = range(5, 16)  # 鳍片数量
    
    # 材料属性
    k_al = 200  # 铝导热系数 W/(m·K)
    epsilon_surface = 0.85  # 阳极氧化表面发射率
    h_conv = 8  # 自然对流系数 W/(m²·K)
    
    best_design = None
    best_score = float('inf')
    
    results_matrix = []
    
    for n_fins in fin_numbers:
        row = []
        for h_fin in fin_heights:
            # 计算鳍片间距
            spacing = (base_length - n_fins * 2) / (n_fins + 1)  # 假设鳍片厚度2mm
            
            if spacing < 4:  # 最小间距限制
                row.append(None)
                continue
            
            # 计算散热面积
            A_base = base_width * base_length * 1e-6  # m²
            A_fins = n_fins * 2 * (base_width + h_fin) * h_fin * 1e-6  # m² (两侧)
            A_total = A_base + A_fins
            
            # 计算辐射散热热阻
            T_s_avg = 80 + 273.15  # 假设平均表面温度
            T_amb_k = T_ambient + 273.15
            h_rad = 4 * epsilon_surface * SIGMA * ((T_s_avg + T_amb_k)/2)**3
            R_th_rad = 1 / (h_rad * A_total)
            
            # 计算对流散热热阻
            R_th_conv = 1 / (h_conv * A_total)
            
            # 并联热阻
            R_th_total = 1 / (1/R_th_rad + 1/R_th_conv)
            
            # 计算鳍片效率
            m = np.sqrt(2 * h_conv / (k_al * 0.002))  # 假设鳍片厚度2mm
            eta_fin = np.tanh(m * h_fin * 1e-3) / (m * h_fin * 1e-3)
            
            # 有效散热面积
            A_effective = A_base + A_fins * eta_fin
            
            # 计算实际热阻(考虑鳍片效率)
            R_th_actual = R_th_total * (A_total / A_effective)
            
            # 计算结温
            T_s = T_ambient + P_heat * R_th_actual
            T_j = T_s + P_heat * (R_th_jc + R_th_cs)
            
            # 计算质量
            volume = (base_width * base_length * 3 + n_fins * base_width * h_fin * 2) * 1e-9  # m³
            mass = volume * 2700  # kg (铝密度)
            
            # 评分(越低越好)
            score = R_th_actual + mass * 10  # 综合考虑热阻和质量
            
            row.append({
                'n_fins': n_fins,
                'h_fin': h_fin,
                'spacing': spacing,
                'A_total': A_total * 1e4,  # cm²
                'R_th': R_th_actual,
                'T_s': T_s,
                'T_j': T_j,
                'mass': mass * 1000,  # g
                'score': score
            })
            
            if score < best_score and T_j < T_j_max:
                best_score = score
                best_design = row[-1]
        
        results_matrix.append(row)
    
    # 输出优化结果
    print(f"\n最优散热器设计参数:")
    if best_design:
        print(f"  鳍片数量: {best_design['n_fins']}")
        print(f"  鳍片高度: {best_design['h_fin']:.0f} mm")
        print(f"  鳍片间距: {best_design['spacing']:.1f} mm")
        print(f"  总散热面积: {best_design['A_total']:.1f} cm²")
        print(f"  散热器热阻: {best_design['R_th']:.2f} °C/W")
        print(f"  表面温度: {best_design['T_s']:.1f}°C")
        print(f"  结温: {best_design['T_j']:.1f}°C")
        print(f"  散热器质量: {best_design['mass']:.1f} g")
    
    # 表面处理对比
    print("\n\n不同表面处理方式对比:")
    print("-" * 60)
    
    surface_treatments = {
        '抛光铝': {'epsilon': 0.1, 'cost_factor': 1.0},
        '喷砂铝': {'epsilon': 0.5, 'cost_factor': 1.1},
        '阳极氧化': {'epsilon': 0.85, 'cost_factor': 1.3},
        '黑漆处理': {'epsilon': 0.92, 'cost_factor': 1.2},
    }
    
    A_fixed = 0.015  # m² (固定散热面积)
    T_s_fixed = 80  # °C
    
    print(f"{'处理方式':<12} {'发射率':<10} {'辐射散热(W)':<15} {'结温(°C)':<12} {'相对成本':<12}")
    print("-" * 65)
    
    for name, params in surface_treatments.items():
        epsilon = params['epsilon']
        cost_factor = params['cost_factor']
        
        T_s_k = T_s_fixed + 273.15
        T_amb_k = T_ambient + 273.15
        
        Q_rad = led_radiation_heat_transfer(epsilon, A_fixed, T_s_k, T_amb_k)
        Q_conv = convection_heat_transfer(h_conv, A_fixed, T_s_fixed, T_ambient)
        
        # 计算热阻
        h_rad = 4 * epsilon * SIGMA * ((T_s_k + T_amb_k)/2)**3
        R_th_rad = 1 / (h_rad * A_fixed)
        R_th_conv = 1 / (h_conv * A_fixed)
        R_th_total = 1 / (1/R_th_rad + 1/R_th_conv)
        
        T_j = T_ambient + P_heat * (R_th_total + R_th_jc + R_th_cs)
        
        print(f"{name:<12} {epsilon:<10.2f} {Q_rad:<15.2f} {T_j:<12.1f} {cost_factor:<12.1f}")
    
    # 可视化
    fig, axes = plt.subplots(2, 2, figsize=(14, 10))
    fig.suptitle('LED散热器优化设计', fontsize=16, fontweight='bold')
    
    # 图1:鳍片数量vs热阻
    ax1 = axes[0, 0]
    n_fins_list = list(fin_numbers)
    R_th_by_fins = []
    
    for i, n_fins in enumerate(fin_numbers):
        valid_results = [r for r in results_matrix[i] if r is not None]
        if valid_results:
            avg_R_th = np.mean([r['R_th'] for r in valid_results])
            R_th_by_fins.append(avg_R_th)
        else:
            R_th_by_fins.append(None)
    
    ax1.plot(n_fins_list, R_th_by_fins, 'b-o', linewidth=2.5, markersize=8)
    ax1.axhline(y=R_th_required, color='red', linestyle='--', linewidth=2, 
                label=f'要求热阻 {R_th_required:.1f} °C/W')
    ax1.set_xlabel('鳍片数量', fontsize=12)
    ax1.set_ylabel('散热器热阻 (°C/W)', fontsize=12)
    ax1.set_title('鳍片数量对热阻的影响', fontsize=13, fontweight='bold')
    ax1.legend(fontsize=10)
    ax1.grid(True, alpha=0.3)
    
    # 图2:鳍片高度vs热阻
    ax2 = axes[0, 1]
    R_th_by_height = []
    
    for j, h_fin in enumerate(fin_heights):
        col_values = []
        for i in range(len(fin_numbers)):
            if results_matrix[i][j] is not None:
                col_values.append(results_matrix[i][j]['R_th'])
        if col_values:
            R_th_by_height.append(np.mean(col_values))
        else:
            R_th_by_height.append(None)
    
    ax2.plot(fin_heights, R_th_by_height, 'g-s', linewidth=2.5, markersize=8)
    ax2.axhline(y=R_th_required, color='red', linestyle='--', linewidth=2,
                label=f'要求热阻 {R_th_required:.1f} °C/W')
    ax2.set_xlabel('鳍片高度 (mm)', fontsize=12)
    ax2.set_ylabel('散热器热阻 (°C/W)', fontsize=12)
    ax2.set_title('鳍片高度对热阻的影响', fontsize=13, fontweight='bold')
    ax2.legend(fontsize=10)
    ax2.grid(True, alpha=0.3)
    
    # 图3:表面处理对比
    ax3 = axes[1, 0]
    treatment_names = list(surface_treatments.keys())
    T_j_values = []
    
    for name, params in surface_treatments.items():
        epsilon = params['epsilon']
        h_rad = 4 * epsilon * SIGMA * ((T_s_fixed + 273.15 + T_ambient + 273.15)/2)**3
        R_th_rad = 1 / (h_rad * A_fixed)
        R_th_conv = 1 / (h_conv * A_fixed)
        R_th_total = 1 / (1/R_th_rad + 1/R_th_conv)
        T_j = T_ambient + P_heat * (R_th_total + R_th_jc + R_th_cs)
        T_j_values.append(T_j)
    
    colors = ['#95a5a6', '#3498db', '#2ecc71', '#e74c3c']
    bars = ax3.bar(treatment_names, T_j_values, color=colors, edgecolor='black', linewidth=1.5)
    ax3.axhline(y=T_j_max, color='red', linestyle='--', linewidth=2, label='最大结温 125°C')
    ax3.axhline(y=85, color='green', linestyle='--', linewidth=2, label='推荐结温 85°C')
    ax3.set_ylabel('结温 (°C)', fontsize=12)
    ax3.set_xlabel('表面处理方式', fontsize=12)
    ax3.set_title('不同表面处理的结温对比', fontsize=13, fontweight='bold')
    ax3.legend(fontsize=10)
    ax3.grid(axis='y', alpha=0.3)
    
    for bar, T_j in zip(bars, T_j_values):
        ax3.text(bar.get_x() + bar.get_width()/2, bar.get_height() + 2,
                f'{T_j:.1f}°C', ha='center', va='bottom', fontsize=9, fontweight='bold')
    
    # 图4:热阻网络图
    ax4 = axes[1, 1]
    ax4.set_xlim(0, 10)
    ax4.set_ylim(0, 10)
    ax4.axis('off')
    ax4.set_title('LED热阻网络示意图', fontsize=13, fontweight='bold')
    
    # 绘制热阻网络
    # LED芯片
    led = FancyBboxPatch((0.5, 7), 1.5, 1.5, boxstyle="round,pad=0.1", 
                         facecolor='yellow', edgecolor='black', linewidth=2)
    ax4.add_patch(led)
    ax4.text(1.25, 7.75, 'LED\n芯片', ha='center', va='center', fontsize=10, fontweight='bold')
    
    # 热阻箭头
    ax4.annotate('', xy=(3, 7.75), xytext=(2, 7.75),
                arrowprops=dict(arrowstyle='->', lw=3, color='red'))
    ax4.text(2.5, 8.2, 'Rth(j-c)', ha='center', fontsize=9, color='red', fontweight='bold')
    
    # 封装
    package = FancyBboxPatch((3, 7), 1.5, 1.5, boxstyle="round,pad=0.1",
                            facecolor='orange', edgecolor='black', linewidth=2)
    ax4.add_patch(package)
    ax4.text(3.75, 7.75, '封装', ha='center', va='center', fontsize=10, fontweight='bold')
    
    # 界面热阻
    ax4.annotate('', xy=(5.5, 7.75), xytext=(4.5, 7.75),
                arrowprops=dict(arrowstyle='->', lw=3, color='red'))
    ax4.text(5, 8.2, 'Rth(c-s)', ha='center', fontsize=9, color='red', fontweight='bold')
    
    # 散热器
    heatsink = FancyBboxPatch((5.5, 6.5), 3, 2.5, boxstyle="round,pad=0.1",
                             facecolor='silver', edgecolor='black', linewidth=2)
    ax4.add_patch(heatsink)
    ax4.text(7, 7.75, '散热器', ha='center', va='center', fontsize=10, fontweight='bold')
    
    # 散热器热阻
    ax4.text(7, 6.8, f'Rth(s-a) = {R_th_required:.1f} °C/W', ha='center', 
            fontsize=9, color='blue', fontweight='bold')
    
    # 散热方式
    ax4.annotate('', xy=(8.5, 5.5), xytext=(8.5, 6.5),
                arrowprops=dict(arrowstyle='->', lw=2, color='blue'))
    ax4.text(8.5, 5.2, '对流', ha='center', fontsize=9, color='blue')
    
    ax4.annotate('', xy=(6.5, 5.5), xytext=(6.5, 6.5),
                arrowprops=dict(arrowstyle='->', lw=2, color='green'))
    ax4.text(6.5, 5.2, '辐射', ha='center', fontsize=9, color='green')
    
    # 环境温度
    ax4.text(7, 4.5, f'环境温度 = {T_ambient}°C', ha='center', fontsize=10, 
            bbox=dict(boxstyle='round', facecolor='lightblue', alpha=0.5))
    
    plt.tight_layout()
    plt.savefig('case2_heatsink_optimization.png', dpi=150, bbox_inches='tight')
    print("\n✓ 案例2结果已保存: case2_heatsink_optimization.png")
    plt.close()


# ============================================================================
# 案例3:LED寿命预测
# ============================================================================

def case3_led_lifetime_prediction():
    """
    案例3:LED寿命预测
    """
    print("\n" + "="*80)
    print("案例3:LED寿命预测")
    print("="*80)
    
    # 阿伦尼乌斯模型参数
    E_a = 0.4  # 激活能 eV
    L_0 = 50000  # 参考寿命(结温85°C时)小时
    
    # 结温范围
    T_j_range = np.linspace(60, 140, 50)  # °C
    T_j_kelvin = T_j_range + 273.15
    
    # 计算寿命
    lifetimes = [predict_led_lifetime(T_j, E_a, L_0) for T_j in T_j_kelvin]
    
    print("\n不同结温下的LED寿命预测(阿伦尼乌斯模型):")
    print("-" * 60)
    print(f"{'结温(°C)':<12} {'L70寿命(小时)':<18} {'相对寿命':<15} {'使用年限(年)'}")
    print("-" * 60)
    
    # 选取几个关键点输出
    key_temps = [75, 85, 95, 105, 115, 125]
    for T_j in key_temps:
        T_j_k = T_j + 273.15
        L = predict_led_lifetime(T_j_k, E_a, L_0)
        relative_L = L / L_0 * 100
        years = L / (24 * 365)
        print(f"{T_j:<12} {L:<18.0f} {relative_L:<15.1f}% {years:<12.1f}")
    
    # 经验法则验证
    print("\n\n经验法则验证:结温每降低10°C,寿命延长约2倍")
    print("-" * 60)
    
    for T_j in [105, 95, 85]:
        T_j_k = T_j + 273.15
        L = predict_led_lifetime(T_j_k, E_a, L_0)
        L_next = predict_led_lifetime(T_j_k - 10, E_a, L_0)
        ratio = L_next / L
        print(f"结温从{T_j}°C降到{T_j-10}°C: 寿命从{L:.0f}小时延长到{L_next:.0f}小时,延长{ratio:.2f}倍")
    
    # 散热改进的寿命收益
    print("\n\n散热改进的寿命收益分析:")
    print("-" * 60)
    
    # 假设通过优化散热器,结温从105°C降到85°C
    T_j_before = 105 + 273.15
    T_j_after = 85 + 273.15
    
    L_before = predict_led_lifetime(T_j_before, E_a, L_0)
    L_after = predict_led_lifetime(T_j_after, E_a, L_0)
    
    print(f"优化前结温: 105°C, 寿命: {L_before:.0f} 小时 ({L_before/24/365:.1f} 年)")
    print(f"优化后结温: 85°C, 寿命: {L_after:.0f} 小时 ({L_after/24/365:.1f} 年)")
    print(f"寿命延长: {L_after - L_before:.0f} 小时 ({(L_after/L_before - 1)*100:.1f}%)")
    print(f"假设每天使用8小时,延长使用寿命: {(L_after - L_before)/8/365:.1f} 年")
    
    # 光衰预测
    print("\n\n光通量衰减预测:")
    print("-" * 60)
    
    time_years = np.linspace(0, 10, 100)  # 年
    time_hours = time_years * 365 * 24
    
    # 不同结温下的光衰曲线
    decay_rates = {
        75: 0.000008,  # 衰减系数 /小时
        85: 0.000014,
        95: 0.000024,
        105: 0.000041,
        115: 0.000070,
    }
    
    print(f"{'结温(°C)':<12} {'L70寿命(年)':<15} {'5年光通量维持率':<20}")
    print("-" * 50)
    
    for T_j, alpha in decay_rates.items():
        L70 = -np.log(0.7) / alpha / 24 / 365
        flux_5yr = np.exp(-alpha * 5 * 365 * 24) * 100
        print(f"{T_j:<12} {L70:<15.1f} {flux_5yr:<20.1f}%")
    
    # 可视化
    fig, axes = plt.subplots(2, 2, figsize=(14, 10))
    fig.suptitle('LED寿命预测与可靠性分析', fontsize=16, fontweight='bold')
    
    # 图1:寿命vs结温(阿伦尼乌斯曲线)
    ax1 = axes[0, 0]
    ax1.semilogy(T_j_range, lifetimes, 'b-', linewidth=2.5)
    ax1.fill_between(T_j_range, lifetimes, alpha=0.2, color='blue')
    
    # 标记关键点
    for T_j in key_temps:
        T_j_k = T_j + 273.15
        L = predict_led_lifetime(T_j_k, E_a, L_0)
        ax1.plot(T_j, L, 'ro', markersize=8)
        ax1.annotate(f'{L/1000:.0f}k', xy=(T_j, L), xytext=(T_j+2, L*1.5),
                    fontsize=9, fontweight='bold')
    
    ax1.axhline(y=50000, color='green', linestyle='--', linewidth=2, label='参考寿命 50,000h')
    ax1.axvline(x=85, color='green', linestyle=':', linewidth=2, alpha=0.7)
    ax1.axvline(x=125, color='red', linestyle=':', linewidth=2, alpha=0.7)
    ax1.set_xlabel('结温 (°C)', fontsize=12)
    ax1.set_ylabel('L70寿命 (小时)', fontsize=12)
    ax1.set_title('LED寿命随结温变化(阿伦尼乌斯模型)', fontsize=13, fontweight='bold')
    ax1.legend(fontsize=10)
    ax1.grid(True, alpha=0.3)
    ax1.set_xlim([60, 140])
    
    # 图2:光通量衰减曲线
    ax2 = axes[0, 1]
    colors = ['#2ecc71', '#3498db', '#f39c12', '#e74c3c', '#9b59b6']
    
    for i, (T_j, alpha) in enumerate(decay_rates.items()):
        flux = np.exp(-alpha * time_hours) * 100
        ax2.plot(time_years, flux, linewidth=2.5, label=f'{T_j}°C', color=colors[i])
        
        # 标记L70点
        L70_idx = np.argmin(np.abs(flux - 70))
        if L70_idx < len(time_years) - 1:
            ax2.plot(time_years[L70_idx], 70, 'o', color=colors[i], markersize=8)
    
    ax2.axhline(y=70, color='red', linestyle='--', linewidth=2, label='L70 (70%)')
    ax2.axhline(y=80, color='orange', linestyle='--', linewidth=2, label='L80 (80%)')
    ax2.set_xlabel('时间 (年)', fontsize=12)
    ax2.set_ylabel('相对光通量 (%)', fontsize=12)
    ax2.set_title('不同结温下的光通量衰减曲线', fontsize=13, fontweight='bold')
    ax2.legend(fontsize=9, ncol=2)
    ax2.grid(True, alpha=0.3)
    ax2.set_xlim([0, 10])
    ax2.set_ylim([50, 105])
    
    # 图3:散热改进收益
    ax3 = axes[1, 0]
    
    # 不同散热方案的成本和寿命
    scenarios = {
        '基础方案\n(结温105°C)': {'T_j': 105, 'cost': 10},
        '+ 阳极氧化\n(结温100°C)': {'T_j': 100, 'cost': 13},
        '+ 鳍片优化\n(结温90°C)': {'T_j': 90, 'cost': 18},
        '+ 热管\n(结温75°C)': {'T_j': 75, 'cost': 35},
    }
    
    scenario_names = list(scenarios.keys())
    lifetimes_scenario = []
    costs = []
    
    for name, params in scenarios.items():
        T_j_k = params['T_j'] + 273.15
        L = predict_led_lifetime(T_j_k, E_a, L_0)
        lifetimes_scenario.append(L / 1000)  # 转换为千小时
        costs.append(params['cost'])
    
    x_pos = np.arange(len(scenario_names))
    bars = ax3.bar(x_pos, lifetimes_scenario, color=colors[:len(scenarios)], 
                   edgecolor='black', linewidth=1.5)
    
    # 添加成本标签
    for i, (bar, cost) in enumerate(zip(bars, costs)):
        ax3.text(bar.get_x() + bar.get_width()/2, bar.get_height() + 2,
                f'¥{cost}', ha='center', va='bottom', fontsize=9, fontweight='bold')
    
    ax3.set_xticks(x_pos)
    ax3.set_xticklabels(scenario_names, fontsize=9)
    ax3.set_ylabel('L70寿命 (千小时)', fontsize=12)
    ax3.set_xlabel('散热方案', fontsize=12)
    ax3.set_title('不同散热方案的寿命与成本对比', fontsize=13, fontweight='bold')
    ax3.grid(axis='y', alpha=0.3)
    
    # 图4:性价比分析
    ax4 = axes[1, 1]
    
    # 计算性价比(寿命/成本)
    cost_effectiveness = [L / cost for L, cost in zip(lifetimes_scenario, costs)]
    
    ax4.bar(x_pos, cost_effectiveness, color=colors[:len(scenarios)], 
            edgecolor='black', linewidth=1.5)
    ax4.set_xticks(x_pos)
    ax4.set_xticklabels(scenario_names, fontsize=9)
    ax4.set_ylabel('性价比 (千小时/¥)', fontsize=12)
    ax4.set_xlabel('散热方案', fontsize=12)
    ax4.set_title('散热方案性价比分析', fontsize=13, fontweight='bold')
    ax4.grid(axis='y', alpha=0.3)
    
    # 标记最优方案
    best_idx = np.argmax(cost_effectiveness)
    ax4.annotate('最优', xy=(best_idx, cost_effectiveness[best_idx]), 
                xytext=(best_idx, cost_effectiveness[best_idx] + 0.5),
                ha='center', fontsize=11, fontweight='bold', color='green',
                arrowprops=dict(arrowstyle='->', color='green', lw=2))
    
    plt.tight_layout()
    plt.savefig('case3_led_lifetime_prediction.png', dpi=150, bbox_inches='tight')
    print("\n✓ 案例3结果已保存: case3_led_lifetime_prediction.png")
    plt.close()


# ============================================================================
# 案例4:LED灯具热仿真
# ============================================================================

def case4_led_luminaire_thermal_simulation():
    """
    案例4:LED灯具热仿真
    """
    print("\n" + "="*80)
    print("案例4:LED灯具热仿真")
    print("="*80)
    
    # LED筒灯参数
    P_elec = 12.0  # W
    eta = 0.35  # 电光转换效率
    P_heat = calculate_heat_power(P_elec, eta)  # 热功率
    T_ambient = 25  # °C
    
    # 热阻网络参数
    R_th_jc = 8  # 结到壳热阻 °C/W
    R_th_cs = 0.5  # 壳到基板热阻 °C/W (导热硅脂)
    R_th_pb = 0.3  # 基板到散热器热阻 °C/W
    
    # 不同散热器方案
    heatsink_configs = {
        '基础压铸铝': {'R_th': 8.0, 'epsilon': 0.6, 'cost': 8},
        '阳极氧化': {'R_th': 7.5, 'epsilon': 0.85, 'cost': 12},
        '鳍片优化': {'R_th': 5.0, 'epsilon': 0.85, 'cost': 18},
        '热管散热': {'R_th': 3.0, 'epsilon': 0.9, 'cost': 35},
    }
    
    print("\nLED筒灯热阻网络分析:")
    print("-" * 70)
    print(f"{'散热方案':<12} {'总热阻':<10} {'结温(°C)':<12} {'壳温(°C)':<12} {'成本(¥)':<10}")
    print("-" * 70)
    
    results = []
    for name, config in heatsink_configs.items():
        R_th_hs = config['R_th']
        R_th_total = R_th_jc + R_th_cs + R_th_pb + R_th_hs
        
        # 计算温度
        T_j = T_ambient + P_heat * R_th_total
        T_c = T_j - P_heat * R_th_jc
        T_s = T_c - P_heat * (R_th_cs + R_th_pb)
        
        print(f"{name:<12} {R_th_total:<10.1f} {T_j:<12.1f} {T_c:<12.1f} {config['cost']:<10}")
        
        results.append({
            'name': name,
            'R_th_total': R_th_total,
            'T_j': T_j,
            'T_c': T_c,
            'T_s': T_s,
            'cost': config['cost'],
            'epsilon': config['epsilon']
        })
    
    # 辐射散热计算
    print("\n\n辐射散热贡献分析(鳍片优化方案):")
    print("-" * 60)
    
    A_surface = 0.012  # m² (120 cm²)
    epsilon_values = [0.6, 0.85, 0.9]
    T_s = 65  # °C (散热器表面温度)
    h_conv = 8  # W/(m²·K)
    
    print(f"{'发射率':<10} {'辐射散热(W)':<15} {'对流散热(W)':<15} {'辐射占比':<12}")
    print("-" * 55)
    
    for eps in epsilon_values:
        T_s_k = T_s + 273.15
        T_amb_k = T_ambient + 273.15
        
        Q_rad = led_radiation_heat_transfer(eps, A_surface, T_s_k, T_amb_k)
        Q_conv = convection_heat_transfer(h_conv, A_surface, T_s, T_ambient)
        Q_total = Q_rad + Q_conv
        ratio = Q_rad / Q_total * 100
        
        print(f"{eps:<10.2f} {Q_rad:<15.2f} {Q_conv:<15.2f} {ratio:<12.1f}%")
    
    # 瞬态热分析
    print("\n\n瞬态热分析(开灯后温度上升过程):")
    print("-" * 60)
    
    # 简化的瞬态模型
    C_th = 50  # 热容 J/°C (估算值)
    R_th = 14  # 总热阻 °C/W
    
    time = np.linspace(0, 600, 1000)  # 10分钟
    tau = R_th * C_th  # 时间常数
    T_steady = T_ambient + P_heat * R_th
    
    T_j_transient = T_ambient + (T_steady - T_ambient) * (1 - np.exp(-time / tau))
    
    # 找到达到稳态90%的时间
    t_90 = -tau * np.log(0.1)
    print(f"热时间常数: {tau:.1f} s ({tau/60:.1f} 分钟)")
    print(f"达到稳态90%的时间: {t_90:.0f} s ({t_90/60:.1f} 分钟)")
    print(f"稳态结温: {T_steady:.1f}°C")
    
    # 可视化
    fig, axes = plt.subplots(2, 2, figsize=(14, 10))
    fig.suptitle('LED灯具热仿真分析', fontsize=16, fontweight='bold')
    
    # 图1:不同散热方案的温度对比
    ax1 = axes[0, 0]
    names = [r['name'] for r in results]
    T_j_values = [r['T_j'] for r in results]
    T_c_values = [r['T_c'] for r in results]
    
    x = np.arange(len(names))
    width = 0.35
    
    bars1 = ax1.bar(x - width/2, T_j_values, width, label='结温', 
                    color='#e74c3c', edgecolor='black', linewidth=1.5)
    bars2 = ax1.bar(x + width/2, T_c_values, width, label='壳温',
                    color='#3498db', edgecolor='black', linewidth=1.5)
    
    ax1.axhline(y=85, color='green', linestyle='--', linewidth=2, label='推荐结温 85°C')
    ax1.axhline(y=125, color='red', linestyle='--', linewidth=2, label='最大结温 125°C')
    
    ax1.set_ylabel('温度 (°C)', fontsize=12)
    ax1.set_xlabel('散热方案', fontsize=12)
    ax1.set_title('不同散热方案的温度对比', fontsize=13, fontweight='bold')
    ax1.set_xticks(x)
    ax1.set_xticklabels(names, fontsize=9)
    ax1.legend(fontsize=9)
    ax1.grid(axis='y', alpha=0.3)
    
    # 图2:热阻网络瀑布图
    ax2 = axes[0, 1]
    
    # 选取鳍片优化方案展示
    R_th_components = [R_th_jc, R_th_cs, R_th_pb, 5.0]  # 鳍片优化方案的热阻
    component_names = ['结-壳\nRth(j-c)', '壳-基板\nRth(c-p)', '基板-散热器\nRth(p-s)', '散热器-环境\nRth(s-a)']
    colors_components = ['#e74c3c', '#f39c12', '#f1c40f', '#2ecc71']
    
    cumulative = 0
    for i, (R_th, name, color) in enumerate(zip(R_th_components, component_names, colors_components)):
        ax2.barh(0, R_th, left=cumulative, color=color, edgecolor='black', 
                linewidth=1.5, height=0.5)
        ax2.text(cumulative + R_th/2, 0, f'{R_th:.1f}', ha='center', va='center',
                fontsize=10, fontweight='bold', color='white')
        cumulative += R_th
    
    ax2.set_xlim([0, cumulative + 2])
    ax2.set_ylim([-0.5, 0.5])
    ax2.set_xlabel('热阻 (°C/W)', fontsize=12)
    ax2.set_title('热阻网络组成(鳍片优化方案)', fontsize=13, fontweight='bold')
    ax2.set_yticks([])
    ax2.legend(component_names, loc='upper right', fontsize=9)
    
    # 添加总热阻标注
    ax2.text(cumulative/2, -0.35, f'总热阻 = {cumulative:.1f} °C/W', 
            ha='center', fontsize=11, fontweight='bold',
            bbox=dict(boxstyle='round', facecolor='lightblue', alpha=0.7))
    
    # 图3:瞬态温度响应
    ax3 = axes[1, 0]
    ax3.plot(time/60, T_j_transient, 'r-', linewidth=2.5, label='结温')
    ax3.axhline(y=T_steady, color='red', linestyle='--', linewidth=2, alpha=0.7, label='稳态结温')
    ax3.axhline(y=T_steady * 0.9, color='orange', linestyle=':', linewidth=2, alpha=0.7, label='90%稳态')
    ax3.axvline(x=t_90/60, color='green', linestyle='--', linewidth=2, alpha=0.7)
    ax3.fill_between(time/60, T_j_transient, alpha=0.2, color='red')
    
    ax3.set_xlabel('时间 (分钟)', fontsize=12)
    ax3.set_ylabel('结温 (°C)', fontsize=12)
    ax3.set_title('LED结温瞬态响应(开机过程)', fontsize=13, fontweight='bold')
    ax3.legend(fontsize=10)
    ax3.grid(True, alpha=0.3)
    ax3.set_xlim([0, 10])
    
    # 图4:成本效益分析
    ax4 = axes[1, 1]
    
    costs = [r['cost'] for r in results]
    T_j_values = [r['T_j'] for r in results]
    
    scatter = ax4.scatter(costs, T_j_values, s=300, c=range(len(results)), 
                         cmap='RdYlGn_r', edgecolors='black', linewidths=2, alpha=0.8)
    
    for i, name in enumerate(names):
        ax4.annotate(name, (costs[i], T_j_values[i]), 
                    xytext=(5, 5), textcoords='offset points',
                    fontsize=9, fontweight='bold')
    
    ax4.axhline(y=85, color='green', linestyle='--', linewidth=2, label='推荐结温 85°C')
    ax4.set_xlabel('成本 (¥)', fontsize=12)
    ax4.set_ylabel('结温 (°C)', fontsize=12)
    ax4.set_title('散热方案成本效益分析', fontsize=13, fontweight='bold')
    ax4.legend(fontsize=10)
    ax4.grid(True, alpha=0.3)
    
    # 添加最优区域标注
    ax4.axhspan(60, 85, alpha=0.1, color='green', label='最优区域')
    
    plt.tight_layout()
    plt.savefig('case4_led_luminaire_thermal.png', dpi=150, bbox_inches='tight')
    print("\n✓ 案例4结果已保存: case4_led_luminaire_thermal.png")
    plt.close()


# ============================================================================
# 生成GIF动画:LED温度分布瞬态变化
# ============================================================================

def create_temperature_animation():
    """
    创建LED散热器温度分布瞬态变化的GIF动画
    """
    print("\n" + "="*80)
    print("生成GIF动画:LED散热器温度分布瞬态变化")
    print("="*80)
    
    # 仿真参数
    nx, ny = 50, 30  # 网格数
    dx = 0.002  # 网格间距 2mm
    dt = 0.5  # 时间步长
    alpha = 9.7e-5  # 铝的热扩散系数 m²/s
    
    # 初始条件
    T_initial = 25  # 初始温度 °C
    T_ambient = 25  # 环境温度 °C
    
    # 热源位置(LED芯片位置)
    heat_source_x = 10
    heat_source_y = ny // 2
    q_dot = 5000  # 热源强度 W/m³
    
    # 稳定性检查
    stability = alpha * dt / dx**2
    if stability > 0.25:
        print(f"警告:稳定性条件不满足 ({stability:.3f} > 0.25)")
        dt = 0.25 * dx**2 / alpha
        print(f"调整时间步长为: {dt:.4f} s")
    
    # 初始化温度场
    T = np.ones((nx, ny)) * T_initial
    
    # 存储结果
    n_frames = 100
    save_interval = 20
    frames = []
    
    print("  正在计算温度场...")
    
    for step in range(n_frames * save_interval):
        T_new = T.copy()
        
        # 内部节点
        for i in range(1, nx-1):
            for j in range(1, ny-1):
                # 热源区域
                if abs(i - heat_source_x) < 3 and abs(j - heat_source_y) < 3:
                    source = q_dot * dx**2 / (200 * 2700 * 900) * dt  # 简化的热源项
                else:
                    source = 0
                
                T_new[i, j] = T[i, j] + alpha * dt / dx**2 * (
                    T[i+1, j] + T[i-1, j] + T[i, j+1] + T[i, j-1] - 4*T[i, j]
                ) + source
        
        # 边界条件
        # 左边界(对称)
        T_new[0, :] = T_new[1, :]
        # 右边界(对流+辐射)
        h_eff = 15  # 等效换热系数 W/(m²·K)
        T_new[-1, :] = T_new[-2, :] - h_eff * dx / 200 * (T_new[-2, :] - T_ambient)
        # 上下边界(对流+辐射)
        T_new[:, 0] = T_new[:, 1] - h_eff * dx / 200 * (T_new[:, 1] - T_ambient)
        T_new[:, -1] = T_new[:, -2] - h_eff * dx / 200 * (T_new[:, -2] - T_ambient)
        
        T = T_new
        
        if step % save_interval == 0:
            frames.append(T.copy())
    
    print(f"  计算完成,生成 {len(frames)} 帧动画")
    
    # 创建动画
    fig, ax = plt.subplots(figsize=(10, 6))
    
    im = ax.imshow(frames[0].T, cmap='hot', aspect='auto', 
                   vmin=T_initial, vmax=np.max(frames[-1]),
                   extent=[0, nx*dx*1000, 0, ny*dx*1000])
    
    cbar = plt.colorbar(im, ax=ax)
    cbar.set_label('温度 (°C)', fontsize=12)
    
    ax.set_xlabel('长度 (mm)', fontsize=12)
    ax.set_ylabel('宽度 (mm)', fontsize=12)
    ax.set_title('LED散热器瞬态温度分布', fontsize=14, fontweight='bold')
    
    # 标记热源位置
    circle = Circle((heat_source_x*dx*1000, heat_source_y*dx*1000), 3, 
                   color='blue', fill=False, linewidth=3, linestyle='--')
    ax.add_patch(circle)
    ax.text(heat_source_x*dx*1000, heat_source_y*dx*1000 - 5, 'LED芯片', 
           ha='center', fontsize=10, color='blue', fontweight='bold')
    
    time_text = ax.text(0.02, 0.98, '', transform=ax.transAxes, fontsize=11,
                       verticalalignment='top', bbox=dict(boxstyle='round', 
                       facecolor='white', alpha=0.8))
    
    def update(frame_idx):
        im.set_array(frames[frame_idx].T)
        time_text.set_text(f'时间: {frame_idx * save_interval * dt:.1f} s')
        return im, time_text
    
    anim = animation.FuncAnimation(fig, update, frames=len(frames),
                                   interval=100, blit=True, repeat=True)
    
    # 保存GIF
    anim.save('led_temperature_animation.gif', writer='pillow', fps=10, dpi=100)
    print("\n✓ GIF动画已保存: led_temperature_animation.gif")
    plt.close()


# ============================================================================
# 主程序
# ============================================================================

def main():
    """
    主程序:运行所有仿真案例
    """
    print("\n" + "="*80)
    print("主题054:LED照明热管理辐射 - Python仿真")
    print("="*80)
    print("\n本程序包含以下仿真案例:")
    print("  1. LED结温计算与辐射散热分析")
    print("  2. LED散热器优化设计")
    print("  3. LED寿命预测")
    print("  4. LED灯具热仿真")
    print("  5. 生成温度分布GIF动画")
    print("\n" + "="*80)
    
    # 运行案例1
    case1_led_junction_temperature()
    
    # 运行案例2
    case2_heatsink_optimization()
    
    # 运行案例3
    case3_led_lifetime_prediction()
    
    # 运行案例4
    case4_led_luminaire_thermal_simulation()
    
    # 生成GIF动画
    create_temperature_animation()
    
    print("\n" + "="*80)
    print("所有案例运行完成!")
    print("="*80)
    print("\n生成的文件:")
    print("  - case1_led_junction_temperature.png")
    print("  - case2_heatsink_optimization.png")
    print("  - case3_led_lifetime_prediction.png")
    print("  - case4_led_luminaire_thermal.png")
    print("  - led_temperature_animation.gif")
    print("\n" + "="*80)
    print("主题054:LED照明热管理辐射 - 仿真完成")
    print("="*80 + "\n")


if __name__ == "__main__":
    main()

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐