SignalPlot - Time-based State Control
SignalPlot
Section titled “SignalPlot”Path: src/modbus/SignalPlot.h
Revision History: Initial documentation
SignalPlot is a component that handles time-based control points for various signal types. It extends the PlotBase class to provide a framework for executing specific actions at defined time intervals. This component is particularly useful for controlling signals through Modbus, directly manipulating GPIO pins, or executing commands at specific times during a profile execution.
Requirements
Section titled “Requirements”- ESP32 hardware platform
- PlatformIO environment
- Components: Bridge (for command execution)
- Modbus TCP server for Modbus-based signal control
Provides
Section titled “Provides”SignalPlotRegisterOffset
: Enum for Modbus register offsetsSignalPlotCommand
: Enum for control commands (START, STOP, PAUSE, RESUME)E_SIGNAL_TYPE
: Enum defining supported signal typesE_GpioWriteMode
: Enum for GPIO write modes (DIGITAL, ANALOG_PWM)E_SIGNAL_STATE
: Enum for signal execution statesS_SignalControlPoint
: Struct for defining control pointsSignalPlot
: Main class that handles time-based signal state control
Features
Section titled “Features”- Time-based execution of various signal types
- Support for multiple control points (up to 20 per instance)
- Control via Modbus TCP
- Direct GPIO control (digital and analog/PWM)
- Command execution through the Bridge component
- Pause, resume, start, and stop control of signal execution
- Configurable via JSON
Dependencies
Section titled “Dependencies”Behaviour
Section titled “Behaviour”Performance
Section titled “Performance”- Consider using a binary search when searching for control points if the number of points becomes significant
- Optimize execution logic for control points with frequently accessed states
Security
Section titled “Security”- Validate Modbus access restrictions to prevent unauthorized control
- Add validation for GPIO pins to ensure they don’t affect critical system functionality
- Consider adding authorization for command execution to prevent security issues
Compliance
Section titled “Compliance”- Ensure command execution respects timing requirements in industrial applications
- For critical applications, add error handling and recovery mechanisms
- Document GPIO limitations for industrial environments
Recommendations
Section titled “Recommendations”- Pre-sort control points by time during loading to optimize runtime performance
- Ensure GPIO pins are properly configured before using this component
- Use meaningful names and descriptions for control points to improve maintainability
- Consider implementing additional signal types for specific use cases
- When using command strings, ensure proper escaping and validation to avoid parsing issues