Subroutine Type |
Modeling |
|
Definition |
Used 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. |
||
Calling Syntax |
Fortran SUBROUTINE SENSUB (ID, TIME, PAR, NPAR, IFLAG, VALUE) SUBROUTINE SEVSUB (ID, TIME, PAR, NPAR, IFLAG, VALUE)
C 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 def SENSUB(id, time, par, npar, iflag): return value def SEVSUB(id, time, par, npar, iflag) return value
MATLAB function value = SENSUB(id, time, par, npar, iflag) function value = SEVSUB(id, time, par, npar, iflag) |
|
Input Arguments |
[integer] ID |
The user-defined sensor 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] IFLAG |
Initialization flag. |
|
Output Values |
[double precision] VALUE |
The output value that contains the value of the function that the sensor event returns (for SENSUB). |
[double precision] VALUE |
The output value that contains the value of the function that the sensor evaluate entity computes (for SEVSUB). |
|
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 |
See Also: