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

📄 rlcthreeloop.frm

📁 一款开源基于电子电路理论支持编写的电子电路模拟和分析小软件
💻 FRM
📖 第 1 页 / 共 4 页
字号:
         End
      End
   End
   Begin VB.Line Line2 
      BorderWidth     =   4
      X1              =   0
      X2              =   10320
      Y1              =   10200
      Y2              =   10200
   End
   Begin VB.Line Line1 
      BorderWidth     =   4
      X1              =   0
      X2              =   10320
      Y1              =   600
      Y2              =   600
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "交流电路 - R, L, C 三回路电路"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   18
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   495
      Left            =   1680
      TabIndex        =   34
      Top             =   120
      Width           =   6375
   End
   Begin VB.Shape Shape1 
      BackColor       =   &H00FF8080&
      BackStyle       =   1  'Opaque
      Height          =   615
      Left            =   -120
      Top             =   0
      Width           =   10815
   End
End
Attribute VB_Name = "RLCThreeLoop"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim R(5) As Single
Dim V(5) As Single
Dim L(5) As Single
Dim C(5) As Single
Dim Z(5) As Single
Dim f As Single
Dim n As Integer
Dim XC(5), XL(5) As Single
Dim Z1, Z2, Z3, Z4, Z5 As Single
Dim D, D1, D2, D3, D4, D5, D6 As Single
Dim V12, V23, V34 As Single
Dim Z12, Z21, Z23, Z31, Z34 As Single
Dim VA, VB, I1, I2, I3 As Single
Dim VC, VD, VE, VF, VG, VH As Single
Const vbkeyDecPt = 46
Const pi = 22 / 7

Private Sub calculate_Click()
R(0) = Val(TextR1.Text)
R(1) = Val(TextR2.Text)
R(2) = Val(TextR3.Text)
R(3) = Val(TextR4.Text)
R(4) = Val(TextR5.Text)
L(0) = Val(TextL1.Text)
L(1) = Val(TextL2.Text)
L(2) = Val(TextL3.Text)
L(3) = Val(TextL4.Text)
L(4) = Val(TextL5.Text)
C(0) = Val(TextC1.Text)
C(1) = Val(TextC2.Text)
C(2) = Val(TextC3.Text)
C(3) = Val(TextC4.Text)
C(4) = Val(TextC5.Text)
f = Val(Textf.Text)
V(0) = Val(TextV1.Text)
V(1) = Val(TextV2.Text)
V(2) = Val(TextV3.Text)
V(3) = Val(TextV4.Text)
V(4) = Val(TextV5.Text)
For n = 0 To 4
If L(n) = 0 Then
XL(n) = 0
Else
XL(n) = 2 * pi * f * L(n)
End If
Next n
For n = 0 To 4
If C(n) = 0 Or f = 0 Then
XC(n) = 0
Else
XC(n) = 1 / (2 * pi * f * C(n))
End If
Next n
Z1 = (R(0) ^ 2 + (XL(0) - XC(0)) ^ 2) ^ (1 / 2)
Z2 = (R(1) ^ 2 + (XL(1) - XC(1)) ^ 2) ^ (1 / 2)
Z3 = (R(2) ^ 2 + (XL(2) - XC(2)) ^ 2) ^ (1 / 2)
Z4 = (R(3) ^ 2 + (XL(3) - XC(3)) ^ 2) ^ (1 / 2)
Z5 = (R(4) ^ 2 + (XL(4) - XC(4)) ^ 2) ^ (1 / 2)

If Option1.Value = True Then
V12 = V(0) - V(1)
Z12 = Z1 + Z2
Z21 = -Z2
V23 = V(1) - V(2) - V(4)
Z23 = -Z3
V34 = V(2) - V(3)
Z34 = Z3 + Z4
D = (Z12 * Z23 * Z34) - (Z12 * (Z31) ^ 2) - ((Z21) ^ 2 * Z34)
D1 = (V12 * Z23 * Z34) - (V12 * (Z31) ^ 2) - (Z21 * V23 * Z34) + (Z21 * Z31 * V34)
D2 = (V23 * Z12 * Z34) - (V34 * Z12 * Z31) - (V12 * Z21 * Z34)
D3 = (V34 * Z12 * Z23) - (V23 * Z12 * Z31) - (V34 * (Z21) ^ 2) + (V12 * Z21 * Z31)
I1 = D1 / D
I2 = D2 / D
I3 = D3 / D
LblI1.Caption = Format$(I1, "###.000000A")
LblI2.Caption = Format$(I2, "###.000000A")
LblI3.Caption = Format$(I3, "###.000000A")
LblVA.Caption = " "
LblVB.Caption = " "
ElseIf Option2.Value = True Then
VC = (Z2 * Z5) + (Z1 * Z5) + (Z1 * Z2)
VD = -(Z1 * Z2)
VE = (V(0) * Z2 * Z5) + (V(1) * Z1 * Z5) + (V(4) * Z1 * Z2)
VF = -(Z3 * Z4)
VG = (V(2) * Z4 * Z5) + (V(3) * Z3 * Z5) - (V(4) * Z3 * Z4)
VH = (Z4 * Z5) + (Z3 * Z5) + (Z3 * Z4)
D4 = (VC * VH) - (VD * VF)
D5 = (VE * VH) - (VD * VG)
D6 = (VC * VG) - (VE * VF)
VA = D5 / D4
VB = D6 / D4
LblVA.Caption = Format$(VA, "###.000000V")
LblVB.Caption = Format$(VB, "###.000000V")
LblI1.Caption = " "
LblI2.Caption = " "
LblI3.Caption = " "
End If
End Sub

Private Sub clear_Click()
TextR1.Text = " "
TextR2.Text = " "
TextR3.Text = " "
TextR4.Text = " "
TextR5.Text = " "
TextL1.Text = " "
TextL2.Text = " "
TextL3.Text = " "
TextL4.Text = " "
TextL5.Text = " "
TextC1.Text = " "
TextC2.Text = " "
TextC3.Text = " "
TextC4.Text = " "
TextC5.Text = " "
Textf.Text = " "
TextV1.Text = " "
TextV2.Text = " "
TextV3.Text = " "
TextV4.Text = " "
TextV5.Text = " "
LblVA.Caption = " "
LblVB.Caption = " "
LblI1.Caption = " "
LblI2.Caption = " "
LblI3.Caption = " "
End Sub

Private Sub Command1_Click()
Unload Me
Splash.Show
End Sub


Private Sub TextC1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub


Private Sub TextC2_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub


Private Sub TextC3_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub


Private Sub TextC4_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub


Private Sub TextC5_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub


Private Sub Textf_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub


Private Sub TextL1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub


Private Sub TextL2_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub


Private Sub TextL3_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub


Private Sub TextL4_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub


Private Sub TextL5_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub


Private Sub TextR1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub

Private Sub TextR2_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub

Private Sub TextR3_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub

Private Sub TextR4_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub


Private Sub TextR5_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub


Private Sub TextV1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub

Private Sub TextV2_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub

Private Sub TextV3_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub

Private Sub TextV4_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub

Private Sub TextV5_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or _
KeyAscii = vbKeyBack Or KeyAscii = vbkeyDecPt Then
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub

⌨️ 快捷键说明

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