Skip to main content

Section: Parameters

In this section all parameters can be defined which must be available for a parameterization in the Parameters of the module instance.

SEC Parameters                               //optional: yes, modifier: [UPDATE]
    SEC Param : <parameter identifier>         //optional: yes, modifier [HIDE,UPDATE]
            Variable := <variable name>;         //optional: yes, type: InstancePath
            VariableType := <data type>          //optional: yes, type: @JG???IEC-Typ
            Name := <parameter name>;            //optional: no, type: text
            Desc := <parameter description>;     //optional: no, type: text
            Group := <parameter group name>      //optional: yes, type: text
            MustBeSet := TRUE/FALSE              //optional: yes, type: BoolFlag
            Default := <default value>;          //optional: yes, type: LiteralOrConstant
            Max := <max value>;                  //Optional: yes, type: LiteralOrConstant
            Min := <min value>;                  //Optional: yes, type: LiteralOrConstant
    END_SEC
END_SEC

Details regarding the syntax of definition types are described in the section Module Declaration.

. Specification:
  • The target of the section Param must identify the parameter uniquely.

  • The definition Variable is an input instance path relative to the module function block. This variable will store the parameter value, its type defines the parameter type. If Variable is declared, the parameter VariableType does not have to be defined and will be ignored.

  • The parameter VariableType defines the IEC type of the variable. If VariableType is declared but no real existing FB variable is given in the Variable definition, the Default definition must exist. This value must match the VariableType.

  • The parameters Name and Desc are strings and must be defined in a text list.

  • Module parameter can be basic types and enumerations but no instances of structures and arrays.

  • Parameter variables must have Initialization values, which are defined in the declaration of the function block.

  • The optional parameter Default allows to overwrite the initialization value. For the initialization expression and for the default value literals and constants of the correct type are allowed. This includes library parameters.

  • The optional parameter Group allows to split the parameters in groups. Each group is then displayed as a separate tab in the module editor under Parameters .

  • With the optional parameter MustBeSet the user can be forced to set a parameter in the module editor. If the parameter is not set, an error message appears.

  • The definitions Min and Max allow to set limits for the parameter value. A check of these limits is only possible for variables of numeric type or times. All other variable types are not allowed and will produce an error.

Example 20. Example
SEC Parameters
        SEC Param : InParam1
                Variable := xIn1;
                VariableTyp := BOOL;
                Name := TL.Input1_Name;
                Desc := TL.Input1_Desc;
        END_SEC
END_SEC

The variable xIn1 must be defined in the declaration part of the function block: xIn1 : BOOL := FALSE ;



Initialization values

The initialization value is the value of a variable which is defined in the initialization. In simple variables of the FB this value is always on the right side of the variable declaration:

iVar : INT := 17 ;  // Initialisierungswert: 17

In case of definition of variables in structures the initialization of the structure is essential:

TYPE s : STRUCT
        i1 : INT := 7 ;
        r1 : REAL := 5 ;
END_STRUCT END_TYPE

Declaration in the module FB:

structVar : s := (i1 := 2, r1 := 0.0) ;

In this case the initialization value which defines the value of structVar.i1 is 2 (and not 7).

In nested structures all initializations in the path from the module FB to the variable must be considered. The outermost initialization of the variable determines the value.