-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAutomated_Irrigation.c
More file actions
83 lines (73 loc) · 2.57 KB
/
Automated_Irrigation.c
File metadata and controls
83 lines (73 loc) · 2.57 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
* File: Automated_Irrigation_Control_System.c
*
* Code generated for Simulink model 'Automated_Irrigation_Control_System'.
*
* Model version : 1.1
* Simulink Coder version : 9.9 (R2023a) 19-Nov-2022
* C/C++ source code generated on : Wed Mar 20 00:31:22 2024
*
* Target selection: ert.tlc
* Embedded hardware selection: Atmel->AVR
* Code generation objectives:
* 1. Execution efficiency
* 2. RAM efficiency
* Validation result: Not run
*/
#include "Automated_Irrigation_Control_System.h"
/* Private macros used by the generated code to access rtModel */
#ifndef rtmIsMajorTimeStep
#define rtmIsMajorTimeStep(rtm) (((rtm)->Timing.simTimeStep) == MAJOR_TIME_STEP)
#endif
#ifndef rtmIsMinorTimeStep
#define rtmIsMinorTimeStep(rtm) (((rtm)->Timing.simTimeStep) == MINOR_TIME_STEP)
#endif
#ifndef rtmSetTPtr
#define rtmSetTPtr(rtm, val) ((rtm)->Timing.t = (val))
#endif
/* Real-time model */
static RT_MODEL rtM_;
RT_MODEL *const rtM = &rtM_;
/* Model step function */
void Automated_Irrigation_Control_System_step(void)
{
/* Update absolute time for base rate */
/* The "clockTick0" counts the number of times the code of this task has
* been executed. The absolute time is the multiplication of "clockTick0"
* and "Timing.stepSize0". Size of "clockTick0" ensures timer will not
* overflow during the application lifespan selected.
*/
rtM->Timing.t[0] =
((time_T)(++rtM->Timing.clockTick0)) * rtM->Timing.stepSize0;
{
/* Update absolute timer for sample time: [0.001s, 0.0s] */
/* The "clockTick1" counts the number of times the code of this task has
* been executed. The resolution of this integer timer is 0.001, which is the step size
* of the task. Size of "clockTick1" ensures timer will not overflow during the
* application lifespan selected.
*/
rtM->Timing.clockTick1++;
}
}
/* Model initialize function */
void Automated_Irrigation_Control_System_initialize(void)
{
/* Registration code */
{
/* Setup solver object */
rtsiSetSimTimeStepPtr(&rtM->solverInfo, &rtM->Timing.simTimeStep);
rtsiSetTPtr(&rtM->solverInfo, &rtmGetTPtr(rtM));
rtsiSetStepSizePtr(&rtM->solverInfo, &rtM->Timing.stepSize0);
rtsiSetErrorStatusPtr(&rtM->solverInfo, (&rtmGetErrorStatus(rtM)));
rtsiSetRTModelPtr(&rtM->solverInfo, rtM);
}
rtsiSetSimTimeStep(&rtM->solverInfo, MAJOR_TIME_STEP);
rtsiSetSolverName(&rtM->solverInfo,"FixedStepDiscrete");
rtmSetTPtr(rtM, &rtM->Timing.tArray[0]);
rtM->Timing.stepSize0 = 0.001;
}
/*
* File trailer for generated code.
*
* [EOF]
*/