标题:求大神帮忙 生成曲线 代码如下……
只看楼主
dukaidihhh
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2017-5-24
结帖率:0
已结贴  问题点数:20 回复次数:2 
求大神帮忙 生成曲线 代码如下……
Private Sub Command1_Click()
Dim Pd, r0, r1, Hz, Zb, Tb, Tt, Vg, i, r, Va, Zt, PLo, Q, Vd, Te, Po, t1, t2, t, H1, H2, Rzw, Rzn, Rsn, Rjn, rg, Dz, Ds, Dj, Pp, Pm, Pg, Hg, Hgt, Pati As Single
Pd = Val(Form1.Text1.Text)
r0 = Val(Form1.Text2.Text)
Hz = Val(Form1.Text4.Text)
Zb = Val(Form1.Text5.Text)
Tb = Val(Form1.Text6.Text)
Tt = Val(Form1.Text7.Text)
Vg = Val(Form1.Text8.Text)
Zt = Val(Form1.Text10.Text)
PLo = Val(Form1.Text11.Text)
Q = Val(Form1.Text12.Text)
Te = Val(Form1.Text14.Text)
Po = Val(Form1.Text15.Text)
H1 = Val(Form1.Text18.Text)
H2 = Val(Form1.Text19.Text)
Rzw = Val(Form1.Text20.Text)
Rzn = Val(Form1.Text21.Text)
Rsn = Val(Form1.Text29.Text)
Rjn = Val(Form1.Text27.Text)
Ds = Val(Form1.Text30.Text)
Dj = Val(Form1.Text28.Text)
rg = Val(Form1.Text33.Text)
t = Val(Form1.Text31.Text)
Text3.Text = (Pd + 9.8 * 10 ^ -3 * r0 * H1) / 9.8 * 10 ^ -3 / H1
r1 = Text3.Text
r = Val(r1) - Val(Text3.Text)
Text9.Text = (Dj * 3.141 * (Rjn ^ 2 - Rzw ^ 2) / 4 / H2 + Ds * 3.141 * (Rsn ^ 2 - Rzw ^ 2) / 4 / H2) * 10 ^ -6
Va = Text9.Text
Text13.Text = (Rzn ^ 2 / 4) * 3.141 * H2 / H2 * 10 ^ -6
Vd = Text13.Text
Text16.Text = ((Rzn ^ 2 / 4) * 3.141 * H2 / 60 / Q) * 10 ^ -3
t1 = Text16.Text
Text17.Text = ((Rzn ^ 2 / 4) * 3.141 * H2 * 10 ^ -3 / 60 / Q + ((Dj * 3.141 * (Rjn ^ 2 - Rzw ^ 2) * 10 ^ -3 / 4 + Ds * 3.141 * (Rsn ^ 2 - Rzw ^ 2) * 10 ^ -3) / 4) / (60 * Q))
t2 = Text17.Text
Text22.Text = Pd + (9.8 * 10 ^ -3) * r0 * Hz
Pp = Text22.Text
Text26.Text = Vg / Va
Hg = Text26.Text
If t >= Val(Form1.Text16.Text) Then
i = 2
Else
i = 1
End If
Text34.Text = i
Dim K, K1, K2, K3, X, Y, Y1, A, A1, B As Single
Y = (6 * 10 ^ -2) * (Q * t / Va)
X = (6 * 10 ^ -2) * Q * (t - K * t1) / (Vd + K * (Va - Vd))
If t - t1 <= 0 Then
K = 0
Else
K = 1
End If
A = Pp + Po - (9.8 * 10 ^ -3) * K * (X - Hz) * r - Pg
B = (Pp + Po) * Hg * Zt * Tt / (Tb * Zb)
A1 = A + (9.8 * 10 ^ -3) * Ro * Hz
Y1 = (A1 - Sqr(A1 ^ 2 - 39.2 * 10 ^ -3 * r0 * (A * H - B))) / (19.6 * 10 ^ -3) / r0
If Y > Y1 Then
K1 = 0
Else
K1 = 1
End If
If Y1 < Y <= H Then
K2 = 1
Else
K2 = 0
End If
If i = 1 Then
K3 = 1
Else
K3 = 0
End If
Text25.Text = K3 * (((K1 * B) / (A - (9.8 * 10 ^ -3 * r0 * Y))) + (K2 * (Hz - Y)))
Hgt = Text25.Text
Text23.Text = 9.8 * 10 ^ -3 * ((Hz - Hgt) * r0 + K * (X - Hz) * r)
Pm = Text23.Text
Text24.Text = (9.8 * 10 ^ -3) * K3 * rg * Hg * (K1 + (K2 * (Hz - Y) / (Hz - Y1)))
Pg = Text24.Text
Text32.Text = Po + Pp - Pg - Pm
Pati = Text32.Text
Dim Pdi, Pbi, PL1, Pdti, Pdii, Pd1, d0, c, V As Single
V = Val(Va) + Val(Vd)
d0 = Val(Form1.Text40.Text)
c = Val(Form1.Text41.Text)
Pd1 = Pd * (1 - r / (r1 * H1) * (X - K * (X - H))) * 10 ^ -6
If i = 1 Then
Pdii = Pd
Else
Pdii = Pd1
End If
Text35.Text = Pdii * (1 - r / (r1 * H1) * (X - K * (X - H)))
Pdi = Text35.Text
Text36.Text = (8.11 * 10 ^ -2) * Q ^ 2 * (r0 + K * r) / c ^ 2 / (d0 * 10 ^ -2) ^ 4
Pbi = Text36.Text
Text38.Text = ((PLo * r1 / H2 / r0)) * (X + K * (Hz - K) + Vd / V * (2 * K * (X - Hz) - X))
PL1 = Text38.Text
Text39.Text = Po + Pdi + Pbi + PL0 + PL1
Pbti = Text39.Text
End Sub
 求Pati和pbti的曲线 时间为变量 两个值都是压力值
搜索更多相关主题的帖子: 曲线 Text If Then End 
2017-05-24 02:11
xiangyue0510
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:86
帖 子:934
专家分:5244
注 册:2015-8-10
得分:10 
每个人都有自己的编程风格,你这种代码洋洋洒洒一大片,别人读懂要不少时间,也没有心情去细看。
提问要准确并简介,你X、Y分别是什么都没说,别人怎么给你说?
2017-05-24 19:45
风吹过b
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:364
帖 子:4912
专家分:29900
注 册:2008-10-15
得分:10 
你来套这个框子吧。把时间和值压进去。

https://bbs.bccn.net/viewthread.php?tid=306299

授人于鱼,不如授人于渔
早已停用QQ了
2017-05-25 11:36



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-477316-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.208991 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved