Managing events with Excel
TwinCAT Package "TwinCAT.XAE.EventloggerExcelAddIn" is required Install the package "TwinCAT.XAE.EventloggerExcelAddIn" to use the functionality described here. |
In addition to the TMC Editor as part of the TwinCAT Solution, TwinCAT also offers the possibility to use Microsoft Excel to create event classes with events and their translations. These can then be exported from Excel and integrated in TwinCAT as "Shared TMC".
Installation
After installing the package, a corresponding setup is available at C:\ProgramData\Beckhoff\TwinCAT\EventloggerExcelAddIn. The directory can also be transferred from here to other systems that do not have TwinCAT installed.
The setup can be used if Microsoft Excel is installed and activated. To do this, simply run setup.exe to perform the integration in Excel.
Use
After a start of Excel a new main menu item is available in Excel:
- Create New Sample creates both the base structure and the two sample event classes "Master" and "Machine" in the current Solution.
- Import is used to import the resource information and transfer it into event classes. Cf. Importing resource files
- New EventClass creates a new event class as a new sheet.
- Add missing Translation Keys creates corresponding keys in the Translations sheet based on all existing event classes.
- Highlight unused Translation Keys marks the keys that are currently not used.
- Generate Id (hash) from Name generates a hash value of the name as EventId for an event class. Cf. Internationalization of sources
- Generate TMC File generates a TMC file based on the event classes. This can be used as a shared TMC in TwinCAT.
- Create PLC mapping function creates a TcPOU file as PLC Function. This represents a mapping to map the SourceId and EventId used in resource files to the event classes. Cf. Importing resource files
Workflow and implementation
At this point the workflow between Excel and TwinCAT is described:
- The setup.exe has been executed and the add-in is registered in Microsoft Excel.
- 1. Switch to the TcEventLogger menu item and click on "Create New Sample".
- The sample event classes are created.
- 2. You can expand them or create translations in the "Translations" sheet.
- 3. Use "Add missing Translation Keys" and also "Highlight unused Translation Keys" for creating the entries.
- At "Generate TMC-File" a selection dialog appears, in which the event classes to be exported are selected:
- A dialog for selecting the save dialog is displayed. The TMC file is generated in the process.
- 4. Include the TMC file via the System -> Right Click -> Add Existing Item... type:
- The file is included as a reference in the TwinCAT Solution. The included event classes are ready:
- 5. If you overwrite the file, TwinCAT notices this and applies corresponding updates:
- The description of the event classes is made in Excel and automatically imported into TwinCAT via the export function.
In this workflow, the Excel file is the "leading" file. It must be organizationally prevented that changes are made via the TMC editor in the TwinCAT Solution, since these cannot be restored.