泄露1.1

import numpy as np
import math
import json

#假设输入数据
a = (1,2,3,4,)
b = (1,1,1,1)
c = (2,3.2,4,8)
d = (4,5,9,1)

#定义json输入
he_leakmodel = json.dumps({'HE_P_inlet_pre':a,'HE_P_outlet_pre':b,
                'HE_T_inlet_tem':c,'HE_T_outlet_tem':d})

def HE_Leakmodel(HE_Leakmodel1):
    '''
    热交换器泄露
    此函数作用于计算热交换器泄露


    Keyword arguments:
        input:
            HE_hole_thi     泄露孔厚度
            HE_hole_dia     泄漏孔当量直径
            fluid_viscosity     介质流体粘度
            HE_P_inlet_pre      管程进口压力
            HE_P_outlet_pre     管程出口压力
            HE_T_inlet_tem      管程进口温度
            HE_T_outlet_tem     管程出口温度

        output:
            HE_Lea_num      泄漏量

    '''
    HE_hole_thi = float(input('泄露孔厚度:\t'))
    HE_hole_dia = float(input('泄漏孔当量直径:\t'))
    fluid_viscosity = float(input('介质流体粘度:\t'))

    #转换json格式为python
    Leaking = json.loads(HE_Leakmodel1)
    print(f'泄露{Leaking}')

    #转换为数组
    inlet_pre = np.array(Leaking['HE_P_inlet_pre'])
    outlet_pre = np.array(Leaking['HE_P_outlet_pre'])
    inlet_tem = np.array(Leaking['HE_T_inlet_tem'])
    outlet_tem = np.array(Leaking['HE_T_outlet_tem'])
    
    #计算泄漏量
    HE_Lea_num = (HE_hole_dia*pow(HE_hole_thi,3)*(inlet_pre-outlet_pre))/(12*fluid_viscosity)

    #转换为元组
    HE_Lea_num = tuple(HE_Lea_num)
    output = {'泄漏量':HE_Lea_num}#转换为字典
    print(f'泄漏量:{output}')
    
    #定义json输出
    Leaking_out = json.dumps(output)


HE_Leakmodel(he_leakmodel)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值