Skip to main content

Subsection: Device

The Device subsection defines devices to be added by the device generator. There are several types of generated devices that are defined with the different subsections Identification, Wildcard, and FlexibleWildcard .

Syntax:

SEC DeviceGenerator                                 //optional: yes, modifier: [UPDATE]
    SEC Device : <target ID>                  //optional: yes, modifier [UPDATE]
        Parent := <target ID>;                //optional: yes, type: ID
        ParentSlotIndex := <slot number>;     //optional: yes, type: literal/integer
        SEC Identification                          //optional: yes, modifier: [UPDATE]
            Type := <type number>;            //optional: no, type: literal/string
            ID := <ID mumber>;                //optional: no, type: literal/string
            ModuleID := <module ID>;          //optional: yes, type: literal/string
            Version := <version mumber>;      //optional: no, type: literal/string
            SEC SetChildName                        //optional: yes, modifier: [UPDATE]
                Value := <child name>;        //optional: no, type: literal/string
                ChildIndex := <index number>; //optional: no, type: literal/string
            END_SEC
        END_SEC
    END_SEC
    SEC ExportDevice                                //optional: yes, modifier: [UPDATE, HIDE]
        Files   :=[<filename1>, <filename2>, ...];  //optional: no, type: string
    END_SEC
END_SEC
. Specification:
  • The Device section has a target ID that uniquely identifies it among the other generated devices of a module. This ID can be used to reference this device. This is mainly done in the definition Parent of other created devices or connected I/Os.

  • The Parent definition specifies the desired parent device under which the created device is to be mounted.

    The parent device can be identified not at all (definition is optional), by its ID or by a parameter.

    In detail, the parent device is then determined in the following way:

    • If no Parent is defined at all, the first matching available parent is always used, and for an empty Parent definition only searches starting from the first parent module. If no device is defined in the direct parent module itself, the history of the parent modules is tracked until there is finally a device that matches or the toplevel module is reached. In this case, its application device is then used if possible.

    • If, in addition, a device ID or a parameter is specified as a Parent , the history of the parent devices is scanned in the same way, whereby the devices of the output module itself are now also taken into account and a possible parent device must also have the corresponding ID.

    • If, according to the rules described above, no possible parent device can be found, an error is output during the generation check.

    • ParentSlotIndex: Specifies the index of the slot (number) of the parent device into which the device is inserted. This is helpful when plugging is required.

  • The Identification subsection includes the unique description of a device to be added. This creates a unique reference to this Device type.

    • The definitions Type, ID, ModuleID, and Version of the Identification section uniquely identify a device type of a specific version. For example, an EtherCAT Master has the following definition:

      Type := '64';

      ID := '000 0001';

      Version := '3.5.1.0';

      If * is defined as the version, the latest version of the device is always used. If the ModuleID definition is not used, the system is searched for devices with a DeviceIdentification, otherwise it is searched for devices with a module identification.

      If the defined device does not exist in the device repository, a corresponding error message is already issued during the scan process.

    • Subsection: SetChildName with the definitions for Value and ChildIndex

      These options allow you to specify the name which an automatically inserted device should have. If the same name is used more than one time, then the resulting name is made unique by appending an underscore and a number.

      • Value: Desired name of the device

      • ChildIndex: Index of the automatically inserted device to be renamed

    This section offers the possibility to fill the fields with the help of the Input Assistant. To do this, place the cursor at the end of the line after Identification and press Return. Afterwards, the Input Assistant opens and offers the available channels. After you choose a device, the corresponding parameters are transferred to the module declaration. Please note that this function is only available when the end of the sub-section (END_SEC) has not been entered yet.

  • The definition Files contains a list of devices that will be added to the project. These devices were manually configured and exported to a library.

Example 30. Example
SEC Device : Buskoppler2
    SEC Identification
        Type := '65';
        ID := '2_044C2C5200110000';
        Version := '*';
    END_SEC
END_SEC
SEC Device : KlemmeDigitalOutput
    Parent := Buskoppler2;
    SEC Wildcard : KlemmeTyp
        Desc := TL.WildDesc;
    END_SEC
    SEC ExportDevices
        Files := [ExtFile.BK5120_1SDO, ExtFile.BK5120_2SDO];
    END_SEC
END_SEC


Example 31. Example with parameters
SEC std.DeviceGenerator
    SEC Device : CANopen_Manager
        Parent := CurrentCAN;
        SEC FlexibleIdentification
           Type := '16';
           ID := '181016';
           Version := '*';
           Maximum := 1;
        END_SEC
    END_SEC
END_SEC
SEC std.Parameters
    SEC Param : CurrentCAN
        Name := TL.CurrentCAN_Name;
        Desc := TL.CurrentCAN_Desc;
        VariableType := wSTRING;
        Default := 'CANBus_0';
    END_SEC
END_SEC


Example 32. Example of defining a device name
SEC std.DeviceGenerator
	SEC Device : EcoVario
	    Parent := CanManager;
		SEC Identification
		    Type := '18';
		    ID := '1619 0001';
		    Version := '*';
		    SEC SetChildName : ChildDevice
			    Value := 'ChildName';
			    ChildIndex := 0;
		    END_SEC
	    END_SEC
    END_SEC
    SEC Parameters : EcoVario
	    SEC AddParameter : BoolParamAdd
		    ParameterID := '150';
		    ParameterName := 'BoolParam';
	    	ParameterType := 'std:BOOL';
		    ChildIndex := 0;
	    END_SEC
	    SEC SetParameter : BoolParamAdd
		    ParameterID := '150';
			ElemPath := '';
			Value := 'TRUE';
			ChildIndex := 0;
		END_SEC
		SEC SetParameter : bVirtual
			ParameterID := '1040';
			ElemPath := '';
			ConnectorID := '0';
			Value := 'TRUE';
			ChildIndex := 0;
		END_SEC
	END_SEC
    SEC InstRefMapping : Axis
	    SEC Demand
	        Desc := TL.DescAxis;
			Properties := [SM_DRIVE_CAN];
		END_SEC
	END_SEC
END_SEC