Main Content

Global Tunable Parameter Initialization for PC WORX

For PC WORX™, the coder generates an initialization function, PLC_INIT_PARAMETERS, to initialize global tunable parameters that are arrays and structures. This initialization function is called in the top-level initialization method.

For example, suppose that your model has a global array variable, ParArrayXLUT:

ParArrayXLUT=[0,2,6,10];

In the generated code, the PLC_INIT_PARAMETERS function contains the following code to initialize ParArrayXLUT:

(* parameter initialization function starts *)<br/>
ParArrayXLUT[0] := LREAL#0.0;<br/>
ParArrayXLUT[1] := LREAL#2.0;<br/>
ParArrayXLUT[2] := LREAL#6.0;<br/>
ParArrayXLUT[3] := LREAL#10.0;<br/>
(* parameter initialization function ends *)<br/></div></html>

The PLC_INIT_PARAMETERS function is renamed i0_PLC_INIT_PARAMETERS, and called in the top-level initialization method:

CASE SINT_TO_INT(ssMethodType) OF<br/>
    0: <br/>
        i0_PLC_INIT_PARAMETERS();<br/>