📄 工程2.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "流动系数"
ClientHeight = 7200
ClientLeft = 1050
ClientTop = 435
ClientWidth = 11385
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 34878.89
ScaleMode = 0 'User
ScaleWidth = 12000
Begin VB.TextBox Text7
Height = 315
Left = 1620
TabIndex = 19
Text = "3.75"
Top = 6720
Width = 735
End
Begin VB.TextBox Text6
Height = 315
Left = 1620
TabIndex = 18
Text = "860"
Top = 6300
Width = 735
End
Begin VB.TextBox Text5
Height = 315
Left = 1620
TabIndex = 17
Text = "9"
Top = 5880
Width = 735
End
Begin VB.TextBox Text4
Height = 315
Left = 1620
TabIndex = 16
Text = "28"
Top = 5460
Width = 735
End
Begin VB.TextBox Text3
Height = 315
Left = 8640
TabIndex = 15
Top = 5640
Width = 1335
End
Begin VB.TextBox Text2
Height = 315
Left = 8640
TabIndex = 5
Top = 5280
Width = 1335
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 2064
Left = 360
TabIndex = 4
Top = 480
Width = 3015
_ExtentX = 5318
_ExtentY = 3651
_Version = 393216
End
Begin VB.CommandButton Command2
Caption = "直线段拟合"
Height = 615
Left = 5640
TabIndex = 2
Top = 5280
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "原始数据点"
Height = 615
Left = 4080
TabIndex = 1
Top = 5280
Width = 1455
End
Begin VB.PictureBox Pic1
BackColor = &H80000009&
Height = 4815
Left = 4080
ScaleHeight = 4755
ScaleWidth = 6435
TabIndex = 0
Top = 360
Width = 6495
End
Begin VB.Label Label16
Caption = "所求地层参数:"
Height = 315
Left = 3000
TabIndex = 25
Top = 6120
Width = 1515
End
Begin VB.Label Label15
Caption = "已知参数:"
Height = 255
Left = 120
TabIndex = 24
Top = 5100
Width = 1095
End
Begin VB.Label Label14
Caption = "综合压缩系数(10^-4/MPa):"
Height = 375
Left = 120
TabIndex = 23
Top = 6660
Width = 1335
End
Begin VB.Label Label13
Caption = "厚度(cm):"
Height = 255
Left = 120
TabIndex = 22
Top = 6300
Width = 1095
End
Begin VB.Label Label12
Caption = "粘度(mPa.s):"
Height = 315
Left = 120
TabIndex = 21
Top = 5880
Width = 1335
End
Begin VB.Label Label11
Caption = "产量(t/d):"
Height = 315
Left = 120
TabIndex = 20
Top = 5460
Width = 1095
End
Begin VB.Label Label10
Caption = "拟合直线的截距:"
Height = 315
Left = 7080
TabIndex = 14
Top = 5700
Width = 1695
End
Begin VB.Label Label9
Caption = "折算半径(cm):"
Height = 255
Left = 7920
TabIndex = 13
Top = 6480
Width = 1455
End
Begin VB.Label Label8
Caption = "导压系数(cm2/s):"
Height = 255
Left = 6180
TabIndex = 12
Top = 6480
Width = 1635
End
Begin VB.Label Label7
Caption = "渗透率(μm2):"
Height = 255
Left = 4500
TabIndex = 11
Top = 6480
Width = 1335
End
Begin VB.Label Label6
Caption = "流动系数:"
Height = 255
Left = 3000
TabIndex = 10
Top = 6480
Width = 1095
End
Begin VB.Label Label5
Height = 255
Left = 7980
TabIndex = 9
Top = 6780
Width = 1695
End
Begin VB.Label Label4
Height = 255
Left = 6300
TabIndex = 8
Top = 6780
Width = 1455
End
Begin VB.Label Label3
Height = 255
Left = 4560
TabIndex = 7
Top = 6780
Width = 1515
End
Begin VB.Label Label2
Height = 255
Left = 3060
TabIndex = 6
Top = 6780
Width = 1395
End
Begin VB.Label Label1
Caption = "拟合直线的斜率:"
Height = 375
Left = 7080
TabIndex = 3
Top = 5340
Width = 1695
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click() '用原来点画直线
x = Array(0, 2.778, 3.255, 3.556, 3.778, 3.954, 4.079, 4.176, 4.255, 4.417)
y = Array(72.6, 75.5, 80.2, 84.1, 86.4, 87.5, 87.9, 88.1, 88.3, 88.7)
Call pictureshow
For k = 1 To 8
Pic1.Line (x(k) / 2 + 0.3, y(k) / 40 + 0.3)-(x(k + 1) / 2 + 0.3, y(k + 1) / 40 + 0.3), QBColor(10)
Next k
For k = 1 To 9
Pic1.Circle (x(k) / 2 + 0.3, y(k) / 40 + 0.3), 0.015, QBColor(5)
Next k
End Sub
Private Sub Command2_Click()
Dim x1, y1, a, b, c, d, a1, a2, a3, a4 As Single
x = Array(0, 2.778, 3.255, 3.556, 3.778, 3.954, 4.079, 4.176, 4.255, 4.417)
y = Array(72.6, 75.5, 80.2, 84.1, 86.4, 87.5, 87.9, 88.1, 88.3, 88.7)
For i = 5 To 9 '用最后5个点拟合直线
a = x(i) + a
b = y(i) + b
c = x(i) * x(i) + c
d = x(i) * y(i) + d
Next i '最小2乘法求系数跟斜率
x1 = (c * b - a * d) / (5 * c - a * a)
y1 = (5 * d - a * b) / (5 * c - a * a)
Text2.Text = Format(y1, "0.0000") '拟合直线的斜率
Text3.Text = Format(x1, "0.0000") '拟合直线的截距
For i = 5 To 9 '把时间带入直线求压力
y(i) = y1 * x(i) + x1
Next i
a1 = Text4.Text * 0.183 * 10 ^ 6 * 1.12 / 0.85 / 86400 / y1
Label2.Caption = Format(a1, "0.0000") '流动系数
a2 = a1 * Text5.Text / Text6.Text
Label3.Caption = Format(a2, "0.0000") '渗透率
a3 = a2 / 9 / Text7.Text * 10 ^ 5
Label4.Caption = Format(a3, "0.0000") '导压系数
a4 = 10 ^ (-((x1 - y(0)) / y1 - Log(2.25 * a3) / Log(10)) / 2)
Label5.Caption = Format(a4, "0.0000") '折算半径
'Call pictureshow ' 用这句代码就只出现拟合后的 直线
'画图
Pic1.Line (0.3, x1 / 40 + 0.3)-(5 / 2 + 0.3, (5 * y1 + x1) / 40 + 0.3), QBColor(12)
'Command1_Click
'Debug.Print x1, 5 * y1 + x1
End Sub
Sub pictureshow()
Pic1.Cls
Pic1.BackColor = vbWhite
Pic1.ScaleMode = 7
Pic1.Scale (0, 3)-(3, 0)
Pic1.Line (0.3, 0.3)-(2.8, 0.3)
Pic1.Line (0.3, 0.3)-(0.3, 2.8)
Pic1.CurrentY = 0.3
Pic1.CurrentX = 0.3
'Pic1.Print "0.0"
'x轴
ix = 0
xval = 0
stepx = (2.8 - 0.3) / 50
'ii = 0
For i = 0.3 To 2.8 Step stepx
If ix Mod 5 <> 0 Then
Pic1.Line (i, 0.3)-(i, 0.33)
Else
Pic1.Line (i, 0.3)-(i, 0.35)
Pic1.CurrentX = i - 0.05
Pic1.CurrentY = Pic1.CurrentY - 0.1
Pic1.Print Format(xval, "0.0")
xval = xval + 0.5
End If
ix = ix + 1
Next i
Pic1.CurrentX = Pic1.CurrentX + 2.8
Pic1.CurrentY = Pic1.CurrentY
Pic1.Print "Lg(t)"
'y轴
iy = 0
stepy = (2.8 - 0.3) / 50
yval = 0
For i = 0.3 To 2.8 Step stepy
If iy Mod 5 <> 0 Then
Pic1.Line (0.3, i)-(0.33, i)
Else
Pic1.Line (0.3, i)-(0.35, i)
Pic1.CurrentX = Pic1.CurrentX - 0.25
Pic1.CurrentY = i + 0.05
Pic1.Print Format(yval, "0.0")
yval = yval + 10
End If
iy = iy + 1
Next i
Pic1.CurrentY = Pic1.CurrentY + 0.2
Pic1.Print "Pw(t)"
End Sub
Private Sub Form_Load()
Call msflexgridshow
End Sub
Sub msflexgridshow()
x = Array(0, 10, 30, 60, 100, 150, 200, 250, 300, 435)
y = Array(72.6, 75.5, 80.2, 84.1, 86.4, 87.5, 87.9, 88.1, 88.3, 88.7)
totalrows = 11
totalcols = 3
MSFlexGrid1.Visible = False
MSFlexGrid1.Rows = totalrows
MSFlexGrid1.Cols = totalcols
MSFlexGrid1.FixedRows = 1: MSFlexGrid1.FixedCols = 1
MSFlexGrid1.MergeCells = flexMergeNever
For m = 1 To 10
MSFlexGrid1.RowHeightMin = 400
MSFlexGrid1.TextMatrix(m, 0) = m
MSFlexGrid1.TextMatrix(m, 1) = Format(x(m - 1), "0.00")
MSFlexGrid1.TextMatrix(m, 2) = Format(y(m - 1), "0.00")
Next m
MSFlexGrid1.FormatString = "^序号|^t(min)|^Pw(0.1MPa)"
For n = 2 To 3
MSFlexGrid1.ColWidth(n - 1) = 1050
Next n
MSFlexGrid1.Height = 22000
MSFlexGrid1.Width = 2800
' Call blank_MSFlexGridshow
MSFlexGrid1.Visible = True
MSFlexGrid1.TextMatrix(1, 1) = Format(x(1), "0.00")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -