POUTSUB

ModelingRetrieves output from a control plant.

Use

<Control_PlantOutput
       id                  = "2"
       label               = "PlantOut"
       num_element         = "2"
       variable_id_list    = "100, 200"
       hold_order          = "2" 
       interpreter         = "Python"
       script_name         = "poutsub.py"
       usrsub_fnc_name     = "POUTSUB" 
       usrsub_param_string = "USER(100, 200)"
     />

Format

Fortran Calling Syntax
SUBROUTINE POUTSUB (ID, TIME, PAR, NPAR, IFLAG)
C/C++ Calling Syntax
void STDCALL POUTSUB (int *id, double *time, double *par, int *npar, int *iflag)
Python Calling Syntax
def POUTSUB(id, time, par, npar, iflag):
MATLAB Calling Syntax
Not supported.

Attributes

ID
[integer]
The field element identifier.
TIME
[double precision]
The current simulation time.
PAR
[double precision]
An array that contains the constant arguments from the list provided in the user-defined statement.
NPAR
[integer]
The number of entries in the PAR array.
IFLAG
[logical]
The initialization flag.

Example

from math import sin, cos, pi

def POUTSUB(id, time, par, npar, iflag):
    print("POUTSUB, input : ", id, time, par, npar, iflag)

    force = []
    for i in range(npar):
        var_id = int(par[i])
        x, errflg = py_sysfnc("VARVAL", var_id)
        force.append(x)
    print("POUTSUB, output : ", force)