02.04.2013 Views

Welcome to Adams/Solver Subroutines - Kxcad.net

Welcome to Adams/Solver Subroutines - Kxcad.net

Welcome to Adams/Solver Subroutines - Kxcad.net

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

192<br />

<strong>Adams</strong>/<strong>Solver</strong><br />

include the FUNCTION=USER() argument in the REQUEST statement and define the request output in<br />

a REQSUB.<br />

REQSUB passes back an array of eight values. You can call any utility subroutine from REQSUB <strong>to</strong><br />

make any element in the result array functionally dependent on system displacements, velocities,<br />

accelerations, forces, user-defined differential variables, or on-spline data.<br />

Tip: If the SYSARY or SYSFNC utility subroutine is called <strong>to</strong> access angular displacements,<br />

the values returned by them may contain discontinuities. To avoid the discontinuities, use<br />

the RCNVRT utility subroutine <strong>to</strong> convert the rotational angles from Euler angles <strong>to</strong> some<br />

other set of rotational coordinates that does not encounter a singularity.<br />

FORTRAN - Pro<strong>to</strong>type<br />

A sample structure for REQSUB is shown next. The comments explain how the subroutine works.<br />

SUBROUTINE REQSUB ( ID, TIME, PAR, NPAR, IFLAG,<br />

& RESULT )<br />

C<br />

C === Type and dimension statements ===================<br />

C<br />

C - External variable definitions ---------<br />

C<br />

INTEGER ID<br />

DOUBLE PRECISION TIME<br />

DOUBLE PRECISION PAR( * )<br />

INTEGER NPAR<br />

LOGICAL IFLAG<br />

DOUBLE PRECISION RESULT( 8 )<br />

C<br />

C ID Identifier of calling REQUEST statement<br />

C TIME Current time<br />

C PAR Array of passed statement parameters<br />

C NPAR Number of passed parameters<br />

C IFLAG Initialization pass flag<br />

C RESULT Array of values returned <strong>to</strong> ADAMS<br />

C<br />

C - Local variable definitions -----------<br />

C<br />

...<br />

C<br />

C === Executable code =================================<br />

C<br />

C Assign parameter values <strong>to</strong> readable variable names<br />

C<br />

...<br />

C<br />

IF( IFLAG ) THEN<br />

C<br />

C - Subroutine initialization -----------<br />

C<br />

...

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!