汽轮机性能试验计算-电科院版-完整版-pycharm版

import json
import math

import numpy as np
from scipy import interpolate
import CoolProp.CoolProp as CP
from class_steam import WaterVapor
from class_case import Case
from class_heater import Heater
from class_heatrate import SteamTurbine
from class_heatrate import generator
from class_c1 import Corection_1
from class_c1 import C1_E1_press_drop
from class_c1 import C1_Condenser_up_diff_temp
from class_c1 import C1_flow_feedwater_turbine
from class_c1 import C1_Heater1_up_diff_temp
from class_c1 import C1_flow_reheated_spray_water
from class_c1 import C1_flow_super_spray_water
from class_c2 import Correction2
#主蒸汽压力
from class_c2 import Correction2_mainsteam_press_heatrate
from class_c2 import Correction2_main_press_power
#主蒸汽温度
from class_c2 import Correction2_main_temp_heatrate
from class_c2 import Correction2_main_temp_power
#再热蒸汽温度
from class_c2 import Correction2_reheated_temp_heatrate
from class_c2 import Correction2_reheated_temp_power
#再热器压损
from class_c2 import Correction2_reheated_press_drop_heatrate
from class_c2 import Correction2_reheated_press_drop_power
#排汽压力
from class_c2 import Correction2_backpress_heatrate
from class_c2 import Correction2_backpress_power
#除氧器和凝汽器
from class_container import Condenser
from class_container import Deaerator

# 读取JSON文件
with open("test_data.json", "r", encoding="utf-8") as file:
    data = json.load(file)

# 1.缸效率计算
#1.1高压缸效率计算
mainsteam =WaterVapor(data["主蒸汽"]["压力"],data["主蒸汽"]["温度"])
cold_reheated_steam=WaterVapor(data["高压缸排汽"]["压力"],data["高压缸排汽"]["温度"])
HP_case=Case(mainsteam, cold_reheated_steam)
#1.1输出
#print("高压缸效率为:",HP_case.calculate_cylinder_efficiency())
#1.2中压缸效率计算
reheated_steam =WaterVapor(data["热再热蒸汽"]["压力"],data["热再热蒸汽"]["温度"])
IP_exhaust_steam=WaterVapor(data["中压缸排汽"]["压力"],data["中压缸排汽"]["温度"])
IP_case=Case(reheated_steam, IP_exhaust_steam)
#1.2输出
#print("中压缸效率为:",IP_case.calculate_cylinder_efficiency())

#2高加热平和计算
#2.1 1号高压加热器热平衡计算
HP_heater1_inlet_water=WaterVapor(data["1号高加进水"]["压力"],data["1号高加进水"]["温度"], data["1号高加进水"]["流量"])
HP_heater1_outlet_water=WaterVapor(data["1号高加出水"]["压力"],data["1号高加出水"]["温度"])
E1_steam=WaterVapor(data["一段抽汽"]["压力"],data["一段抽汽"]["温度"])
HP_heater1_inlet_steam=WaterVapor(data["1号高加进汽"]["压力"],data["1号高加进汽"]["温度"])
HP_heater1_drain_water=WaterVapor(data["1号高加疏水"]["压力"],data["1号高加疏水"]["温度"])
HP_heater1=Heater(HP_heater1_inlet_water,HP_heater1_outlet_water,E1_steam,HP_heater1_inlet_steam,HP_heater1_drain_water)
HP_heater1_drain_water_flow=HP_heater1.calculate_inlet_steam_flow()
#2.1输出
# print("一号高加进汽流量为:",round(HP_heater1.calculate_inlet_steam_flow(),3),"t/h")
# print("一号高加进汽压损为:",round(HP_heater1.calculate_inlet_steam_pressure_drop(),2),"%")
# print("一号高加出口端差为:",round(HP_heater1.calculate_upper_difference(),1),"℃")
# print("一号高加疏水端差为:",round(HP_heater1.calculate_lower_difference(),1),"℃")
# print("一号高加温升为:",round(HP_heater1.calculate_temperature_rise(),1),"℃")
#print("一号高加疏水流量为:",round(HP_heater1_drain_water_flow,3),"t/h")

#2.2 2号高压加热器热平衡计算
HP_heater2_inlet_water=WaterVapor(data["2号高加进水"]["压力"],data["2号高加进水"]["温度"], data["2号高加进水"]["流量"])
HP_heater2_outlet_water=WaterVapor(data["2号高加出水"]["压力"],data["2号高加出水"]["温度"])
E2_steam=WaterVapor(data["二段抽汽"]["压力"],data["二段抽汽"]["温度"])
HP_heater2_inlet_steam=WaterVapor(data["2号高加进汽"]["压力"],data["2号高加进汽"]["温度"])
HP_heater2_drain_water=WaterVapor(data["2号高加疏水"]["压力"],data["2号高加疏水"]["温度"])
HP_heater1_drain_flow=HP_heater1.calculate_inlet_steam_flow()
HP_heater2_previous_drain_water=WaterVapor(data["1号高加疏水"]["压力"],data["1号高加疏水"]["温度"],HP_heater1_drain_flow)
HP_heater2=Heater(HP_heater2_inlet_water,HP_heater2_outlet_water,E2_steam,HP_heater2_inlet_steam,HP_heater2_drain_water,HP_heater2_previous_drain_water)
HP_heater2_drain_water_flow=HP_heater2.calculate_inlet_steam_flow()+HP_heater1.calculate_inlet_steam_flow()
#2.2输出
# print("二号高加进汽流量为:",round(HP_heater2.calculate_inlet_steam_flow(),3),"t/h")
# print("二号高加进汽压损为:",round(HP_heater2.calculate_inlet_steam_pressure_drop(),2),"%")
# print("二号高加出口端差为:",round(HP_heater2.calculate_upper_difference(),1),"℃")
# print("二号高加疏水端差为:",round(HP_heater2.calculate_lower_difference(),1),"℃")
# print("二号高加温升为:",round(HP_heater2.calculate_temperature_rise(),1),"℃")
#print("二号高加疏水流量为:",round(HP_heater2_drain_water_flow,3),"t/h")
#2.3 3号高压加热器热平衡计算
HP_heater3_inlet_water=WaterVapor(data["3号高加进水"]["压力"],data["3号高加进水"]["温度"], data["3号高加进水"]["流量"])
HP_heater3_outlet_water=WaterVapor(data["3号高加出水"]["压力"],data["3号高加出水"]["温度"])
E3_steam=WaterVapor(data["三段抽汽"]["压力"],data["三段抽汽"]["温度"])
HP_heater3_inlet_steam=WaterVapor(data["3号高加进汽"]["压力"],data["3号高加进汽"]["温度"])
HP_heater3_drain_water=WaterVapor(data["3号高加疏水"]["压力"],data["3号高加疏水"]["温度"])
HP_heater2_drain_flow=HP_heater2.calculate_inlet_steam_flow()+HP_heater1.calculate_inlet_steam_flow()
HP_heater3_previous_drain_water=WaterVapor(data["2号高加疏水"]["压力"],data["2号高加疏水"]["温度"],HP_heater2_drain_flow)
HP_heater3=Heater(HP_heater3_inlet_water,HP_heater3_outlet_water,E3_steam,HP_heater3_inlet_steam,HP_heater3_drain_water,HP_heater3_previous_drain_water)
HP_heater3_drain_water_flow=HP_heater2_drain_water_flow+HP_heater3.calculate_inlet_steam_flow()
#2.3输出
# print("三号高加进汽流量为:",round(HP_heater3.calculate_inlet_steam_flow(),3),"t/h")
# print("三号高加进汽压损为:",round(HP_heater3.calculate_inlet_steam_pressure_drop(),2),"%")
# print("三号高加出口端差为:",round(HP_heater3.calculate_upper_difference(),1),"℃")
# print("三号高加疏水端差为:",round(HP_heater3.calculate_lower_difference(),1),"℃")
# print("三号高加温升为:",round(HP_heater3.calculate_temperature_rise(),1),"℃")
# print("三号高加疏水流量为:",round(HP_heater3_drain_water_flow,3),"t/h")
#3不明漏量计算
with open("container_data.json", "r", encoding="utf-8") as file:
    data1 = json.load(file)
Deaerator_start=Deaerator(data1["除氧器_开始时间"]["筒体长度"],data1["除氧器_开始时间"]["筒体内半径"],data1["除氧器_开始时间"]["封头长度"],data1["除氧器_开始时间"]["水位"])
condenser_start=Condenser(data1["凝汽器_开始时间"]["长度"],data1["凝汽器_开始时间"]["宽度"],data1["凝汽器_开始时间"]["个数"],data1["凝汽器_开始时间"]["水位"])
Deaerator_finish=Deaerator(data1["除氧器_结束时间"]["筒体长度"],data1["除氧器_结束时间"]["筒体内半径"],data1["除氧器_结束时间"]["封头长度"],data1["除氧器_结束时间"]["水位"])
condenser_finish=Condenser(data1["凝汽器_结束时间"]["长度"],data1["凝汽器_结束时间"]["宽度"],data1["凝汽器_结束时间"]["个数"],data1["凝汽器_结束时间"]["水位"])


V_Deae_start=Deaerator_start.calculate_volume(data1["除氧器_开始时间"]["筒体长度"],data1["除氧器_开始时间"]["筒体内半径"],data1["除氧器_开始时间"]["封头长度"],data1["除氧器_开始时间"]["水位"])
V_Cond_start=condenser_start.calculate_volume(data1["凝汽器_开始时间"]["长度"],data1["凝汽器_开始时间"]["宽度"],data1["凝汽器_开始时间"]["个数"],data1["凝汽器_开始时间"]["水位"])
V_Deae_finish=Deaerator_finish.calculate_volume(data1["除氧器_结束时间"]["筒体长度"],data1["除氧器_结束时间"]["筒体内半径"],data1["除氧器_结束时间"]["封头长度"],data1["除氧器_结束时间"]["水位"])
V_Cond_finish=condenser_finish.calculate_volume(data1["凝汽器_结束时间"]["长度"],data1["凝汽器_结束时间"]["宽度"],data1["凝汽器_结束时间"]["个数"],data1["凝汽器_结束时间"]["水位"])

midu_deae=CP.PropsSI('D', 'T', data["除氧器出水"]["温度"]+273.15, 'Q', 1, 'IF97::Water')
midu_cond=CP.PropsSI('D', 'T', data["凝汽器热井出水"]["温度"]+273.15, 'Q', 1, 'IF97::Water')
#print("凝汽器出水密度",midu_cond)
DL_flow_deae=V_Deae_start-V_Deae_finish
DL_flow_cond=V_Cond_start-V_Cond_finish

# #print(Rongji)
# print("凝汽器开始水容积量:",V_Cond_start)
# print("凝汽器结束水容积量:",V_Cond_finish)
#
# print(DL_flow_deae)
# print(DL_flow_cond)
#系统不明泄漏量计算
BM_leakage_flow=round(DL_flow_deae+DL_flow_cond-data1["系统明漏量"],3)
#print("系统不明泄漏量为:",BM_leakage_flow)
#3输出不明泄漏量
#print("系统不明泄漏量为:",BM_leakage_flow)

#4主蒸汽流量计算

feedwater=WaterVapor(data["最终给水"]["压力"],data["最终给水"]["温度"], data["最终给水"]["流量"])
super_spray_water=WaterVapor(data["过热器减温水"]["压力"],data["过热器减温水"]["温度"],data["过热器减温水"]["流量"])
mainsteam=WaterVapor(data["主蒸汽"]["压力"],data["主蒸汽"]["温度"])
mainsteam.massflow=feedwater.massflow+super_spray_water.massflow-BM_leakage_flow*data1["分配给锅炉侧的不明漏量比例"]

#4输出主蒸汽流量
# print("最终给水流量为:",feedwater.massflow)
# print("过热器减温水流量为:",super_spray_water.massflow)
# print("主蒸汽流量为:",mainsteam.massflow)
#5流量平衡计算
#5.1高压缸轴封
#5.1.1高压缸前轴封
GL_steam_G1_flow=data["高压缸前轴封漏汽至高排蒸汽G1"]["流量"]
GL_steam_L1_flow=data["高压缸前轴封漏汽至四抽蒸汽L1"]["流量"]
GL_steam_M1_flow=data["高压缸前轴封漏汽至均压箱蒸汽M1"]["流量"]
GL_steam_N1_flow=data["高压缸前轴封漏汽至轴加蒸汽N1"]["流量"]
#高压前轴封漏量合计
GL_Q_steam_flow=GL_steam_G1_flow+GL_steam_L1_flow+GL_steam_M1_flow+GL_steam_N1_flow

#print(GL_steam_G1_flow)
#print(GL_steam_L1_flow)
#print(GL_steam_M1_flow)
#print(GL_steam_N1_flow)
#5.1.2高压缸后轴封
GL_steam_L_flow=data["高压缸后轴封漏汽至四抽蒸汽L"]["流量"]
GL_steam_M_flow=data["高压缸后轴封漏汽至均压箱蒸汽M"]["流量"]
GL_steam_N_flow=data["高压缸后轴封漏汽至轴加蒸汽N"]["流量"]
#高压后轴封漏量合计
GL_H_steam_flow=GL_steam_L_flow+GL_steam_M_flow+GL_steam_N_flow
#print(GL_steam_L_flow)
#print(GL_steam_M_flow)
#print(GL_steam_N_flow)
#5.2门杆漏汽
MG_leakage_flow_A=data["高压门杆漏汽至高排蒸汽A"]["流量"]
MG_leakage_flow_B=data["高压门杆漏汽至轴加蒸汽B"]["流量"]
#print(MG_leakage_flow_A)
#print(MG_leakage_flow_B)
#5.3流量平衡计算
cold_reheated_steam.massflow=mainsteam.massflow-MG_leakage_flow_A-MG_leakage_flow_B
cold_reheated_steam.massflow=cold_reheated_steam.massflow-GL_Q_steam_flow
cold_reheated_steam.massflow=cold_reheated_steam.massflow-HP_heater1.calculate_inlet_steam_flow()
cold_reheated_steam.massflow=cold_reheated_steam.massflow-HP_heater2.calculate_inlet_steam_flow()
cold_reheated_steam.massflow=cold_reheated_steam.massflow+MG_leakage_flow_A+GL_steam_G1_flow
reheated_steam.massflow=cold_reheated_steam.massflow+data["再热器减温水"]["流量"]
#5.3输出
#print(cold_reheated_steam.massflow)
#print(reheated_steam.massflow)
#6热耗率计算
# 创建 WaterVapor 对象
jn1_mainsteam = WaterVapor(data["主蒸汽"]["压力"], data["主蒸汽"]["温度"],mainsteam.massflow)
jn1_coldreheatedsteam = WaterVapor(data["冷再热蒸汽"]["压力"], data["冷再热蒸汽"]["温度"],cold_reheated_steam.massflow)
jn1_reheatedsteam = WaterVapor(data["热再热蒸汽"]["压力"], data["热再热蒸汽"]["温度"],reheated_steam.massflow)
jn1_feedwater = WaterVapor(data["最终给水"]["压力"], data["最终给水"]["温度"],data["最终给水"]["流量"])
jn1_super_spray_water = WaterVapor(data["过热器减温水"]["压力"], data["过热器减温水"]["温度"],data["过热器减温水"]["流量"])
jn1_reheat_spray_water = WaterVapor(data["再热器减温水"]["压力"], data["再热器减温水"]["温度"],data["再热器减温水"]["流量"])

# 创建 SteamTurbine 对象
jn1_turbine = SteamTurbine(jn1_mainsteam, jn1_feedwater,jn1_coldreheatedsteam,jn1_reheatedsteam,
        jn1_super_spray_water, jn1_reheat_spray_water)
jn1_generator=generator(data["负荷"]["功率"])
# 计算汽轮机热耗率
jn1_heat_rate = jn1_turbine.calculate_heatrate()/jn1_generator.load
#6输出
#print("电功率为:",round(jn1_generator.load,3),"MW")
#print("汽轮机试验热耗率为: ", round(jn1_heat_rate,2),"kJ/(kW.h)")
#7修正后主蒸汽流量计算
#试验值
test_main_steam_flow=mainsteam.massflow
test_main_steam_press=mainsteam.pressure/1000000
test_main_steam_temp=mainsteam.temperature-273.15
test_main_steam_V=CP.PropsSI('V', 'T', mainsteam.temperature, 'P', mainsteam.pressure, 'IF97::Water')
#print(test_main_steam_V)
#设计值

with open("design_data.json", "r", encoding="utf-8") as file:
    data2 = json.load(file)
design_main_steam_press=data2["设计参数"]["设计主蒸汽压力"]
design_main_steam_temp=data2["设计参数"]["设计主蒸汽温度"]
design_main_steam_V=CP.PropsSI('V', 'T', design_main_steam_temp+273.15, 'P', design_main_steam_press*1000000, 'IF97::Water')

C_main_steam_flow=test_main_steam_flow*math.sqrt(design_main_steam_press*test_main_steam_V/(test_main_steam_press*design_main_steam_V))
#7输出
#print("修正后的主蒸汽流量为:", round(C_main_steam_flow,3),"t/h")
#8一类修正计算
VWO_main_steam_flow=data2["设计参数"]["阀全开时主蒸汽流量"]
flow_ratio=mainsteam.massflow/VWO_main_steam_flow*100
#8.1 一段抽汽压损一类修正

jn1_C1_E1_press_drop = C1_E1_press_drop(HP_heater1.calculate_inlet_steam_pressure_drop(), data2["加热器参数"]["1号高压加热器"]["管道压损"]*100, flow_ratio, data["一段抽汽"]["压力"],data["一段抽汽"]["压力"])

C1_1_HR = jn1_C1_E1_press_drop.C1_heat_rate()
C1_1_Pr = jn1_C1_E1_press_drop.C1_power()

# #输出结果
#print("一段抽汽压损对热耗率的修正系数",round(C1_1_HR,5))
#print("一段抽汽压损对电功率的修正系数",round(C1_1_Pr,5))

#8.2 凝汽器过冷度一类修正
LP_press=data["低压缸排汽"]["压力"]
Cond_outlet_temp=data["凝汽器热井出水"]["温度"]
Cond_sat_temp=CP.PropsSI('T', 'P', LP_press*1000000, 'Q', 1, 'IF97::Water')-273.15
#print(Cond_sat_temp)
DT_cond=Cond_sat_temp-Cond_outlet_temp
#print("凝汽器过冷度为",round(DT_cond,2),"℃")
jn1_C1_Condenser_up_diff_temp = C1_Condenser_up_diff_temp(DT_cond, 0, flow_ratio)

C1_2_HR= jn1_C1_Condenser_up_diff_temp.C1_heat_rate()
C1_2_Pr= jn1_C1_Condenser_up_diff_temp.C1_power()
#输出
#print("凝汽器过冷度对热耗率的修正系数",C1_2_HR)
#print("凝汽器过冷度对电功率的修正系数",C1_2_Pr)
#8.3 小机抽汽流量一类修正

test_value_ratio=data["小机进汽"]["流量"]/mainsteam.massflow*100
design_value_ratio=data2["设计参数"]["THA工况小机进汽流量"]/data2["设计参数"]["THA工况主蒸汽流量"]*100

#print(test_value_ratio,design_value_ratio)

jn1_C1_flow_feedwater_turbine = C1_flow_feedwater_turbine(test_value_ratio, design_value_ratio, flow_ratio, data["小机进汽"]["压力"],data["小机进汽"]["压力"])

C1_3_HR = jn1_C1_flow_feedwater_turbine.C1_heat_rate()
C1_3_Pr = jn1_C1_flow_feedwater_turbine.C1_power()
# 输出
#print("小机抽汽流量对热耗率的修正系数:",round(C1_3_HR,5))
#print("小机抽汽流量对电功率的修正系数:",round(C1_3_Pr,5))
#8.4一号高加出口端差一类修正

jn1_C1_Heater1_up_diff_temp = C1_Heater1_up_diff_temp(HP_heater1.calculate_upper_difference(), data2["加热器参数"]["1号高压加热器"]["上端差"], flow_ratio)


C1_4_HR= jn1_C1_Heater1_up_diff_temp.C1_heat_rate()
C1_4_Pr= jn1_C1_Heater1_up_diff_temp.C1_power()
# 输出
#print("一号高加出口端差对热耗率的修正系数:",round(C1_4_HR,5))
#print("一号高加出口端差对电功率的修正系数:",round(C1_4_Pr,5))
#8.5再热器减温水流量一类修正

test_flow_ratio_reheated_spay_water=jn1_reheat_spray_water.massflow/mainsteam.massflow*100
jn1_C1_flow_reheated_spray_water = C1_flow_reheated_spray_water(jn1_reheat_spray_water.massflow,0,test_flow_ratio_reheated_spay_water)

C1_5_HR = jn1_C1_flow_reheated_spray_water.C1_heat_rate()
C1_5_Pr= jn1_C1_flow_reheated_spray_water.C1_power()
# 输出
#print("再热器减温水流量对热耗率修正系数:",round(C1_5_HR,5))
#print("再热器减温水流量对电功率修正系数:",round(C1_5_Pr,5))
#8.6 过热器减温水流量一类修正
test_flow_ratio_super_spay_water=jn1_super_spray_water.massflow/mainsteam.massflow*100
jn1_C1_flow_super_spray_water= C1_flow_super_spray_water(jn1_super_spray_water.massflow,0,flow_ratio,test_flow_ratio_super_spay_water)


C1_6_HR = jn1_C1_flow_super_spray_water.C1_heat_rate()
C1_6_Pr = jn1_C1_flow_super_spray_water.C1_power()
# 输出
#print("过热器减温水流量对热耗率修正系数:",round(C1_6_HR,5))
#print("过热器减温水流量对电功率修正系数:",round(C1_6_Pr,5))
#8.7 一类修正总修正系数计算
C1_HR=C1_1_HR*C1_2_HR*C1_3_HR*C1_4_HR*C1_5_HR*C1_6_HR
C1_Pr=C1_1_Pr*C1_2_Pr*C1_3_Pr*C1_4_Pr*C1_5_Pr*C1_6_Pr
C1_C_HR=jn1_heat_rate/C1_HR
C1_C_Pr=jn1_generator.load/C1_Pr
# 输出
# print("热耗率总的一类修正系数:",round(C1_HR,5))
# print("电功率总的一类修正系数:",round(C1_Pr,5))
# print("一类修正后热耗率:",round(C1_C_HR,1),"kJ/(kW.h)")
# print("一类修正后电功率:",round(C1_C_Pr,3),"MW")
#9二类修正计算
with open("C2_data.json", "r", encoding="utf-8") as file:
    data3 = json.load(file)


#9.1 主蒸汽压力二类修正计算
x1_1=data3["主蒸汽压力VS热耗率"]["主蒸汽压力"]
y1_1=data3["主蒸汽压力VS热耗率"]["热耗率"]
jn1_C2_mainsteam_press_HR = Correction2(x1_1, y1_1)
specific_value1 = data["主蒸汽"]["压力"]
result1_1 = jn1_C2_mainsteam_press_HR.interpolate(specific_value1)
C2_1_HR=1+result1_1/100
# 输出
#print("主蒸汽压力对热耗率修正系数:",round(C2_1_HR,5))

x1_2=data3["主蒸汽压力VS电动率"]["主蒸汽压力"]
y1_2=data3["主蒸汽压力VS电动率"]["电功率"]
jn1_C2_mainsteam_press_Pr = Correction2(x1_2, y1_2)
specific_value1 = data["主蒸汽"]["压力"]
result1_2 = jn1_C2_mainsteam_press_Pr.interpolate(specific_value1)
C2_1_Pr=1+result1_2/100
# 输出
#print("主蒸汽压力对电功率修正系数:",round(C2_1_Pr,5))
#9.2 主蒸汽温度二类修正计算
x2_1=data3["主蒸汽温度VS热耗率"]["主蒸汽温度"]
y2_1=data3["主蒸汽温度VS热耗率"]["热耗率"]

jn1_C2_main_temp_HR = Correction2(x2_1, y2_1)
specific_value2 = data["主蒸汽"]["温度"]
result2_1 = Correction2_main_temp_heatrate.interpolate(specific_value2)
C2_2_HR = 1+result2_1/100
# 输出
#print("主蒸汽温度对热耗率修正系数:",round(C2_2_HR,5))

x2_2=data3["主蒸汽温度VS电动率"]["主蒸汽温度"]
y2_2=data3["主蒸汽温度VS电动率"]["电功率"]

jn1_C2_main_temp_Pr = Correction2(x2_2, y2_2)
specific_value2 = data["主蒸汽"]["温度"]
result2_2 = jn1_C2_main_temp_Pr.interpolate(specific_value2)
C2_2_Pr = 1+result2_2/100
# 输出
#print("主蒸汽温度对电功率修正系数:",round(C2_2_Pr,5))
#9.3 再热蒸汽温度二类修正计算
x3_1 = data3["再热蒸汽温度VS热耗率"]["再热蒸汽温度"]
y3_1 = data3["再热蒸汽温度VS热耗率"]["热耗率"]

