5. Sample Code for C#

5.1. Getting Started

Open the Visual Studio 2015 Solution (”SrcC#EniBuilder.sln”) or Visual Studio 2017 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.exe with parameter “C:myEniBuilderDirconfig_simple.xml”, which will generate an ENI file based on the EBI file settings

5.2. Architecture

ENI Builder contains the following components:

_images/architecture.png
  1. Sample Code
    EniBuilder.exe
    • C# Console Application, which parses the command line parameters and loads the “EniEngine” for generating the ENI file.

  2. 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

5.3. Command line interface

The command line interface supports the following commands:

Name of the EBI file

Specify the path to the EBI file which contains all information for generating the ENI file

/APPDATA = “Path to AppData directory” (optional)

Specify the path to the AppData directory. It contains a subfolder “EtherCAT” with all ESI files and it is also the path for the logfile.

/INDENTXMLFILES (optional)

Activates indenting of XML files (makes exported XML files readable, but increases size).

/NOEBISCHEMA (optional)

Deactivates EBI schema 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.