Samples | I/O 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 Creating and handling variable mappings for more information. 6.6.5 Enabling and disabling I/O devices | Enabling and disabling I/O devices To enable or disable a Tree Item in a configuration, you must create a TwinCAT System Manager instance and open the configuration.
The LookupTreeItem method of the ITcSysManager interface returns an ITcSmTreeItem interface pointer implemented by the Tree Item referenced by its pathname [ } 14] . This interface contains a Disabled property of the Tree Item. Procedure The procedure for creating the ITcSysManager interface (the ' sysMan ' instance here) is described in the chapter Accessing TwinCAT configurations [ } 22] . This interface has a LookupTreeItem method that returns an ITcSmTreeItem pointer to a Tree Item specified by its path name [ } 14] . The following code snippets can be used to enable or disable the “ TIID^EtherCAT master ” Tree Item. Sample (CSharp): TE1000 256 Version: 1.7.0 Name Language Description