firmware-base/docs/profiles/SignalPlot.md

2.9 KiB

title description keywords
SignalPlot Discrete signal control component for time-based automation and process control
signal-control
automation
discrete-states
modbus
time-based
industrial-control
plot-profile

SignalPlot

Path : src/profiles/SignalPlot.h revision history - initial documentation

A component for managing discrete signal state changes over time. Inherits from PlotBase to provide time-based automation capabilities for industrial applications.

Requirements

  • -Inheritance: PlotBase (component)
  • Memory: Maximum 20 control points

Features

  • Discrete state control with time-based triggering
  • Multiple signal types (Modbus, GPIO, Method calls)
  • Modbus TCP integration
  • JSON configuration loading
  • State querying and user value retrieval

Dependencies

graph TD
    PlotBase --> SignalPlot
    ModbusTCP --> SignalPlot
    JSONConfig --> SignalPlot

Behaviour

graph TD
    A[Start] --> B[LoadConfig]
    B --> C[InitControlPoints]
    C --> D[RunLoop]
    D --> E[CheckElapsedTime]
    E --> F{C.time_elapsed?}
    F --> Yes| GoexeuteAction
    F --> No | D
    G --> H[UpdateState]
    H --> D

Todos

Performance

  • Optimize control point lookup algorithm
  • Implement binary search for larger datasets

Security

  • Validate control point parameters
  • Implement safe gaurds for critical GPIO operations

Compliance

  • Verify Modbus compliance
  • Implement error handling for industrial standards

Recommendations

  • Implement remaining signal types (CALL_METHOD, CALL_FUNCTION, CALL_REST, USER_DEFINED)
  • Add state validation and error handling
  • Implement advanced GPIO control modes (SERVO, TONE)

Example

Here an example how such component is being constructed and mounted:

#define SIGNAL_PLOT_SLOT_0 0
#define COMPONENT_KEY_SIGNAL_PLOT_0 920

signalPlot_0 = new SignalPlot(
    this,                 // owner
    SIGNAL_PLOT_SLOT_0,     // slot
    COMPONENT_KEY_SIGNAL_PLOT_0 // componentId
);

if (signalPlot_0)
{
    components.push_back(signalPlot_0);
    Log.infoln(F("SignalPlot_0 initialized. Slot:%d, ID:%d"),
                 SIGNAL_PLOT_SLOT_0, COMPONENT_KEY_SIGNAL_PLOT_0);
}
else
{
    Log.errorln(F("SignalPlot_0 initialization failed."));
}

Example JSON configuration:

{
  "name": "TISControlPlot",
  "duration": 300000,
  "controlPoints": [
    { "id": 1, "time": 0, "state": 2, "type": 6, "arg_0": 21, "arg_1": 0, "arg_2": 1 },
    { "id": 2, "time": 5000, "state": 3, "type": 2, "arg_0": 100, "arg_1": 500, "arg_2": 0 },
    { "id": 3, "time": 10000, "state": 2, "type": 1, "arg_0": 20, "arg_1": 1, "arg_2": 0 }
  ]
}

References

${DOXYGEN_PLACEHOLDER}

${VENDOR_PLACEHOLDER}