Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/assets/code/c/src/test/SlowingClockTest.lf
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ main reactor(start:time(100 msec), incr:time(100 msec)) {
=}
reaction(a) -> a {=
instant_t elapsed_logical_time = lf_time_logical_elapsed();
printf("Logical time since start: \%lld nsec.\n",
printf("Logical time since start: %lld nsec.\n",
elapsed_logical_time
);
if (elapsed_logical_time != self->expected_time) {
printf("ERROR: Expected time to be: \%lld nsec.\n",
printf("ERROR: Expected time to be: %lld nsec.\n",
self->expected_time
);
exit(1);
Expand All @@ -33,7 +33,7 @@ main reactor(start:time(100 msec), incr:time(100 msec)) {
reaction(shutdown) {=
if (self->expected_time != MSEC(1500)) {
printf("ERROR: Expected the next expected time to be: 1500000000 nsec.\n");
printf("It was: \%lld nsec.\n", self->expected_time);
printf("It was: %lld nsec.\n", self->expected_time);
exit(2);
} else {
printf("Test passes.\n");
Expand Down
22 changes: 11 additions & 11 deletions docs/assets/code/uc/src/test/SlowingClockTest.lf
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
* The use of the logical action ensures the elapsed time jumps exactly from
* 0 to 100, 300, 600, and 1000 msec.
*/
target uC {
timeout: 1 sec,
fast: true,
};
main reactor(start:time(100 msec), incr:time(100 msec)) {
target uC
@platform("Native")
@timeout(1 sec)
@fast(true)
main reactor(start:time = 100 msec, incr:time = 100 msec) {
logical action a;
state interval:time(start);
state expected_time:time(start);
state interval:time = start;
state expected_time:time = start;
reaction(startup) -> a {=
lf_schedule(a, self->start);
=}
reaction(a) -> a {=
instant_t elapsed_logical_time = lf_time_logical_elapsed();
printf("Logical time since start: \%lld nsec.\n",
interval_t elapsed_logical_time = env->get_elapsed_logical_time(env);
printf("Logical time since start: %lld nsec.\n",
elapsed_logical_time
);
if (elapsed_logical_time != self->expected_time) {
printf("ERROR: Expected time to be: \%lld nsec.\n",
printf("ERROR: Expected time to be: %lld nsec.\n",
self->expected_time
);
exit(1);
Expand All @@ -33,7 +33,7 @@ main reactor(start:time(100 msec), incr:time(100 msec)) {
reaction(shutdown) {=
if (self->expected_time != MSEC(1500)) {
printf("ERROR: Expected the next expected time to be: 1500000000 nsec.\n");
printf("It was: \%lld nsec.\n", self->expected_time);
printf("It was: %lld nsec.\n", self->expected_time);
exit(2);
} else {
printf("Test passes.\n");
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/security.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ShowIf, ShowIfs, ShowOnly
} from '@site/src/components/LinguaFrancaMultiTargetUtils';

<LanguageSelector c py />
<LanguageSelector c py uc cpp ts rs/>

By default, there is no secure authentication when a federate joins a federation, and data exchanged between federates is not encrypted. For targets that support it, Lingua Franca provides robust, end-to-end communication security that encrypts all message exchanges and ensures only authorized federates can participate.

Expand Down
23 changes: 1 addition & 22 deletions docs/reference/target-declaration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ShowIf, ShowIfs, ShowOnly,
} from '@site/src/components/LinguaFrancaMultiTargetUtils';

<LanguageSelector c cpp py rs ts />
<LanguageSelector c uc cpp py rs ts />

# Target Declaration

Expand Down Expand Up @@ -89,27 +89,6 @@ c={
workers: <non-negative integer>,
};`
}
uc={
`target uC {
auth: <true or false>
build: <string>,
build-type: <Debug, Release, RelWithDebInfo, or MinSizeRel>,
cmake-args: <object of key-value pairs>,
cmake-include: <string or list of strings>,
compiler: <string>,
compiler-flags: <string or list of strings>,
docker: <true or false>,
fast: <true or false>,
files: <string or list of strings>,
logging: <error, warning, info, log, debug>,
no-compile: <true or false>,
protobufs: <string or list of strings>,
single-threaded: <true or false>,
timeout: <time>,
trace-plugin: <object with package, library, and optional path>,
workers: <non-negative integer>,
};`
}
cpp={
`target Cpp {
build-type: <Debug, Release, RelWithDebInfo, or MinSizeRel>,
Expand Down
25 changes: 18 additions & 7 deletions docs/writing-reactors/distributed-execution.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -321,22 +321,33 @@ The `maxwait` is specified as an attribute of the instantiation of a reactor, as
```
</ShowOnly>
<ShowOnly uc>
2. The federate's physical clock matches or exceeds _t_ + _m_, where _m_ is the maximum over the `maxwait` of the federate and the `maxwait` of each input port that is unknown at _g_.
2. The federate's physical clock matches or exceeds _t_ + _M_*(_m_+1), where _M_ is the maximum of the `maxwait` value of each input port that is unknown at _g_, and _m_ is the microstep of the tag _g_.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we dont move forward with this equation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the description in the latest push.


The `maxwait` is specified as an attribute of the instantiation of a reactor or of a connection, as in the following example:
The `maxwait` is specified as an attribute of the connection to the input port, as in the following example:

```lf
@maxwait(0)
my_instance = new MyReactor()
@maxwait(10 ms)
upstream1.out -> my_instance.in1
upstream2.out -> my_instance.in2
```

The default `maxwait` is `forever`.
To override the default, you can specify a `maxwait` value on the instantiation of the reactor.
Hence, the following specification gives the same result as the specification above:

```lf
@maxwait(10 ms)
my_instance = new MyReactor()
upstream1.out -> my_instance.in1
@maxwait(forever)
upstream2.out -> my_instance.in2
```
In the above example, the instance will not advance to tag _g_=(_t_,_m_) until `in2` is known at _g_ because of the `@maxwait(forever)`.
Once `in2` is known at _g_, it will wait at most 10 ms beyond the logical time _t_ for input `in1` to become

In the both cases, the `my_instance` federate will not advance to tag _g_=(_t_,_m_) until `in2` is known at _g_.
Assuming the microstep _m_ is 0, once `in2` is known at _g_,
the federate will wait at most 10 ms beyond the logical time _t_ for input `in1` to become
known, after which, if `in1` is still unknown, the federate will assume it is absent at _g_.
The `@maxwait(0)` on the federate instance overrides the default maxwait of `forever`.
</ShowOnly>

By default, the maxwait is `forever`. A maxwait of `forever` is OK for any federate where either:
Expand All @@ -349,7 +360,7 @@ At the other extreme, a maxwait of zero is OK for any federate where:

1. The federate has no inputs.
2. Every logical connection into the federate has a sufficiently large `after` clause.
3. The federate has only one upstream federate sending it messages, and it has no local timers or actions.
3. The federate has only one input port, and it has no local timers or actions.

The use of `after` provides a design style similar to **logical execution time** (**LET**).
If the value of the `after` delay on each connection exceeds the sum of the [clock synchronization](#clock-synchronization) error _E_, a bound _L_ on the network latency, and the time lag on the sender _D_ (the physical time at which it sends the message minus the timestamp of the message),
Expand Down
Loading