5. Sample Code for C#
5.1. Getting Started
Open the Visual Studio 2019 Solution (”SrcC#EniBuilder.sln”) or Visual Studio 2022 Solution (”SrcC#EniBuilderDnc.sln”) and do the following things:
Compile the solution (Output folder of the “Debug” configuration is the root folder, where all the binaries are located)
Run
EniBuilder.exewith parameter “C:myEniBuilderDirconfig_simple.xml”, which will generate anENIfile based on theEBIfile settings
5.2. Architecture
ENI Builder contains the following components:
- Sample Code
EniBuilder.exeC# Console Application, which parses the command line parameters and loads the “EniEngine” for generating the
ENIfile.
- CTK
- EniEngine (
EcEniEngine.dll) EthterCAT Slave Information File (
ESI)EtherCAT Network Information File (
ENI)ENI Generation (PDO, MDP, CoE, DC, Hot Connect, …)
EniBuilder Input File Format (
.ebi)
- Resources (
EcResources.dll) Language Manager
Logger
- EniEngine (
5.3. Command line interface
The command line interface supports the following commands:
- Name of the
EBIfile Specify the path to the
EBIfile which contains all information for generating theENIfile, if the command /EXPORTFOLDER is used, the path will become the path to the folder to theEBIfiles/APPDATA= “Path to AppData directory” (optional)Specify the path to the AppData directory. It contains a subfolder “EtherCAT” with all
ESIfiles and it is also the path for the logfile./INDENTXMLFILES(optional)Activates indenting of
XMLfiles (makes exportedXMLfiles readable, but increases size)./NOEBISCHEMA(optional)Deactivates
EBIschema check (maybe necessary for compatibility reasons)./IGNOREREVISION(optional)Deactivates the revision check, if slave was not found and tries to find a compatible slave.
/LOGLEVEL=”ERR” (optional)Specify the log level (possible values are: DBG = Debug, INF = Info, WRN = Warning, ERR = Error)
/PROCESSIMAGELAYOUT(optional)For flags please see EC-Engineer documentation. Please enter decimal values.
/ALLOWDUPLICATENAMES(optional)Allows duplicate names e.g. for slaves and variables.
/IGNOREMISSINGOBJECTS(optional)Missing objects will be ignored and just reported as a warning. Without this option they will be reported as an error and further processing will be stopped.
/PROCESSDEVICEIDENTIFIERASUNSIGNEDINENI(optional)Process device identifier (vendor id, product code, revision number, serial no) as unsigned in ENI (cause schema violation)
/EXPORTFOLDER(optional)Enables the generation of multiple
ENIfiles from the path to the folder where all theEBIfiles located.