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.

Input Arguments<br />

<strong>Welcome</strong> <strong>to</strong> <strong>Adams</strong>/<strong>Solver</strong> <strong>Subroutines</strong><br />

id An integer variable that gives the identifier of the GSE statement<br />

requesting information from the GSE subroutine. From the identifier,<br />

<strong>Adams</strong>/<strong>Solver</strong> au<strong>to</strong>matically recognizes other information (such as the<br />

Par argument) that is associated with that GSE statement.<br />

time A double-precision variable containing the current simulation time.<br />

par A double-precision array containing the constant parameters taken in<br />

order from the USER parenthetical list in the GSE statement.<br />

npar An integer variable containing the number of constants in the<br />

Function=USER(...) parenthetical list in the GSE statement.<br />

The primary purpose is <strong>to</strong> provide the subroutine with the number of<br />

entries in the Par array.<br />

iflag A logical variable that is set <strong>to</strong> true when <strong>Adams</strong>/<strong>Solver</strong> calls the<br />

subroutine during the code initialization pass. For other evaluation<br />

subroutines, the flag is used when <strong>Adams</strong>/<strong>Solver</strong> needs functional<br />

dependency information and normally controls calls <strong>to</strong> the SYSFNC and<br />

SYSARY utility subroutines. Although you cannot call these routines<br />

from any of the GSE evaluation subroutines, you can use the IFLAG<br />

argument <strong>to</strong> control any other initialization you might need <strong>to</strong> do in the<br />

GSE evaluation subroutine.<br />

Output Arguments<br />

sample_step A double-precision scalar, containing the sample step (that is, the<br />

difference between the next sample time, and the current simulation).<br />

Example<br />

For an example of this subroutine, see gse_samp.f.<br />

C Style - Pro<strong>to</strong>type<br />

typedef void adams_c_GSESUB(const struct s<strong>Adams</strong>GSE* gse, double TIME,<br />

int DFLAG, int IFLAG, int NSTATE, const double* STATES, int NINPUT,<br />

const double* INPUTS, int NPUTPUT, double* STATED, double* OUTPUT);<br />

typedef void adams_c_GSEXU(const struct s<strong>Adams</strong>GSE* gse, double TIME,<br />

int IFLAG, int NSTATE, const double* STATES, int NINPUT, const<br />

double* INPUTS, int NOUTPUTS, double* DERIVS);<br />

typedef void adams_c_GSEXX(const struct s<strong>Adams</strong>GSE* gse, double TIME,<br />

int IFLAG, int NSTATE, const double* STATES, int NINPUT, const<br />

double* INPUTS, int NOUTPUTS, double* DERIVS);<br />

typedef void adams_c_GSEYU(const struct s<strong>Adams</strong>GSE* gse, double TIME,<br />

int IFLAG, int NSTATE, const double* STATES, int NINPUT, const<br />

double* INPUTS, int NOUTPUTS, double* DERIVS);<br />

177

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

Saved successfully!

Ooh no, something went wrong!