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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

102<br />

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

argument is false, SYSARY returns the instantaneous values of the system states. You can make several<br />

calls <strong>to</strong> SYSARY, specifying each time the function used, and the parameters of the function.<br />

Tip: 1. Use SYSFNC <strong>to</strong> access individual states. Quite often, user-defined values depend<br />

on a single-system state such as the x component of the displacement between two<br />

markers, or the z component of the velocity between two markers. While you can<br />

use SYSARY <strong>to</strong> access the individual components, a single call <strong>to</strong> SYSFNC is<br />

convenient and more efficient. The use of SYSFNC is therefore recommended<br />

under these circumstances.<br />

Examples<br />

2. Use RCNVRT <strong>to</strong> convert rotational displacements Euler angles <strong>to</strong> any other angle<br />

representation, for example <strong>Adams</strong> AX, AY, AZ projected angles.<br />

CALL SYSFNC (`RDISP', IPAR, 2, ANGLES, NSTATE, ERRFLG)<br />

CALL RCNVRT (`EULER', ANGLES, `AXAYAZ', ANGLES, ISTAT)<br />

Use SYSFNC <strong>to</strong> access individual states.Quite often, user-defined values depend<br />

on a single-system state such as the x component of the displacement between two<br />

markers. While you may use SYSARY <strong>to</strong> access the individual components, a<br />

single call <strong>to</strong> SYSFNC is convenient and more efficient. The use of SYSFNC is<br />

therefore recommended under these circumstances.<br />

Caution: When the iflag argument is true, you must be sure <strong>to</strong> make the same SYSARY calls as when<br />

actually computing the results. <strong>Adams</strong>/<strong>Solver</strong> passes a parameter iflag <strong>to</strong> each user-written<br />

subroutine (xxxSUB). It indicates <strong>to</strong> you whether <strong>Adams</strong>/<strong>Solver</strong> is calling the subroutine<br />

for an initialization pass (iflag = true) or for a function evaluation (iflag =false). You must<br />

construct user-written subroutines such that all calls <strong>to</strong> SYSARY that are made during the<br />

simulation are also invoked when the iflag argument is true. <strong>Adams</strong>/<strong>Solver</strong> uses this<br />

information <strong>to</strong> construct the correct Jacobian matrix.<br />

This example shows properly written calls <strong>to</strong> SYSARY for UVX, UVY, UVE, and DC.<br />

SUBROUTINE VARSUB (ID, TIME, PAR, NPAR, DFLAG, IFLAG, VALUE)<br />

C<br />

C Inputs:<br />

C<br />

INTEGER ID, NPAR<br />

DOUBLE PRECISION TIME, PAR(*)<br />

LOGICAL DFLAG, IFLAG<br />

C<br />

C Outputs:<br />

C<br />

LOGICAL VALUE<br />

C<br />

C Local Variables:

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

Saved successfully!

Ooh no, something went wrong!