| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 846 人关注过本帖
标题:斑竹,大侠求救啊~~~~
只看楼主 加入收藏
sskss
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2008-6-17
收藏
 问题点数:0 回复次数:2 
斑竹,大侠求救啊~~~~
哪位高手近来给小弟讲讲这个程序啊,分段介绍功能。  跪求了~~~


'=====统计控制状态信息数组=====
Dim X(7) As Integer
'=====控制相关参数数组=====
'平均统计状态偏差,统计趋势,统计超调,尾偏差,调节增量,统计稳定系数
'      Y(0)          Z(0)      Z(1)     Y(1)     Y(2)       Y(3)
Dim Y(3) As Single
Dim Z(2) As Integer
'=====控制相关参数记忆数组=====
Dim Y_0(3) As Single
Dim Z_0(1) As Integer
'=====控制权重数组=====
Dim r(4) As Single
'=====控制游标尺度数组=====
Dim w(3) As Single
'=====运算数组=====
Dim J0, J1, J2, J3, J4, J5, J6, J7 As Integer
'=====坐标=====
Dim X1, X2, Y1, Y2 As Single
'=====突出显示标志=====
Dim SeFlag(6) As Boolean
'=====循环计数=====
Dim nkj As Long
'=====循环数=====
Dim mmmkkk As Long
Dim sunbeer, sunbeer88, sunbeer888 As String
Dim XUNHUAN As Long
'=====调节增量极值数组=====
Dim MINandMAX(3) As Single
Dim MINandSUN(3) As Long
Dim Myg0, Myg1 As Single
Dim KONGZHI As Boolean
Dim MyTime, MyTime0 As Integer
Dim CHAZHAO As Boolean

Private Sub Form_Click()
Dim i As Integer
Form1.BackColor = &HFFFFFF
Text1.BackColor = &HFFFFFF

For i = 0 To 3
    Text2(i).BackColor = &HFFFFFF
Next i

For i = 0 To 9
    Line1(i).BorderColor = &H0&
Next i
Line1(18).BorderColor = &H0&
For i = 20 To 27
    Line1(i).BorderColor = &H0&
Next i

Frame1.BackColor = &HFFFFFF
Frame3.BackColor = &HFFFFFF
End Sub

Private Sub Form_DblClick()
Dim i As Integer
Form1.BackColor = &H89792C
Text1.BackColor = &H89792C

For i = 0 To 3
    Text2(i).BackColor = &H89792C
Next i

For i = 0 To 3
    Text2(i).BackColor = &H89792C
Next i

For i = 0 To 9
    Line1(i).BorderColor = &HC0C0C0
Next i
Line1(18).BorderColor = &HC0C0C0
For i = 20 To 27
    Line1(i).BorderColor = &HC0C0C0
Next i

Frame1.BackColor = &H89792C
Frame3.BackColor = &H89792C
End Sub

Private Sub Form_Load()

初始化

End Sub




Private Sub Label1_Click(Index As Integer)
If CHAZHAO = True Then Exit Sub
Dim HHH, MyHHH1 As Integer
HHH = Index
If HHH = 0 Then
    sunbeer = Text1.Text
    字符转换
    OPEN_0
    画图
    计算
    OPEN_1
End If

If HHH = 1 Then
    Timer1.Enabled = False
   
    For MyHHH1 = 0 To 3
        Text2(MyHHH1).BorderStyle = 0
    Next MyHHH1
   
    Text1.BorderStyle = 0
    Image1.Visible = False
End If

If HHH = 3 Then
    OPEN_0
    Timer2.Enabled = False
   
    CHAZHAO = True
    查找增量零值
End If

End Sub

Private Sub Label1_DblClick(Index As Integer)
Dim HHH, MyHHH1 As Integer
HHH = Index

If HHH = 1 Then
    Timer1.Enabled = True
   
    For MyHHH1 = 0 To 3
        Text2(MyHHH1).BorderStyle = 1
    Next MyHHH1
   
    Text1.BorderStyle = 1
End If

If HHH = 3 Then
    OPEN_1
    Timer2.Enabled = False
    CHAZHAO = False
End If

End Sub

Private Sub Label10_Click()
Label10.Caption = "当前控制微元平均偏差统计"
KONGZHI = False
End Sub

Private Sub Label10_DblClick()
Label10.Caption = "扩展控制微元平均偏差统计"
KONGZHI = True
End Sub

Private Sub Label4_Click(Index As Integer)

End Sub

Private Sub Label7_Click()
If CHAZHAO = True Then Exit Sub
Timer2.Enabled = True
End Sub

Private Sub Label7_DblClick()
Timer2.Enabled = False
End Sub

Private Sub Text1_Change()
'循环点数值检测
End Sub

Private Sub Text1_DblClick()
Text1.Text = ""
End Sub

Private Sub Text2_Change(Index As Integer)
Dim i As Integer

For i = 0 To 3
    If Text2(i).Text = "" Then Text2(i).Text = "0."
    sunbeer = Text2(i).Text
    sunbeer88 = Mid(sunbeer, 1, 1)
    If sunbeer88 = "-" Then Text2(i).Text = "0."
    数据整理
    r(i) = CSng(Val(sunbeer))
    Text2(i).Text = sunbeer
Next i
End Sub

Private Sub Timer1_Timer()
MyTime = MyTime - 1
If MyTime = 1 Then Image1.Visible = True
If MyTime = 0 Then
    Image1.Visible = False
    MyTime = MyTime0
End If
End Sub


Private Sub Timer2_Timer()
循环加
字符转换
OPEN_0
画图
计算
OPEN_1
End Sub


Sub 画图()
'Cls

Dim i, j As Long
'定横线
For i = 0 To 7
    X(i) = CInt(Mid(sunbeer, i + 1, 1))
    Line3(i).Y1 = (9 - X(i)) * Myg0 + Line1(9).Y1
    Line3(i).Y2 = Line3(i).Y1
Next i


'定纵线
For i = 0 To 6
    Myg1 = X(i + 1) - X(i)
    If Myg1 = 0 Then
        Line11(i).Visible = False
    Else
        If Myg1 > 0 Then
            Line11(i).Y1 = Line3(i + 1).Y1
            Line11(i).Y2 = Line3(i).Y1
        Else
            Line11(i).Y1 = Line3(i).Y1
            Line11(i).Y2 = Line3(i + 1).Y1
        End If
        Line11(i).Visible = True
    End If
Next i

End Sub

Sub 计算()

If KONGZHI = True Then
    '扩展控制微元平均统计状态偏差
    Y(0) = (X(0) + X(1) + X(2) + X(3) + X(4) + X(5) + X(6) + X(7)) / 8 - 4.5
Else
    '当前控制微元平均统计状态偏差
    Y(0) = (X(2) + X(3) + X(4) + X(5) + X(6) + X(7)) / 6 - 4.5
End If
sunbeer = CStr(Y(0))
数据整理
Label5(0).Caption = sunbeer


'统计趋势
Z(0) = X(7) - X(0)
sunbeer = CStr(Z(0))
Label5(1).Caption = sunbeer


'统计超调
Z(1) = X(0) - X(2)
sunbeer = CStr(Z(1))
Label5(2).Caption = sunbeer


'尾偏差
Y(1) = X(7) - 4.5
sunbeer = CStr(Y(1))
数据整理
Label5(3).Caption = sunbeer


'相对调节增量
Y(2) = r(0) * Y(0) + r(1) * Z(0) + r(2) * Z(1) + r(3) * Y(1)
sunbeer = CStr(Y(2))
数据整理
Label5(4).Caption = sunbeer



End Sub

Sub OPEN_0()
Dim JKHH As Integer
Text1.Enabled = False

For JKHH = 0 To 3
    Text2(JKHH).Enabled = False
Next JKHH
End Sub

Sub OPEN_1()
Dim JKHH As Integer
Text1.Enabled = True

For JKHH = 0 To 3
    Text2(JKHH).Enabled = True
Next JKHH
End Sub

Sub 字符转换()

If Text1.Text = "" Then Text1.Text = "0"

'数据整理
mmmkkk = CLng(Val(sunbeer))
If mmmkkk < 0 Then mmmkkk = 99999999
sunbeer = CStr(mmmkkk)
Text1.Text = sunbeer

'控制状态获得
myL = Len(sunbeer)

If myL = 7 Then sunbeer = "0" & sunbeer
If myL = 6 Then sunbeer = "00" & sunbeer
If myL = 5 Then sunbeer = "000" & sunbeer
If myL = 4 Then sunbeer = "0000" & sunbeer
If myL = 3 Then sunbeer = "00000" & sunbeer
If myL = 2 Then sunbeer = "000000" & sunbeer
If myL = 1 Then sunbeer = "0000000" & sunbeer
Label8.Caption = sunbeer
End Sub


Sub 数据整理()
myN = Len(sunbeer)
sunbeer88 = Mid(sunbeer, 1, 1)
sunbeer888 = Mid(sunbeer, 1, 2)
If sunbeer88 = "." Then sunbeer = "0" & sunbeer
If sunbeer888 = "-." Then sunbeer = "-0." & Mid(sunbeer, 3, myN - 2)
End Sub



Sub 循环加()
sunbeer = Text1.Text
XUNHUAN = CLng(Val(sunbeer)) + 1
If XUNHUAN = 100000000 Then XUNHUAN = 0
sunbeer = Str(XUNHUAN)
Text1.Text = sunbeer
End Sub



Sub 查找增量零值()
Dim KJ, KI As Long
Dim MySTR1 As String

循环加
For KJ = 0 To 99999999
    MyOther = DoEvents()
    If CHAZHAO = False Then Exit Sub
   
    字符转换
   
    For KI = 0 To 7
        MySTR1 = Mid$(sunbeer, KI + 1, 1)
        X(KI) = CInt(MySTR1)
    Next KI
    '=======================
    If KONGZHI = True Then
        '扩展控制微元平均统计状态偏差
        Y(0) = (X(0) + X(1) + X(2) + X(3) + X(4) + X(5) + X(6) + X(7)) / 8 - 4.5
    Else
        '当前控制微元平均统计状态偏差
        Y(0) = (X(2) + X(3) + X(4) + X(5) + X(6) + X(7)) / 6 - 4.5
    End If
   
    '统计趋势
    Z(0) = X(7) - X(0)
   
    '统计超调
    Z(1) = X(0) - X(2)
   
    '尾偏差
    Y(1) = X(7) - 4.5
   
    '相对调节增量
    Y(2) = r(0) * Y(0) + r(1) * Z(0) + r(2) * Z(1) + r(3) * Y(1)
   
    If Y(2) = 0 Then
        字符转换
        画图
        计算
        CHAZHAO = False
        OPEN_1
        Exit Sub
    End If
    '=========================
    XUNHUAN = CLng(Val(sunbeer)) + 1
    If XUNHUAN = 100000000 Then
        OPEN_1
        CHAZHAO = False
        Exit Sub
    End If
   
    sunbeer = Str(XUNHUAN)
Next KJ

End Sub


Sub 初始化()

Dim i As Integer
'=====权重数组=====
Text2(0).Text = "0.43"
Text2(1).Text = "0.12"
Text2(2).Text = "0.15"
Text2(3).Text = "0.3"
r(4) = 0.13

'权重初始值
For i = 0 To 3
    r(i) = Val(Text2(i).Text)
    sunbeer = CStr(r(i))
    Text2(i).Text = sunbeer
Next i

Text1.Text = "30039868"
sunbeer = Text1.Text
MyTime = 2
MyTime0 = 2

Timer1.Enabled = True
Timer1.Interval = 503
Timer2.Enabled = False
Timer2.Interval = 1000
Timer3.Enabled = False
Timer2.Interval = 2009
'线变化基本长度
Myg0 = 240

Label10.Caption = "当前控制微元平均偏差统计"
KONGZHI = False

For i = 0 To 3
    Label5(i).Caption = ""
Next i

For i = 0 To 6
Line11(i).BorderWidth = 3
Line11(i).Visible = False
Line3(i).BorderWidth = 3
Next i
Line3(7).BorderWidth = 3

OPEN_0
字符转换
画图
计算
OPEN_1
End Sub
搜索更多相关主题的帖子: Dim Integer 斑竹 
2008-06-17 12:10
flyue
Rank: 10Rank: 10Rank: 10
来 自:江南西道
等 级:贵宾
威 望:19
帖 子:3465
专家分:1563
注 册:2006-6-20
收藏
得分:0 
这么多代码,先把那些高手们吓跑了

天之道,损有余而补不足.人之道则不然,损不足以奉有余.孰能有余以奉天下,唯有道者.
2008-06-17 18:51
三断笛
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:31
帖 子:1621
专家分:1617
注 册:2007-5-24
收藏
得分:0 
可惜了  这么多的中文和拼音的函数和过程

代码太长   哪句看不懂问哪句
2008-06-17 23:49
快速回复:斑竹,大侠求救啊~~~~
数据加载中...
 
   



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

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