3. Software Integration
3.1. EcSimulatorSilDemo
The example application EcSimulatorSilDemo will handle the following tasks:
Stack initialization
Flash process data
Out of the box solution for different operating systems:
Windows
Linux
…
Example implementation for polled 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 MainDevice and EC-Simulator stack |
|
Application specific settings for EcSimulatorSilDemo |
|
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 |
|
Operating system independent default timing task implementation (base class) |
|
Message logging functions |
|
|
CoE object dictionary example |
Start and monitor timeouts |
3.1.2. 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. MainDevice and EC-Simulator stack 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 MainDevice stack initialization.
The MainDevice and EC-Simulator stack automatically filters log messages according to the log level. 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.