Skip to content

Swinging chain #1

@moorepants

Description

@moorepants

https://github.com/pydy/pst-notebooks/blob/main/chain-link.ipynb

A long time ago, I saw a swinging chain as an example of some simulation system, I do not recall which one. Having nothing better to do, I tried to do it with sympy mechanics.

I modelled it as a pendulum consisiting of n links, suspended at one end.
I modelled the links as thin rods.
The total length of the pendulum is l, hence each link has length l/n.

I noticed the following:

When I defined the rotation of frame A[i] with respect to A[i-1] ( A[0] is the frame attached to the suspension point ), the number of operations shot up. For n = 15, the mass matrix had 25 mio operations.
When I defined the rotation of each frame A[i] w.r.t. the inertial frame O, the operations dropped a lot: For n = 50, MM has 40,000 operations, force has 50,000 operations. Normal numbers.

I guess, this has an explanation similar to the one with orient_body_fixed, which Timo explained to me a while back.

As per my experience, it takes a long time to set up Kane's equations.
For a system with 40,000 operations in MM and 50,000 in force, this should take maybe 20 sec.
Here it took about 120 sec.
I have no explanation of this.

Also the lambdification took over 20 sec, unusually long for such a small system.
The numerical integration also seemed to be on the longer side.

Anyway, my program shows, that such a chain can easily be modelled with symy mechanics!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions