# REQSUB

ModelingUsed to compute outputs for a user-defined request element. This is typically done when the output quantities are too complicated to be expressed as explicit functions.

## Use

User-defined request calling a REQSUB for the calculation of output quantities:
<Post_Request
comment             = "reqsub"
id                  = "70000006"
type                = "USERSUB"
usrsub_param_string = "USER(30102,30123,30003)"
usrsub_dll_name     = "NULL"
/>

## Format

Fortran Calling Syntax
SUBROUTINE REQSUB (ID, TIME, PAR, NPAR, IFLAG, RESULTS)
C/C++ Calling Syntax
void STDCALL REQSUB (int *id, double *time, double *par, int *npar, int *iflag, double *results)
Python Calling Syntax
def REQSUB(id, time, par, npar, iflag):
return results
MATLAB Calling Syntax
function results = REQSUB(id, time, par, npar, iflag)

## Attributes

ID
[integer]
The user-defined request element identifier.
TIME
[double precision]
The current simulation time.
PAR
[double precision]
An array that contains the constant arguments from the list provided in the user-defined statement.
NPAR
[integer]
The number of entries in the PAR array.
IFLAG
[logical]
The initialization flag.

## Output

RESULTS
[double precision]
The vector output value of dimension eight that contains the computed outputs.

## Example

def REQSUB(id, time, par, npar, iflag):

states =9*[0.0]
ipar =3*[0]

results =8*[0.0]

ipar[0] =int(par[1])
ipar[1] =int(par[2])
ipar[2] =int(par[3])

[states, errflg] = py_sysary("TFORCE", ipar)
results[1] = states[0]
results[2] = states[1]
results[3] = states[2]

[states, errflg] = py_sysary("RFORCE", ipar)
results[5] = states[0]
results[6] = states[1]
results[7] = states[2]

return results