2.  Using Dynawiz

Previous    Next    Home

Planning a Dynawiz Simulation

As with any simulation, it starts with planning. In a multibody dynamics simulation case, you must have the following information about the machine or the plant that's being simulated:

The mass property of the member bodies of the machine/mechanism/plant

The type of motion between connected bodies

The initial condition of the position, orientation and their velocities in some reference coordinate frames

The control forces and disturbances on the member bodies

Motion signals required to model sensors and control systems

The environmental forces such as gravity or aerodynamic drag

Constraints

Timing parameters

Defining Input File

You would create a data file based on the information above to instruct  Dynawiz on:

Selecting the required kinetic, kinematic and constraint equations to solve the given dynamics problem

Initializing the system states and the member body motion parameters for the desired dynamics solution

Defining the data to pass between the plant and the control system and disturbance models

Defining the data to save for plotting and post-simulation analysis

BuildX helps you create this file. It's an interactive program and its usage is described on next page.

Defining Control System and Disturbances

You must define the control signals that moves the plant bodies in a desired motion against disturbance forces that oppose it. Functionally, you provide a mapping of the motion signals to the control and disturbances signals.

Dynawiz lets you do this in three ways. In the Fortran/C++ implementations, the user supplies the subroutine called control.for /control.c  to receive motion signals from the main simulation program and to return forces and torque defined at the interbody hinges. This control program can be arranged to call any subroutine that supports these force and torque calculations. It can be programmed to model discrete processes, transfer functions, and time-based or event-based switching events.

In the Matlab/Simulink(c) implementation, the plant dynamics is represented by an S-function called Dynawiz.dll in the Simulink workspace. The input and output of this S-function are the plant control signals and outgoing motion signals. The user defines the control system and disturbances by creating control components and signal generating functions using Simulink's graphic programming tools. By connecting these components and functions to the plant S-function, you would produce the desired control system and disburbance signals for your simulation.

The input and output data list to the plant are defined by the Edit_Yfile and Edit_Ufile actions when you create your input file using BuildX.

Running the Dynawiz Simulation

In the Fortran or C++ implementations, you activate the simulation by typing 'Dynawiz' on the command line. A menu would appear to let you adjust the simulation timing parameters or to switch the model file. Following this, type 'go' to start. Dynawiz would run to completion barring errors that can arise from poor choice of step size, plant singularity, or inconsistent constraints. At the end of the simulation, you will be notified of all the files that Dynawiz has generated. These include the plot datafile, a short summary file, run time messages, initial data that was read and so forth.

The procedure to run the Matlab/Simulink version of Dynawiz is just as easy. Let's say that your Simulink model is mysim.mdl. Then, type mysim at the Matlab prompt to bring out mysim.mdl to the Simulink workspace. Mouse-click on the Simulate button on the control bar at the top of the screen and select Parameters to adjust the simulation time steps and error threshold numbers. As for the method of integration, you can only select from variable step integration algorithms. Select one, and click Start to begin. The simulation would run to completion barring numeric singularities and inconsistent constraints defined in the input file. At the end of the simulation, you would get the plot datafile, and other files as is the case with the Fortran implementation.

Viewing Dynawiz Results Using Matlab

The plot data are stored in a tabular fashion in the plot file, call it z.dat.  Each column represents the time series of a particular output parameter. The first column is time. Dynawiz creates a .m file for each output data requested. That .m file could be a single element time plot (i.e. hinge angle) or a multiple element time plot (i.e. system angular momentum in the inertial frame). To view the result, first activate matlab. Secondly, load z.dat into Matlab workspace, and type "z<index>" (without quotes) to see the plot of the indexed output variable. (For example, by typing "z12", you will see the time plot of the 12th variable.) If your plot file name happens to be joe.dat, then you would type "joe12" instead of "z12". The output data list is created using the Edit_Ofile command from the Buildx Menu. To view what that list is, simply type 'type o.dat' on a PC command line, or 'vi o.dat' on a workstation command line.

The five steps above are the key activities involved in obtaining results from a Dynawiz-based multibody dynamics simulation. These five steps apply to the XAL package also, except that it needs one step after step 2 to create the xcd.dll file from the AUTOLEV generated C code. For that detail, go to the XAL page.

 

Previous    Next    Home

 

DynaWiz, BuildX, XAL, and QX3D are trademarks of Concurrent Dynamics International. All other products mentioned are registered trademarks or trademarks of their respective companies.

Questions or problems regarding this web site should be directed to admin@concurrent-dynamics.com.
Copyright © 2001-2003 Concurrent Dynamics International. All rights reserved.
Last modified: Tuesday July 22, 2003.