Challenge

Project 2-Highway Assistant-Lane Changing Assistant

To develop one specific requirement of Highway Assistant – Lane Changing Assistant algorithm with the concepts of Autosar SW-C Development using MATLAB by following the MBD guidelines.


AIM:

To develop one specific requirement of Highway Assistant – Lane Changing Assistant algorithm with concepts of Autosar Software Component Development in MATLAB Environment by following the Model Based Development guidelines. The Project must be done keeping in mind the following processes & steps.

Conditions:

  • This model must be developed in MATLAB Simulink per MBD guidelines.
  • Code Generation Profile must be Autosar Coder.
  • Simulink Data Dictionary must be created for the model & must be linked to the model.
  • All the input & output signals must be mapped into the Autosar Editor.
  • Model Advisor Report is mandatory & this will be followed by Code Generation.

INTRODUCTION:

The Highway Assistant supports the driver and takes over the longitudinal and lateral guidance of the vehicle in monotonous driving situations on highways. The partially automated function can automatically start, accelerate, brake as well as steer the vehicle to a certain extent. The driver has to permanently supervise the system and be ready to take over the complete control of the vehicle at any time.

Drivers are taught to assess surrounding traffic before changing lanes by checking their rearview and side mirrors and looking over each shoulder. However, even for those who follow this sequence of checks, the vehicle's blind spot – the area alongside and just behind the vehicle – is a constant source of danger and often the cause of serious accidents. Even vehicles approaching quickly from behind can pose a risk. To make changing lanes safer, this feature has been developed.

WORKING PRINCIPLE:

Highway Assistant is a partially automated driving function for a speed range of up to 180 km/h (112 mph) on highways. It combines the radar-based longitudinal guidance of Adaptive Cruise Control (ACC) with the video-based lateral guidance of lane keeping support in one system. Highway Assistant can be supplemented by an automatic lane change initiated and monitored by the driver in a speed range of 60 – 130 km/h (35 – 80 mph).

The lane Change Assistant works by using two mid-range radar sensors that are concealed in the rear bumper – one on the left, one on the right. These two sensors monitor the area alongside and behind the car. Powerful control software collates the sensor information to create a complete picture of all traffic in the area behind the vehicle.Whenever another vehicle approaches at speed from behind or is already present in the blind spot, a signal such as a warning light in the side mirror alerts the driver to the hazard. Should the driver still activate the turn signal with the intention of changing lanes, the system issues an additional acoustic and/or haptic warning.