jn1_C2_reheated_temp_HR = Correction2(x3_1, y3_1)
specific_value3 = data["热再热蒸汽"]["温度"]
result3_1 = jn1_C2_reheated_temp_HR.interpolate(specific_value3)
C2_3_HR = 1+result3_1/100
# 输出
#print("再热蒸汽温度对热耗率的修正系数:",round(C2_3_HR,5))
x3_2 = data3["再热蒸汽温度VS电动率"]["再热蒸汽温度"]
y3_2 = data3["再热蒸汽温度VS电动率"]["电功率"]

jn1_C2_reheated_temp_Pr = Correction2(x3_2, y3_2)
specific_value3 = data["热再热蒸汽"]["温度"]
result3_2 = jn1_C2_reheated_temp_Pr.interpolate(specific_value3)
C2_3_Pr = 1+result3_2/100
# 输出
#print("再热蒸汽温度对电功率的修正系数:",round(C2_3_Pr,5))
#9.4 再热器压损二类修正计算
x4_1 = data3["再热器压损VS热耗率"]["再热器压损"]
y4_1 = data3["再热器压损VS热耗率"]["热耗率"]
jn1_C2_reheated_press_drop_HR = Correction2(x4_1, y4_1)
specific_value4 = (data["高压缸排汽"]["压力"]-data["热再热蒸汽"]["压力"])/data["高压缸排汽"]["压力"]*100
result4_1 = Correction2_reheated_press_drop_heatrate.interpolate(specific_value4)
C2_4_HR = 1+result4_1/100
# 输出
#print("再热器压损对热耗率的修正系数:",round(C2_4_HR,5))

x4_2 = data3["再热器压损VS电动率"]["再热器压损"]
y4_2 = data3["再热器压损VS电动率"]["电功率"]

jn1_C2_reheated_press_drop_Pr = Correction2(x4_2, y4_2)

result4_2 = jn1_C2_reheated_press_drop_Pr.interpolate(specific_value4)
C2_4_Pr = 1+result4_2/100
#print("再热器压损对电功率的修正系数:",round(C2_4_Pr,5))
#9.5 低压缸排汽压力二类修正计算
x5_1= data3["低压缸排汽压力VS热耗率"]["低压缸排汽压力"]
y5_1=data3["低压缸排汽压力VS热耗率"]["热耗率"]

jn1_C2_backpress_HR = Correction2(x5_1, y5_1)
specific_value5 = data["低压缸排汽"]["压力"]*1000
specific_value5=specific_value5-data2["设计参数"]["低压缸排汽压力/kPa"]
result5_1 = jn1_C2_backpress_HR.interpolate(specific_value5)
C2_5_HR = 1+result5_1/100
#print("低压缸排汽压力对热耗率的修正系数:",round(C2_5_HR,5))

x5_2= data3["低压缸排汽压力VS电功率"]["低压缸排汽压力"]
y5_2= data3["低压缸排汽压力VS电功率"]["电功率"]

jn1_C2_backpress_Pr = Correction2(x5_2, y5_2)

result5_2 = jn1_C2_backpress_Pr.interpolate(specific_value5)
C2_5_Pr = 1+result5_2/100
#print("低压缸排汽压力对电功率的修正系数:",round(C2_5_Pr,5))

#9.6 二类修正总系数计算
C2_HR=C2_1_HR*C2_2_HR*C2_3_HR*C2_4_HR*C2_5_HR
C2_Pr=C2_1_Pr*C2_2_Pr*C2_3_Pr*C2_4_Pr*C2_5_Pr
C2_C_HR=C1_C_HR/C2_HR
C2_C_Pr=C1_C_Pr/C2_Pr
# 输出
#print("热耗率二类修正总系数:",round(C2_HR,5))
#print("电功率二类修正总系数:",round(C2_Pr,5))
#print("二类修正后热耗率:",round(C2_C_HR,1),"kJ/(kW.h)")
#print("二类修正后电功率:",round(C2_C_Pr,3),"MW")




