Combination Federation with Native HELICS Filters¶
This custom filter federate example expands the combination federation example to demonstrate how HELICS filters can be added to endpoints.
This tutorial is organized as follows:
Example files¶
All files necessary to run the Native Filter Example can be found in the Fundamental examples repository:
Python program and configuration JSON for Battery federate
Python program and configuration JSON for Charger federate
Python program and configuration JSON for Controller federate
HELICS runner JSON to enable execution of the co-simulation
HELICS filters¶
As discussed in the User Guide, filters have the ability to act on messages being sent between endpoints and perform various functions on them (delay, drop, reroute, etc). In this example, we’re going to take the Combination Federate Example and add a filter between the Charger and the Controller (since this is where the messages are flowing). Specifically, we’re adding a destination filter to the controller endpoint such that all messages received by that endpoint will be delayed. Note that this filter will only act on the messages received at this endpoint and not those sent out from it. Here’s the entire Controller JSON config:
{
"name": "Controller",
"log_level": "warning",
"core_type": "zmq",
"time_delta": 1,
"uninterruptible": false,
"terminate_on_error": true,
"endpoints": [
{
"name": "Controller/ep",
"global": true
}
],
"filters": [
{
"name": "ep_filter",
"destination_target": "Controller/ep",
"operation": "delay",
"properties": {
"name": "delay",
"value": "900s"
}
}
]
}
The delay value is set to 900 seconds so that the impact of the fictitious communication system delay is obvious in the results of this example and the delay can be set to much lower or higher values.
Co-simulation execution¶
Execution of this co-simulation is done as before with the helics run
command:
helics run --path=fundamental_combo_runner.json
Below are pairs of output graphs with the first from each pair being from the original Combination Federate Example and the second from this Native Filter Example with the communication delay.
Questions and Help¶
Do you have questions about HELICS or need help?
Come to office hours!
Post on the gitter!
Place your question on the github forum!