REQUIREMENTS:

  • Requirement No: 1 - [Highway_DisplayUnit]:
    Inputs to this particular subsystem are “Highway_Input_Signal”, “Enable_Display”, “Input_Switch”. These three input signals, when assigned to a particular value will give output signals of specific value. The output signals are “Highway_Display_Mode_1”, “Highway_Display_Mode_2”, “Highway_Display_Mode_3”, “Highway_Display_Mode_4”. The requirement must be implemented in the form of a Stateflow logic.

    Condition

    Action

    Highway_Input_Signal = 1

    Enable_Display = off

    Input_Switch = on

    Highway_Display_Mode_1 = 232

    Highway_Display_Mode_2 = 183

    Highway_Display_Mode_3 = 41

    Highway_Display_Mode_4 = 94

    Highway_Input_Signal = 1

    Enable_Display = on

    Input_Switch = on

    Highway_Display_Mode_1 = 213

    Highway_Display_Mode_2 = 183

    Highway_Display_Mode_3 = 9

    Highway_Display_Mode_4 = 94




  • Requirement No: 2
    Inputs to this particular subsystem are “Enable_Display”, “Input_Switch”, “Lane_Input_Signal”. These three input signals, when assigned to a particular value will give output signals of specific value. The output signals are “Lane_Display_Mode_1”, “Lane_Display_Mode_2”, “Lane_Display_Mode_3”, “Lane_Display_Mode_4”. The requirement must be implemented in the form of Stateflow logic.

    Condition

    Action

    Lane_Input_Signal= 6

    Enable_Display = off

    Input_Switch = on

    Lane_Display_Mode_1 = 132

    Lane_Display_Mode_2 = 185

    Lane_Display_Mode_3 = 54

    Lane_Display_Mode_4 = 67

    Lane_Input_Signal= 6

    Enable_Display = on

    Input_Switch = on

    Lane_Display_Mode_1 = 127

    Lane_Display_Mode_2 = 248

    Lane_Display_Mode_3 = 186

    Lane_Display_Mode_4 = 84



  • Requirement No: 3

    Signals coming from both subsystems “Highway_Display_Mode_1” & “Lane_Display_Mode_1” are given as inputs to a switch block which will have input signal “Highway_Input_Signal” given as 2nd input to the switch block. Corresponding output from this particular switch block is output signal “Display_Mode_1”.

    Signals coming from both subsystems “Highway_Display_Mode_2” & “Lane_Display_Mode_2” are given as inputs to a switch block which will have input signal “Highway_Input_Signal” given as 2nd input to the switch block. Corresponding output from this particular switch block is output signal “Display_Mode_2”.

    Signals coming from both subsystems “Highway_Display_Mode_3” & “Lane_Display_Mode_3” are given as inputs to a switch block which will have input signal “Highway_Input_Signal” given as 2nd input to the switch block. Corresponding output from this particular switch block is output signal “Display_Mode_3”.

    Signals coming from both subsystems “Highway_Display_Mode_4” & “Lane_Display_Mode_4” are given as inputs to a switch block which will have input signal “Highway_Input_Signal” given as 2nd input to the switch block. Corresponding output from this particular switch block is output signal “Display_Mode_4”.

DEVELOPED MODEL:

Main Model:



Under Subsystem, Highway_LCA




Under Requirement 1 - Highway_DisplayUnit:

Chart of Highway_DisplayUnit:




Under Requirement 2 - Lane_DisplayUnit:

Chart of Lane_DisplayUnit:





Under Third Subsystem:


Simulink Data Dictionary:






REQUIREMENT TAGGING:

Requirement Document for all the three subsystems are linked with Word



Modifying CONFIGURATION PARAMETERS for AUTOSAR Port Mapping:
For Solver Settings:


For Code Generation:


Now, We can Modify the AUTOSAR SW Component by Configuring Autosar Dictionary

For reference, Lets create an EXCEL document with all the Porting Parameters:


Modifying XML Options:



Now, We can Create The Sender- Receiver Interface:



Adding Corresponding Data Elements:



Now Configure the Sender and Receiver Ports:







Now, we can do the PortMapping for Inports and Outports using Autosar Software Component:

For Inport

For Outport




Successfully Validated the Port Mapping


Final simulation to check the model is working properly




Performing MODEL ADVISOR check:




Since we have succesfuly performed the Model Advisory Check, Lets Generate the AUTOSAR Code



The Summary Of Generated Autosar Model is




For HighwayAssist_LCA.c

1	/*
2	 * File: HighwayAssist_LCA.c
3	 *
4	 * Code generated for Simulink model 'HighwayAssist_LCA'.
5	 *
6	 * Model version                  : 1.21
7	 * Simulink Coder version         : 9.5 (R2021a) 14-Nov-2020
8	 * C/C++ source code generated on : Mon Dec 27 17:36:11 2021
9	 *
10	 * Target selection: autosar.tlc
11	 * Embedded hardware selection: Intel->x86-64 (Windows64)
12	 * Code generation objectives: Unspecified
13	 * Validation result: Not run
14	 */
15	
16	#include "HighwayAssist_LCA.h"
17	#include "HighwayAssist_LCA_private.h"
18	
19	/* Named constants for Chart: '<S2>/Highway_DisplayUnit' */
20	#define HighwayAssis_IN_NO_ACTIVE_CHILD ((uint8)0U)
21	#define HighwayAssist_LCA_CALL_EVENT   (-1)
22	#define HighwayAssist_LCA_IN_Case_1    ((uint8)1U)
23	#define HighwayAssist_LCA_IN_Case_2    ((uint8)2U)
24	
25	/* Block signals (default storage) */
26	B_HighwayAssist_LCA_T HighwayAssist_LCA_B;
27	
28	/* Block states (default storage) */
29	DW_HighwayAssist_LCA_T HighwayAssist_LCA_DW;
30	
31	/* Model step function */
32	void HighwayAssist_LCA_Step(void)
33	{
34	  uint8 rtb_Display_Mode_4;
35	  boolean b_sf_internal_predicateOutput;
36	  boolean b_sf_internal_predicateOutput_0;
37	  boolean sf_internal_predicateOutput;
38	  boolean sf_internal_predicateOutput_0;
39	
40	  /* Chart: '<S2>/Highway_DisplayUnit' incorporates:
41	   *  Inport: '<Root>/Enable_Display'
42	   *  Inport: '<Root>/Highway_Input_Signal'
43	   *  Inport: '<Root>/Input_Switch'
44	   */
45	  if (((uint32)HighwayAssist_LCA_DW.is_active_c2_HighwayAssist_LCA) == 0U) {
46	    HighwayAssist_LCA_DW.is_active_c2_HighwayAssist_LCA = 1;
47	    HighwayAssist_LCA_DW.is_c2_HighwayAssist_LCA = HighwayAssist_LCA_IN_Case_1;
48	    HighwayAssist_LCA_B.Highway_Display_Mode_1 = 232;
49	    HighwayAssist_LCA_B.Highway_Display_Mode_2 = 183;
50	    HighwayAssist_LCA_B.Highway_Display_Mode_3 = 41;
51	    HighwayAssist_LCA_B.Highway_Display_Mode_4 = 94;
52	  } else {
53	    switch (HighwayAssist_LCA_DW.is_c2_HighwayAssist_LCA) {
54	     case HighwayAssist_LCA_IN_Case_1:
55	      if (((((float64)
56	             Rte_IRead_HighwayAssist_LCA_Step_Rp_Highway_Input_Signal_DE_Highway_Input_Signal
57	             ()) == 1.0) && (((float64)
58	                              Rte_IRead_HighwayAssist_LCA_Step_Rp_Enable_Display_DE_Enable_Display
59	                              ()) == HighwayAssist_LCA_DW.on_g)) && (((float64)
60	            Rte_IRead_HighwayAssist_LCA_Step_Rp_Input_Switch_DE_Input_Switch()) ==
61	           HighwayAssist_LCA_DW.on_g)) {
62	        sf_internal_predicateOutput = true;
63	      } else {
64	        sf_internal_predicateOutput = false;
65	      }
66	
67	      if (sf_internal_predicateOutput) {
68	        HighwayAssist_LCA_DW.is_c2_HighwayAssist_LCA =
69	          HighwayAssist_LCA_IN_Case_2;
70	        HighwayAssist_LCA_B.Highway_Display_Mode_1 = 213;
71	        HighwayAssist_LCA_B.Highway_Display_Mode_2 = 183;
72	        HighwayAssist_LCA_B.Highway_Display_Mode_3 = 9;
73	        HighwayAssist_LCA_B.Highway_Display_Mode_4 = 94;
74	      }
75	      break;
76	
77	     default:
78	      /* case IN_Case_2: */
79	      if (((((float64)
80	             Rte_IRead_HighwayAssist_LCA_Step_Rp_Highway_Input_Signal_DE_Highway_Input_Signal
81	             ()) == 1.0) && (((float64)
82	                              Rte_IRead_HighwayAssist_LCA_Step_Rp_Enable_Display_DE_Enable_Display
83	                              ()) == HighwayAssist_LCA_DW.off_f)) && (((float64)
84	            Rte_IRead_HighwayAssist_LCA_Step_Rp_Input_Switch_DE_Input_Switch()) ==
85	           HighwayAssist_LCA_DW.on_g)) {
86	        b_sf_internal_predicateOutput = true;
87	      } else {
88	        b_sf_internal_predicateOutput = false;
89	      }
90	
91	      if (b_sf_internal_predicateOutput) {
92	        HighwayAssist_LCA_DW.is_c2_HighwayAssist_LCA =
93	          HighwayAssist_LCA_IN_Case_1;
94	        HighwayAssist_LCA_B.Highway_Display_Mode_1 = 232;
95	        HighwayAssist_LCA_B.Highway_Display_Mode_2 = 183;
96	        HighwayAssist_LCA_B.Highway_Display_Mode_3 = 41;
97	        HighwayAssist_LCA_B.Highway_Display_Mode_4 = 94;
98	      } else {
99	        HighwayAssist_LCA_B.Highway_Display_Mode_1 = 213;
100	        HighwayAssist_LCA_B.Highway_Display_Mode_2 = 183;
101	        HighwayAssist_LCA_B.Highway_Display_Mode_3 = 9;
102	        HighwayAssist_LCA_B.Highway_Display_Mode_4 = 94;
103	      }
104	      break;
105	    }
106	  }
107	
108	  /* End of Chart: '<S2>/Highway_DisplayUnit' */
109	
110	  /* Chart: '<S3>/Lane_DisplayUnit' incorporates:
111	   *  Inport: '<Root>/Enable_Display'
112	   *  Inport: '<Root>/Input_Switch'
113	   *  Inport: '<Root>/Lane_Input_Signal'
114	   */
115	  if (((uint32)HighwayAssist_LCA_DW.is_active_c1_HighwayAssist_LCA) == 0U) {
116	    HighwayAssist_LCA_DW.is_active_c1_HighwayAssist_LCA = 1;
117	    HighwayAssist_LCA_DW.is_c1_HighwayAssist_LCA = HighwayAssist_LCA_IN_Case_1;
118	    HighwayAssist_LCA_B.Lane_Display_Mode_1 = 132;
119	    HighwayAssist_LCA_B.Lane_Display_Mode_2 = 185;
120	    HighwayAssist_LCA_B.Lane_Display_Mode_3 = 54;
121	    HighwayAssist_LCA_B.Lane_Display_Mode_4 = 67;
122	  } else {
123	    switch (HighwayAssist_LCA_DW.is_c1_HighwayAssist_LCA) {
124	     case HighwayAssist_LCA_IN_Case_1:
125	      if (((((float64)
126	             Rte_IRead_HighwayAssist_LCA_Step_Rp_Lane_Input_Signal_DE_Lane_Input_Signal
127	             ()) == 6.0) && (((float64)
128	                              Rte_IRead_HighwayAssist_LCA_Step_Rp_Enable_Display_DE_Enable_Display
129	                              ()) == HighwayAssist_LCA_DW.off)) && (((float64)
130	            Rte_IRead_HighwayAssist_LCA_Step_Rp_Input_Switch_DE_Input_Switch()) ==
131	           HighwayAssist_LCA_DW.on)) {
132	        sf_internal_predicateOutput_0 = true;
133	      } else {
134	        sf_internal_predicateOutput_0 = false;
135	      }
136	
137	      if (sf_internal_predicateOutput_0) {
138	        HighwayAssist_LCA_DW.is_c1_HighwayAssist_LCA =
139	          HighwayAssist_LCA_IN_Case_2;
140	        HighwayAssist_LCA_B.Lane_Display_Mode_1 = 127;
141	        HighwayAssist_LCA_B.Lane_Display_Mode_2 = 248;
142	        HighwayAssist_LCA_B.Lane_Display_Mode_3 = 186;
143	        HighwayAssist_LCA_B.Lane_Display_Mode_4 = 84;
144	      }
145	      break;
146	
147	     default:
148	      /* case IN_Case_2: */
149	      if (((((float64)
150	             Rte_IRead_HighwayAssist_LCA_Step_Rp_Lane_Input_Signal_DE_Lane_Input_Signal
151	             ()) == 6.0) && (((float64)
152	                              Rte_IRead_HighwayAssist_LCA_Step_Rp_Enable_Display_DE_Enable_Display
153	                              ()) == HighwayAssist_LCA_DW.on)) && (((float64)
154	            Rte_IRead_HighwayAssist_LCA_Step_Rp_Input_Switch_DE_Input_Switch()) ==
155	           HighwayAssist_LCA_DW.on)) {
156	        b_sf_internal_predicateOutput_0 = true;
157	      } else {
158	        b_sf_internal_predicateOutput_0 = false;
159	      }
160	
161	      if (b_sf_internal_predicateOutput_0) {
162	        HighwayAssist_LCA_DW.is_c1_HighwayAssist_LCA =
163	          HighwayAssist_LCA_IN_Case_1;
164	        HighwayAssist_LCA_B.Lane_Display_Mode_1 = 132;
165	        HighwayAssist_LCA_B.Lane_Display_Mode_2 = 185;
166	        HighwayAssist_LCA_B.Lane_Display_Mode_3 = 54;
167	        HighwayAssist_LCA_B.Lane_Display_Mode_4 = 67;
168	      } else {
169	        HighwayAssist_LCA_B.Lane_Display_Mode_1 = 127;
170	        HighwayAssist_LCA_B.Lane_Display_Mode_2 = 248;
171	        HighwayAssist_LCA_B.Lane_Display_Mode_3 = 186;
172	        HighwayAssist_LCA_B.Lane_Display_Mode_4 = 84;
173	      }
174	      break;
175	    }
176	  }
177	
178	  /* End of Chart: '<S3>/Lane_DisplayUnit' */
179	
180	  /* Switch: '<S4>/Switch' incorporates:
181	   *  Inport: '<Root>/Highway_Input_Signal'
182	   */
183	  if (((sint32)
184	       Rte_IRead_HighwayAssist_LCA_Step_Rp_Highway_Input_Signal_DE_Highway_Input_Signal
185	       ()) != 0) {
186	    /* Switch: '<S4>/Switch3' */
187	    rtb_Display_Mode_4 = HighwayAssist_LCA_B.Highway_Display_Mode_1;
188	  } else {
189	    /* Switch: '<S4>/Switch3' */
190	    rtb_Display_Mode_4 = HighwayAssist_LCA_B.Lane_Display_Mode_1;
191	  }
192	
193	  /* End of Switch: '<S4>/Switch' */
194	
195	  /* Outport: '<Root>/Display_Mode_1' */
196	  Rte_IWrite_HighwayAssist_LCA_Step_Pp_Display_Mode_1_DE_Display_Mode_1
197	    (rtb_Display_Mode_4);
198	
199	  /* Switch: '<S4>/Switch1' incorporates:
200	   *  Inport: '<Root>/Highway_Input_Signal'
201	   */
202	  if (((sint32)
203	       Rte_IRead_HighwayAssist_LCA_Step_Rp_Highway_Input_Signal_DE_Highway_Input_Signal
204	       ()) != 0) {
205	    /* Switch: '<S4>/Switch3' */
206	    rtb_Display_Mode_4 = HighwayAssist_LCA_B.Highway_Display_Mode_2;
207	  } else {
208	    /* Switch: '<S4>/Switch3' */
209	    rtb_Display_Mode_4 = HighwayAssist_LCA_B.Lane_Display_Mode_2;
210	  }
211	
212	  /* End of Switch: '<S4>/Switch1' */
213	
214	  /* Outport: '<Root>/Display_Mode_2' */
215	  Rte_IWrite_HighwayAssist_LCA_Step_Pp_Display_Mode_2_DE_Display_Mode_2
216	    (rtb_Display_Mode_4);
217	
218	  /* Switch: '<S4>/Switch2' incorporates:
219	   *  Inport: '<Root>/Highway_Input_Signal'
220	   */
221	  if (((sint32)
222	       Rte_IRead_HighwayAssist_LCA_Step_Rp_Highway_Input_Signal_DE_Highway_Input_Signal
223	       ()) != 0) {
224	    /* Switch: '<S4>/Switch3' */
225	    rtb_Display_Mode_4 = HighwayAssist_LCA_B.Highway_Display_Mode_3;
226	  } else {
227	    /* Switch: '<S4>/Switch3' */
228	    rtb_Display_Mode_4 = HighwayAssist_LCA_B.Lane_Display_Mode_3;
229	  }
230	
231	  /* End of Switch: '<S4>/Switch2' */
232	
233	  /* Outport: '<Root>/Display_Mode_3' */
234	  Rte_IWrite_HighwayAssist_LCA_Step_Pp_Display_Mode_3_DE_Display_Mode_3
235	    (rtb_Display_Mode_4);
236	
237	  /* Switch: '<S4>/Switch3' incorporates:
238	   *  Inport: '<Root>/Highway_Input_Signal'
239	   */
240	  if (((sint32)
241	       Rte_IRead_HighwayAssist_LCA_Step_Rp_Highway_Input_Signal_DE_Highway_Input_Signal
242	       ()) != 0) {
243	    /* Switch: '<S4>/Switch3' */
244	    rtb_Display_Mode_4 = HighwayAssist_LCA_B.Highway_Display_Mode_4;
245	  } else {
246	    /* Switch: '<S4>/Switch3' */
247	    rtb_Display_Mode_4 = HighwayAssist_LCA_B.Lane_Display_Mode_4;
248	  }
249	
250	  /* End of Switch: '<S4>/Switch3' */
251	
252	  /* Outport: '<Root>/Display_Mode_4' */
253	  Rte_IWrite_HighwayAssist_LCA_Step_Pp_Display_Mode_4_DE_Display_Mode_4
254	    (rtb_Display_Mode_4);
255	}
256	
257	/* Model initialize function */
258	void HighwayAssist_LCA_Init(void)
259	{
260	  /* SystemInitialize for Chart: '<S2>/Highway_DisplayUnit' */
261	  HighwayAssist_LCA_DW.on_g = 1.0;
262	
263	  /* SystemInitialize for Chart: '<S3>/Lane_DisplayUnit' */
264	  HighwayAssist_LCA_DW.on = 1.0;
265	}
266	
267	/*
268	 * File trailer for generated code.
269	 *
270	 * [EOF]
271	 */
272	



For HighwayAssist_LCA.h

1	/*
2	 * File: HighwayAssist_LCA.h
3	 *
4	 * Code generated for Simulink model 'HighwayAssist_LCA'.
5	 *
6	 * Model version                  : 1.21
7	 * Simulink Coder version         : 9.5 (R2021a) 14-Nov-2020
8	 * C/C++ source code generated on : Mon Dec 27 17:36:11 2021
9	 *
10	 * Target selection: autosar.tlc
11	 * Embedded hardware selection: Intel->x86-64 (Windows64)
12	 * Code generation objectives: Unspecified
13	 * Validation result: Not run
14	 */
15	
16	#ifndef RTW_HEADER_HighwayAssist_LCA_h_
17	#define RTW_HEADER_HighwayAssist_LCA_h_
18	#ifndef HighwayAssist_LCA_COMMON_INCLUDES_
19	#define HighwayAssist_LCA_COMMON_INCLUDES_
20	#include "rtwtypes.h"
21	#include "Rte_HighwayAssist_LCA.h"
22	#endif                                 /* HighwayAssist_LCA_COMMON_INCLUDES_ */
23	
24	#include "HighwayAssist_LCA_types.h"
25	
26	/* Macros for accessing real-time model data structure */
27	
28	/* Block signals (default storage) */
29	typedef struct tag_B_HighwayAssist_LCA_T {
30	  uint8 Lane_Display_Mode_1;           /* '<S3>/Lane_DisplayUnit' (Output 1)  */
31	  uint8 Lane_Display_Mode_2;           /* '<S3>/Lane_DisplayUnit' (Output 2)  */
32	  uint8 Lane_Display_Mode_3;           /* '<S3>/Lane_DisplayUnit' (Output 3)  */
33	  uint8 Lane_Display_Mode_4;           /* '<S3>/Lane_DisplayUnit' (Output 4)  */
34	  uint8 Highway_Display_Mode_1;     /* '<S2>/Highway_DisplayUnit' (Output 1)  */
35	  uint8 Highway_Display_Mode_2;     /* '<S2>/Highway_DisplayUnit' (Output 2)  */
36	  uint8 Highway_Display_Mode_3;     /* '<S2>/Highway_DisplayUnit' (Output 3)  */
37	  uint8 Highway_Display_Mode_4;     /* '<S2>/Highway_DisplayUnit' (Output 4)  */
38	} B_HighwayAssist_LCA_T;
39	
40	/* Block states (default storage) for system '<Root>' */
41	typedef struct tag_DW_HighwayAssist_LCA_T {
42	  float64 off;                 /* '<S3>/Lane_DisplayUnit' (Local data 'off')  */
43	  float64 on;                   /* '<S3>/Lane_DisplayUnit' (Local data 'on')  */
44	  float64 off_f;            /* '<S2>/Highway_DisplayUnit' (Local data 'off')  */
45	  float64 on_g;              /* '<S2>/Highway_DisplayUnit' (Local data 'on')  */
46	  uint8 is_active_c1_HighwayAssist_LCA;
47	                                /* '<S3>/Lane_DisplayUnit' (Chart is active)  */
48	  uint8 is_c1_HighwayAssist_LCA;
49	                   /* '<S3>/Lane_DisplayUnit' (Active substate of the chart)  */
50	  uint8 is_active_c2_HighwayAssist_LCA;
51	                             /* '<S2>/Highway_DisplayUnit' (Chart is active)  */
52	  uint8 is_c2_HighwayAssist_LCA;
53	                /* '<S2>/Highway_DisplayUnit' (Active substate of the chart)  */
54	} DW_HighwayAssist_LCA_T;
55	
56	/* Block signals (default storage) */
57	extern B_HighwayAssist_LCA_T HighwayAssist_LCA_B;
58	
59	/* Block states (default storage) */
60	extern DW_HighwayAssist_LCA_T HighwayAssist_LCA_DW;
61	
62	/*-
63	 * The generated code includes comments that allow you to trace directly
64	 * back to the appropriate location in the model.  The basic format
65	 * is <system>/block_name, where system is the system number (uniquely
66	 * assigned by Simulink) and block_name is the name of the block.
67	 *
68	 * Use the MATLAB hilite_system command to trace the generated code back
69	 * to the model.  For example,
70	 *
71	 * hilite_system('<S3>')    - opens system 3
72	 * hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
73	 *
74	 * Here is the system hierarchy for this model
75	 *
76	 * '<Root>' : 'HighwayAssist_LCA'
77	 * '<S1>'   : 'HighwayAssist_LCA/HIghway_LCA'
78	 * '<S2>'   : 'HighwayAssist_LCA/HIghway_LCA/Highway_DisplayUnit'
79	 * '<S3>'   : 'HighwayAssist_LCA/HIghway_LCA/Lane_DisplayUnit'
80	 * '<S4>'   : 'HighwayAssist_LCA/HIghway_LCA/Requirement_3'
81	 * '<S5>'   : 'HighwayAssist_LCA/HIghway_LCA/Highway_DisplayUnit/Highway_DisplayUnit'
82	 * '<S6>'   : 'HighwayAssist_LCA/HIghway_LCA/Lane_DisplayUnit/Lane_DisplayUnit'
83	 */
84	
85	/*-
86	 * Requirements for '<Root>': HighwayAssist_LCA
87	 *
88	 * Inherited requirements for '<S1>/Highway_DisplayUnit':
89	 *  1. Requirement No: 1 - [Highway_DisplayUnit]: Inputs to this particular subsystem are “Highway_Input_Signal”, “Enable_Display”, “Input_Switch”. These three input signals, when assigned to a particular value will give output signals of specific value. The output signals are “Highway_Display_Mode_1”, “Highway_Display_Mode_2”, “Highway_Display_Mode_3”, “Highway_Display_Mode_4”. The requirement must be implemented in the form of a Stateflow logic. Condition Action Highway_Input_Signal = 1 Enable_Display = off Input_Switch = on Highway_Display_Mode_1 = 232 Highway_Display_Mode_2 = 183 Highway_Display_Mode_3 = 41 Highway_Display_Mode_4 = 94 Highway_Input_Signal = 1 Enable_Display = on Input_Switch = on Highway_Display_Mode_1 = 213 Highway_Display_Mode_2 = 183 Highway_Display_Mode_3 = 9 Highway_Display_Mode_4 = 94
90	 *
91	 * Inherited requirements for '<S1>/Lane_DisplayUnit':
92	 *  1. Requirement No: 2 Inputs to this particular subsystem are “Enable_Display”, “Input_Switch”, “Lane_Input_Signal”. These three input signals, when assigned to a particular value will give output signals of specific value. The output signals are “Lane_Display_Mode_1”, “Lane_Display_Mode_2”, “Lane_Display_Mode_3”, “Lane_Display_Mode_4”. The requirement must be implemented in the form of Stateflow logic. Condition Action Lane_Input_Signal= 6 Enable_Display = off Input_Switch = on Lane_Display_Mode_1 = 132 Lane_Display_Mode_2 = 185 Lane_Display_Mode_3 = 54 Lane_Display_Mode_4 = 67 Lane_Input_Signal= 6 Enable_Display = on Input_Switch = on Lane_Display_Mode_1 = 127 Lane_Display_Mode_2 = 248 Lane_Display_Mode_3 = 186 Lane_Display_Mode_4 = 84
93	 *
94	 * Inherited requirements for '<S1>/Requirement_3':
95	 *  1. Requirement No: 3 Signals coming from both subsystems “Highway_Display_Mode_1” & “Lane_Display_Mode_1” are given as inputs to a switch block which will have input signal “Highway_Input_Signal” given as 2nd input to the switch block. Corresponding output from this particular switch block is output signal “Display_Mode_1”. Signals coming from both subsystems “Highway_Display_Mode_2” & “Lane_Display_Mode_2” are given as inputs to a switch block which will have input signal “Highway_Input_Signal” given as 2nd input to the switch block. Corresponding output from this particular switch block is output signal “Display_Mode_2”. Signals coming from both subsystems “Highway_Display_Mode_3” & “Lane_Display_Mode_3” are given as inputs to a switch block which will have input signal “Highway_Input_Signal” given as 2nd input to the switch block. Corresponding output from this particular switch block is output signal “Display_Mode_3”. Signals coming from both subsystems “Highway_Display_Mode_4” & “Lane_Display_Mode_4” are given as inputs to a switch block which will have input signal “Highway_Input_Signal” given as 2nd input to the switch block. Corresponding output from this particular switch block is output signal “Display_Mode_4”.
96	
97	 */
98	#endif                                 /* RTW_HEADER_HighwayAssist_LCA_h_ */
99	
100	/*
101	 * File trailer for generated code.
102	 *
103	 * [EOF]
104	 */
105	




The Final model with Autosar Code Generation




CONCLUSION:

  • The model for Lane Changing Assistant is developed using MATLAB Simulink as per MBD guidelines.
  • Simulink Data Dictionary is created for the model and is linked to the model.
  • Requirement document is tagged with each subsystem.
  • All the input & output signals are mapped into the Autosar Editor.
  • Code Generation Profile is chosen to be Autosar Coder.
  • Model Advisor Report is performed, and the the Report is Generated
  • And finally, Code generation is executed using Autosar Coder
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.