4.2.4 Condition Executor |
The C:\Program Files\RAYLASE\ProcessDataAnalyzer\API\SampleCode\SampleApplications\ConditionExecutor demonstrates how to use and execute custom conditions with the Process Data Analyzer server. This example shows how to load a custom condition DLL that implements the ICondition interface and execute it against incoming trace data to trigger automated trace file saving based on user-defined criteria.
The ConditionExecutor application serves as a host application that:
Connects to a Process Data Analyzer server or runs in standalone mode
Loads a custom condition DLL (such as the one created in Custom Condition)
Configures the acquisition and streaming settings
Executes the condition checks on incoming trace data
Automatically saves trace files when conditions are met
This example application demonstrates the complete workflow of condition-based trace acquisition. It can be run as a command-line application with various configuration options.
For a reference on how to create custom condition DLLs, refer to the Custom Condition topic. For general configuration of control cards and signals, see the Custom Trigger Streaming example.
The ConditionExecutor loads a custom condition DLL at runtime. The DLL must implement the ICondition interface. The application uses reflection to discover and instantiate the condition class.
Specify the path to your custom condition DLL either through command-line arguments or configuration file. The executor will validate the DLL and initialize the condition using the Initialize method.
The ConditionExecutor allows you to configure various acquisition parameters:
Card connection settings (IP address, serial number)
Signal selection and configuration
Trigger settings (pre-trigger, post-trigger buffer lengths)
Output directory for automatically saved trace files
Condition evaluation frequency and timing
These settings can be provided through a JSON configuration file similar to other sample applications.
During acquisition, the ConditionExecutor continuously calls the Check method of the loaded condition with current timestamp and signal values.
When the condition returns true, the executor triggers the Process Data Analyzer server to save a trace file with the configured pre- and post-trigger data. The application logs all condition evaluations and trace file saves for monitoring and debugging purposes.
To run the ConditionExecutor:
Build or obtain a custom condition DLL (e.g., from the CustomCondition sample)
Configure the application settings (card connection, signals, trigger parameters)
Start the Process Data Analyzer server (if using client mode) or let the executor start it
Run ConditionExecutor with appropriate command-line arguments
Monitor the console output for condition evaluation results
Check the output directory for automatically saved trace files
The ConditionExecutor sample demonstrates the practical application of several Process Data Analyzer concepts:
It uses custom conditions created as shown in Custom Condition
It demonstrates client-server architecture similar to Client API Tutorial
It can be used as a reference implementation for production monitoring systems