Federate Filter creation and integration #1571
-
@kdheepak: I'm trying to write a filter federate for the User Guide Python example suite. as best I can tell (with help from @nightlark from the ns-3 example), I need to use two APIs:
Any guidance? |
Beta Was this translation helpful? Give feedback.
Replies: 13 comments 7 replies
-
So @nightlark pointed out that the callback is specific to the ns-3 implementation and not a HELICS thing. So maybe this is a question for @phlptp: once I register my federate as a filter, is there anything else to do? helicsFederateRegisterFilter returns a filter object so maybe I just helicsAddSourceFilterToEndpoint with the registered filters name? And then any time a message comes in on an endpoint with this filter federate it will get granted a time? |
Beta Was this translation helpful? Give feedback.
-
I think you want |
Beta Was this translation helpful? Give feedback.
-
in the C API when you create a filter you specify a type with it. Unless you specify a custom type the callback function won't do much and might error. The other types might have some configuration but otherwise don't require a callback. |
Beta Was this translation helpful? Give feedback.
-
So, things I need clarity on:
|
Beta Was this translation helpful? Give feedback.
-
filters can be registered on a core as well if you don't want to use a federate |
Beta Was this translation helpful? Give feedback.
-
OK, I've written an initial version and have begun testing/debugging. Right now the federation gets stuck at its initial time grant (all federates waiting for something). As I've been trying to debug it I decided to check to see if the rerouting filters the filter federate was installing on the other federates' endpoints. Here is a sample of the filter federate config:
To confirm these filters are getting installed, I put a ten second pause on When watching these log files in real-time as the federation runs, the pause is very apparent (giving me confidence it is working as expected) but the filter count is zero. It seems like the installation of the filters by the filter federate onto the EV federate isn't happening. I don't know if this explains why the federation is hanging, though. Any thoughts? |
Beta Was this translation helpful? Give feedback.
-
I'm comparing what I've done to what I can see in example_filters.json and I can't see any reason why this shouldn't be working.
|
Beta Was this translation helpful? Give feedback.
-
Previous attempts were made under HELICS v2.6.0. I tried running under v2.4.2 and am having the same problem. |
Beta Was this translation helpful? Give feedback.
-
Based on the comments from @phlptp, let's consider my filter-count efforts a red herring. Getting back to the base issue: right now the federation hangs when the filter federate is included and doesn't when its excluded. Right now I have four federates making the following time requests and none are being granted a time: (The filter is setup to operate on the messages sent between the charger and the controller.) This doesn't seems like it should be happening even if the reroute filter that were put in place aren't working properly. The co-simulation should be able to advance in time but the results will be wrong as the charging control coordination between the filter and controller would be broken. Somebody should be granted a time, though. Any thoughts or suggestions on further debugging? Right now, I'm stuck 😖 |
Beta Was this translation helpful? Give feedback.
-
As an experiment, I changed the filter Original:
Experiment:
Same behavior and no error messages; this makes me think there could be something subtly wrong in my definition and I'm not seeing the error message from it. |
Beta Was this translation helpful? Give feedback.
-
Just checked this on the v3.0.0-alpha.2 release and the co-sim runs to the point when the first message should be sent (and the filter intercepts it) and all federates are stuck waiting for a time grant. The Controller and the Filter are requesting infinite time and the Battery and Controller are requesting 180s. The message should be sent on this timestep from Charger to Controller. |
Beta Was this translation helpful? Give feedback.
-
@eberleim has been working on this for a week or two and hopefully will have figured out what's going on soon. |
Beta Was this translation helpful? Give feedback.
-
There are still on-going challenges (even in v3) with rerouting filters and filter federates. This issue has been captures in #1995 so I'm going to close the discussion here. |
Beta Was this translation helpful? Give feedback.
There are still on-going challenges (even in v3) with rerouting filters and filter federates. This issue has been captures in #1995 so I'm going to close the discussion here.