⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dicengmodule.frm

📁 地层出水预测计算模型
💻 FRM
📖 第 1 页 / 共 3 页
字号:
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'全局变量定义
Public Optionh2 As Boolean, Optionrou2 As Boolean, Optionv2 As Boolean, m As String
Dim h() As Double           '井深
Dim pp() As Double          '孔隙压力梯度
Dim Rou() As Double         '地层密度
Dim deltatp() As Double     '纵波时差
Dim deltats() As Double     '横波时差
Dim vp() As Double          '纵波速度
Dim vs() As Double          '横波速度
Dim Gr() As Double          '自然伽马
Dim Sp() As Double          '自然电位
Dim Rild() As Double        '深探测电阻率
Dim GRmax As Double         '纯泥岩自然伽马值
Dim GRmin As Double         '纯砂岩自然伽马值
Dim GRav As Double          '自然伽马平均值
Dim SPmin As Double         '自然电位最低值
Dim Rst As Double           '标准水层深探测电阻率
Dim Igr() As Double         '泥质含量指数
Dim Vcl() As Double         '泥质含量
Dim GCUR As Double          '希尔奇指数
Dim sigmaz() As Double      '上覆岩层压力
Dim sigmah1() As Double     '最大水平地压力
Dim sigmah2() As Double     '最小水平地压力
Dim alpha() As Double       '有效应力系数
Dim miud() As Double        '动态泊松比
Dim mius() As Double        '静态泊松比
Dim Emd() As Double         '动态弹性模量
Dim Ems() As Double         '静态弹性模量
Dim deltasigma() As Double  '应力差
Dim A1() As Double          '转换系数
Dim A2() As Double          '转换系数
Dim B1() As Double          '转换系数
Dim B2() As Double          '转换系数
Dim Pe() As Double          '供给压力
Dim Pw() As Double          '井底压力

'全局常量定义
Const pi = 3.1415926        '圆周率
Const fai = 30              '内摩擦角
Const rougny = 3.16         '泥页岩骨架密度
Const rougsy = 2.65         '砂岩骨架密度
Const vpgny = 3182          '泥页岩纵波速度
Const vsgny = 1928.4        '泥页岩横波速度
Const vpgsy = 5750          '砂岩纵波速度
Const vsgsy = 3090          '砂岩横波速度


'地层出水预测计算局部变量
Dim Hwater As Double        '水层厚度
Dim Dwater As Double        '水层起始处

Dim minw As Double          '地层水粘度
Dim Rouma As Double         '砂岩骨架密度
Dim rouf As Double          '水密度
Dim deltaf As Double        '水声波时差
Dim deltatma As Double      '砂岩骨架声波时差
Dim Re As Double            '供给边缘压力
Dim Rw As Double            '井眼半径

Dim pora() As Double        '孔隙度1
Dim porb() As Double        '孔隙度2
Dim por() As Double         '平均孔隙度
Dim Swi() As Double         '束缚水饱和度
Dim KK() As Double          '渗透率
Dim Q() As Double           '出水量


Dim i As Integer
Dim WellStart  As Integer
Dim WellEnd As Integer

Dim conn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset

Dim flag As Boolean

Dim Td() As Double
Dim i1, j1 As Integer
Dim rouCount As Integer
Dim h1, h2 As Double

Dim acount As Integer






Private Sub Command1_Click()
' 变量赋初值,主要是给定值,或界面输入值。
If Text6.Text = "" Then
MsgBox "请输入完整数据", vbOKCancel, "系统提示"
GoTo Exit_sub:
End If
If Text2.Text = "" Then
MsgBox "请输入完整数据", vbOKCancel, "系统提示"
GoTo Exit_sub:
End If
If Text3.Text = "" Then
MsgBox "请输入完整数据", vbOKCancel, "系统提示"
GoTo Exit_sub:
End If
If Text4.Text = "" Then
MsgBox "请输入完整数据", vbOKCancel, "系统提示"
GoTo Exit_sub:
End If
If Text5.Text = "" Then
MsgBox "请输入完整数据", vbOKCancel, "系统提示"
GoTo Exit_sub:
End If
If Text8.Text = "" Then
MsgBox "请输入完整数据", vbOKCancel, "系统提示"
GoTo Exit_sub:
End If
If Text9.Text = "" Then
MsgBox "请输入完整数据", vbOKCancel, "系统提示"
GoTo Exit_sub:
End If
If Text11.Text = "" Then
MsgBox "请输入完整数据", vbOKCancel, "系统提示"
GoTo Exit_sub:
End If

