Subroutine Type |
Modeling |
|
Definition |
Calculates an algebraic value for a user defined variable element. |
|
Use |
User-defined variable calling a VARSUB for the calculation of its algebraic values: |
|
<Reference_Variable id = "30100100" type = "USERSUB" usrsub_param_string = "USER(30131,30100,0.01,1)" usrsub_dll_name = "NULL" /> |
||
Calling Syntax |
Fortran SUBROUTINE VARSUB(ID, TIME, PAR, NPAR, DFLAG, IFLAG, VALUE)
C void STDCALL VARSUB (int *id, double *time, double *par, int *npar, int *dflag, int *iflag, double *value)
Python def VARSUB(id, time, par, npar, dflag, iflag): return value
MATLAB function value = VARSUB(id, time, par, npar, dflag, iflag) |
|
Input Arguments |
[integer] ID |
The user-defined variable element identifier. |
[double precision] TIME |
The current simulation time. |
|
[double precision] PAR |
An array that contains the constant arguments from the list provided in the user defined statement. |
|
[integer] NPAR |
The number of entries in the PAR array. |
|
[logical] DFLAG |
The differentiating flag. |
|
[logical] IFLAG |
The initialization flag. |
|
Output Values |
[double precision] VALUE |
The output that contains the algebraic variable value that the VARSUB has computed. |
Example |
def VARSUB(id, time, par, npar, dflag, iflag):
ipar = 2*[0] ipar[0] = int(par[0]) ipar[1] = int(par[1]) [dz, errflg] = py_sysfnc("DZ", ipar) py_errmes(errflg, "Error calling SYSFNC for DZ", id, "STOP") [vz, errflg] = py_sysfnc("VZ", ipar) py_errmes(errflg, "Error calling SYSFNC for VZ", id, "STOP")
value = -par[2]*vz - par[3]*dz
return value |
See Also: