1
/*
2
* File: ObstacleDetection_sil_sil_ec.c
3
*
4
* Code generated for Simulink model 'ObstacleDetection_sil_sil_ec'.
5
*
6
* Model version : 1.2
7
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
8
* C/C++ source code generated on : Tue Oct 29 09:35:36 2019
9
*
10
* Target selection: ert.tlc
11
* Embedded hardware selection: Intel->x86-64 (Windows64)
12
* Code generation objectives:
13
* 1. Execution efficiency
14
* 2. RAM efficiency
15
* Validation result: Not run
16
*/
17
18
#include "ObstacleDetection_sil_sil_ec.h"
19
20
/* Block signals and states (default storage) */
21
DW_ObstacleDetection_sil_sil__T
ObstacleDetection_sil_sil_ec_DW
;
22
23
/* External inputs (root inport signals with default storage) */
24
ExtU_ObstacleDetection_sil_si_T
ObstacleDetection_sil_sil_ec_U
;
25
26
/* External outputs (root outports fed by signals with default storage) */
27
ExtY_ObstacleDetection_sil_si_T
ObstacleDetection_sil_sil_ec_Y
;
28
29
/* Real-time model */
30
RT_MODEL_ObstacleDetection_si_T
ObstacleDetection_sil_sil_ec_M_
;
31
RT_MODEL_ObstacleDetection_si_T
*
const
ObstacleDetection_sil_sil_ec_M
=
32
&
ObstacleDetection_sil_sil_ec_M_
;
33
34
/* Model step function */
35
void
ObstacleDetection_sil_sil_ec_step
(
void
)
36
{
37
int32_T
rowIdx
;
38
boolean_T
rtb_RelationalOperator
;
39
40
/* RelationalOperator: '
<S1>/Relational Operator
' incorporates:
41
* Constant: '
<S1>/Constant1
'
42
* Inport: '
<Root>/usSensorFront
'
43
*/
44
rtb_RelationalOperator
= (
ObstacleDetection_sil_sil_ec_U
.
usSensorFront
<=
45
ObstacleDetection_sil_sil_ec_P
.
DIST_OBSTACLE_STOP
);
46
47
/* CombinatorialLogic: '
<S3>/Logic
' incorporates:
48
* Constant: '
<S1>/Constant3
'
49
* Inport: '
<Root>/remoteCtrlCmd
'
50
* Logic: '
<S1>/Logical Operator
'
51
* Logic: '
<S1>/Logical Operator1
'
52
* Memory: '
<S3>/Memory
'
53
* RelationalOperator: '
<S1>/Relational Operator2
'
54
*/
55
rowIdx
= (
int32_T
)(((((
!
rtb_RelationalOperator
)
||
56
(
ObstacleDetection_sil_sil_ec_U
.
remoteCtrlCmd
==
57
ObstacleDetection_sil_sil_ec_P
.
REMOTE_DRIVE_REV
))
+
((
uint32_T
)
58
rtb_RelationalOperator
<<
1))
<<
1)
+
59
ObstacleDetection_sil_sil_ec_DW
.
Memory_PreviousInput
);
60
61
/* Outport: '
<Root>/emergencyStopObstacle
' incorporates:
62
* CombinatorialLogic: '
<S3>/Logic
'
63
*/
64
ObstacleDetection_sil_sil_ec_Y
.
emergencyStopObstacle
=
65
ObstacleDetection_sil_sil_ec_P
.
Logic_table
[(
uint32_T
)
rowIdx
];
66
67
/* Outport: '
<Root>/obstacleDetection
' incorporates:
68
* Constant: '
<S1>/Constant2
'
69
* Inport: '
<Root>/usSensorFront
'
70
* RelationalOperator: '
<S1>/Relational Operator1
'
71
*/
72
ObstacleDetection_sil_sil_ec_Y
.
obstacleDetection
=
73
(
ObstacleDetection_sil_sil_ec_U
.
usSensorFront
<=
74
ObstacleDetection_sil_sil_ec_P
.
DIST_OBSTACLE_EVADE
);
75
76
/* Update for Memory: '
<S3>/Memory
' incorporates:
77
* CombinatorialLogic: '
<S3>/Logic
'
78
*/
79
ObstacleDetection_sil_sil_ec_DW
.
Memory_PreviousInput
=
80
ObstacleDetection_sil_sil_ec_P
.
Logic_table
[(
uint32_T
)
rowIdx
];
81
}
82
83
/* Model initialize function */
84
void
ObstacleDetection_sil_sil_ec_initialize
(
void
)
85
{
86
/* InitializeConditions for Memory: '
<S3>/Memory
' */
87
ObstacleDetection_sil_sil_ec_DW
.
Memory_PreviousInput
=
88
ObstacleDetection_sil_sil_ec_P
.
S_R_Flip_Flop_initial_condition
;
89
}
90
91
/* Model terminate function */
92
void
ObstacleDetection_sil_sil_ec_terminate
(
void
)
93
{
94
/* (no terminate code required) */
95
}
96
97
/*
98
* File trailer for generated code.
99
*
100
* [EOF]
101
*/
102