-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Safely skipping redundant port absent messages in the centralized federated execution #295
Comments
I guess this is the The real problem here, I think, is that In a more general scenario, |
Could a NET message later be invalidated by a physical action happening? Or would the presence of a physical action cause the NET not have a lower bound corresponding to the earliest possible occurrence of a physical action? |
I think a physical action in an upstream federate prevents the NET(FOREVER) from being sent (it also results in a warning when using centralized control and a hint to set a parameter to control the frequency of interactions). |
I think a physical action in an upstream federate doesn't cause the issue but a physical action in a downstream federate can invalidate a NET message. I'm trying to figure out if there is another situation that causes invalidated NET messages. |
A NET(g) message from reactor R is a promise that, absent any network inputs, R will not produce an output with a tag less than g. I don't see how anything downstream of R, including any physical action, could possibly invalidate this. Note that there is nothing special about g = FOREVER, so FOREVER should not be treated as a special case. A message from upstream could result in a new NET(g') from R where g' < g. This is why the RTI calculates a transitive upstream NET before granting a TAG. The "transitive" aspect of this effectively calculates the least g' that might later be sent by R. However, I discovered today that we are not calculating the transitive upstream NET correctly when there are after delays on the connections. The problem is the algorithm uses a "visited" flag to avoid examining an upstream reactor more than once. This is wrong because the least g' due to an upstream reactor R' depends not only on R's NET, but also on the path delays from R' to R. The current algorithm with the "visited" flag is assuming all paths have the delays. I think this algorithm needs to be updated to use dynamic programming. I think this is the cause for a bug report I recently submitted involving a fairly complex federated program where I couldn't find a way to trigger the bug with a simpler test. |
Very Interesting. Technically, when Receiver sends NET(2 sec, 0), it does not violate the contract as stated because it produces no outputs at all. It may be that we need to strengthen the contract, but this could have other effects. Does this actually create a problem for NDT? When Sender receives NDT(1.71 sec, 0), it will be in one of two states:
If there is an after delay D on the connection, then the threshold used at Sender should be 1.7 - D. Note that this will slow down the reaction to the physical action in Receiver. And an after delay won't help in this case, thereby nullifying the CAL theorem advantage of relaxing consistency. Consider for example the ADAS case. Slowing down the reaction at Receiver could be a really bad thing to do. So maybe this optimization should be disabled by default when the downstream reactor has a physical action? Note that all these corner cases suggest we need a good formalism for reasoning about them. Ideally, we could prove theorems. This will be tricky because of the multiplicity of timelines. I would suggest first assuming perfectly synchronized clocks. Then all logical time relations become constraints on physical time relations with just one physical timeline. Also, I'm seeing real potential for a nice Ph.D. thesis here... :-) |
Thank you for sharing your insights, professor!
In this example, it won't cause any problems for NDT. However, when there is a loop, it needs to be analyzed. I'm doing that.
Yes, it should be disabled when the downstream federate has a physical action. After the discussion with @lhstrh and @hokeun, we decided that each federate reports the presence of physical action to the RTI whenever it wants to join the federation. |
Relevant Issue: #264
Relevant PR: #176
There is a need for saving skipped
ABS
(port absent) messages when we useNDT
to not send redundantABS
messages.ABS
messages?Let's consider the example
PingPongDistributed.lf
. At the tag (0, 10), there is no event, andreaction_1
of 'Ping' should send anABS
message. The trace below is an intended way to handleNDT
. The left side is the RTI, the middle one isPong
, and the left side isPing
.NDT (0, 10)
is received beforePing
advances its tag to(0, 10)
. Thus, it does not skipABS (0, 10)
.However, it's possible to receive

NDT (0, 10)
afterPing
advancing its tag to(0, 10)
. In that case, theport_absent_reaction
ofreaction_1
ofPing
already decided not to send anABS
message. As a result, we have to keep a skippedABS (T)
message until a federate (Ping
) completes the tagT
.ABS
messages not straightforward?It's not difficult to save
ABS
messages for the current tag. However, when it comes to a connection with a delay, we have to save the futureABS
messages too. Thus, we have to save the tag, the destination federate, and the destination port of theABS
message. In regards to scalability, it can be a waste of memory.Currently, every
ABS
message is not skipped in the NDT PR even if it's not needed. We can reduceABS
messages too when we solve the problem I explained.The text was updated successfully, but these errors were encountered: