DIFSUB
ModelingUsed to calculate a differential equation value for a control DIFF entity.
Use
A control diff statement based on a user-defined differential equation:
<Control_Diff
label = "Diff/301001"
id = "301001"
is_implicit = "FALSE"
ic = "0."
ic_dot = "0."
is_static_hold = "FALSE"
type = "USERSUB"
usrsub_param_string = "USER(30102020,30101010)"
usrsub_dll_name = "NULL"
/>
Format
- Fortran Calling Syntax
-
SUBROUTINE DIFSUB (ID, TIME, PAR, NPAR, DFLAG, IFLAG, VALUE)
- C/C++ Calling Syntax
-
void STDCALL DIFSUB (int *id, double *time, double *par, int *npar, int *dflag, int *iflag, double *value)
- Python Calling Syntax
-
def DIFSUB(id, time, par, npar, dflag, iflag): return values
- MATLAB Calling Syntax
-
function value = DIFSUB(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 DIFSUB(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")
ipar =1*[0]
ipar[0] =id
[dif, errflg] = py_sysfnc("DIF", ipar)
py_errmes(errflg,"Error calling SYSFNC for DIF",id,"STOP")
value = dz-dif
return value