diff --git a/examples/C/src/zero-delay-cycles/Consistency.lf b/examples/C/src/zero-delay-cycles/Consistency.lf index 7f115f8c..5597af55 100644 --- a/examples/C/src/zero-delay-cycles/Consistency.lf +++ b/examples/C/src/zero-delay-cycles/Consistency.lf @@ -14,17 +14,15 @@ reactor Controller { state latest_control: double = 0.0 state first: bool = true - reaction c1(local_update, remote_update) {= - =} + reaction c1(local_update, remote_update) {= =} - reaction c2(local_update) -> control {= - =} + reaction c2(local_update) -> control {= =} } reactor Platform { input update: double output publish: double - + c = new Controller() p = new PhysicalPlant() p.sensor -> c.local_update @@ -36,7 +34,7 @@ reactor Platform { federated reactor { p1 = new Platform() p2 = new Platform() - + p1.publish -> p2.update p2.publish -> p1.update } diff --git a/examples/C/src/zero-delay-cycles/README.md b/examples/C/src/zero-delay-cycles/README.md index 411d1346..502b7598 100644 --- a/examples/C/src/zero-delay-cycles/README.md +++ b/examples/C/src/zero-delay-cycles/README.md @@ -15,4 +15,8 @@ These examples show usage patterns for zero-delay cycles in Lingua Franca. ZeroDelayCycle ZeroDelayCycle.lf: Trivial test case. + + CausalityLoop + CausalityLoop.lf: Failing example due to a causality loop. + diff --git a/examples/C/src/zero-delay-cycles/ZeroDelayCycle.lf b/examples/C/src/zero-delay-cycles/ZeroDelayCycle.lf index 08230aba..c2473134 100644 --- a/examples/C/src/zero-delay-cycles/ZeroDelayCycle.lf +++ b/examples/C/src/zero-delay-cycles/ZeroDelayCycle.lf @@ -1,8 +1,8 @@ target C -reactor A (Period:time = 1 msec) { - input in:int - output out:int +reactor A(Period: time = 1 msec) { + input in: int + output out: int timer t(0, Period) @@ -15,10 +15,10 @@ reactor A (Period:time = 1 msec) { =} } - reactor B { - input in:int - output out:int + input in: int + output out: int + reaction(in) -> out {= lf_set(out, in->value); =} @@ -30,4 +30,4 @@ federated reactor { a.out -> b.in b.out -> a.in -} \ No newline at end of file +} diff --git a/examples/C/src/zero-delay-cycles/CausalityLoop.lf b/examples/C/src/zero-delay-cycles/failing/CausalityLoop.lf similarity index 100% rename from examples/C/src/zero-delay-cycles/CausalityLoop.lf rename to examples/C/src/zero-delay-cycles/failing/CausalityLoop.lf diff --git a/examples/C/src/zero-delay-cycles/img/CausalityLoop.png b/examples/C/src/zero-delay-cycles/img/CausalityLoop.png new file mode 100644 index 00000000..2687627a Binary files /dev/null and b/examples/C/src/zero-delay-cycles/img/CausalityLoop.png differ