| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 455 人关注过本帖
标题:求助!程序出错了大家一块解决一下。
只看楼主 加入收藏
xuchangan115
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-9-29
结帖率:0
收藏
已结贴  问题点数:20 回复次数:4 
求助!程序出错了大家一块解决一下。
Private Sub Cmd_Exit_Click()
End
End Sub

Private Sub Cmd_JS_Click()

IX = 28
JY = 37
KRY0 = 3
KRYN = 23
DS = 1000
DT = 120
F1 = 38.93
TT = 5
Nbrs = 6
HM20 = 0.968
HM2N = 1.023
HS20 = 0.303
HS2N = 0.328
GM20 = 287
GM2N = 288.5
N = 0.034
MH = 205
MHI = 18
DYU = 3
DYV = 3
DXV = 3
DXU = 3
'-------------------------
IUH = ((JY - 1) / 2 - 1) + DYU
IVH = ((JY - 1) / 2 - 2) + DYV
IVL = (IX / 2 - 1) + DXV
IUL = (IX / 2 - 2) + DXU
'------------------------
If IX >= JY Then
ij = IX + 2
Else
ij = JY + 2
End If
'-------------------------
TT1 = TT - 3
PDT = 1440
M4 = PDT / DT
M1 = 3600 / DT * 2 * 12 / M4
'-------------------------
MY = IX * JY
MI = IUH * 12 * Nbrs
MJ = IX / 2 - 1
'-------------------------
MLUH = 3 * IUH
MLVH = 3 * IVH
MLVL = 3 * IVL
MLUL = 3 * IUL
'--------------------
KR = (KRYN - KRY0) / 2 + 1
'--------------------
ReDim Y(MY) As Double, Y0(MY) As Double, YU(MY) As Double
ReDim A(ij) As Double, B(ij) As Double, C(ij) As Double, X1(ij) As Double
ReDim H(MH) As Single
ReDim HA(MH) As Single, HI(MH) As Single
ReDim LUH(MLUH) As Integer
ReDim LVH(MLVH) As Integer
ReDim LVL(MLVL) As Integer
ReDim LUL(MLUL) As Integer
'------------------------
ReDim HM2(KR) As Single, HS2(KR) As Single, GM2(KR) As Single
'-------------------------
ReDim UX(MI, MJ) As Single, VY(MI, MJ) As Single
'------------------------
Open App.Path & "Datum.txt" For Output As #1
Open App.Path & "UV.txt " For Output As #2
'-------------------------
FileNo = FreeFile
Open App.Path & "\U行信息.txt" For Input As #FileNo
For j = 1 To MLUH
    Input #FileNo, LUH(j)
Next j
Close #FileNo
'-------------------------
FileNo = FreeFile
Open App.Path & "\V行信息.txt" For Input As #FileNo
For j = 1 To MLVH
    Input #FileNo, LVH(j)
Next j
Close #FileNo
'-------------------------
FileNo = FreeFile
Open App.Path & "\V列信息.txt" For Input As #FileNo
For j = 1 To MLVL
    Input #FileNo, LVL(j)
Next j
Close #FileNo
'-------------------------
FileNo = FreeFile
Open App.Path & "\U列信息.txt" For Input As #FileNo
For j = 1 To MLUL
    Input #FileNo, LUL(j)
Next j
Close #FileNo
'-------------------------
FileNo = FreeFile
Open App.Path & "\水深信息.txt" For Input As #FileNo
For j = 1 To MH
    Input #FileNo, H(j)
Next j
Close #FileNo
'-------------------------
FileNo = FreeFile
Open App.Path & "\水深信息.txt" For Input As #FileNo
For j = 1 To MHI + 3
    Input #FileNo, HI(j)
Next j
Close #FileNo
'---------------------------
M3 = 0
For i = 1 To MH
If H(i) < 0 Then
   M3 = M3 + 1
   j = IX * (-H(i) - 1) + HI(M3)
Else
   Y(j) = H(i)
   j = j + 2
End If
Next i
'--------------------------
DF = 0!: X1(1) = 0!
'------------------------
G = 9.8
PI = 3.1415926
W = 0.0001
OMIGA = 30!
PH = 1! / 6!
PI1 = PI / 180
DF = -DF
OMIGA = OMIGA * PI1
DF = PI / 180 * DF
'-------------------------
S1 = 2 * DS
S2 = DT / (4 * DS)
S3 = DT * G / (2 * DS)
S4 = 4 * DT * G
'-------------------------
M333 = 0
For j = 1 To MLUH
If Abs(LUH(j)) > M333 Then M333 = Abs(LUH(j))
Next j
For j = 1 To MLVH
If Abs(LVH(j)) > M333 Then M333 = LVH(j)
Next j
M333 = M333 + 2
'---------------------------
i = 1
M22 = 1
JK = 0
MK = 0
For j = 1 To IUH
    M2 = IX * (LUH(i + 1) - 1) + LUH(i)
    If LUH(i + 2) < 0 Then
    M3 = (-LUH(i + 2) - LUH(i)) / 2 + 1
    MK = MK + 1
    LUH(M22) = -M2
    If MK = 1 Then
      JK = LUH(i + 1)
      KS0 = IX * JK - 1
    End If
    Else
    M3 = (LUH(i + 2) - LUH(i)) / 2 + 1
    LUH(M22) = M2
    End If
    LUH(M22 + 1) = M3
    i = i + 3
    M22 = M22 + 2
Next j
'----------------------------
i = 1
M22 = 1
For j = 1 To IVH
    M2 = IX * (LVH(i + 1) - 1) + LVH(i)
    M3 = (LVH(i + 2) - LVH(i)) / 2 + 1
    LVH(M22) = M2
    LVH(M22 + 1) = M3
    i = i + 3
    M22 = M22 + 2
Next j
'-----------------------------
i = 1
M22 = 1
MS = 0
For j = 1 To IVL
    M2 = IX * (LVL(i + 1) - 1) + LVL(i)
    M3 = (LVL(i + 2) - LVL(i + 1)) / 2 + 1
    LVL(M22) = M2
    LVL(M22 + 1) = M3
    i = i + 3
    M22 = M22 + 2
Next j
'------------------------------
i = 1
M22 = 1
For j = 1 To IUL
    M2 = IX * (LUL(i + 1) - 1) + LUL(i)
    M3 = (LUL(i + 2) - LUL(i + 1)) / 2 + 1
    LUL(M22) = M2
    LUL(M22 + 1) = M3
    i = i + 3
    M22 = M22 + 2
Next j
'---------------------------------
GM20 = GM20 * PI1
GM2N = GM2N * PI1
'-------------------------------
DHM2 = (HM2N - HM20) / (KR - 1)
DHS2 = (HS2N - HS20) / (KR - 1)
DGM2 = (GM2N - GM20) / (KR - 1)
'------------------------------
HM2(1) = HM20
HS2(1) = HS20
GM2(1) = GM20
'-------------------------------
For j = 2 To KR
    HM2(j) = HM20 + DHM2 * (j - 1)
    HS2(j) = HS20 + DHS2 * (j - 1)
    GM2(j) = GM20 + DGM2 * (j - 1)
Next j
'------------------------------
LP1 = 0
For i = 1 To IUH
M2 = LUH(2 * i - 1)
M3 = LUH(2 * i)
If M2 < 0 Then M2 = -M2
K0 = M2 - 2
For j = 1 To M3
    K = K0 + j + j
    Y1 = Y(K - 1 - IX)
    Y2 = Y(K - 1 + IX)
    Y3 = Y(K + 1 - IX)
    Y4 = Y(K + 1 + IX)
    If j <> M3 Then
    D0 = (Y1 + Y2 + Y3 + Y4) / 4
    D1 = (Y3 + Y(K + 3 + IX) + Y4 + Y(K + 3 - IX)) / 4
    D2 = Exp(PH * Log(D0)) / N
    D3 = Exp(PH * Log(D1)) / N       此处错误提示,无效的过程调用或参数(D1=0)
    D4 = (D2 + D3) ^ 2
    kp = j + LP1
    HA(kp) = D4
    End If
Next j
LP1 = LP1 + M3 - 1
Next i
'----------------------------------------
For j = 1 To MY
YU(j) = Y(j)
Next j
'---------------------------------------
T0 = DT / 2
LZ1 = IX + IX
KSN = LZ1 * (MK - 1) + KS0
F1 = PI1 * F1
'------------------------------------
p1000:
'------------------------------------
LP1 = 0
LD1 = 0
For j = 2 To M333 - 1 Step 2
A(j) = -S3
C(j + 1) = S3
Next j
'------------------------------
2010-09-29 15:34
zmh886
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:12
帖 子:238
专家分:1305
注 册:2010-6-2
收藏
得分:10 
把文件打包发上来别人方便测试

http://www./
2010-09-29 18:41
zmh886
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:12
帖 子:238
专家分:1305
注 册:2010-6-2
收藏
得分:0 
或者把代码处理下 把多余部分去掉

http://www./
2010-09-29 18:41
风吹过b
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:364
帖 子:4947
专家分:30084
注 册:2008-10-15
收藏
得分:10 
你单步执行一下,
以及下监视点,跟踪 D1 值变化,看看D1是怎么算出来的,为什么算出来是一个0 。
有必要的话,跟踪所有的与 D1 值有关的变量,然后手动计算一下,看看是不是哪步的工式写错了。

------------------------
最后:你这个程序有很大的代码优化范围。相同的代码,完全可以定义为一个过程,减少重复代码量,以提高代码质量。

FileNo = FreeFile
Open App.Path & "\V列信息.txt" For Input As #FileNo
For j = 1 To MLVL
    Input #FileNo, LVL(j)
Next j
Close #FileNo

完全定义一个过程,传进 文件名,数组(按地址传递的),总行数
那么调用后,数组值就好了,可以减少你 N 多重复块。

--------------------
固定的数据,定义为变量,不要定义为变量。
Coust PI = 3.1415926

------------------
程序太长,没兴趣仔细去看代码,看到一大块的计算,头都大了。
也没办法测试、跟踪,没工程,没支持文件。
靠你自己啦。


[ 本帖最后由 风吹过b 于 2010-9-29 21:26 编辑 ]

授人于鱼,不如授人于渔
早已停用QQ了
2010-09-29 21:24
xuchangan115
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-9-29
收藏
得分:0 
版主,你给我个邮箱吧,我打包给你你帮我调调。
2010-09-30 08:21
快速回复:求助!程序出错了大家一块解决一下。
数据加载中...
 
   



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

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