|
Part 1 of this feature discussed multibody dynamic modeling procedures and system topology for an articulated-steering vehicle.
Generating efficient simulation code
Once the system topology and parameters have been defined, the ModelBuilder GUI tool uses principles of linear graph theory to automatically select a suitable set of system coordinates. Our articulated-steer vehicle model has 10 degrees of freedom: Six for the position and orientation of the front chassis and one each for the spin of the tires. Note that the articulated joint does not add a degree of freedom, because its motion is input as a prescribed function of time for simulating various maneuvers. The 10 position and velocity coordinates shown below will, therefore, result in the minimum number of dynamic equations. ModelBuilder is used to export a model definition file, which is then interpreted by the DynaFlexPro package for modeling and simulating multibody dynamics.
ModelBuilder can automatically select the system coordinates resulting in the minimum number of dynamic equations.
View a full-size image
Once DynaFlexPro has been loaded in Maple, the "BuildEQs" command generates and simplifies the system equations automatically, based on the data contained in the model definition file. The symbolic form of these equations can be displayed, though they can become quite large for complex systems.
To generate a numerical simulation of the dynamic response, values must be set for the symbolic model parameters. Input functions, in this case the prescribed steering angle, must also be defined. The "BuildSimCode" command then generates optimized simulation code in the form of a Maple, MATLAB, or C procedure that calculates the time derivatives of the state variables, which can then be integrated over time. BuildSimCode can also generate optimized simulation code for evaluating arbitrary symbolic Maple functions of system state variables.
Simulating and validating the system
For our articulated-steered vehicle example, a lane change maneuver is simulated by specifying a sinusoidal input motion to the articulating joint and an initial forward vehicle velocity of 10 m/sec. Initial conditions for the state variables and their first derivatives are passed into the Maple "dsolve" routine, which numerically integrates the optimized Maple procedure generated with BuildSimCode.
When exported as a C procedure and incorporated into a Simulink S-Function, the 10-second simulation executes in 0.00625 seconds on a Windows computer with a 3.2-GHz Pentium 4 processor and 1 GByte of RAM. The ode15s integrator was used with absolute and relative error tolerances of 1E-3. The simulation takes about 1.6 seconds to execute in Maple, which is still many times faster than real-time. The resulting vehicle trajectory, shown below, is consistent with the results obtained using an equivalent model developed in MSC Adams [Ref. 8], integrated using a GSTIFF solver with an SI2 formulation and the same error tolerance of 1E-3.
A sinusoidal steering angle input is used to simulate a lane change maneuver.
For this example, the DynaFlexPro model was found to execute in Simulink approximately 20 times faster than the equivalent MSC Adams model, which testifies to the efficiency of the simulation code that can be generated using a combination of linear graph theory and symbolic computing.
|