📄 form1.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1
Caption = "瞬变电磁深度电阻率计算程序"
ClientHeight = 4470
ClientLeft = 60
ClientTop = 450
ClientWidth = 4755
ClipControls = 0 'False
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
NegotiateMenus = 0 'False
OLEDropMode = 1 'Manual
ScaleHeight = 4470
ScaleWidth = 4755
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text3
Height = 270
Left = 2280
TabIndex = 14
Text = "2.3"
Top = 4080
Width = 855
End
Begin VB.TextBox Text2
Height = 270
Left = 1080
TabIndex = 12
Text = "0.15"
Top = 4065
Width = 735
End
Begin VB.OptionButton Option2
Caption = "半径"
Height = 255
Left = 3960
TabIndex = 9
Top = 840
Width = 855
End
Begin VB.OptionButton Option1
Caption = "边长"
Height = 255
Left = 3240
TabIndex = 8
Top = 840
Value = -1 'True
Width = 735
End
Begin VB.CommandButton CmdExit
Caption = "退 出"
Height = 375
Left = 3360
TabIndex = 7
Top = 3600
Width = 1095
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 1920
Top = 1440
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton CmdSave
Caption = "保存文件"
Height = 375
Left = 3360
TabIndex = 6
Top = 3000
Width = 1095
End
Begin VB.CommandButton CmdOpen
Caption = "打开文件"
Height = 375
Left = 3360
TabIndex = 5
Top = 1800
Width = 1095
End
Begin VB.CommandButton CmdDo
Caption = "计 算"
Height = 375
Left = 3360
TabIndex = 4
Top = 2400
Width = 1095
End
Begin VB.TextBox Text1
Height = 375
Left = 3240
TabIndex = 3
Top = 1200
Width = 1335
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 3375
Left = 120
TabIndex = 0
Top = 480
Width = 2895
_ExtentX = 5106
_ExtentY = 5953
_Version = 393216
Rows = 300
Cols = 12
AllowUserResizing= 3
End
Begin VB.Label Label5
Caption = "k="
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1920
TabIndex = 13
Top = 4080
Width = 375
End
Begin VB.Label Label4
Caption = "a="
BeginProperty Font
Name = "Symbol"
Size = 12
Charset = 2
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 720
TabIndex = 11
Top = 4080
Width = 495
End
Begin VB.Label Label3
Caption = "系数:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 10
Top = 4080
Width = 1215
End
Begin VB.Label Label2
Caption = "回线的"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 3240
TabIndex = 2
Top = 600
Width = 1095
End
Begin VB.Label Label1
Caption = "响应数据:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 1
Top = 240
Width = 3615
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Nt As Integer
Dim T(500) As Double, Vt(500) As Double
Dim L As Double
'Dim Pi As Double, U0 As Double
Const Pi = 3.1415926
Const U0 = 4 * Pi * 10# ^ (-7#)
Private Sub CmdDo_Click()
Dim s As Double, H1(500) As Double, H2(500) As Double, H3(500) As Double
Dim P1(500) As Double, P2(500) As Double, P3(500) As Double, t1 As Double
Dim Vz As Double, d As Double, delt As Double, f As Double, deltt1 As Double, t2 As Double
Dim deltpa As Double, pa As Double, alfa As Double, k As Double, pb As Double, v As Double
Dim msg, tmp As Double, deltvz
Dim i As Integer, j As Integer
If (Text1.Text = "") Then
msg = MsgBox("请输入回线半径", vbOKOnly)
Exit Sub
End If
If Option1.Value = True Then
L = Val(Text1.Text)
End If
If Option2.Value = True Then
L = Sqr(Pi) * Val(Text1.Text)
End If
If Text2.Text = "" Or Text3.Text = "" Then
msg = MsgBox("情输入校正系数", vbOKOnly)
Exit Sub
End If
alfa = Val(Text2.Text)
k = Text3.Text
For i = 1 To Nt - 1
'计算pa-h,t1用s
t1 = T(i) / 1000#
Vz = Vt(i)
deltt1 = (T(i + 1) - T(i))
deltvz = (Vt(i + 1) - Vt(i - 1))
If Vz <= 0 Then
Vz = 1E-16
End If
s = (Vz * 16 * Pi / (3# * ((L * U0) ^ 4#))) ^ (1# / 3#)
s = s * Vz ^ (5# / 3#) / ((deltvz / deltt1) ^ (4#)) ^ (1# / 3#)
H1(i) = (3 * (L ^ 4#) / (16 * Pi * Vz * s)) ^ (1# / 4#) - t1 / (U0 * s)
'vz 用uV/A,t1用ms
v = Vz * 1000000#
t1 = t1 * 1000#
P1(i) = (L ^ (8# / 3#)) * (v ^ (-2# / 3#)) * (t1 ^ (-5# / 3#))
P1(i) = 6.32 * (10 ^ (-3#)) * P1(i)
'以上计算pa-h
'##########################################################################################
'vz 用V/A,t1用ms
' t1 = t1 / 1000#
Vz = Vz / 1000000#
d = (Vz / Vt(1)) ^ (-2# / 3#) - 1
If (d < 0) Then d = 1E-16
d = Sqr(Pi) * L * d ^ (1# / 2#)
f = 1# / Sqr(2#)
delt = d / (2 * f)
If (delt / (Sqr(Pi) * L) > 1) Then
f = 1.05
delt = d / (2 * f)
End If
pa = U0 * delt * delt / (2 * t1)
' pa = P1(i)
P2(i) = k * pa * Exp(alfa - 1)
' H2(i) = delt / k / 100#
H2(i) = ((2 * t1 * pa / (U0)) ^ (0.5)) / k
'以上按第一种方法计算p-h
If (i >= 2) Then
deltt1 = Log(T(i) / T(i - 1))
deltpa = Log(pa / pb)
P3(i) = pa * (1 + deltpa / deltt1) / (1 - deltpa / deltt1)
' H3(i) = delt * (3.9 / (4 * Pi)) ^ (1# / 2#)
' H3(i) = H3(i) / 100#
H3(i) = (3.9 * t1 * pa / (2 * Pi * U0)) ^ (0.5)
End If
pb = pa
Next i
'#########################################################################################
'在表格中输出数据
j = 0
Do While j < 3
For i = 4 + j To Nt - 4 - j
P1(i) = (P1(i - 3) + P1(i - 2) + P1(i - 1) + P1(i) + P1(i + 1) + P1(i + 2) + P1(i + 3)) / 7#
P2(i) = (P2(i - 3) + P2(i - 2) + P2(i - 1) + P2(i) + P2(i + 1) + P2(i + 2) + P2(i + 3)) / 7#
P3(i) = (P3(i - 3) + P3(i - 2) + P3(i - 1) + P3(i) + P3(i + 1) + P3(i + 2) + P3(i + 3)) / 7#
Next i
j = j + 1
Loop
MSFlexGrid1.TextMatrix(0, 3) = "H1"
MSFlexGrid1.TextMatrix(0, 4) = "P1"
MSFlexGrid1.TextMatrix(0, 5) = "H2"
MSFlexGrid1.TextMatrix(0, 6) = "P2"
MSFlexGrid1.TextMatrix(0, 7) = "H3"
MSFlexGrid1.TextMatrix(0, 8) = "P3"
For i = 1 To Nt - 1
MSFlexGrid1.TextMatrix(i, 3) = Int(H1(i) * 1000) / 1000#
MSFlexGrid1.TextMatrix(i, 4) = Int(P1(i) * 1000) / 1000#
MSFlexGrid1.TextMatrix(i, 5) = Int(H2(i) * 1000) / 1000#
MSFlexGrid1.TextMatrix(i, 6) = Int(P2(i) * 1000) / 1000#
MSFlexGrid1.TextMatrix(i, 7) = Int(H3(i) * 1000) / 1000#
MSFlexGrid1.TextMatrix(i, 8) = Int(P3(i) * 1000) / 1000#
Next i
Close (1)
msg = MsgBox("计算完毕!", vbOKOnly)
End Sub
Private Sub CmdExit_Click()
End
End Sub
Private Sub CmdOpen_Click()
Dim sf As String
Dim R As Double
Dim P1 As Double
Dim i As Integer
CommonDialog1.Action = 1
sf = CommonDialog1.FileName
On Error Resume Next
Open sf For Input As #1
Input #1, sf
MSFlexGrid1.Clear
MSFlexGrid1.TextMatrix(0, 1) = "t(ms)"
MSFlexGrid1.TextMatrix(0, 2) = "Vz(mv)"
If sf = "回线半径:" Then
Input #1, R
Input #1, P1
Text1.Text = Str$(R)
i = 0
Do While Not EOF(1)
i = i + 1
Input #1, T(i), Vt(i)
'V以v表示
Vt(i) = Vt(i) / 1000000#
't以ms表示
' T(i) = T(i) * 1000#
If (i >= 1000) Then Exit Sub
Loop
Else
i = 0
Do While Not EOF(1)
i = i + 1
Input #1, T(i), Vt(i)
Vt(i) = Vt(i) / 1000000#
If (i >= 1000) Then Exit Sub
Loop
End If
Nt = i
MSFlexGrid1.Cols = 12
MSFlexGrid1.Rows = Nt
For i = 1 To Nt
MSFlexGrid1.TextMatrix(i, 0) = i
MSFlexGrid1.TextMatrix(i, 1) = Int(100000 * T(i)) / 100000#
MSFlexGrid1.TextMatrix(i, 2) = Int(1000000 * Vt(i)) * 1000 / 1000000#
Next
Close (1)
End Sub
Private Sub CmdSave_Click()
Dim s(8)
Dim i As Integer, j As Integer
CommonDialog1.Action = 2
On Error Resume Next
Open CommonDialog1.FileName For Output As #1
For i = 0 To Nt - 1
For j = 1 To 8
s(j) = MSFlexGrid1.TextMatrix(i, j)
Next j
Print #1, i, s(1), s(2), s(3), s(4), s(5), s(6), s(7), s(8)
Next i
Close (1)
End Sub
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Form1.Height = 4995
Form1.Width = 4860
End Sub
Private Sub Form_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
Form1.Height = 4995
Form1.Width = 4860
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -