Beruflich Dokumente
Kultur Dokumente
'2DTruss
'=================================================
Option Explicit
Option Base 1
Type Joint_Data
x As Double
y As Double
End Type
Type Member_Data
J1 As Integer
J2 As Integer
Dens As Double
Ax As Double
E As Double
lx As Double
ly As Double
Lh As Double
Cx As Double
Cy As Double
End Type
Sub TRUSS2D()
On Error GoTo ErrMsg
Const NDJ = 2
Dim NLJ As Integer 'no of joint load
NJ = Cells(4, 2)
NM = Cells(5, 2)
'X-range:
XAx_Wd = Application.Max(Rows("10:10")) - Application.Min(Rows("10:10"))
'Y-range:
YAx_Wd = Application.Max(Rows("11:11")) - Application.Min(Rows("11:11"))
NS = Application.Count(Rows("22:22"))
NLJ = Application.Count(Rows("27:27"))
'Total number of joint displacement, NP:
NP = NDJ * NJ
'===============
'Read Input Data
'===============
'Guide_Input_of_Coordinates
For i = 1 To NJ
With Joint(i)
.x = Cells(10, 1 + i)
.y = Cells(11, 1 + i)
End With
Next i
Next i
'#restrained joint
NR = NP - DOF
'==================
'Structure Analysis
'==================
Call Mindex(Idm, Idj, Irj)
Call Stiff_Mtx(MS, GS)
Call MInvers(DFX, DFR)
'generate load
Call Genload(Pmm, Psum)
'determine displacements
Call DISP(Xs, Xm)
'============
'Print Result
'============
'clear previous content
Dim LastRow
LastRow = ActiveSheet.UsedRange.Rows.Count
Range(Cells(35, 1), Cells(LastRow, 10)).ClearContents
'1.Print Load
For i = 1 To NJ
Cells(34 + i, 1).NumberFormat = "0"
Cells(34 + i, 1) = i
Cells(34 + i, 2).NumberFormat = "0.000"
Cells(34 + i, 2) = Psum(2 * i - 1)
Cells(34 + i, 3).NumberFormat = "0.000"
Cells(34 + i, 3) = Psum(2 * i)
Next i
'-------------
'Member Forces
'-------------
'{F}m=[K]m.{X}m
For i = 1 To NM
For j = 1 To 4
Fm(j, i) = 0
For n = 1 To 4
Fm(j, i) = Fm(j, i) + MS(j, n, i) * Xm(n, i)
Next n
Next j
Next i
'Print member foces
For i = 1 To NM
With Member(i)
Cells(34 + i, 6).NumberFormat = "0"
Cells(34 + i, 6) = i & "./" & Format(.Lh, "0.0")
Cells(34 + i, 7).NumberFormat = "0.000"
Cells(34 + i, 7) = Pmm(Idm(1, i), i) + Fm(1, i)
Cells(34 + i, 8).NumberFormat = "0.000"
Cells(34 + i, 8) = Pmm(Idm(3, i), i) + Fm(3, i)
End With
Next i
'-----------------
'Support Reactions
'-----------------
For i = 1 To 2 * NS
For j = 1 To DOF
RJ(i) = RJ(i) + DFX(i, j) * Xs(Idj(j))
Next j
Next i
For i = 1 To NS
Cells(34 + i, 9).NumberFormat = "0"
Cells(34 + i, 9) = spn(i)
Cells(34 + i, 10).NumberFormat = "0.000"
Cells(34 + i, 10) = RJ(2 * i - 1) - Psum(Irj(2 * i - 1))
Cells(34 + i, 11).NumberFormat = "0.000"
Cells(34 + i, 11) = RJ(2 * i) - Psum(Irj(2 * i))
Next i
Call PlotGeometry
Call PlotDisplacement
Call PlotAxial
Range("A1").Select
Application.ScreenUpdating = True
Exit Sub
ErrMsg: MsgBox "Error, please check input ...", vbOKOnly + vbExclamation,
"TRUSS2D"
Range("A1").Select
Application.ScreenUpdating = True
End Sub