VARSUB
ModelingCalculates 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"
/>
Format
- Fortran Calling Syntax
-
SUBROUTINE VARSUB(ID, TIME, PAR, NPAR, DFLAG, IFLAG, VALUE)
- C/C++ Calling Syntax
-
void STDCALL VARSUB (int *id, double *time, double *par, int *npar, int *dflag, int *iflag, double *value)
- Python Calling Syntax
-
def VARSUB(id, time, par, npar, dflag, iflag): return value
- MATLAB Calling Syntax
-
function value = VARSUB(id, time, par, npar, dflag, iflag)
Attributes
- ID
- [integer]
- TIME
- [double precision]
- PAR
- [double precision]
- NPAR
- [integer]
- DFLAG
- [logical]
- IFLAG
- [logical]
Output
- VALUE
- [double precision]
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