Skip to main content

Section: Slots

This section defines the availability and the type of slots of modules in the module tree. Two different types of slots can be defined.

Slot

SEC Slots                                                   //optional: yes, modifier: [UPDATE]]
    SEC Slot : <slot identifier>                            //optional: yes, modifier [HIDE,UPDATE]
            Variable := <variable name>;                        //optional: no, type: InstancePath
            Role := <role name>;                                //optional: no, type: text
            Type := <slot type>;                                //optional: no, type: SlotType
            Inst_Prefix := <instance prefix>;                   //optional: yes, type: ID
            Optional := TRUE/FALSE;                             //optional: yes, type: BoolFlag
            Default_Inst_Name := <instance name>;               //optional: yes, type: text
            Pragmas := [<pragma1>, <pragma2>,...];              //optional: yes, type: Pragmalist
            RegularExpressionParameterId :=  <RegEx param ID>   //optional: yes, type: text
            SEC Default_Allocation :                            //optional: yes, modifier [UPDATE]
                    Module_Name := <default module ID>;             //optional: yes, type: ID
                    Instance_Name := <default name>;                //optional: yes, type: ID
                    NotDeletable := TRUE/FALSE                      //optional: yes, type: BoolFlag
                    SEC VisuEmbeddings                              //optional: yes, modifier [UPDATE]
                            Empty := TRUE/FALSE;                        //optional: yes, type: BoolFlag
                            SEC Embedding : <visu identigier>           //optional: yes, modifier [UPDATE]
                                    VisuName := <visu name>;                //optional: no, type: ID
                                    Target := <target name>;                //optional: yes, type: ID
                                    LinkId := <link ID>;                    //optional: yes, type: ID
                            END_SEC
                    END_SEC
                    SEC PageVisu                                    //optional: yes, modifier [UPDATE]
                            VisuName := <visu name>;                    //optional: yes, type: ID
                            TopLevelTap := TRUE/FALSE;                  //optional: yes, type: BoolFlag
                    END_SEC
                    SEC IOMappings                                  //optional: yes, modifier [UPDATE]
                            SEC Mapping : <mapping identifier>          //optional: yes, modifier [UPDATE]
                                    NoMapping := TRUE/FALSE;                //optional: yes, type: BoolFlag
                                    STExpression := <ST expression>;        //optional: yes, tye: ID/ST expression
                            END_SEC
                    END_SEC
                    SEC Parameters                                  //optional: yes, modifier [UPDATE]
                            SEC Param : <param identifier>              //optional: yes, modifier [UPDATE]
                                    Value := <value>;                       //optional: no, type: ID)
                            END_SEC
                    END_SEC
            END_SEC
    END_SEC
END_SEC

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

. Specification:
  • The section Slot defines a slot which allows 0 connection or 1 connection.

  • The target of the section Slot must identify the parameter uniquely. As a result, there must not be two different slots (whether Slot or Slot_Multi) that have the same target. (Upper/lower case is irrelevant.)

  • The definition Variable is an input instance path relative to the module function block. The instance path may refer in all its components only to input variables (for structure instances also local variables). The type of the addressed variable must be an interface or a FB type. Two different slots must not use the same variable.

  • Role defines the role description of the slot.

  • Type defines the slot type. The connection type can have the following values:

    • SUBMODULE: Slot for submodule instances.

    • REFERENCE: Slot for referenced submodule instances.

    • DECOUPLED: Slot for "decoupled" module instances.

      See also: Section: Decoupled

  • Inst_Prefix is a prefix which is used for the name of the generated FB variable. Empty prefix (Inst_Prefix := ;) is also possible, but may create conflicts with other variable names of the function block. May only be specified for SUBMODULE type slots.

  • Optional defines if it is allowed to leave the slot open or if it must be connected.

  • Default_Inst_Name can be used to define a default name for module instances being children of this slot. Each module which is added will get this name by default using text list entry defined by "Default_Inst_Name". The default name of the slot is preferred to the one of the modules meta data.

  • Pragmas contains a list of compiler pragmas which are inserted before FB instances of the submodules. Pragmas may only be used for managed slots.

  • RegularExpressionParameterId defines a parameter of type STRING/WSTRING for this slot. The value of this parameter is interpreted as regular expression and it must match the name of the inserted submodule.

  • The sections Slot.Default_Allocation and Slot_Multi.Default_Allocation allow to define default settings for slots with variable numbers of elements (Multi_Slots and Slots). For Slots.Multi_Slot they must be identified by unique targets whereas Slots.Slot has not target and can only have one Default_Allocation section. The instance will be added depending on its position within the section. The module name and instance name follows the definition of Slot.DefaultModule and Slot.DefaultName. If this definitions are not available the settings of Default_Allocation.Module_Name and Default_Allocation.Instance_Name will be used. It is recommended to use Default_Allocation.* for slots instead of DefaultModule and DefaultName which only exists for compatibility reasons. The settings of the default module instance can be defined in the subsections of Default_Allocation:

    • Module_Name defines the name of the module of which an instance will be created automatically. If the module comes from a library, the module name must be qualified with namespace. The parameter is only allowed for slots of type SUBMODULE.

      Infinite calls are not allowed and will create an error message (example: declaration of module "A" contains default module "B"; declaration of module "B" contains default module "A").

    • Instance_Name must be specified whenever DefaultModule is specified, and never otherwise. It must be a valid IEC identifier which is used as the name of the default module instance. The name must not begin or end with an underline (_). The default names of all slots of a declaration must be unique. (Case sensitivity makes no difference.)

    • NotDeletable specifies whether or not the module can be deleted by the user. If TRUE, then the module cannot be deleted. An error message is displayed. If the parameter is FALSE or it is omitted, then the module can be deleted.

    • VisuEmbeddings: If the Empty parameter is set to TRUE, then an empty list of embedded visus is created for this module instance. If the value is FALSE, then the desired list of embedded visualizations can be generated for the module instance via the listing of desired embedded visualizations in the Embedding subsection. Each Embedding section must define the name VisuName of the desired embedded visu for this purpose and can specify additional properties such as Target or LinkId of this embedded visu.

    • PageVisu: In this section the PageVisu of the module instance can be chosen (VisuName). Furthermore it can be defined if this visu creates a TopLevelTap. The parameter TopLevelTap has to be given the values TRUE and FALSE.

    • IOMappings: In the subsection Mapping the I/O channels can be defined. The targets of the sections Mapping describe the target I/O channel. The default can be set to NoMapping or to an STExpression.

    • Parameters: In the subsection Param the value Value of each parameter which is defined in the target of the section can be defined.

