📄 libbreakdowns.bas
字号:
Attribute VB_Name = "LibBreakDowns"
Option Explicit
Rem 诊断故障与计算漏失系数
Sub BreakDowns_Diagnose(rpm As Single, dpump As Single, HSink As Single, nw As Single, PowerPrlSimulated As Single, _
Ncal_Card As Integer, Pr_Card() As Single, Prl_Card() As Single, _
jcal As Integer, UnitXPumpU() As Single, UnitPPumpU() As Single, FU1() As Single, _
UnitXPumpD() As Single, UnitPPumpD() As Single, FD1() As Single, _
SPumpSuction As Single, SPumpDischarge As Single, wrbar As Single, _
LPmax As Single, LPMaxDiagnose As Single, BreakdownKind As String, CoeffLeak As Single)
Dim j As Integer
Dim UnitPPumpD1(500) As Single
Dim UnitXPumpD0 As Single
Dim SPumpDischargeNew As Single
Dim BreakdownKindJL As String '结蜡故障
Dim BreakdownKindLiquidGas As String '供液不足和气影响
Dim JOpenU As Integer '上冲程固定阀打开时,记数序号
Dim JOpenD As Integer '下冲程游动阀打开时,记数序号
Dim DeltSOpen As Single '固定阀滞后开启行程。上冲程开始段,游动阀漏失特征行程
Dim DeltSClose As Single '上冲程结束段,游动阀漏失特征行程
Dim DeltDClose As Single '下冲程结束段,固定阀漏失特征行程
Dim ALeakingU1 '上冲程下死点游动阀漏失面积
Dim ALeakingU2 '上冲程上死点游动阀漏失面积
Dim ALeakingD1 '下冲程上死点固定阀漏失面积
Dim ALeakingD2 '下冲程下死点固定阀漏失面积
Dim PrlMax As Single, PrlMin As Single, PrPowerMeasured As Single '测试最大载荷、最小载荷、光杆功率
CoeffLeak = 1 '无漏失时,影响系数为1
BreakdownKind = ""
If Trim(BreakdownKind) = "" Then
BreakdownKind = "泵况正常"
End If
End Sub
Rem 抽油杆柱在泵处断脱时,计算抽油杆断脱特征值(光杆功率)
Sub Card_Simulation(WellType As String, NcalWell As Integer, XWell() As Single, SetWell() As Single, FaiWell() As Single, _
twell As Single, _
nrod As Integer, drod() As Single, lrod() As Single, Spr_use As Single, _
rpm As Single, dpump As Single, lpump As Single, SCrudeOil As Single, sp As Single, _
nw As Single, mu As Single, dtubei As Single, poil As Single, pcase As Single, _
hmove As Single, tanchor As String, PowerPrlSimulated As Single, PrlMaxSimulated As Single)
Dim j As Integer, jcal As Integer
Dim setg As Single, VSetCal As Single, DeltT As Single
Dim Pr(1500) As Single, vpr(1500) As Single, apr(1500) As Single, prl(1500) As Single
Dim PrlMax As Single, PrlMin As Single
jcal = 500
VSetCal = 2 * pi * rpm / 60
DeltT = 2 * pi / VSetCal / jcal
For j = 0 To jcal
setg = 2 * pi / jcal * j
Pr(j) = Spr_use / 2 * (1 - Cos(setg))
vpr(j) = Spr_use / 2 * VSetCal * Sin(setg)
apr(j) = Spr_use / 2 * VSetCal ^ 2 * Cos(setg)
Next j
Call PrlBrokenRod_Cal(WellType, NcalWell, XWell, SetWell, FaiWell, twell, _
nrod, drod, lrod, Spr_use, rpm, dpump, lpump, SCrudeOil, sp, nw, mu, _
dtubei, poil, pcase, hmove, tanchor, jcal, Pr, vpr, apr, prl, PrlMax, PrlMin)
PowerPrlSimulated = 0
For j = 1 To jcal - 1
PowerPrlSimulated = PowerPrlSimulated + (prl(j) + prl(j + 1)) / 2 * (Pr(j + 1) - Pr(j))
Next j
PowerPrlSimulated = PowerPrlSimulated / 1000 * rpm / 60
PrlMaxSimulated = PrlMax
Exit Sub
eedd:
Screen.MousePointer = 0
Call ErrorHandle
End Sub
Rem 正常间隙漏失系数
Sub C_Leaking_Cal(scale_pump As Integer, SprPump As Single, dpump As Single, FPump As Single, mu As Single, _
rpm As Single, ps As Single, pd As Single, c_leaking As Single)
Dim deltr As Single, efclo As Single, lc As Single, tu As Single, dv As Single
Dim pi As Single
pi = 3.14159265
deltr = (0.12 + 0.17) / 2 / 2 * 0.001
If scale_pump <= 1 Then
deltr = (0.02 + 0.07) / 2 / 2 * 0.001
End If
If scale_pump = 2 Then
deltr = (0.07 + 0.12) / 2 / 2 * 0.001
End If
If scale_pump = 3 Then
deltr = (0.12 + 0.17) / 2 / 2 * 0.001
End If
efclo = 0.995
lc = 1.2
tu = 60 / rpm / 2
dv = pi * dpump * (pd - ps) * deltr ^ 3 / 12 / mu / lc * (1 + 3 / 2 * efclo ^ 2) * tu
c_leaking = (FPump * SprPump - dv) / FPump / SprPump
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -