3. Software Integration
3.1. EcSimulatorHilDemo
The example application EcSimulatorHilDemo will handle the following tasks:
Stack initialization
Flash process data
Out of the box solution for different operating systems:
Windows
Linux
LxWin
…
Example implementation for polled mode or interrupt mode operation
Thread with periodic tasks and application thread already implemented
The output messages of the demo application will be printed on the console as well as in log files (*.log)
3.1.1. File reference
The Demo application consists of the following files:
Filename |
Description |
|---|---|
Entry point for the different operating systems |
|
Operating system specific settings (task priorities, timer settings) |
|
Initialize, start and terminate the EC-Simulator stack |
|
Application specific settings for EcSimulatorHilDemo |
|
Parsing of command line parameters and generic helper functions |
|
Basic configuration parameters |
|
Common functions which abstract the command line parsing into Real-time Ethernet Driver parameter |
|
SubDevice monitoring and error detection (function |
|
SubDevice information services |
|
Message logging functions |
|
Start and monitor timeouts |
3.1.2. Simulator lifecycle
Basically the operation of the EC-Simulator stack is wrapped between the functions
3.1.3. Logging
The example program demonstrates how messages can be processed by the application, see Examples/Common/EcLogging.cpp.
The messages handled by EcLogging.cpp are of different type, e.g. EC-Simulator Log Messages and Application Messages are logged to console and/or to files.
The verbosity of the demo given as console parameter “-v” is used to determine the log level of the application, see “set application log level” in EcDemoMain.cpp.
Logging is configured on initialization, see the structure documentation of EC_T_SIMULATOR_INIT_PARMS::LogParms in esInitSimulator().
The EC-Simulator automatically filters log messages according to EC_T_SIMULATOR_INIT_PARMS::LogParms.dwLogLevel . Log messages which are less relevant according to their severity (see EC_LOG_LEVEL…) are filtered out.
CAtEmLogging has various parameters beside the log level, like Roll Over setting, log task prio and affinity, log buffer size, etc. See InitLogging in EcLogging.h, EcDemoMain.cpp for reference.
The application can override CAtEmLogging::PrintConsole / CAtEmLogging::PrintMsg if the default handler in EcLogging.cpp does not fulfill the application’s needs.
Important
The callback is typically called from the Job Task’s context and should return as fast as possible.
Important
Logging to files is disabled by default for some OS, because e.g. a file system must be added explicitly. Setting bLogFileEnb to 1 is needed for some operating systems to enable file logging.
Identical messages are skipped automatically by default.