露点温度计算算法

算法1

输入为室内温湿度,输出结露温度

static float cal_dew_temp(float temp,float rh)
{
    float es,e,Td;
    es = 6.112*exp((17.67*temp)/(temp+243.5));
    e = (es * rh)/100;
    Td = (243.5*log(e/6.112))/(17.67-log(e/6.112));
    return(Td);
}

算法2

static double cal_dew_point_temp(double temperature, double humidity)
{
    double a = 17.27, b = 237.7;
    double r_value;

    r_value = a * temperature / (b + temperature) + log(humidity / 100);

    if((b * r_value / (a - r_value)) < 0)
        return (0);
    return (b * r_value / (a - r_value));
}

你可能感兴趣的:(数据处理算法的学习)