html页面
绘制输入框:
fun_type, width, weight, init_time, init_temp, ambi_temp
默认值分别为:
1680, 12720, 当前日期的零点零分, 310, 36
后台计算参数:
# 默认参数
k1, k2, k3, k4, k5, k6 = (0.03691591, -0.01086697, -0.02207111, -0.04971315, -0.06927802, -0.00682166)
density = 2.7*(10**-6)
inner_radius = 665
list_fan_type = ['自然冷却', '单个大风机', '单4风机', '大风机+单4风机', '双4风机']
format_time = r'%Y-%m-%d %H:%M'
# 函数
def fun_z5(fan_type, list_fan_type=list_fan_type):
for i, j in enumerate(list_fan_type):
i += 1
if i > 1:
exec("z{} = 0".format(i), globals())
if fan_type == j:
exec("z{} = 1")
return z2, z3, z4, z5
def fun_z6(width, weight, density=density, inner_radius=inner_radius):
outer_radius = np.sqrt(
weight/density/width/np.pi + inner_radius**2
)
surface_area = 2 * np.pi * (
outer_radius*width + inner_radius*width + outer_radius**2 - inner_radius**2
) / 10**6
z6 = surface_area / weight * 10**4
return z6
def fun_k():
k = k1 + np.dot([k2, k3, k4, k5, k6], [z2, z3, z4, z5, z6])
return k
def fun_x(time):
x = (pd.Timestamp(time) - pd.Timestamp(initial_time)).total_seconds() / 3600
return x
def fun_Y(x):
Y = (initial_temp-ambient_temp) * np.exp(k*x) + ambient_temp
return Y
def fun_Y_x(Y):
x = k**(-1) * np.log((Y-ambient_temp) / (initial_temp-ambient_temp))
time = (pd.Timestamp(initial_time) + pd.Timedelta(seconds=x*3600)).strftime(format_time)
return x, time
# 自动换算
z2, z3, z4, z5 = fun_z5(fan_type)
z6 = fun_z6(width, weight)
k = fun_k()
a = init_temp
b = ambi_temp
展示公式:
y=(a-b)*e^(kx)+b
绘制曲线
x在0到70范围, y在0到410范围内的y=(a-b)*e^(kx)+b曲线
绘制输入框:
目标时间, 目标温度
默认值:
当前日期的零点零分+50小时, 50
展示结果:
目标时间的预测温度, 目标温度的预测时间