#10总输出汇总
# print("高压缸效率为:",round(HP_case.calculate_cylinder_efficiency(),2),"%")
# print("中压缸效率为:",round(IP_case.calculate_cylinder_efficiency(),2),"%")
# print("一号高加进汽流量为:",round(HP_heater1.calculate_inlet_steam_flow(),3),"t/h")
# print("一号高加进汽压损为:",round(HP_heater1.calculate_inlet_steam_pressure_drop(),2),"%")
# print("一号高加出口端差为:",round(HP_heater1.calculate_upper_difference(),1),"℃")
# print("一号高加疏水端差为:",round(HP_heater1.calculate_lower_difference(),1),"℃")
# print("一号高加温升为:",round(HP_heater1.calculate_temperature_rise(),1),"℃")
# print("一号高加疏水流量为:",round(HP_heater1_drain_water_flow,3),"t/h")
# print("二号高加进汽流量为:",round(HP_heater2.calculate_inlet_steam_flow(),3),"t/h")
# print("二号高加进汽压损为:",round(HP_heater2.calculate_inlet_steam_pressure_drop(),2),"%")
# print("二号高加出口端差为:",round(HP_heater2.calculate_upper_difference(),1),"℃")
# print("二号高加疏水端差为:",round(HP_heater2.calculate_lower_difference(),1),"℃")
# print("二号高加温升为:",round(HP_heater2.calculate_temperature_rise(),1),"℃")
# print("二号高加疏水流量为:",round(HP_heater2_drain_water_flow,3),"t/h")
# print("三号高加进汽流量为:",round(HP_heater3.calculate_inlet_steam_flow(),3),"t/h")
# print("三号高加进汽压损为:",round(HP_heater3.calculate_inlet_steam_pressure_drop(),2),"%")
# print("三号高加出口端差为:",round(HP_heater3.calculate_upper_difference(),1),"℃")
# print("三号高加疏水端差为:",round(HP_heater3.calculate_lower_difference(),1),"℃")
# print("三号高加温升为:",round(HP_heater3.calculate_temperature_rise(),1),"℃")
# print("三号高加疏水流量为:",round(HP_heater3_drain_water_flow,3),"t/h")
# print("系统不明泄漏量为:",round(BM_leakage_flow,3),"t/h")
# print("最终给水流量为:",round(feedwater.massflow,3),"t/h")
# print("过热器减温水流量为:",round(super_spray_water.massflow,3),"t/h")
# print("主蒸汽流量为:",round(mainsteam.massflow,3),"t/h")
# print("冷再热蒸汽流量为:",round(cold_reheated_steam.massflow,3),"t/h")
# print("热再热蒸汽流量为:",round(reheated_steam.massflow,3),"t/h")
# print("电功率为:",round(jn1_generator.load,3),"MW")
# print("汽轮机试验热耗率为: ", round(jn1_heat_rate,2),"kJ/(kW.h)")
# print("修正后的主蒸汽流量为:", round(C_main_steam_flow,3),"t/h")
# print("一段抽汽压损对热耗率的修正系数",round(C1_1_HR,5))
# print("一段抽汽压损对电功率的修正系数",round(C1_1_Pr,5))
# print("凝汽器过冷度对热耗率的修正系数",round(C1_2_HR,5))
# print("凝汽器过冷度对电功率的修正系数",round(C1_2_Pr,5))
# print("小机抽汽流量对热耗率的修正系数:",round(C1_3_HR,5))
# print("小机抽汽流量对电功率的修正系数:",round(C1_3_Pr,5))
# print("一号高加出口端差对热耗率的修正系数:",round(C1_4_HR,5))
# print("一号高加出口端差对电功率的修正系数:",round(C1_4_Pr,5))
# print("再热器减温水流量对热耗率修正系数:",round(C1_5_HR,5))
# print("再热器减温水流量对电功率修正系数:",round(C1_5_Pr,5))
# print("过热器减温水流量对热耗率修正系数:",round(C1_6_HR,5))
# print("过热器减温水流量对电功率修正系数:",round(C1_6_Pr,5))
# print("热耗率总的一类修正系数:",round(C1_HR,5))
# print("电功率总的一类修正系数:",round(C1_Pr,5))
# print("一类修正后热耗率:",round(jn1_heat_rate/C1_HR,1),"kJ/(kW.h)")
# print("一类修正后电功率:",round(jn1_generator.load/C1_Pr,3),"MW")
#print("主蒸汽压力对热耗率修正系数:",round(C2_1_HR,5))
#print("主蒸汽压力对电功率修正系数:",round(C2_1_Pr,5))
#print("主蒸汽温度对热耗率修正系数:",round(C2_2_HR,5))
#print("主蒸汽温度对电功率修正系数:",round(C2_2_Pr,5))
#print("再热蒸汽温度对热耗率的修正系数:",round(C2_3_HR,5))
#print("再热蒸汽温度对电功率的修正系数:",round(C2_3_Pr,5))
#print("低压缸排汽压力对热耗率的修正系数:",round(C2_5_HR,5))
#print("低压缸排汽压力对电功率的修正系数:",round(C2_5_Pr,5))
#print("热耗率二类修正总系数:",round(C2_HR,5))
#print("电功率二类修正总系数:",round(C2_Pr,5))
#print("二类修正后热耗率:",round(C2_C_HR,1),"kJ/(kW.h)")
#print("二类修正后电功率:",round(C2_C_Pr,3),"MW")
#11结果写入
# 构建数据字典
data4 = {
    "高压缸效率": str(round(HP_case.calculate_cylinder_efficiency(), 2)) + "%",
    "中压缸效率": str(round(IP_case.calculate_cylinder_efficiency(), 2)) + "%",
    "一号高加进汽流量": str(round(HP_heater1.calculate_inlet_steam_flow(), 3)) + " t/h",
    "一号高加进汽压损": str(round(HP_heater1.calculate_inlet_steam_pressure_drop(), 2)) + "%",
    "一号高加出口端差": str(round(HP_heater1.calculate_upper_difference(), 1)) + " ℃",
    "一号高加疏水端差": str(round(HP_heater1.calculate_lower_difference(), 1)) + " ℃",
    "一号高加温升": str(round(HP_heater1.calculate_temperature_rise(), 1)) + " ℃",
    "一号高加疏水流量": str(round(HP_heater1_drain_water_flow, 3)) + " t/h",
    "二号高加进汽流量": str(round(HP_heater2.calculate_inlet_steam_flow(), 3)) + " t/h",
    "二号高加进汽压损": str(round(HP_heater2.calculate_inlet_steam_pressure_drop(), 2)) + "%",
    "二号高加出口端差": str(round(HP_heater2.calculate_upper_difference(), 1)) + " ℃",
    "二号高加疏水端差": str(round(HP_heater2.calculate_lower_difference(), 1)) + " ℃",
    "二号高加温升": str(round(HP_heater2.calculate_temperature_rise(), 1)) + " ℃",
    "二号高加疏水流量": str(round(HP_heater2_drain_water_flow, 3)) + " t/h",
    "三号高加进汽流量": str(round(HP_heater3.calculate_inlet_steam_flow(), 3)) + " t/h",
    "三号高加进汽压损": str(round(HP_heater3.calculate_inlet_steam_pressure_drop(), 2)) + "%",
    "三号高加出口端差": str(round(HP_heater3.calculate_upper_difference(), 1)) + " ℃",
    "三号高加疏水端差": str(round(HP_heater3.calculate_lower_difference(), 1)) + " ℃",
    "三号高加温升": str(round(HP_heater3.calculate_temperature_rise(), 1)) + " ℃",
    "三号高加疏水流量": str(round(HP_heater3_drain_water_flow, 3)) + " t/h",
    "系统不明泄漏量": str(round(BM_leakage_flow, 3)) + " t/h",
    "最终给水流量": str(round(feedwater.massflow, 3)) + " t/h",
    "过热器减温水流量": str(round(super_spray_water.massflow, 3)) + " t/h",
    "主蒸汽流量": str(round(mainsteam.massflow, 3)) + " t/h",
    "冷再热蒸汽流量": str(round(cold_reheated_steam.massflow, 3)) + " t/h",
    "热再热蒸汽流量": str(round(reheated_steam.massflow, 3)) + " t/h",
    "电功率": str(round(jn1_generator.load, 3)) + " MW",
    "汽轮机试验热耗率": str(round(jn1_heat_rate, 2)) + " kJ/(kW.h)",
    "修正后的主蒸汽流量": str(round(C_main_steam_flow, 3)) + " t/h",
    "一段抽汽压损对热耗率的修正系数": str(round(C1_1_HR, 5)),
    "一段抽汽压损对电功率的修正系数": str(round(C1_1_Pr, 5)),
    "凝汽器过冷度对热耗率的修正系数": str(round(C1_2_HR, 5)),
    "凝汽器过冷度对电功率的修正系数": str(round(C1_2_Pr, 5)),
    "小机抽汽流量对热耗率的修正系数": str(round(C1_3_HR, 5)),
    "小机抽汽流量对电功率的修正系数": str(round(C1_3_Pr, 5)),
    "一号高加出口端差对热耗率的修正系数": str(round(C1_4_HR, 5)),
    "一号高加出口端差对电功率的修正系数": str(round(C1_4_Pr, 5)),
    "再热器减温水流量对热耗率修正系数": str(round(C1_5_HR, 5)),
    "再热器减温水流量对电功率修正系数": str(round(C1_5_Pr, 5)),
    "过热器减温水流量对热耗率修正系数": str(round(C1_6_HR, 5)),
    "过热器减温水流量对电功率修正系数": str(round(C1_6_Pr, 5)),
    "热耗率总的一类修正系数": str(round(C1_HR, 5)),
    "电功率总的一类修正系数": str(round(C1_Pr, 5)),
    "一类修正后热耗率": str(round(jn1_heat_rate / C1_HR, 1)) + " kJ/(kW.h)",
    "一类修正后电功率": str(round(jn1_generator.load / C1_Pr, 3)) + " MW",
    "主蒸汽压力对热耗率修正系数": str(round(C2_1_HR, 5)),
    "主蒸汽压力对电功率修正系数": str(round(C2_1_Pr, 5)),
    "主蒸汽温度对热耗率修正系数": str(round(C2_2_HR, 5)),
    "主蒸汽温度对电功率修正系数": str(round(C2_2_Pr, 5)),
    "再热蒸汽温度对热耗率的修正系数": str(round(C2_3_HR, 5)),
    "再热蒸汽温度对电功率的修正系数": str(round(C2_3_Pr, 5)),
    "低压缸排汽压力对热耗率的修正系数": str(round(C2_5_HR, 5)),
    "低压缸排汽压力对电功率的修正系数": str(round(C2_5_Pr, 5)),
    "热耗率二类修正总系数": str(round(C2_HR, 5)),
    "电功率二类修正总系数": str(round(C2_Pr, 5)),
    "二类修正后热耗率": str(round(C2_C_HR, 1)) + " kJ/(kW.h)",
    "二类修正后电功率": str(round(C2_C_Pr, 3)) + " MW"
}

# 打印字典数据
for key, value in data4.items():
    print(key + ":" + value)





# 将数据字典写入output_data.json文件
with open('output_data.json', 'w', encoding='utf-8') as f:
    json.dump(data4, f, ensure_ascii=False)































# 打印值
#print(mainsteam.temperature)
#print("主蒸汽焓:", mainsteam.H_PT_water(mainsteam.pressure, mainsteam.temperature))
#print("高压缸排汽焓:", cold_reheated_steam.H_PT_water(cold_reheated_steam.pressure, cold_reheated_steam.temperature))




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

CODE-boy1

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值