Counter

This function block keeps a running total of numeric inputs. It is useful for simple accumulations, counters, or integrating values over time. Use the reset input to clear the accumulated value when needed.

πŸ“₯ Inputs

Number Provide a numeric value to be added to the running total. Each evaluation adds this value to the current accumulation.

Reset A boolean signal that clears the accumulated total when active (true).

πŸ“€ Outputs

Number The current accumulated total after processing the inputs.

πŸ•ΉοΈ Controls

This block does not expose additional on-block controls or sliders. It operates based on the provided inputs.

🎯 Features

  • Persistent accumulation of incoming numeric values across evaluations.

  • Immediate reset capability via the Reset input to start counting from zero.

  • Skips disconnected inputs so only active numeric sources affect the total.

πŸ“ Usage Instructions

  1. Connect a numeric source to the Number input to increase the counter.

  2. Use a boolean source on the Reset input to clear the counter when needed.

  3. Read the current total from the block's Number output.

πŸ“Š How it runs

On each run, the block checks the Number input and adds it to the stored total. If the Reset input is active, the stored total is cleared before continuing. The updated total is emitted through the Number output.

πŸ’‘ Tips and Tricks

  • Combine with Number Input to manually test counting behavior.

  • Use Logic Input as a convenient way to trigger the Reset signal from the UI.

  • Use Data Memory to freeze or retain a recorded total under certain conditions.

  • Send the output into CSV Export or Data to JSON to log counts over time for later analysis.

  • Visualize numeric changes live by connecting the output to Scope.

πŸ› οΈ Troubleshooting

  • No change in total: ensure the Number input is connected and producing numeric values. Use Is None or Data Type Converter if needed to validate inputs.

  • Unexpected values or types: insert Round or other math operation blocks to sanitize incoming numbers.

  • Need periodic persistence: export the output with CSV Export or Data to JSON so counts are stored outside the scenario.

Last updated

Was this helpful?