'界面给定值

minw = Text6.Text
Rouma = Text2.Text
rouf = Text3.Text
deltaf = Text4.Text
deltatma = Text5.Text
Re = Text8.Text
Rw = Text9.Text
hr = Text11.Text

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


'测试数据
'h(0) = 5
'GRmax = 100
'GRmin = 30
'Gr(0) = 60
'deltatp(0) = 61
'Rou(0) = 2.3
'pp(0) = 1
'Pe(0) = 1 * 2000 * 0.0098
'GCUR = 2
'Rw = 0.2159 / 2
'Re = 50
'Pw(0) = 200 * 0.098
'minw = 450

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'SPmin为Sp最低值
SPmin = Sp(0)
For i = 0 To acount - 1
    If Sp(i) < SPmin Then
        SPmin = Sp(i)
    End If
Next i
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Rst为渗透层中探测电阻率最低的层作为标准水层
Rst = Rild(0)
For i = 0 To acount - 1
    '首先判断他为渗透层,其次判断他为水层
    If Rild(i) < Rst And Abs(Sp(i)) < 0.7 * Abs(SPmin) Then
        Rst = Rild(i)
    End If
Next i
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'计算泥沙含量
'程序中读取最大最小泥质含量
GRmin = Gr(0)
GRmax = Gr(0)
For i = 0 To acount - 1
   If Gr(i) > GRmax Then
     GRmax = Gr(i)
   End If
   If Gr(i) < GRmin Then
     GRmin = Gr(i)
   End If
Next i
'count循环
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
For i = 0 To acount - 1
'首先根据参数设置进行计算前的单位转换

If Optionh2 = True Then
    h(i) = 0.3048 * h(i)
End If

If Optionrou2 = True Then
    Rou(i) = Rou(i) * 28300
End If
   
If Optionv2 = True Then
    deltatp(i) = deltatp(i) * 3.28 * 10 ^ -6
    deltats(i) = deltats(i) * 3.28 * 10 ^ -6
End If

'第一步 计算孔隙度
'方法一:声波测井法
'砂岩: 56微秒/英尺(优先考虑)
'声波超限条件判断
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'判断水层深度和厚度。
If Abs(Sp(i)) < 0.7 * Abs(SPmin) Then
''判断为渗透层
''将深探测电阻率最低的层作为标准水层 Rst
''电阻率Rild<3Rst时判断为水层
    If Rild(i) < 3 * Rst Then
       '计算累计水层厚度
       Hwater = Hwater + 0.125
       GoTo Exit_for
    Else
       '跳到下一行,结束本次循环
       If Hwater <> 0 Then
         GoTo compute:
       Else
         Hwater = 0
         i = i + 1
         GoTo Exit_for
       End If
    End If
Else
    '跳到下次循环,结束本次循环
    i = i + 1
    GoTo Exit_for
End If

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
compute:
'写txt文件,记录计算过程
Open "C:\Documents and Settings\Administrator\桌面\计算过程.txt" For Output As #1

If deltatp(i) < 0 Then
MsgBox "声波值小于零!", vbOKCancel, "系统提示"
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
pora(i) = (deltatp(i) - deltatma) / (deltaf - deltatma)
'当泥岩处的横波时差175微妙/英尺时,需要对岩层进行压实校正。
If deltats(i) > 175 Then
    pora(i) = pora(i) * 175 / deltatp(i)
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'条件判断  由声波测井法所得孔隙度值应该在0.001-0.8之间,并根据该值进行修正
If pora(i) < 0 Then
    pora(i) = 0.001
Else
    If pora(i) > 0.8 Then
        pora(i) = 0.8
    End If
End If


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'方法二:密度测井法
'岩石骨架密度 只有对于单矿物岩性的纯地层,才是确切已知的。
porb(i) = (Rouma - Rou(i)) / (Rouma - rouf)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'条件判断  由声波测井法所得孔隙度值应该在0.001-0.8之间,并根据该值进行修正
If porb(i) < 0 Then
    porb(i) = 0.001
Else
    If porb(i) > 0.8 Then
        porb(i) = 0.8
    End If
End If

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'第一步 由上面两方法所得数据计算平均岩石孔隙度参数
por(i) = (pora(i) + porb(i)) / 2

'条件判断 por值应该在0-0.5之间
If por(i) < 0 Or por(i) > 0.5 Then
   ' MsgBox h(i) & "处孔隙度值不在0到50%之间!", vbOKCancel, "系统提示"
End If

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'计算GCUR西尔奇指数, 与地质年代有关,老地层取2, 第三系地层取3.7 ,根据Hr计算
If h(i) > hr Then
    GCUR = 2
Else
    GCUR = 3.7
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'计算泥质含量指数
Igr(i) = (Gr(i) - GRmin) / (GRmax - GRmin)

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'第二步 计算泥质含量
Vcl(i) = (2 ^ (GCUR * Igr(i)) - 1) / (2 ^ GCUR - 1)
If Vcl(i) > 1 Then
Vcl(i) = 1
End If
If Vcl(i) <= 0 Then
Vcl(i) = 0.001
End If

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'第三步 计算束缚水饱和度
If por(i) / Vcl(i) - 0.25 < 0 Then
    Swi(i) = 0.7
    GoTo nextone:
End If
Swi(i) = 0.3098 * (1.145 - Log(por(i) / Vcl(i) - 0.25) / Log(10))
'保证Swi(i)值在5%--65%之间
If Swi(i) < 0.05 Then
    Swi(i) = 0.05
End If
If Swi(i) > 0.65 Then
    Swi(i) = 0.65
End If

'如果por(i) / Vcl(i) - 0.25 < 0 Swi 直接赋值退出束缚水饱和度计算公式
nextone:

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'第四步 计算渗透率KK   C取决于原油或天然气的比重,对于中等比重的原油C为250,对于干气C为79。区域性值这里暂取250
KK(i) = (250 * por(i) ^ 3 / Swi(i)) ^ 2

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'第五步 计算出水量
Pe(i) = por(i) * h(i)
Pw(i) = h(i) * 0.1 * 9800 * 10 ^ (-6)

Q(i) = 0.0864 * 2 * pi * KK(i) * Hwater * (Pe(i) - Pw(i)) / (24 * minw * Log(Re / Rw))

'保存到文件以备画图
F1Book1.TextRC(i + 1, 1) = h(i)
F1Book1.TextRC(i + 1, 2) = Q(i)


Write #1, "i="; i
Write #1, "pora(i)="; pora(i)
Write #1, "porb(i)="; porb(i)
Write #1, "por(i)="; por(i)
Write #1, "Igr(i)="; Igr(i)
Write #1, "Vcl(i)="; Vcl(i)
Write #1, "Swi(i)="; Swi(i)
Write #1, "KK(i)="; KK(i)
Write #1, "Q(i)="; Q(i)
Close 1

'MsgBox Q(i)
Exit_for:
Next i

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Exit_sub:

F1Book1.Write "c:\data.xls", 4
MsgBox "计算完毕,可以画图!", vbOKCancel, "系统提示"
End Sub


Private Sub Command10_Click()
If MSFlexGrid2.Rows = 1 Then
MSFlexGrid2.AddItem ""
MSFlexGrid2.Col = 0
MSFlexGrid2.Row = 1
Text7.SetFocus
End If
End Sub

Private Sub Command11_Click()
    If MSFlexGrid2.Rows >= 2 Then
        For i1 = 0 To MSFlexGrid2.Rows - 1
            If MSFlexGrid2.TextMatrix(i1, 2) = "" Then
                Exit For
            End If
        Next i1
        rouCount = i1 - 1
        ReDim Td(rouCount, 3)

        For i1 = 1 To rouCount
            Td(i1 - 1, 0) = MSFlexGrid2.TextMatrix(i1, 0)
            Td(i1 - 1, 1) = MSFlexGrid2.TextMatrix(i1, 1)
            Td(i1 - 1, 2) = MSFlexGrid2.TextMatrix(i1, 2)

        Next i1
        
        h1 = Td(0, 0)
        h2 = Td(rouCount - 1, 1)
       ' Dim count As Integer
   '     count = (h2 - h1) / 0.125
    
        
   
        '井深h 从文件读取
        For i1 = 0 To acount
            For j1 = 0 To rouCount - 1
                If h(i1) > Td(j1, 0) And h(i1) <= Td(j1, 1) Then
                    Pw(i1) = Td(j1, 2)
                    
                End If
            Next j1
        
        Next i1

    MsgBox "计算参数设置成功", vbOKCancel, "系统提示"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -