⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmain.frm

📁 系统辨识
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmMain 
   AutoRedraw      =   -1  'True
   BackColor       =   &H8000000B&
   Caption         =   "辨识主窗体"
   ClientHeight    =   8040
   ClientLeft      =   225
   ClientTop       =   690
   ClientWidth     =   11565
   LinkTopic       =   "Form1"
   ScaleHeight     =   8040
   ScaleWidth      =   11565
   Begin VB.TextBox txtSeita 
      Height          =   375
      Index           =   4
      Left            =   5040
      TabIndex        =   6
      Text            =   "Text2"
      Top             =   720
      Width           =   2415
   End
   Begin VB.TextBox txtSeita 
      Height          =   375
      Index           =   3
      Left            =   5040
      TabIndex        =   5
      Text            =   "Text1"
      Top             =   120
      Width           =   2415
   End
   Begin VB.TextBox txtModel_error 
      Height          =   375
      Left            =   9120
      TabIndex        =   3
      Text            =   "Text1"
      Top             =   0
      Width           =   2175
   End
   Begin VB.Timer Timer1 
      Interval        =   50
      Left            =   0
      Top             =   480
   End
   Begin VB.TextBox txtSeita 
      Height          =   375
      Index           =   2
      Left            =   1080
      TabIndex        =   2
      Text            =   "Text2"
      Top             =   600
      Width           =   2415
   End
   Begin VB.TextBox txtSeita 
      Height          =   375
      Index           =   1
      Left            =   1080
      TabIndex        =   1
      Text            =   "Text1"
      Top             =   120
      Width           =   2415
   End
   Begin VB.PictureBox Picture1 
      AutoRedraw      =   -1  'True
      BackColor       =   &H80000004&
      Height          =   6735
      Left            =   0
      ScaleHeight     =   6675
      ScaleWidth      =   11475
      TabIndex        =   0
      Top             =   1200
      Width           =   11535
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      Caption         =   "b2:"
      Height          =   180
      Left            =   4680
      TabIndex        =   10
      Top             =   840
      Width           =   360
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "b1:"
      Height          =   180
      Left            =   4680
      TabIndex        =   9
      Top             =   240
      Width           =   360
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "a2:"
      Height          =   180
      Left            =   720
      TabIndex        =   8
      Top             =   720
      Width           =   360
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "a1:"
      Height          =   180
      Left            =   720
      TabIndex        =   7
      Top             =   120
      Width           =   360
   End
   Begin VB.Label Label1 
      Caption         =   "残差:"
      Height          =   375
      Left            =   8160
      TabIndex        =   4
      Top             =   120
      Width           =   855
   End
   Begin VB.Menu 数据模拟生成 
      Caption         =   "数据模拟生成"
   End
   Begin VB.Menu 清屏 
      Caption         =   "清屏"
   End
   Begin VB.Menu 绘制坐标 
      Caption         =   "绘制坐标"
   End
   Begin VB.Menu 退出 
      Caption         =   "退出"
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'本工程功能为:递推最小二乘法
'待辨识的 模型2 结构为:
'y(t)+a1y(t-1)+a2y(t-2)=b1u(t-1)+b2u(t-2)
'该程序参考《控制系统的计算机辅助设计程序汇编》
'清华出版 孙增圻(qi),并略有改变
'改变后的特点:速度比原来快一倍,所需变量比原来少22个(模型为2阶时)
'由文件 Public_Ident.bas 和 frmMain.frm组成
' 下面是文件frmMain.frm的源代码
Option Explicit
Dim t As Integer

Private Sub Form_Load()
Dim i As Integer
For i = 1 To Order
old_seita(i) = 0
Next i
Call system_ini
Call system

For i = 1 To Order '辨识初始化
Call Ident(True, Current_U(0), Current_Y(0))
Call system
Next i
    
t = 0
Call Draw_coordinate(Picture1, True, 0, 0, 0, 0) '绘制坐标

For i = 1 To Order + Order
txtSeita(i).ForeColor = QBColor(i + 8)
Next i

txtModel_error.ForeColor = QBColor(13)


End Sub


Private Sub Timer1_Timer()
    Dim j As Integer
    Call Ident(False, Current_U(0), Current_Y(0))   '辨识
    Call system
    '绘制残差变化曲线、显示残差具体值
    Picture1.ForeColor = QBColor(13)
    Picture1.Line (t, -old_seita(0) * y_graduation * 100)-(t + 1, -Model_Error * y_graduation * 100)
    old_seita(0) = Model_Error  '将t-1时刻的残差保存
    txtModel_error.Text = Model_Error '在文本框控件中显示残差具体值
    
    
    '绘制参数辨识变化曲线、显示参数辨识具体值
    For j = 1 To Order + Order
    Picture1.ForeColor = QBColor(j + 8)
    Picture1.Line ((t), -old_seita(j) * y_graduation * 10)-(t + 1, -Seita_t(j) * y_graduation * 10)
    old_seita(j) = Seita_t(j)
    txtSeita(j).Text = Seita_t(j)  '在文本框控件中显示参数辨识具体值
    Next j
    
    '当绘制完一屏后清屏,然后重新绘制坐标
    If t = x_right Then
    t = 0
    Picture1.Cls
    Picture1.ForeColor = RGB(0, 0, 0)
    Call Draw_coordinate(Picture1, True, 0, 0, 0, 0) '绘制坐标
    End If
    
    t = t + 1
End Sub


Private Sub 清屏_Click()
Me.Cls
End Sub

Private Sub 退出_Click()
Picture1.Cls
'End
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -