HELICS distinguishes between two fundamentally different kinds of data exchange: values (physical quantities like voltage or speed) and messages (directed, unique packets like control signals or sensor readings). Filters and translators are specialized HELICS features that work with the message layer—filters modify messages in transit, and translators bridge the gap between the value and message interfaces.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/GMLC-TDC/HELICS/llms.txt
Use this file to discover all available pages before exploring further.
Filters
Filters model communication system effects on messages traveling between endpoints. Because messages pass through a generic communication layer inside HELICS, that layer can simulate realistic behaviors: a message might be delayed by network latency, randomly dropped due to packet loss, or rerouted to an alternate destination. Values (publications and subscriptions) do not pass through this communication layer and cannot be filtered. Filters are associated with endpoints and can be applied as:- Source filters — applied to messages sent from an endpoint, before they reach their destination.
- Destination filters — applied to messages arriving at an endpoint, before the federate sees them.
Filters do not need to be defined on the same core or federate as the endpoints they target. They can be defined anywhere in the federation, and HELICS will automatically route all affected messages through them.
Built-in filter types
delay — Fixed message delay
delay — Fixed message delay
Delays every message passing through the filter by a fixed amount of time. Use this to model deterministic network latency.Time values can be expressed as strings with units (e.g.,
"76 ms", "2 s") or as bare numbers in seconds.randomdelay — Probabilistic message delay
randomdelay — Probabilistic message delay
Delays messages by a random amount drawn from a configurable statistical distribution. The available distributions match those in the C++ For a
<random> library, including uniform, normal, exponential, lognormal, and many others.uniform distribution, use min and max as parameter names. For exponential, use lambda.randomdrop — Probabilistic message loss
randomdrop — Probabilistic message loss
Randomly drops messages with a specified probability. The drop probability is drawn from a uniform distribution between 0 and 1.A
prob of 0.05 means 5% of messages are dropped. A value of 0.0 drops nothing; 1.0 drops everything.reroute — Redirect messages
reroute — Redirect messages
Sends matching messages to a new destination instead of (or in addition to) their original destination. An optional
condition property specifies a regular expression; only messages whose destination matches the pattern are rerouted.clone — Copy messages to additional destinations
clone — Copy messages to additional destinations
Cloning is not an “operation” in the same sense as the above—it is enabled by setting Cloning is useful for building monitoring or logging federates that observe message traffic without interfering with the co-simulation.
"clone": true on a filter definition. A clone filter copies every matching message and delivers the copy to the endpoints listed in the delivery field. The original message is still delivered to its original destination.firewall — Block messages by rule
firewall — Block messages by rule
The firewall filter blocks messages based on their content, source, or destination. It is used to enforce communication boundaries in the federation. Consult the HELICS API documentation for the full set of rule syntax options.
Configuring filters in JSON
Filters are defined in the"filters" array of a federate’s JSON configuration file:
Creating filters with the C++ API
Filters can also be created programmatically. UsehelicsFederateRegisterFilter to create the filter object, then helicsFilterAddSourceTarget or helicsFilterAddDestinationTarget to associate it with an endpoint:
Translators
Translators bridge the two interface types in HELICS: value interfaces (publications, subscriptions, inputs) and message interfaces (endpoints). Normally these two interface types cannot communicate directly—a federate publishing a double value cannot send it to a federate that only has an endpoint, and vice versa.When to use a translator
- You are working with an existing federation where some federates use value interfaces and others use message interfaces, and you cannot easily change both.
- You need to connect a legacy federate that only implements one interface type to the rest of a federation that uses the other.
- You want to pass value data through a communication simulator (which works with message endpoints) to model transmission delays or loss on physical values.
How translators work
To HELICS, a translator is a specialized internal federate with exactly one input, one publication (output), and one endpoint. It operates as follows:- A value arriving at the translator’s input is converted into a message and sent to any targets connected to the translator’s endpoint.
- A message arriving at the translator’s endpoint is converted into a value and published on the translator’s publication.
Translator types
HELICS provides three translator types:-
JSON — The most useful type for typical use cases. The message produced or consumed by the endpoint is a JSON object:
A double value of
56.78943entering the translator’s input produces exactly this JSON on the endpoint. The reverse transformation works symmetrically. -
Custom — Calls a user-defined callback function (
helicsTranslatorSetCustomCallback) to perform the translation. Use when the JSON format is not suitable. - Binary — Rarely useful in practice.
Configuring a translator in JSON
Translators are defined in the"translators" array of any federate’s configuration file:
source_target— The publication whose values will be converted to messages, or the endpoint whose messages will be converted to values.destination_target— The input or endpoint that receives the translated output.global— Whentrue, the translator’s interfaces are addressed globally, simplifying targeting from other federates.