盧 珍,周小波,李光輝,曾文明,李玉玲,阮紅麗,梁 君,趙九洲,陳小明,郭躍生
(1.四川省農(nóng)業(yè)機械研究設計院,成都 610066;2.西華大學能源與動力工程學院,成都 610039; 3.宜賓市翠屏區(qū)農(nóng)林畜牧局,四川 宜賓 644000)
提灌站是解決丘陵地區(qū)農(nóng)業(yè)灌溉用水的重要基礎設施,在確保糧食安全生產(chǎn)方面擔負著重要作用。在提灌站方案設計中,泵的選型、管道匹配、閥門類型、閥門關閉規(guī)律以及水錘防護措施等是否合理,依據(jù)相關公式進行計算較為復雜。若設計方案不合理,可能導致提灌站抽不上水或者運行工況不滿足要求,還可能存在一些安全隱患,甚至導致在實際運行中發(fā)生水錘事故,最終造成大量財力、物力和人力的損失[1]。
近年來,隨著計算機科學技術的飛速發(fā)展,數(shù)值模擬仿真技術已廣泛應用于各個領域。相比于傳統(tǒng)研究方法,數(shù)值模擬仿真具有研究周期短、成本低、可預見性以及可靠性高等優(yōu)點,已成為工程設計和科學研究中的一個重要工具[2-5]。
作者利用計算機仿真技術,結合Flowmaster流體系統(tǒng)仿真軟件,應用可視化編程技術,開發(fā)了一個專門針對提灌站穩(wěn)態(tài)和過渡過程運行的仿真軟件,為提灌站工程設計人員提供一個較為方便快捷、安全可靠的設計方案優(yōu)化工具,實現(xiàn)對設計方案的提前預測和修改完善,從而有效降低設計成本和設計風險,提高工程運行可靠性。
Flowmaster軟件是全球著名的一維流體系統(tǒng)仿真分析軟件,具有計算效率高、求解結果精確、建模方式快捷、軟件接口豐富等優(yōu)點,具備開放而多樣的聯(lián)合仿真接口開發(fā)能力,易于實現(xiàn)軟件集成與半實物仿真。目前已被汽車、能源動力、航空航天等諸多行業(yè)的各種流體系統(tǒng)所采用。該軟件提供了豐富多樣的元件,可以計算分析流體系統(tǒng)的運行情況,如開啟和關閉閥門、改變泵轉速時流體系統(tǒng)各節(jié)點處運行參數(shù)變化。根據(jù)對流體系統(tǒng)中各個環(huán)節(jié)的參數(shù)進行精確的計算分析,工程師可以快速地進行流體系統(tǒng)的優(yōu)化設計[6]。
該仿真軟件的特點是參數(shù)設置方便和計算效率高,登錄該軟件后,無需再搭建管路模型,只需直接選擇需要的管路模型,通過輸入水泵、管道、閥門等設備的關鍵參數(shù)以及邊界條件和計算條件,通過運行仿真,即可進行設計方案穩(wěn)態(tài)運行情況下實際運行工況點參數(shù)的計算確定,過渡過程運行工況下事故停泵后水泵流量變化、水泵轉速變化、止回閥后壓力變化以及壓力最大值的計算確定,通過穩(wěn)態(tài)和過渡過程的計算結果,即可判定設計方案的合理性,從而有效提高設計方案的可靠性,降低設計風險。
采用Flowmaster組建提灌站管路系統(tǒng)計算模型,并將其作為計算核心,在后臺運行計算。利用VB.NET面向對象的可視化編程特點開發(fā)軟件登錄界面、前處理輸入界面、計算界面和后處理輸出界面等用戶交互界面,借助Flowmaster開放的聯(lián)合仿真接口開發(fā)功能實現(xiàn)數(shù)據(jù)的有效傳輸。仿真軟件開發(fā)流程見圖1。
圖1 仿真軟件開發(fā)流程Fig.1 Development flow chartof simulation software
提灌站水力系統(tǒng)由進水池、進水鋼管、水泵、閘閥、止回閥、出水鋼管、出水池等組成。根據(jù)實際的提灌站水力系統(tǒng)組成,確定計算類型,在Flowmaster中組建提灌站水力系統(tǒng)穩(wěn)態(tài)和過渡過程計算模型,然后將計算模型打包,存放到指定位置,仿真計算過程中再用相關程序調用對應水力模型。
在組建提灌站水力系統(tǒng)穩(wěn)態(tài)和過渡過程計算模型過程中,進水池和出水池采用壓力源邊界條件代替。提灌站水力系統(tǒng)穩(wěn)態(tài)計算模型和過渡過程計算模型見圖2。穩(wěn)態(tài)計算模型需去掉控制器組件。
圖2 提灌站水力系統(tǒng)穩(wěn)態(tài)和過渡過程計算模型Fig.2 Hydraulic system steady state calculation modelof pump station 注:1-壓力源;2-鋼管;3-彎頭;4-鋼管;5-大小頭;6-水泵;7-大小頭;8-彎頭;9-閘閥;10-止回閥;11-彎頭;12-鋼管;13-壓力源;14-控制器。
采用VB.NET進行界面設計,主要包括登錄界面、主界面、前處理界面、計算界面和后處理界面。
(1)登錄界面。通過在登錄界面輸入用戶名和密碼即可登錄仿真軟件。登錄界面見圖3。
圖3 登錄界面Fig.3 Login interface
(2)主界面。主界面主要具有新建、打開、保存文件以及選擇進入前處理界面、計算界面和后處理界面的功能。主界面見圖4。
圖4 主界面Fig.4 Main interface
(3)前處理界面。前處理界面包括管路模型選擇界面和參數(shù)輸入界面。
管路模型選擇界面有IS泵管路模型、S型泵管路模型、D型泵管路模型3種,用戶可根據(jù)實際需求進行選擇。管路模型選擇界面見圖5。
圖5 管路模型選擇界面Fig.5 Pipe model selection interface
確定管路模型的代碼如下:
If ListBox1.SelectedIndex = 0 Then
IS_selected = True
S_selected = False
D_selected = False
ElseIf ListBox1.SelectedIndex = 1 Then
IS_selected = False
S_selected = True
D_selected = False
ElseIf ListBox1.SelectedIndex = 2 Then
IS_selected = False
S_selected = False
D_selected = True
End If
參數(shù)輸入界面包括管路系統(tǒng)計算模型、計算類型選擇、元件參數(shù)和節(jié)點參數(shù)輸入3個區(qū)域,其功能可以實現(xiàn)在穩(wěn)態(tài)計算工況下,對管道、閥門、水泵等設備的關鍵參數(shù)輸入以及計算條件的設置,也可以實現(xiàn)在瞬態(tài)計算工況下,對管道、閥門、水泵等設備的關鍵參數(shù)輸入以及閥門關閉規(guī)律、計算條件的設置。參數(shù)輸入界面見圖6。
圖6 參數(shù)輸入界面Fig.6 Parameter input interface
參數(shù)寫入到變量代碼如下:
If mark = 1 Then
source_A_total_pressure = DataGridView2.Rows(0).Cells(1).Value
ElseIf mark = 2 Then
pipe_A_length = DataGridView2.Rows(0).Cells(1).Value
pipe_A_diameter = DataGridView2.Rows(1).Cells(1).Value
ElseIf mark = 3 Then
bend_A_diameter = DataGridView2.Rows(0).Cells(1).Value
bend_A_deflection_angle = DataGridView2.Rows(1).Cells(1).Value
bend_A_radius_diameter = DataGridView2.Rows(2).Cells(1).Value
ElseIf mark = 4 Then
pipe_B_length = DataGridView2.Rows(0).Cells(1).Value
pipe_B_diameter = DataGridView2.Rows(1).Cells(1).Value
ElseIf mark = 5 Then
gradual_A_length = DataGridView2.Rows(0).Cells(1).Value
gradual _A_minor_diameter = DataGridView2.Rows(1).Cells(1).Value
gradual _A_major_diameter = DataGridView2.Rows(2).Cells(1).Value
ElseIf mark = 6 Then
pump_rated_flow = DataGridView2.Rows(0).Cells(1).Value
pump_rated_head = DataGridView2.Rows(1).Cells(1).Value
pump_rated_speed = DataGridView2.Rows(2).Cells(1).Value
pump_rated_power = DataGridView2.Rows(3).Cells(1).Value
pump_initial_speed = DataGridView2.Rows(4).Cells(1).Value
(4)計算界面。點擊計算按鈕后,計算界面可顯示計算進度,計算界面的功能是通過聯(lián)合仿真接口與Flowmaster軟件進行參數(shù)傳輸,調用Flowmaster軟件進行后臺運行計算。計算界面見圖7。
圖7 計算界面Fig.7 Calculation interface
以下以IS型泵管路模型開發(fā)流程為例進行介紹。
IS型泵穩(wěn)態(tài)計算程序開發(fā)流程:①加載IS型泵管路特性曲線計算模型;②創(chuàng)建Suter-M、Suter-H曲線;③仿真平臺與Flowmaster之間參數(shù)傳遞;④不同流量下管路系統(tǒng)壓降計算,確定管路系統(tǒng)水頭特性;⑤加載IS型泵管路系統(tǒng)穩(wěn)態(tài)計算模型;⑥仿真平臺與Flowmaster之間參數(shù)傳遞;⑦計算系統(tǒng)流量、各元件流速、雷諾數(shù)、壓降,確定IS泵運行工況。
不同流量下管路系統(tǒng)壓降計算代碼如下:
For i = 0 To 9
source1 = net.Component("1")
source1.UseAppUnitSet = True
source1.SetLineBySearch("", "Mass Flow Rate")
flowrate(i) = D_max_flowrate * 998 / 10 + i * D_max_flowrate * 998 / 10
source1.SetCLValue(flowrate(i))
source1.SaveChanges()
inde1 = res.ComponentIndex(2)
inde2 = res.ComponentIndex(3)
inde3 = res.ComponentIndex(4)
inde4 = res.ComponentIndex(5)
inde5 = res.ComponentIndex(6)
inde6 = res.ComponentIndex(7)
inde7 = res.ComponentIndex(8)
inde8 = res.ComponentIndex(9)
inde9 = res.ComponentIndex(10)
pressure_drop(0) = res.ComponentValue(inde1, 401, 1, 0)
pressure_drop(1) = res.ComponentValue(inde2, 401, 1, 0)
pressure_drop(2) = res.ComponentValue(inde3, 401, 1, 0)
pressure_drop(3) = res.ComponentValue(inde4, 401, 1, 0)
pressure_drop(4) = res.ComponentValue(inde5, 401, 1, 0)
pressure_drop(5) = res.ComponentValue(inde6, 401, 1, 0)
pressure_drop(6) = res.ComponentValue(inde7, 401, 1, 0)
pressure_drop(7) = res.ComponentValue(inde8, 401, 1, 0)
pressure_drop(8) = res.ComponentValue(inde9, 401, 1, 0)
For j = 0 To 8
pressure_drop_sum(i) = D_pressure_drop_sum(i) + D_pressure_drop(j)
Next
計算系統(tǒng)流量、各元件流速、雷諾數(shù)、壓降,確定IS泵運行工況代碼如下:
res_pipe1_pressure_drop = Math.Round(res.ComponentValue(index1, 401, 1, 0), 6)
res_pipe1_reynolds_number = Math.Round(res.ComponentArmValue(index1, 2, 91, 0))
res_pipe1_velocity = Math.Round(res.ComponentArmValue(index1, 2, 206, 0), 6)
res_pipe2_pressure_drop = Math.Round(res.ComponentValue(index2, 401, 1, 0), 6)
res_pipe2_reynolds_number = Math.Round(res.ComponentArmValue(index2, 2, 91, 0))
res_pipe2_velocity = Math.Round(res.ComponentArmValue(index2, 2, 206, 0), 6)
res_pipe3_pressure_drop = Math.Round(res.ComponentValue(index3, 401, 1, 0), 6)
res_pipe3_reynolds_number = Math.Round(res.ComponentArmValue(index3, 2, 91, 0))
res_pipe3_velocity = Math.Round(res.ComponentArmValue(index3, 2, 206, 0), 6)
res_bend1_pressure_drop = Math.Round(res.ComponentValue(index4, 401, 1, 0), 6)
res_bend1_reynolds = Math.Round(res.ComponentArmValue(index4, 2, 91, 0))
res_bend1_velocity = Math.Round(res.ComponentArmValue(index4, 2, 206, 0), 6)
IS型泵瞬態(tài)計算程序開發(fā)流程:①加載IS型泵管路系統(tǒng)瞬態(tài)計算模型;②創(chuàng)建Suter-M、Suter-H曲線和閥門開度曲線opening;③仿真平臺與Flowmaster之間參數(shù)傳遞;④瞬態(tài)計算時間步長設置;⑤計算閥門關閉后節(jié)點壓力變化和泵轉速、流量變化。
瞬態(tài)計算時間步長設置代碼如下:
gendat = net.GeneralData
gendat.SetLineBySearch("", "Simulation Start Time")
gendat.SetCLValue(opening_curve(0, 0))
gendat.SaveChanges()
gendat.SetLineBySearch("", "Simulation End Time")
gendat.SetCLValue(opening_curve(num_of_openingcurve1 - 1, 0))
gendat.SaveChanges()
gendat.SetLineBySearch("", "Time Step")
gendat.SetCLValue(Time_step)
gendat.SaveChanges()
計算閥門關閉后節(jié)點壓力變化和泵轉速、流量變化代碼如下:
com_num_of_atr = res.ComponentNumberOfAttribValues(index1, 9)
res_pump_volumeflow_ST = res.ComponentArmTimeHistory(index1, 2, 202)
res_pump_speed_ST = res.ComponentTimeHistory(index1, 9, com_num_of_atr)
index2 = res.NodeIndex(10)
res_node_10_pressure = res.NodeTimeHistory(index2, 294)
test = res.ComponentNumberOfAttribValues(index1, 206)
(5)后處理界面。后處理界面包括穩(wěn)態(tài)計算結果輸出界面和瞬態(tài)計算結果輸出界面。
穩(wěn)態(tài)計算結果輸出界面包括計算結果、特性曲線、管路系統(tǒng)穩(wěn)態(tài)計算模型3個區(qū)域,其功能可以實現(xiàn)在穩(wěn)態(tài)計算工況下,提灌站管路系統(tǒng)實際運行工況點的流量、功率、效率等關鍵參數(shù)的輸出和顯示,以及水泵特性曲線和管路特性曲線的顯示。穩(wěn)態(tài)計算結果輸出界面見圖8。
瞬態(tài)計算結果輸出界面包括計算結果和管路系統(tǒng)瞬態(tài)計算模型2個區(qū)域,其功能可以實現(xiàn)在瞬態(tài)計算工況下,事故停泵后,蝶閥后壓力變化曲線以及最大壓力值的輸出和顯示,水泵轉速變化曲線、水泵流量變化曲線的輸出和顯示。瞬態(tài)計算結果輸出界面見圖9。后處理界面開發(fā)流程圖見圖10。
判斷計算類型代碼如下:
If IS_ selected = True Then
If Model_IS_SS_checked = True Then
IS穩(wěn)態(tài)計算結果.ShowDialog()
ElseIf Model_IS_ST_checked = True Then
IS泵瞬態(tài)計算結果.ShowDialog()
End If
ElseIf S_ selected = True Then
If SModel_IS_SS_checked = True Then
S穩(wěn)態(tài)計算結果.ShowDialog()
ElseIf SModel_IS_ST_checked = True Then
S泵瞬態(tài)計算結果.ShowDialog()
End If
圖8 穩(wěn)態(tài)計算結果輸出界面Fig.8 Steady state calculation results output interface
圖9 瞬態(tài)計算結果輸出界面Fig.9 Transient state calculation results output interface
圖10 后處理輸出界面開發(fā)流程Fig.10 Development flow chart of post-processing output interface
ElseIf D_ selected = True Then
If Model_D_SS_checked = True Then
D穩(wěn)態(tài)計算結果.ShowDialog()
ElseIf Model_D_ST_checked = True Then
D泵瞬態(tài)計算結果.ShowDialog()
End If
End If
輸出各元件壓降、雷諾數(shù)等計算結果代碼如下:
TextBox1.Text = res_pipe1_pressure_drop * 100
Label1.Text = "壓降"
TextBox2.Text = res_pipe1_reynolds_number
Label2.Text = "雷諾數(shù)"
TextBox3.Text = res_pipe1_velocity
Label3.Text = "流速"
確定蝶閥后最大壓力代碼如下:
res_node_10_ pressure_max = res_node_10_ pressure(0, 1)
res_node_10_ pressure_min = res_node_10_ pressure(0, 1)
For i = 1 To node_10_length1-1
If res_node_10_ pressure(1, i) > res_node_10_ pressure_max Then
res_node_10_ pressure_max = res_node_10_ pressure(1, i)
End If
If res_node_10_ pressure(1, i) < res_node_10_ pressure_min Then
res_node_10_ pressure_min = res_node_10_ pressure(1, i)
End If
Next
為了分析仿真軟件的計算精度是否滿足要求,以某提灌站管路系統(tǒng)為計算對象,提灌站基本參數(shù)見表1。首先在提灌站穩(wěn)態(tài)運行情況下,進行現(xiàn)場測試,然后在仿真軟件上進行穩(wěn)態(tài)仿真計算,最后將現(xiàn)場測試數(shù)據(jù)和仿真軟件計算數(shù)據(jù)進行對比。對比結果見表2。
表1 提灌站基本參數(shù) m
表2 現(xiàn)場測試數(shù)據(jù)與仿真軟件計算數(shù)據(jù)對比Tab.2 Thesimulation data Compared with the test data
由表2可知,該提灌站管路系統(tǒng)在穩(wěn)態(tài)運行情況下,現(xiàn)場測試的水泵實際工作流量為682.17 m3/h,仿真軟件計算的水泵實際工作流量為672.84 m3/h,仿真軟件計算的流量結果比現(xiàn)場測試的流量小了9.33 m3/h,仿真計算誤差為-1.37%;現(xiàn)場測試的水泵實際工作揚程為32.48 m,仿真軟件計算的水泵實際工作揚程為33.86 m,仿真軟件計算的揚程比現(xiàn)場測試的揚程高了1.38 m,仿真計算誤差為+4.24%。水泵實際工作流量和實際工作揚程的仿真計算誤差較小,仿真計算結果具有實際參考價值。
基于flowmaster的提灌站穩(wěn)態(tài)和過渡過程運行仿真軟件界面設計簡單、友好。該軟件專業(yè)性強、計算速度快、計算精度高,設計人員僅需輸入水泵、管道、閥門等設備的關鍵參數(shù)以及邊界條件和計算條件即可進行運行仿真計算,根據(jù)計算結果設計人員即可判斷設計方案的合理性,若設計方案不合理,便可快速地進一步對設計方案進行修改完善。可作為提灌站工程設計人員在設計選型時參考。
□