Public Sub xunhuan()
q(i) = 121.829 - 71.2516 / (1 + 2.71828 ^ ((z(i) - 1047.99) / 0.08857))
v(i) = 11.678996 * z(i) - 12155.02
q(i + 1) = 121.829 - 71.2516 / (1 + 2.71828 ^ ((z(i + 1) - 1047.99) / 0.08857))
v(i + 1) = v(i) + ((a(i) + a(i + 1)) / 2 - (q(i) + q(i + 1)) / 2) * 24 * 3600 / 100000000
s(i + 1) = 0.0853 * v(i + 1) + 1040.8
If Abs(s(i + 1) - z(i + 1)) <= 0.001 And q(i) < 120Then
Text1.Text = Text1.Text & s(i + 1) & vbCrLf
Text6.Text = Text6.Text & v(i + 1) & vbCrLf
Text7.Text = Text7.Text & q(i + 1) & vbCrLf
ElseIf Abs(s(i + 1) - z(i + 1)) <= 0.001 And q(i) >= 120 Then
q(i) = 120
q(i + 1) = 120
v(i + 1) = v(i) + ((a(i) + a(i + 1)) / 2 - (q(i) + q(i + 1)) / 2) * 24 * 3600 / 100000000
s(i + 1) = 0.0853 * v(i + 1) + 1040.8
If Abs(s(i + 1) - z(i + 1)) <= 0.001 Then
Text1.Text = Text1.Text & s(i + 1) & vbCrLf
Text6.Text = Text6.Text & v(i + 1) & vbCrLf
Text7.Text = Text7.Text & q(i + 1) & vbCrLf
End If
ElseIf Abs(s(i + 1) - z(i + 1)) <= 0.001 And q(i) >= 120 Then
q(i) = 120
q(i + 1) = 120
v(i + 1) = v(i) + ((a(i) + a(i + 1)) / 2 - (q(i) + q(i + 1)) / 2) * 24 * 3600 / 100000000
s(i + 1) = 0.0853 * v(i + 1) + 1040.8
If Abs(s(i + 1) - z(i + 1)) > 0.001 And ((a(i) + a(i + 1)) / 2 - (q(i) + q(i + 1)) / 2) < 0 Then
z(i + 1) = z(i) - 0.001
Call xunhuan
ElseIf Abs(s(i + 1) - z(i + 1)) > 0.001 And ((a(i) + a(i + 1)) / 2 - (q(i) + q(i + 1)) / 2) < 0 Then
z(i + 1) = z(i + 1) + 0.001
Call xunhuan
End If
ElseIf Abs(s(i + 1) - z(i + 1)) > 0.001 And q(i) < 120 And ((a(i) + a(i + 1)) / 2 - (q(i) + q(i + 1)) / 2) < 0 Then
z(i + 1) = z(i) - 0.001
Call xunhuan
ElseIf Abs(s(i + 1) - z(i + 1)) > 0.001 And q(i) < 120 And ((a(i) + a(i + 1)) / 2 - (q(i) + q(i + 1)) / 2) >= 0 Then
z(i + 1) = z(i + 1) + 0.001
Call xunhuan
ElseIf Abs(s(i + 1) - z(i + 1)) > 0.001 And q(i) >= 120 Then
q(i) = 120
q(i + 1) = 120
v(i + 1) = v(i) + ((a(i) + a(i + 1)) / 2 - (q(i) + q(i + 1)) / 2) * 24 * 3600 / 100000000
s(i + 1) = 0.0853 * v(i + 1) + 1040.8
If Abs(s(i + 1) - z(i + 1)) > 0.001 And ((a(i) + a(i + 1)) / 2 - (q(i) + q(i + 1)) / 2) < 0 Then
z(i + 1) = z(i) - 0.001
Call xunhuan
End If
Else: z(i + 1) = z(i + 1) + 0.001
Call xunhuan
End If
End Sub
q(i) = 121.829 - 71.2516 / (1 + 2.71828 ^ ((z(i) - 1047.99) / 0.08857))
v(i) = 11.678996 * z(i) - 12155.02
q(i + 1) = 121.829 - 71.2516 / (1 + 2.71828 ^ ((z(i + 1) - 1047.99) / 0.08857))
v(i + 1) = v(i) + ((a(i) + a(i + 1)) / 2 - (q(i) + q(i + 1)) / 2) * 24 * 3600 / 100000000
s(i + 1) = 0.0853 * v(i + 1) + 1040.8
If Abs(s(i + 1) - z(i + 1)) <= 0.001 And q(i) < 120Then
Text1.Text = Text1.Text & s(i + 1) & vbCrLf
Text6.Text = Text6.Text & v(i + 1) & vbCrLf
Text7.Text = Text7.Text & q(i + 1) & vbCrLf
ElseIf Abs(s(i + 1) - z(i + 1)) <= 0.001 And q(i) >= 120 Then
q(i) = 120
q(i + 1) = 120
v(i + 1) = v(i) + ((a(i) + a(i + 1)) / 2 - (q(i) + q(i + 1)) / 2) * 24 * 3600 / 100000000
s(i + 1) = 0.0853 * v(i + 1) + 1040.8
If Abs(s(i + 1) - z(i + 1)) <= 0.001 Then
Text1.Text = Text1.Text & s(i + 1) & vbCrLf
Text6.Text = Text6.Text & v(i + 1) & vbCrLf
Text7.Text = Text7.Text & q(i + 1) & vbCrLf
End If
ElseIf Abs(s(i + 1) - z(i + 1)) <= 0.001 And q(i) >= 120 Then
q(i) = 120
q(i + 1) = 120
v(i + 1) = v(i) + ((a(i) + a(i + 1)) / 2 - (q(i) + q(i + 1)) / 2) * 24 * 3600 / 100000000
s(i + 1) = 0.0853 * v(i + 1) + 1040.8
If Abs(s(i + 1) - z(i + 1)) > 0.001 And ((a(i) + a(i + 1)) / 2 - (q(i) + q(i + 1)) / 2) < 0 Then
z(i + 1) = z(i) - 0.001
Call xunhuan
ElseIf Abs(s(i + 1) - z(i + 1)) > 0.001 And ((a(i) + a(i + 1)) / 2 - (q(i) + q(i + 1)) / 2) < 0 Then
z(i + 1) = z(i + 1) + 0.001
Call xunhuan
End If
ElseIf Abs(s(i + 1) - z(i + 1)) > 0.001 And q(i) < 120 And ((a(i) + a(i + 1)) / 2 - (q(i) + q(i + 1)) / 2) < 0 Then
z(i + 1) = z(i) - 0.001
Call xunhuan
ElseIf Abs(s(i + 1) - z(i + 1)) > 0.001 And q(i) < 120 And ((a(i) + a(i + 1)) / 2 - (q(i) + q(i + 1)) / 2) >= 0 Then
z(i + 1) = z(i + 1) + 0.001
Call xunhuan
ElseIf Abs(s(i + 1) - z(i + 1)) > 0.001 And q(i) >= 120 Then
q(i) = 120
q(i + 1) = 120
v(i + 1) = v(i) + ((a(i) + a(i + 1)) / 2 - (q(i) + q(i + 1)) / 2) * 24 * 3600 / 100000000
s(i + 1) = 0.0853 * v(i + 1) + 1040.8
If Abs(s(i + 1) - z(i + 1)) > 0.001 And ((a(i) + a(i + 1)) / 2 - (q(i) + q(i + 1)) / 2) < 0 Then
z(i + 1) = z(i) - 0.001
Call xunhuan
End If
Else: z(i + 1) = z(i + 1) + 0.001
Call xunhuan
End If
End Sub