1/*
2 * Prerelease License - for engineering feedback and testing purposes
3 * only. Not for sale.
4 *
5 * File: ert_main.c
6 *
7 * Code generated for Simulink model 'fuel_rate_control'.
8 *
9 * Model version : 1.742
10 * Simulink Coder version : 9.3 (R2020a) 18-Nov-2019
11 * C/C++ source code generated on : Wed Nov 27 12:21:15 2019
12 *
13 * Target selection: ert.tlc
14 * Embedded hardware selection: Specified
15 * Code generation objectives: Unspecified
16 * Validation result: Not run
17 */
18
19#include <stddef.h>
20#include <stdio.h> /* This ert_main.c example uses printf/fflush */
21#include "fuel_rate_control.h" /* Model's header file */
22#include "rtwtypes.h"
23
24/*
25 * Associating rt_OneStep with a real-time clock or interrupt service routine
26 * is what makes the generated code "real-time". The function rt_OneStep is
27 * always associated with the base rate of the model. Subrates are managed
28 * by the base rate from inside the generated code. Enabling/disabling
29 * interrupts and floating point context switches are target specific. This
30 * example code indicates where these should take place relative to executing
31 * the generated code step function. Overrun behavior should be tailored to
32 * your application needs. This example simply sets an error status in the
33 * real-time model and returns from rt_OneStep.
34 */
35void rt_OneStep(void);
36void rt_OneStep(void)
37{
38 static boolean_T OverrunFlag = false;
39
40 /* Disable interrupts here */
41
42 /* Check for overrun */
43 if (OverrunFlag) {
44 rtmSetErrorStatus(rtM, "Overrun");
45 return;
46 }
47
48 OverrunFlag = true;
49
50 /* Save FPU context here (if necessary) */
51 /* Re-enable timer or interrupt here */
52 /* Set model inputs here */
53
54 /* Step the model */
55 fuel_rate_control_step();
56
57 /* Get model outputs here */
58
59 /* Indicate task complete */
60 OverrunFlag = false;
61
62 /* Disable interrupts here */
63 /* Restore FPU context here (if necessary) */
64 /* Enable interrupts here */
65}
66
67/*
68 * The example "main" function illustrates what is required by your
69 * application code to initialize, execute, and terminate the generated code.
70 * Attaching rt_OneStep to a real-time clock is target specific. This example
71 * illustrates how you do this relative to initializing the model.
72 */
73int_T main(int_T argc, const char *argv[])
74{
75 /* Unused arguments */
76 (void)(argc);
77 (void)(argv);
78
79 /* Initialize model */
80 fuel_rate_control_initialize();
81
82 /* Attach rt_OneStep to a timer or interrupt service routine with
83 * period 0.01 seconds (the model's base sample time) here. The
84 * call syntax for rt_OneStep is
85 *
86 * rt_OneStep();
87 */
88 printf("Warning: The simulation will run forever. "
89 "Generated ERT main won't simulate model step behavior. "
90 "To change this behavior select the 'MAT-file logging' option.\n");
91 fflush((NULL));
92 while (rtmGetErrorStatus(rtM) == (NULL)) {
93 /* Perform other application tasks here */
94 }
95
96 /* Disable rt_OneStep() here */
97 return 0;
98}
99
100/*
101 * File trailer for generated code.
102 *
103 * [EOF]
104 */
105