PINSUB
ModelingCreates user-defined input to a control plant.
Use
<Control_PlantInput
id = "1"
label = "PlantIn"
num_element = "3"
variable_id_list = "1 2 3"
hold_order = "0"
interpreter = "Python"
script_name = "pinsub.py"
usrsub_fnc_name = "PINSUB"
usrsub_param_string = "USER(0.001)"
/>
Format
- Fortran Calling Syntax
-
SUBROUTINE PINSUB (ID, TIME, PAR, NPAR, DFLAG, IFLAG, NVALUE, VALUE)
- C/C++ Calling Syntax
-
void STDCALL PINSUB (int *id, double *time, double *par, int *npar, int *dflag, int *iflag, int *nvalue, double *value)
- Python Calling Syntax
-
def PINSUB(id, time, par, npar, dflag, iflag): return value
- MATLAB Calling Syntax
- Not supported.
Attributes
- ID
- [integer]
- TIME
- [double precision]
- PAR
- [double precision]
- NPAR
- [integer]
- DFLAG
- [logical]
- IFLAG
- [logical]
- NVALUE
- [integer]
Output
- VALUE
- [double precision]
Example
from math import *
def PINSUB(id, time, par, npar, dflag, iflag):
h_max = par[0]
t = 1*[0]
if iflag==1:
py_savpar(101, t)
[t, info] = py_relpar(101)
old_time = t[0]
if time>=old_time+h_max:
old_time = time
t[0] = old_time
py_savpar(101, t)
dz = 0.5*sin(2*pi*old_time)
vz = pi*cos(2*pi*old_time)
accz = -2*pi*pi*sin(2*pi*old_time)
return [dz, vz, accz]