马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
[AppleScript] 纯文本查看 复制代码 .c文件
#include "heat_index.h"
#include <math.h>
float Get_Tg_value(float Ta, float RH)
{
double p1 = 0.151977 * sqrt(RH + 8.313659);
double t1 = Ta * atan(p1);
double t2 = atan(Ta + RH);
double t3 = atan(RH - 1.67633);
double p2 = 0.023101 * RH;
double t4 = 0.00391838 * pow(RH, 1.5) * atan(p2);
double Tw = t1 + t2 - t3 + t4 - 4.686035;
double hi = -0.2442
+ 0.55399 * Tw
+ 0.45535 * Ta
- 0.0022 * Tw * Tw
+ 0.00278 * Tw * Ta
+ 3.0;
return (float)hi;
}
int Get_Heat_Level(float tg)
{
if (tg >= 38.0f) return 4;
if (tg >= 35.0f) return 3;
if (tg >= 33.0f) return 2;
if (tg >= 31.0f) return 1;
return 0;
}
[AppleScript] 纯文本查看 复制代码 .h文件
#ifndef HEAT_INDEX_H
#define HEAT_INDEX_H
#include <stdint.h>
// 获取体感酷热温度
float Get_Tg_value(float temp, float humi);
// 获取高温预警等级 0正常 1蓝 2黄 3橙 4红
int Get_Heat_Level(float tg);
#endif
|