Constrained Multibody Dynamics With Python: From Symbolic Equation Generation to Publication

Symbolic equations of motion (EOMs) for multibody systems are desirable for simulation, stability analyses, control system design, and parameter studies. Despite this, the majority of engineering software designed to analyze multibody systems are numeric in nature (or present a purely numeric user interface). To our knowledge, none of the existing software packages are 1) fully symbolic, 2) open source, and 3) implemented in a popular, general, purpose high level programming language. In response, we extended SymPy (an existing computer algebra system implemented in Python) with functionality for derivation of symbolic EOMs for constrained multibody systems with many degrees of freedom. We present the design and implementation of the software and cover the basic usage and workflow for solving and analyzing problems. The intended audience is the academic research community, graduate and advanced undergraduate students, and those in industry analyzing multibody systems. We demonstrate the software by deriving the EOMs of a N-link pendulum, show its capabilities for LATEX output, and how it integrates with other Python scientific libraries allowing for numerical simulation, publication quality plotting, animation, and online notebooks designed for sharing results. This software fills a unique role in dynamics and is attractive to academics and industry because of its BSD open source license which permits open source or commercial use of the code. ∗Address all correspondence to this author INTRODUCTION There are many dynamic systems which can be better or more effectively studied when their EOMs are accessible in a symbolic form. For equations that may be visually inspected (i.e., of reasonable length), symbolics are generally preferable because the interrelations of the variables and constants can give clear understanding to the nature of the problem without the need for numerical simulation. Many classic problems fit this category, such as the mass-spring-damper, double pendulum, rolling disc, rattleback, and tippy-top. The benefits of symbolic equations of motion are not limited to these basic problems though. Larger, more complicated multibody systems can also be studied more effectively when the equations of motion are available symbolically. Advanced simplification routines can sometimes reduce the length of the equations such that they are human readable and the intermediate derivation steps are often short enough that symbolic checks can be used to validate the correctness. Furthermore, the symbolic form of the EOMs often evaluate much faster than their numerical counterparts, which is a significant advantage for real time computations. Problems in biomechanics, spacecraft dynamics, and single-track vehicles have all been successfully studied using symbolic EOMs. Having the symbolic equations of motion available permits numerical simulation, but also allows for a more mathematical study of the system in question. System behavior can be studied parametrically by examining coefficients in the differential equations. This includes symbolic expressions for equiProceedings of the ASME 2013 International Design Engineering Technical Conferences and Computers and Information in Engineering Conference IDETC/CIE 2013 August 4-7, 2013, Portland, Oregon, USA