Slot_Multi

By use of the section Slot_Multi a list of subinstances and references can be created.

SEC Slots                                                   //optional: yes, modifier: [UPDATE]]
    SEC Slot_Multi : <slot name>                            //optional: yes, modifier [HIDE,UPDATE]
            Variable := <variable name>;                        //optional: no, type: InstancePath
            Var_Count := <variable for count>;                  //optional: no, type: InstancePath
            Role := <name role>;                                //optional: no, type: text
            Cardinality := [<minimum> .. <maximum>];            //optional: no, type: Cardinality
            Type := <slot type>;                                //optional: no, type: SlotType
            Inst_Prefix := <instance prefix>;                   //optional: yes, type: ID
            Pragmas := <pragma list>;                           //optional: yes, type: Pragmalist
            Default_Inst_Name := <instance name>;               //optional: yes, type: text
            RegularExpressionParameterId :=  <RegEx param ID>   //optional: yes, type: text
            SEC Default_Allocation :                            //optional: yes, modifier [UPDATE]
                    Module_Name := <default module ID>;             //optional: yes, type: ID
                    Instance_Name := <default name>;                //optional: yes, type: ID
                    NotDeletable := TRUE/FALSE                      //optional: yes, type: BoolFlag
                    SEC VisuEmbeddings                              //optional: yes, modifier [UPDATE]
                            Empty := TRUE/FALSE;                        //optional: yes, type: BoolFlag
                            SEC Embedding :  <visu identifier>          //optional: yes, modifier [UPDATE]
                                    VisuName := <visu name>;                //optional: no, type: ID
                                    Target := <target name>;                //optional: yes, type: ID
                                    LinkId := <link ID>;                    //optional: yes, type: ID
                            END_SEC
                    END_SEC
                    SEC PageVisu                                    //optional: yes, modifier [UPDATE]
                            VisuName := <visu name>;                    //optional: yes, type: ID
                            TopLevelTap := TRUE/FALSE;                  //optional: yes, type: BoolFlag
                    END_SEC
                    SEC IOMappings                                  //optional: yes, modifier [UPDATE]
                            SEC Mapping :  <mapping identifier>;        //optional: yes, modifier [UPDATE]
                                    NoMapping := TRUE/FALSE;                   //optional: yes, type: BoolFlag
                                    STExpression := <ST expression>;        //optional: yes, tye: ID/ST expression
                            END_SEC
                    END_SEC
                    SEC Parameters                                  //optional: yes, modifier [UPDATE]
                            SEC Param :  <param identifier>             //optional: yes, modifier [UPDATE]
                                    Value := <value>;                       //optional: no, type: ID)
                            END_SEC
                    END_SEC
            END_SEC
    END_SEC
END_SEC
. Additional specifications:
  • Var_Count defines the input instance path of the module function block. This variable (of type Integer) will save the information about the number of instances connected to the slot.

  • Cardinality defines the minimum and maximum number of instances.

  • The Slot_Multi.Default_Allocation section can be used to define default allocations for slots with variable number of elements. They must be identified via unique targets. The instances are inserted in the order of the sections. For the module name and instance name, the specifications for Slot.DefaultModule or Slot.DefaultName apply. The number of default assignments must not exceed the upper digit.

  • The variable addressed by a Slot_Multi section must be of type POINTER TO <INTERFACE>.

  • Each input variable of type integer can be addressed by Var_Count only once. (This also includes InstRef_Multi.Var_Count and VarArray.Var_Count).

Example 21. Example
SEC Slot
        SEC Slot_Multi : subs
                Variable := pSubs;
                Var_Count := uiArraySize;
                Role := TL.Role;
                Cardinality := [2 .. 17];
                Type := SUBMODULE;
                RegularExpressionParameterId := Param_RegEx_Ref;
                SEC Default_Allocation : def1
                        Module_Name   := Sub1;
                        Instance_Name := Submodule;
                END_SEC
                Name := TL.Input1_Name;
                Desc := TL.Input1_Desc;
        END_SEC
END_SEC

Among other declarations the declaration part of the function block must contain: uiArraySize: UINT; pSubs: POINTER TO ITestModule.

In the example, a slot is defined that holds at least 2, but at most 17 subinstances. An array will be created for the subinstances and pSubs points to it. When adding the instance the submodule with name Submodule of type Sub1 will be added automatically to the slot.