建立一个command
Private Sub Command1_Click()
Dim M, G, H, T, D0, D1, D2, C, C1, C2, L1, L2
Dim Z1, Z2
temp = InputBox("请输入M, G, H, T, D0, D1, D2, C, C1, C2,用英文逗号分隔", "输入", d)
a = Split(temp, ",")
M = a(0)
G = a(1)
G = a(2)
T = a(3)
D0 = a(4)
D1 = a(5)
D2 = a(6)
C = a(7)
C1 = a(8)
C2 = a(9)
If T = 1.1 Then
temp = InputBox("输入L1,L2,用英文逗号分隔", "输入", d)
a = Split(temp, ",")
L1 = a(0)
L2 = a(1)
End If
a1 = 0.6: a2 = 0.4
If T = 1.5 Then b1 = 0.3804: b2 = 0.2462
If T = 1.1 Then b1 = 0.3433: b2 = 0.2728
B0 = b1 - (a2 / a1) ^ T * b2
p1 = G / (Z1 * B0): p2 = (a2 / a1) ^ T * p1
If T = 1.5 Then k1 = D1 ^ 0.5 / 0.000095547: k2 = D2 ^ 0.5 / 0.000095547
If T = 1.1 Then k1 = 3633 * (L1 ^ (8# / 9#)): k2 = 3633 * (L1 ^ (8# / 9#))
120:
f1 = (p1 / k1 / (Sin(C1) ^ (T + 1))) ^ (1 / T)
f2 = (p2 / k2 / (Sin(C2) ^ (T + 1))) ^ (1 / T)
a1 = f1 / (f1 + f2 + C): a2 = f2 / (f1 + f2 + C)
a = a1
Call A500(a, j1, j2)
b1 = j1: b3 = j2
a = a2
Call A500(a, j1, j2)
b2 = j1: b4 = j2
p3 = p1 * Z1 * b1: p4 = p2 * Z2 * b2: g0 = p3 = p4
m1 = p1 * Z1 * D0 * b3 / 2: m2 = p2 * Z2 + D0 * b4 / 2: m0 = m1 + m2
x3 = g0 / G: x4 = m0 / M
If x3 > 1.01 Then GoTo 290
If x3 < 0.99 Then GoTo 290
If x4 > 1.01 Then GoTo 290
If x4 < 0.99 Then GoTo 290
GoTo 330
290:
X1 = (p1 * (X1 + x4) + p2 * (x3 - x4)) / (2 * x3 * x4 * p1)
X2 = ((p1 * p2) / x4 - X1 * p1) / p2
p1 = X1 * p1: p2 = X2 * p2
GoTo 120
330:
Q1 = p1 / Sin(C1) + 5 * H / (Cos(C1) + Sin(C1) / Tan(C2)) / Z1
q2 = p2 / Sin(C2) + 5 * H / (Cos(C2) + Sin(C2) / Tan(C1)) / Z2
If T = 1.5 Then S1 = 204 * (Q1 / D1 ^ 2) ^ (1# / 3#): S2 = 204 * (q2 / D2 ^ 2) ^ (1# / 3#)
If T = 1.1 Then S1 = 86.1 * (Q1 / D1 / L1) ^ 0.5: S2 = 86.1 * (q2 / D2 / L2) ^ 0.5
Print "M="; M; "DANMM"; " "; "G = "; G; "; DAN; "; "; "; "; H = "; H; "; DAN; "; "; "; "; M0 = "; m0; "; DANMM; "; "; "; "; G0 = "; g0; "; DAN; """
Print "D0="; D0; " "; "D1= "; D1; " "; "D2="; D2; " "; "c1="; C1; " "; "C2="; C2; " "; "Z1="; Z1; " "; "Z2="; Z2; " "; "C="; C
If T = 1.1 Then Print "L1="; L1; " "; "L2="; L2
Print "Q1="; Q1; "DAN"; " "; "Q2= "; Q1; "; DAN; "; " "; "S1= "; S1; "DAN/SQRMM"; " "; "S2= "; S2; "DAN/SQRMM"; " "; "T="; T
End Sub
Function A500(a, j1, j2)
Dim j1, j2, y1, y2
Dim n
y1 = -Atn((1 - 2 * a) / Sqr(-(1 - 2 * a) * (1 - 2 * a) + 1)) + 2 * Atn(1)
y2 = -y1
y0 = (y1 - y2) / 20
j1 = 0: j2 = 0
For n = 1 To 20
v = 1 - (1 - Cos(y2 + (2 * n - 1) * y0)) / 2 / a
w = 1 - (1 - Cos(y2 + (2 * n * y0))) / 2 / a
If v < 0 Then v = 0
If w < 0 Then w = 0
j1 = j1 + y0 * (4 * v * T + 2 * w * T) / 3
j2 = j2 + y0 * (4 * v * T * Cos(y2 + 2 * n - 1) * y0 + 2 * w * T * Cos(y2 + 2 * n * y0)) / 3
Next n
j1 = j1 / 2 / 3.14159
j2 = j2 / 2 / 3.14159
End Function