-
Notifications
You must be signed in to change notification settings - Fork 64
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
Value of input port in C target when not triggered, and after triggered. #1653
Comments
In the C target, input ports are persistent. For an example of the kind of system for which this is particularly useful, see: https://github.com/lf-lang/examples-lingua-franca/blob/main/C/src/rosace/README.md The initial value of an input will be zero-ish, depending on the data type (the memory in which it is stored is allocated using calloc). |
As Edward mentioned, it is intended. However, it also currently only works this way in the C target. |
Thanks for the response. I'll check out the link. |
Because we seem to have a disagreement about whether this is a good design choice. I think it is, and I think it should be supported in all targets. |
Oh, I see. Thank you! |
The example below is a simple lf code with triggering a single reaction with multiple timers which have different periods.
1.
Is there a default value for input ports in C target? In
reactor Sum
, atlogical time 1 sec
,in2
is not triggered because it's timer starts at logical time2 sec
. So,in2->is_present
becomes0
, howeverin2->value
is0
. This means it has a default value0
. Is this intended? I pasted the results below.2.
Also, I see that the input port's value is valid even after the reaction is finished. For example on
logical time 3 sec
, thein2->value
is still2
, even if it was not triggered. Is this intended? Or is it only happening on C target?The text was updated successfully, but these errors were encountered: