Creating and handling AX5000 devices
This documentation article describes how to create AX5000 devices and and modify their mailbox startup list as well as their power management, PDO and motor condfiguration. All of these settings can be modifies by using the XML description of the AX5000 TreeItem. This article consists of the following chapters:
- Creating an AX5000 I/O device
- Overview XML description
- Parametrization and template generation
- Available tools and samples
- Mappings
Creating an AX5000 I/O device
AX5000 devices can be created by using the CreateChild() method. Please consult the documentation article Erstellung von und Umgang mit EtherCAT-Teilnehmern for more information.
Code Snippet (C#)
ITcSmTreeItem etherCatMaster = sysManager.LookupTreeItem("TIID^EtherCAT Master");
ITcSmTreeItem ax5000 = ethercatMaster.CreateChild("AX5000", 9099, "", "AX5203");
Code Snippet (Powershell)
$etherCatMaster = $sysManager.LookupTreeItem("TIID^EtherCAT Master")
$ax5000 = $ethercatMaster.CreateChild("AX5000", 9099, "", "AX5203")
Overview XML description
The XML description of an AX5000 device consists of the following parts (references to an XML node written as XPath).
Part | Description |
---|---|
/TreeItem/EtherCAT/Slave/Mailbox/SoE/InitCmds/ | Mailbox startup list for drive, including the power management and motor configuration. |
/TreeItem/EtherCAT/Slave/ProcessData/TxPdo /TreeItem/EtherCAT/Slave/ProcessData/RxPdo | PDO configuration |
Mailbox startup list
The mailbox startup list therefore includes many different types of init commands, which are identified via their IDN. Please note that the IDN that is displayed in TwinCAT XAE does not equal the IDN in the XML description, which is why a mapping needs to happen. For example: The IDN P-0-0050 (Motor construction type) equals <IDN>32818</IDN> (0x800A hex). To make this mapping and the identification which init command belongs to which type (drive, motor, power management), the tools that are mentioned below already include a sample mapping for an AX5000_0000_0210.
Import of startup list Please note that the startup list always needs to be imported as a whole (including all init commands). This is also true if only one or two init commands have been changed. |
PDO configuration
The PDO configuration is straight-forward and consists of a TxPdo (Inputs) and RxPdo (Outputs) section. Each PDO entry is identified by its Index (hex) and contains a name, bit length and data type. The optional property “Fixed” describes whether this entry can be deleted via TwinCAT XAE.
AdsInfo When creating a template, the <AdsInfo> section does not need to be present and can be removed from the template file because this information is generated by the TwinCAT XAE. |
Import of PDO configuration Please note that the PDO configuration always needs to be imported as a whole. This is also true if only one or two PDO entries have been changed. |
Parametrization and template generation
It is recommended to create templates for different AX5000 configurations and also a different template for each channel (A and B) of a drive. These templates can then be assembled to a full AX5000 XML description, which can be imported either via the XAE menu entry “TwinCAT -> SelectedItem -> Import XML description” or via the Automation Interface method ConsumeXml().
In order to make the template generation process easier, several tools and samples for the Windows Powershell and C# are available for download. All of these tools are further described below.
Available tools and samples
The following table provides an overview about the available tools and samples that provide help with handling AX5000 configurations via Automation Interface.
Name | Language | Description |
---|---|---|
CreateTcIoAx5000_Templates | Windows Powershell | Demonstrates how to generate template files out of a pre-configured AX5000 configuration. |
CreateTcIoAx5000_Config | Windows Powershell | Demonstrates how to create an AX5000 configuration based on template files. |
Please note that these scripts do not use the TwinCAT Automation Interface API but instead provide help with the preparation of XML configuration files.
CreateTcIoAx5000_Templates
This Windows Powershell script demonstrates how to generate template files out of a pre-configured AX5000 configuration. As a prerequisite, the AX5000 configuration needs to be exported to XML via the TwinCAT XAE menu entry “TwinCAT -> Selected Item -> Export XML description”. This has been done demonstratively for two configuration (SelectedItem_ExportXml_Test1.xml and SelectedItem_ExportXml_Test2.xml). The path to one of these files is then configured in the local variable $FullNameXmlExport within the Powershell script.
The script then loads the config file and subsequently extracts the XML configuration entries for the mailbox startup list, PDOs, power management and motor configuration and saves this information in separate template files (for each channel and for each type of configuration), which can later be re-added to a configuration by using the script “CreateTcIoAx5000_Config”.
CreateTcIoAx5000_Config
This Windows Powershell scripts demonstrates how to build a full AX5000 configuration out of different template files. These template files provide the settings for the PDO configuration as well as the mailbox startup list with their init commands for power management and motor configuration. The script output is a full AX5000 XML description, which can be imported on a AX5000 TreeItem either by using the menu entry “TwinCAT -> SelectedItem -> Import XML description” or by using the Automation Interface method ConsumeXml().
At the beginngin of the script, the local variable $FullNameConfigFile includes the path to the output file. Next, the script provides three different AX5000 configurations to choose from, each using a different template combination from the templates that were previously generated by using the script CreateTcIoAx5000_Templates (see above). Depending on the chosen config, the script then builds the AX5000 XML description by importing the different configuration parts into their corresponding XML section.
Mappings
Process data mapping can be performed via regular Automation Interface mechanisms. Please consult the article Erstellung von und Umgang mit Variablenzuordnungen for more information.