aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/lustrev4_lustrec_heater_control/heater_control_main.c
blob: d0298840233d4376c3e10810ea4934fb7fa58f86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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;
}