JWock82 / xlFrame

A free VBA library to make structural analysis easy in Microsoft Excel
MIT License
67 stars 19 forks source link

Add "Vertical" as a load direction #7

Open dmorchard opened 5 years ago

dmorchard commented 5 years ago

Is your feature request related to a problem? Please describe. When adding a gravity loads, such as snow, to a sloped member the user has to resolve the load into the appropriate "Transverse" and "Axial" components and apply both.

Describe the solution you'd like It'd be handy to have a third load direction, "Vertical", with the T and A components automatically resolved and applied to the member.

Additional context Taking it a step further, perhaps there could be 4 load types: x-local, y-local, X-global & Y-global. Or "Axial", "Transverse", "Horizontal" & "Vertical" if you prefer.

dmorchard commented 5 years ago

This is mostly an update, but please jump in if you think I'm headed for disaster...

I've been focused on this issue the past couple days, and I think I've got a pretty simple solution. This new function inside the FERFunctions module gives the gist of it...

'Returns the fixed end reaction vector for a point load of any orientation
'Replaces original functions: FER_PtLoad & FER_AxialPtLoad
Public Function FER_PointLoad(P As Double, x As Double, L As Double, LambdaX As Double, LambdaY, LoadDir As LoadDirection) As Matrix

    'Define variables
    Dim b As Double
    b = L - x

    'Create the fixed end reaction vector
    Set FER_PointLoad = New Matrix
    Call FER_PointLoad.Resize(6, 1)

    'Resolve point load into local x & y components
    Dim Px As Double, Py As Double
    Select Case direction
    Case Axial
        Px = P
        Py = 0
    Case Transverse
        Px = 0
        Py = P
    Case Horizontal
        Px = P * LambdaX 'a.k.a DirCos
        Py = P * LambdaY 'a.k.a DirSin
    Case Vertical
        Px = P * LambdaY
        Py = P * LambdaX
    End Select

    'Populate the fixed end reaction vector
    With FER_PointLoad
        Call .SetValue(1, 1, -Px * (L - x) / L)
        Call .SetValue(2, 1, Py * b ^ 2 * (L + 2 * x) / L ^ 3)
        Call .SetValue(3, 1, Py * x * b ^ 2 / L ^ 2)
        Call .SetValue(4, 1, -Px * x / L)
        Call .SetValue(5, 1, Py * x ^ 2 * (L + 2 * b) / L ^ 3)
        Call .SetValue(6, 1, -Py * x ^ 2 * b / L ^ 2)
    End With

End Function

Also this enumeration inside the FEModel class module gets 2 new entries...

'Directions for member loads
Public Enum LoadDirection
    Transverse 'Local y
    Axial 'Local x
    Vertical 'Global Y
    Horizontal 'Global X
End Enum

The existing distributed load functions, FER_LinLoad & FER_AxialLinLoad are similarly combined/replaced, and that one being so much more complex I've focused my testing efforts on it entirely. Good news: the approach seems to be solid! I like it because it doesn't require creation of 2 entries in the array of loads in order to achieve horizontal or vertical loading on a sloped member, which is one way my OP could've been interpreted.

Still on my to-do list: chase these functions back through the chain of calling subs/functions to recode accordingly, passing all the required arguments. Then squash bugs.