diff --git a/examples/C/src/modal_models/FurutaPendulum/PendulumController.lf b/examples/C/src/modal_models/FurutaPendulum/PendulumController.lf index a6ad66b7..af1c1448 100644 --- a/examples/C/src/modal_models/FurutaPendulum/PendulumController.lf +++ b/examples/C/src/modal_models/FurutaPendulum/PendulumController.lf @@ -9,18 +9,6 @@ */ target C -preamble {= - #include - #define PI 3.14159265 - #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) - double sign(double x) { - return (x > 0.0) - (x < 0.0); - } - double restrictAngle(double theta) { - return((fmod(fabs(theta) + PI, 2 * PI) - PI) * sign(theta)); - } -=} - reactor PendulumController( h: double = 0.005, // Sample interval w0: double = 6.3, @@ -38,6 +26,18 @@ reactor PendulumController( si3: double = -0.03254225945714, si4: double = -0.05808270221773, phi2: double = -7.0124562) { + preamble {= + #include + #define PI 3.14159265 + #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) + double sign(double x) { + return (x > 0.0) - (x < 0.0); + } + double restrictAngle(double theta) { + return((fmod(fabs(theta) + PI, 2 * PI) - PI) * sign(theta)); + } + =} + input theta: double input d_theta: double input phi: double diff --git a/examples/C/src/modal_models/FurutaPendulum/build_run_plot.sh b/examples/C/src/modal_models/FurutaPendulum/build_run_plot.sh index 70393e20..1e8dc089 100755 --- a/examples/C/src/modal_models/FurutaPendulum/build_run_plot.sh +++ b/examples/C/src/modal_models/FurutaPendulum/build_run_plot.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail # This script compiles the generated code, # executes it, and plots the results. # The first argument is the name of the main reactor diff --git a/examples/C/src/rhythm/compile.sh b/examples/C/src/rhythm/compile.sh index 1eec9942..421a64fa 100755 --- a/examples/C/src/rhythm/compile.sh +++ b/examples/C/src/rhythm/compile.sh @@ -1,5 +1,6 @@ #!/bin/bash -# +set -euo pipefail + # Script to compile the code generated by lfc or by the Lingua Franca IDE # for the programs in this directory using arguments that are suitable to the # OS on which this is running. The OS is detected using the Posix command uname. diff --git a/examples/C/src/rosace/build_run_plot.sh b/examples/C/src/rosace/build_run_plot.sh index 59cce835..c276ff4a 100755 --- a/examples/C/src/rosace/build_run_plot.sh +++ b/examples/C/src/rosace/build_run_plot.sh @@ -1,4 +1,6 @@ #!/bin/bash +set -euo pipefail + # This script compiles the generated code, # executes it, and plots the results. # The one argument is the name of the main reactor.