diff options
Diffstat (limited to 'test/monniaux/lustrev4_lustrec_heater_control/heater_control_main.c')
-rw-r--r-- | test/monniaux/lustrev4_lustrec_heater_control/heater_control_main.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/monniaux/lustrev4_lustrec_heater_control/heater_control_main.c b/test/monniaux/lustrev4_lustrec_heater_control/heater_control_main.c new file mode 100644 index 00000000..d0298840 --- /dev/null +++ b/test/monniaux/lustrev4_lustrec_heater_control/heater_control_main.c @@ -0,0 +1,48 @@ +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <assert.h> +#include "heater_control_alloc.h" +#include "../clock.h" +#include "../dm_random.c" + +static double _get_double(void) { + return (dm_random_uint32()%70000U) * 1E-3 -20.0; +} + +static void _put_bool(const char *name, _Bool b) { + printf("%s: %d\n", name, b); +} + +/* C code generated by lustrec + Version number 1.6-@GITBRANCH@ + Code is C99 compliant + Using (double) floating-point numbers */ + +int main (int argc, char *argv[]) { + + /* Main memory allocation */ + heater_control_ALLOC(static,main_mem); + + clock_prepare(); + clock_start(); + + /* Initialize the main memory */ + heater_control_reset(&main_mem); + + /* Infinite loop */ + for(int loop_count=0; loop_count<1000; loop_count++){ + double T = _get_double(); + double T1 = _get_double(); + double T2 = _get_double(); + double T3 = _get_double(); + _Bool Heat_on; + heater_control_step (T, T1, T2, T3, &Heat_on, &main_mem); + // _put_bool("Heat_on", Heat_on); + } + + clock_stop(); + print_total_clock(); + + return 1; +} |