SENSUB/SEVSUB
ModelingUsed to compute/evaluate the value for a sensor element. SENSUB can detect an event, while SEVSUB is used to return the scalar value computed when the event defined by the sensor occurs.
Use
User-defined request calling a SENSUB/SEVSUB for the calculation of output quantities:
<Sensor_Evaluate
id = "100"
type = "USERSUB"
usrsub_param_string = "USER(2,22,11)"
usrsub_dll_name = "NULL"
/>
<Sensor_Event
label = "Sensor/100"
id = "100"
type = "USERSUB"
usrsub_param_string = "USER(22,11)"
usrsub_dll_name = "NULL"
compare = "GE"
value = "0."
evaluate_id = "100"
error_tol = "0.0001"
/>
The sensor event element calls a SENSUB subroutine, while the sensor evaluate element returns the value computed in the SEVSUB when the event detected by the sensor occurs.
Format
- Fortran Calling Syntax
-
SUBROUTINE SENSUB (ID, TIME, PAR, NPAR, IFLAG, VALUE) SUBROUTINE SEVSUB (ID, TIME, PAR, NPAR, IFLAG, VALUE)
- C/C++ Calling Syntax
-
void STDCALL SENSUB (int *id, double *time, double *par, int *npar, int *iflag, double *value) void STDCALL SEVSUB (int *id, double *time, double *par, int *npar, int *iflag, double *value)
- Python Calling Syntax
-
def SENSUB(id, time, par, npar, iflag): return value def SEVSUB(id, time, par, npar, iflag) return value
- MATLAB Calling Syntax
-
function value = SENSUB(id, time, par, npar, iflag) function value = SEVSUB(id, time, par, npar, iflag)
Attributes
- ID
- [integer]
- TIME
- [double precision]
- PAR
- [double precision]
- NPAR
- [integer]
- IFLAG
- [logical]
Output
- VALUE
- [double precision]
- VALUE
- [double precision]
Example
def SENSUB(id, time, par, npar, iflag):
ipar =2*[0]
twopi =2.0*pi
ipar[0] = int(par[0])
ipar[1] = int(par[1])
[AZ, errflg] = py_sysfnc("AZ", ipar)
value = fmod(AZ,twopi) - (pi/2.0)
return value
def SEVSUB(id, time, par, npar, iflag):
itype =int(par[0])
ipar =1*[0]
ipar[0] =int(par[1])
[senval, errflg] = py_sysfnc("SENVAL", ipar)
value = senval+1.0
return value