齿轮论坛 www.gearbbs.net

 找回密码
 注册

手机号码,快捷登录

手机号码,快捷登录

搜索
查看: 2669|回复: 7
收起左侧

有没有懂VB 的高手。请教!!

[复制链接]
发表于 2008-6-15 12:47 | 显示全部楼层 |阅读模式

本帖子中包含更多资源。

您需要 登录 才可以下载或查看,没有账号?注册

x
有 没有懂VB 的高手。请教!!
在T1行出现“实时错误‘6’。溢出”
即使是把所有  的变量都定义为Double,也还是不行。。
Private Sub Command1_Click()
Dim p As Single, Kc As Single, i As Integer, fi As Single, cgh0 As Single, cgf0 As Single, yr As Single
Dim du As Single, hu As Single, n As Single, a0 As Single, Mn As Single, Zc As Integer, b As Single
Dim cgh As Single, cgf1 As Single, cgf2 As Single, N1 As Double, N2 As Double, T1 As Double
p = Val(Text1.Text)
Kc = Val(Text2.Text)
i = Val(Text3.Text)
fi = Val(Text4.Text)
cgh0 = Val(Text5.Text)
cgf0 = Val(Text6.Text)
yr = Val(Text7.Text)
du = Val(Text8.Text)
hu = Val(Text9.Text)
n = Val(Text10.Text)
N1 = 60 * n * 1 * yr * du * hu
If N1 <= 5 * 10 ^ 5 Then KHN1 = 1.6
If N1 <= 10 ^ 6 And N1 > 5 * 10 ^ 5 Then KHN1 = 0.9 + 0.8 / (2 * 10 ^ 9 - 5 * 10 ^ 5) * n
If N1 <= 2 * 10 ^ 7 And N1 > 10 ^ 6 Then KHN1 = 0.95
If N1 <= 10 ^ 10 And N1 > 2 * 10 ^ 7 Then KHN1 = 0.88
If N1 <= 10 ^ 4 Then KFN1 = 2.5
If N1 <= 2 * 10 ^ 6 And N1 > 10 ^ 4 Then KFN1 = 1 + 1.5 / (10 ^ 6 - 10 ^ 4) * n
If N1 <= 10 ^ 7 And N1 > 2 * 10 ^ 6 Then KFN1 = 0.95
If N1 <= 10 ^ 8 And N1 > 10 ^ 7 Then KFN1 = 0.9
If N1 <= 10 ^ 9 And N1 > 10 ^ 8 Then KFN1 = 0.85
If N1 <= 10 ^ 10 And N1 > 10 ^ 9 Then KFN1 = 0.82
N2 = 60 * n * i * 1 * yr * du * hu
If N2 <= 5 * 10 ^ 5 Then KHN2 = 1.6
If N2 <= 10 ^ 9 And N2 > 5 * 10 ^ 5 Then KHN2 = 0.9 + 0.8 / (2 * 10 ^ 9 - 5 * 10 ^ 5) * n
If N2 <= 2 * 10 ^ 7 And N2 >= 10 ^ 6 Then KHN2 = 0.95
If N2 <= 10 ^ 10 And N2 > 2 * 10 ^ 7 Then KHN2 = 0.88
If N2 <= 10 ^ 4 Then KFN2 = 2.5
If N2 <= 10 ^ 6 And N2 > 10 ^ 4 Then KFN2 = 1 + 1.5 / (10 ^ 6 - 10 ^ 4) * n
If N2 <= 10 ^ 7 And N2 > 10 ^ 6 Then KFN2 = 0.95
If N2 <= 10 ^ 8 And N2 > 10 ^ 7 Then KFN2 = 0.9
If N2 <= 10 ^ 9 And N2 > 10 ^ 8 Then KFN2 = 0.85
If N2 <= 10 ^ 10 And N2 >= 10 ^ 9 Then KFN2 = 0.82
Slim = 1
cgh = (cgh1 + cgh2) / 2
cgh1 = KHN1 * cgh0 / Slim
cgh2 = KHN2 * cgh0 / Slim
cgf1 = KFN1 * cgf0 / Slim
cgf2 = KFN2 * cgf0 / Slim
ZE = 189.8
ZH = 0.00693 * β - 0.2179 * β + 0.4091
T1 = 9.55 * 1000000 * p / n
Фd = 0.5 * (1 + i) * fi
d1 = (2 * Kc * T1 * (i + 1) * (ZH * ZE / cgh) ^ 2 / (Фd * i)) ^ 1 / 3
Mn = d1 * Cos(β) / z1
β = 30
a0 = (z1 + Z2) / (2 * Cos(β)) * Mn
Zc = z1 + Z2
b = Фd * d1
Text11.Text = a0
Text12.Text = Mn
Text13.Text = Zc
Text14.Text = b
Text15.Text = cgh
Text16.Text = cgf1
Text17.Text = cgf2
End Sub

评分

1

查看全部评分

发表于 2008-6-15 13:45 | 显示全部楼层
计算什么?可以将开发时的几个完整文件发给我吗,可以帮你分析一下。 邮箱: chen54510@yahoo.cn
 楼主| 发表于 2008-6-15 21:04 | 显示全部楼层
谢谢。我给你油箱发一个完整的。
发表于 2008-6-15 22:58 | 显示全部楼层
这种情况一般是计算过程无法实现,比如 t=2,你又让cosα=t,再求α值,那么这种情况就会发生溢出错误,检查一下你的计算过程是否存在这种问题~~
发表于 2008-6-17 12:43 | 显示全部楼层
改成 T1 = 9.55 / n* 1000000 * p  试试。
发表于 2008-6-18 10:29 | 显示全部楼层
我用VB6.0我看一下
我在开始调试时同样提示 ,原因n=0
继续调试就少很多参数,也有程序次序颠倒,参数无法求解。
添加Z1,Z2参数通过

想发一个完整的附件但不支持exe格式
说一下地址传过去

stjshu@163.com

[ 本帖最后由 jingshi 于 2008-6-18 11:21 编辑 ]
发表于 2008-8-7 09:04 | 显示全部楼层

回复 1# xinyu4936 的帖子

溢出一定是n=0了。
发表于 2009-5-12 19:13 | 显示全部楼层
太麻烦了,不知这个程序是做什么的
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|手机版|Archiver|齿轮论坛

GMT+8, 2024-5-18 21:41 , Processed in 0.184704 second(s), 15 queries , MemCache On.

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表