Skip to content
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

Mode transition fails to trigger in some cases #1433

Closed
edwardalee opened this issue Oct 30, 2022 · 3 comments · Fixed by #2416
Closed

Mode transition fails to trigger in some cases #1433

edwardalee opened this issue Oct 30, 2022 · 3 comments · Fixed by #2416
Assignees
Labels
bug Something isn't working modal models
Milestone

Comments

@edwardalee
Copy link
Collaborator

I found a simple modal model where a transition fails to trigger when it should. This is checked into the transition-trigger branch here:

https://github.com/lf-lang/lingua-franca/blob/transition-trigger/test/C/src/modal_models/TransitionTrigger.lf

Even stranger, if you uncomment the empty reaction on line 24, then the test passes. This reaction should really have no effect.

@edwardalee edwardalee added bug Something isn't working modal models labels Oct 30, 2022
@edwardalee edwardalee changed the title Mode transition fails to trigger in some Mode transition fails to trigger in some cases Oct 30, 2022
@a-sr
Copy link
Collaborator

a-sr commented Nov 3, 2022

I was able to further boil down the issue and it is not related to modes, see TransitionTrigger2.

It seems no reaction in the Destination reactor that only has y as a trigger, will be executed. Only if there is a reaction that has y and x suddenly the y trigger works again, despite the fact that x is never set.

I had a look at the generated code and it seems the triggering relation are correctly set up.

// Iterate over ranges TransitionTrigger2.ui.y(0,1)->[TransitionTrigger2.dlc.y(0,1)] and TransitionTrigger2.dlc.y(0,1).
...
// Point to destination port TransitionTrigger2.dlc.y's trigger struct.
transitiontrigger2_ui_self[src_runtime]->_lf__reaction_0.triggers[triggers_index[src_runtime] + src_channel][0] = &transitiontrigger2_dlc_self[dst_runtime]->_lf__y;

However, at runtime the log says that there are no reactions to trigger.

LOG: Worker 0: Invoking reaction TransitionTrigger2.ui reaction 0 at elapsed tag (0, 0).
S
DEBUG: There are 2 outputs from reaction TransitionTrigger2.ui reaction 0.
DEBUG: Output 1 has been produced.
DEBUG: There are 0 trigger arrays associated with output 1.

Maybe the output to trigger association is not correct because x is not connected to any downstream reaction?
I am sorry but I don't know where to look next.

@soerendomroes
Copy link
Collaborator

@lhstrh This ticket and that one #1489 should be tackled in the next release.

@lhstrh lhstrh added this to the 0.9.0 milestone Jul 1, 2024
@lhstrh lhstrh assigned edwardalee and unassigned a-sr Aug 5, 2024
@lhstrh lhstrh modified the milestones: 0.9.0, 0.10.0 Aug 5, 2024
@edwardalee
Copy link
Collaborator Author

This is fixed with #2416.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working modal models
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants