Skip to main content

小节:设备

Device 小节定义了设备生成器要添加的设备。生成的设备有多种类型,它们是用不同的小节定义的 Identification, Wildcard, 和 FlexibleWildcard

句法:

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
. 规格:
  • Device 部分有一个目标 ID,可在模块的其他生成的设备中唯一标识该部分。该 ID 可用于引用该设备。这主要是在定义中完成的 Parent 其他创建的设备或连接的 I/O。

  • Parent 定义指定要在其下安装创建的设备的所需父设备。

    父设备根本无法通过其 ID 或参数来识别(定义是可选的)。

    具体地,然后通过以下方式确定父设备:

    • 如果不 Parent 完全定义后,始终使用第一个匹配的可用父级,并且对于空的 Parent 定义仅从第一个父模块开始搜索。如果直接父模块本身没有定义设备,则跟踪父模块的历史记录,直到最终有匹配的设备或到达顶层模块。在这种情况下,如果可能的话,则使用其应用装置。

    • 另外,如果将设备 ID 或参数指定为 Parent ,以相同的方式扫描父设备的历史记录,由此输出模块本身的设备现在也被考虑在内,并且可能的父设备也必须具有相应的ID。

    • 如果根据上述规则找不到可能的父设备,则在代检查期间输出错误。

    • ParentSlotIndex:指定设备插入的父设备的插槽索引(编号)。当需要插入时这很有用。

  • Identification 小节包括要添加的设备的唯一描述。这将创建对此的唯一引用 Device 类型。

    • 定义 Type, ID, ModuleID, 和 VersionIdentification 部分唯一标识特定版本的设备类型。例如,EtherCAT 主站具有以下定义:

      Type := '64';

      ID := '000 0001';

      Version := '3.5.1.0';

      如果 * 定义为版本,始终使用设备的最新版本。如果 ModuleID 如果不使用定义,则系统将搜索具有 DeviceIdentification 的设备,否则将搜索具有模块标识的设备。

      如果设备存储库中不存在定义的设备,则在扫描过程中已发出相应的错误消息。

    • 小节: SetChildName 与定义 ValueChildIndex

      这些选项允许您指定自动插入的设备应具有的名称。如果同一名称使用多次,则通过附加下划线和数字来使生成的名称唯一。

      • Value:所需的设备名称

      • ChildIndex:要重命名的自动插入设备的索引

    此部分提供了在输入助手的帮助下填写字段的可能性。为此,请将光标放在行尾之后 Identification 并按 返回。然后,输入助手将打开并提供可用的频道。选择设备后,相应的参数将传输到模块声明中。请注意,此功能仅在小节结束时可用(END_SEC) 尚未输入。

  • 定义 文件 包含将添加到项目中的设备列表。这些设备是手动配置并导出到库中的。

30. 例子
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


31. 带参数的示例
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


32. 定义设备名称的示例
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