Skip to content

Commit

Permalink
Merge pull request #11 from dmorchard/master
Browse files Browse the repository at this point in the history
proposed solution to issue #5
  • Loading branch information
dmorchard authored Jun 14, 2019
2 parents b273d9f + 3e942cc commit 90c7a97
Show file tree
Hide file tree
Showing 2 changed files with 193 additions and 0 deletions.
185 changes: 185 additions & 0 deletions Class Modules/FEModel.cls
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,63 @@ Public Function GetDispDiagram(MemberName As String) As EZArray

End Function

'Returns the local displacement diagram for a member, segment-by-segment
Public Function GetDispDiagram2(MemberName As String) As EZArray

'Solve the model if necessary
If Solved = False Then
Call Analyze
End If

'Start a new array to hold the results
Set GetDispDiagram2 = New EZArray

'Step through each member in the 'Members' collection
Dim MemberItem As Member2D
For Each MemberItem In Members

'Find the member in the 'Members' collection
If MemberItem.Name = MemberName Then
Const p As Long = 12 'qty of intermediate partitions per segment
Dim r As Long 'EZArray index
Dim s As Long 'Segment counter
Dim SegmentItem As Variant 'Segment

'Resize EZarray
Call GetDispDiagram2.Resize(MemberItem.NumSegs * (p + 1), 2)

For Each SegmentItem In MemberItem.Segments
With SegmentItem

Dim i As Long, x As Double
s = s + 1

'Get diagram coordinates at intermediate points
For i = 1 To p + 1

'Calculate the position of the x-coordinate
x = .SegStart + (i - 1) * (.SegEnd - .SegStart) / p

'Determine EZArray index value
r = i + (s - 1) * (p + 1)

'Get the diagram coordinates
Call GetDispDiagram2.SetValue(r, 1, x)
Call GetDispDiagram2.SetValue(r, 2, MemberItem.Deflection(x))

Next i

End With 'SegmentItem
Next SegmentItem

Exit Function

End If

Next MemberItem

End Function

'Returns the shear in a member at a given location
Public Function GetShear(MemberName As String, x As Double) As Double

Expand Down Expand Up @@ -803,6 +860,70 @@ Public Function GetShearDiagram(MemberName As String) As EZArray

End Function

'Returns the shear diagram for a member, segment-by-segment
Public Function GetShearDiagram2(MemberName As String) As EZArray

'Solve the model if necessary
If Solved = False Then
Call Analyze
End If

'Start a new array to hold the results
Set GetShearDiagram2 = New EZArray

'Step through each member in the 'Members' collection
Dim MemberItem As Member2D
For Each MemberItem In Members

'Find the member in the 'Members' collection
If MemberItem.Name = MemberName Then
Const p As Long = 12 'qty of intermediate partitions per segment
Dim r As Long 'EZArray index
Dim s As Long 'Segment counter
Dim SegmentItem As Variant 'Segment

'Resize EZarray
Call GetShearDiagram2.Resize(MemberItem.NumSegs * (p + 1), 2)

For Each SegmentItem In MemberItem.Segments
With SegmentItem

Dim i As Long, x As Double
s = s + 1

'Determine EZArray index value
r = 1 + (s - 1) * (p + 1)

'Get diagram coordinates at start of segment
Call GetShearDiagram2.SetValue(r, 1, .SegStart)
Call GetShearDiagram2.SetValue(r, 2, .V1)

'Get diagram coordinates at intermediate points
For i = 2 To p + 1

'Calculate the position of the x-coordinate
x = .SegStart + (i - 1) * (.SegEnd - .SegStart) / p

'Determine EZArray index value
r = i + (s - 1) * (p + 1)

'Get the rest of the diagram coordinates
Call GetShearDiagram2.SetValue(r, 1, x)
Call GetShearDiagram2.SetValue(r, 2, MemberItem.Shear(x))

Next i

End With 'SegmentItem
Next SegmentItem

Exit Function

End If

Next MemberItem

End Function

'Returns the maximum shear in a member
Public Function GetMaxShear(MemberName As String) As Double

Expand Down Expand Up @@ -918,6 +1039,70 @@ Public Function GetMomentDiagram(MemberName As String) As EZArray

End Function

'Returns the moment diagram for a member, segment-by-segment
Public Function GetMomentDiagram2(MemberName As String) As EZArray

'Solve the model if necessary
If Solved = False Then
Call Analyze
End If

'Start a new array to hold the results
Set GetMomentDiagram2 = New EZArray

'Step through each member in the 'Members' collection
Dim MemberItem As Member2D
For Each MemberItem In Members

'Find the member in the 'Members' collection
If MemberItem.Name = MemberName Then
Const p As Long = 12 'qty of intermediate partitions per segment
Dim r As Long 'EZArray index
Dim s As Long 'Segment counter
Dim SegmentItem As Variant 'Segment

'Resize EZarray
Call GetMomentDiagram2.Resize(MemberItem.NumSegs * (p + 1), 2)

For Each SegmentItem In MemberItem.Segments
With SegmentItem

Dim i As Long, x As Double
s = s + 1

'Determine EZArray index value
r = 1 + (s - 1) * (p + 1)

'Get diagram coordinates at start of segment
Call GetMomentDiagram2.SetValue(r, 1, .SegStart)
Call GetMomentDiagram2.SetValue(r, 2, .M1)

'Get diagram coordinates at intermediate points
For i = 2 To p + 1

'Calculate the position of the x-coordinate
x = .SegStart + (i - 1) * (.SegEnd - .SegStart) / p

'Determine EZArray index value
r = i + (s - 1) * (p + 1)

'Get the diagram coordinates
Call GetMomentDiagram2.SetValue(r, 1, x)
Call GetMomentDiagram2.SetValue(r, 2, MemberItem.Moment(x))

Next i

End With 'SegmentItem
Next SegmentItem

Exit Function

End If

Next MemberItem

End Function

'Returns the maximum moment in a member
Public Function GetMaxMoment(MemberName As String) As Double

Expand Down
8 changes: 8 additions & 0 deletions Class Modules/Member2D.cls
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ Private m_Segments() As New Segment 'Array representing mathematically c
Private m_NumSegs As Integer 'Number of mathematically continuous segments in the member

'Class properties
Property Get NumSegs() As Integer
NumSegs = m_NumSegs
End Property

Property Get Segments() As Segment()
Segments = m_Segments
End Property

Property Let Name(Value As String)
m_Name = Value
End Property
Expand Down

0 comments on commit 90c7a97

Please sign in to comment.