DCode

Covers Engine 2.0.0

channel_calculation

Define a reactive calculation for a RAPID channel.

Syntax

channel_calculation <channel>:

Available in

  • File scope

Native C++

Compiled calculations use the same inline dependency path. Return a numeric expression on each path. Runtime state is numeric; strings, tables and metadata access are unavailable. Native nil translates to false (numeric zero), not a Lua nil result.

Lifecycle

Activation registers explicit and detected dependencies; dependency changes evaluate the calculation and update its target channel.

Persistence

Calculation state remains available between evaluations while the calculation is loaded.

Reload behavior

DARTWIC tracks changes to the block when loading the calculation.

Runtime sections

  • depends_on
  • calculation body

Example

channel_calculation channel_name:
    return value