用Python建模朗肯循环
朗肯循环是任何热电厂的核心。基本的朗肯循环有四个过程,即汽轮机和泵中的可逆绝热功相互作用,以及锅炉和冷凝器中的等压热相互作用。
热电厂示意图如下所示。
为了提高朗肯循环的效率,使用了再生,即将蒸汽从汽轮机中抽出,并将其与给水混合在给水加热器中。循环中的不同过程必须借助蒸汽表中的数据进行建模。因此,在代码本身中拥有数据就变得非常重要。
值得庆幸的是,Pyromat模块可以提供饱和状态和过热状态下的蒸汽数据。让我们通过一个例子来演示Pyromat的使用及其建模循环的能力。
示例1
考虑使用蒸汽作为工作流体的再生循环。蒸汽离开锅炉,以4 MPa,400 °C的压力进入汽轮机。膨胀到400 kPa后,一些蒸汽从汽轮机中抽出,以在开式FWH中加热给水。FWH中的压力为400 kPa,离开FWH的水为400 kPa下的饱和液体。未抽出的蒸汽膨胀到10 kPa。确定循环效率。
解决方案
该过程可以示意性地表示为:
这里:
SH - 过热器
CEP - 冷凝水抽出泵
FWH - 给水加热器
BFP - 锅炉给水泵
ECO - 节能器
SH - 过热器
用于模拟朗肯循环的Python程序
用于模拟它的Python程序如下:
示例
# Importing the pyromat module
from pyromat import*
# configuring the pressure and fluid
config["unit_pressure"]="kPa"
prop_water=get('mp.H2O')
# Input data
# Boiler exit pressure and temperature
p1=4000
T1=400+273
# Economiser exit pressure
p8=p1
# Economiser inlet pressure
p7=p1
# Steam extraction pressure
p5=400
# Inlet pressure from BFP
p6=p5
# Exit pressure from CEP
p4=p5
# Condenser pressure
p2=10
p3=p2
# Boiler exit pressure
p9=p8
# Turbine
# POINT-1
h1=prop_water.h(p=p1,T=T1)
s1=prop_water.s(p=p1,T=T1)
s5=s1
s2=s1
# POINT-5
T5,x5=prop_water.T_s(p=p5,s=s5,quality='True')
h5=prop_water.h(p=p5,x=x5)
# POINT-2
T2,x2=prop_water.T_s(p=p2,s=s2,quality='True')
h2=prop_water.h(p=p2,x=x2)
# Condenser
# POINT-3
h3=prop_water.hs(p=p3)[0]
T3=prop_water.Ts(p=p3)
s3=prop_water.ss(p=p3)[0]
# CEP
v3=1/prop_water.ds(p=p3)[0]
w_cep=v3*(p4-p3)
# POINT-4
s4=s3
h4=h3+w_cep
T4=prop_water.T_s(s=s4,p=p4)
# FWH
# POINT-6
h6=prop_water.hs(p=p6)[0]
s6=prop_water.ss(p=p6)[0]
T6=prop_water.Ts(p=p6)
v6=1/prop_water.ds(p=p6)[0]
# BFP
# POINT-7
s7=s6
w_bfp=v6*(p7-p6)
h7=h6+w_bfp
T7=prop_water.T_s(s=s7,p=p7)
# POINT-8
h8=prop_water.hs(p=p8)[0]
s8=prop_water.ss(p=p8)[0]
T8=prop_water.Ts(p=p8)
# POINT-9
s9=prop_water.ss(p=p8)[1]
T9=T8
# Final Calculations
# Calculation of extracted mass
m=(h6-h4)/(h5-h4)
w_turbine=h1-h5+(1-m)*(h5-h2)
w_net=w_turbine-w_cep-w_bfp
q1=h1-h7
q2=(1-m)*(h2-h3)
# Method 1
efficiency=(w_net/q1)*100
# Method 2
e2=(1-q2/q1)*100
print('The efficiency of Rankine Cycle is: ',round(e2[0],2),'%')
print('The efficiency of Rankine Cycle is: ',round(efficiency[0],2),'%')
输出
执行此程序时,将产生以下输出:
The efficiency of Rankine Cycle is: 37.46 % The efficiency of Rankine Cycle is: 37.45 %
为了了解不同点的温度和压力,可以编写以下代码:
from pandas import *
p=[p1,p2,p3,p4,p5,p6,p7,p8,p9]
T=[T1,T2,T3,T4,T5,T6,T7,T8,T9]
stage=list(range(1,10))
data={'stage':stage,'p':p,'T':T}
df=DataFrame(data)
print(df)
输出将是:
stage p T 0 1 4000 673 1 2 10 [318.95560780290276] 2 3 10 [318.95560780290276] 3 4 400 [318.968869853315] 4 5 400 [416.7588812509273] 5 6 400 [416.7588812509273] 6 7 4000 [417.1315355843229] 7 8 4000 [523.5036113863505] 8 9 4000 [523.5036113863505]
要绘制朗肯循环,可以使用以下代码:
# Importing modules
from pylab import *
from numpy import *
# Setting fonts
font = {'family':'Times New Roman', 'size': 14}
figure(figsize=(7.20, 5.20))
title('Rankine Cycle with Feed water heating (T-s Diagram)',color='b')
rc('font', **font)
# Drawing vapour dome
p=linspace(1,22064,1000)
T=prop_water.Ts(p=p)
s=prop_water.ss(p=p)
plot(s[0],T,'b--',linewidth=2)
plot(s[1],T,'r--',linewidth=2)
# connecting all states with lines
se=[s1,s5,s2,s3,s4,s6,s7,s8,s9,s1]
Te=[T1,T5,T2,T3,T4,T6,T7,T8,T9,T1]
plot(se,Te,'k',linewidth=3)
plot([s5,s6],[T5,T6],'r',linewidth=3)
xlim(0,9)
# Numbering the states
text(s1+0.1,T1,'1')
text(s5+0.1,T5,'5')
text(s2+0.3,T2,'2')
text(s3-0.3,T3,'3')
text(s4-0.3,T4+15,'4')
text(s6-0.3,T6,'6')
text(s7-0.3,T7+15,'7')
text(s8-0.3,T8,'8')
text(s9+0.1,T9-4,'9')
text((s5+s6)/2,(T5)+10,'m')
text((s3+s2)/2+0.3,(T3)+10,'1-m')
xlabel('Entropy (kJ/kg-K)')
ylabel('Temperature (K)')
savefig("Rankine.jpg")
show()
因此,上述代码生成的朗肯循环图如下:
结论
在本简短教程中,使用Pyromat模块在Python中对朗肯循环进行了建模。在使用Pyromat之前,您应该安装它(对于pip用户:“pip install pyromat”)。评估并打印不同点的属性。基于属性数据,最终绘制了朗肯循环。
广告
数据结构
网络
关系数据库管理系统 (RDBMS)
操作系统
Java
iOS
HTML
CSS
Android
Python
C语言编程
C++
C#
MongoDB
MySQL
Javascript
PHP