Challenge

Project 2 - Development of TFT Cluster Speedometer Software Component

Develop the Simulink model based on the given requirements and also create SLDD file and link the same to the model.

Perform the complete V and V workflow for the obtained model

Development of TFT Cluster Speedometer Software Component

Cluster Instrument receives the signals from other ECU via CAN bus interface. It also receives commands from the driver via steering wheel buttons. The signals are then processed by the Cluster ECU, after which the Cluster ECU may send the vehicle information to the LCD or light the LEDs and so forth, according to the results. Therefore, the Cluster ECU can be viewed as a carrier of the information flow.

Requirements:

1.1 Calculating TFT Display Speed

Average Vehicle Speed would be displayed only if its between 2 kmph & 250 kmph. Any value outside this range will be discarded by its lower limit & upper limit

When Average Vehicle Speed is < 2 kmph, DisplaySpeed = 2 kmph

When Average Vehicle Speed is in between 2 kmph & 250 kmph, DisplaySpeed = Average Vehicle Speed

When Average Vehicle Speed is > 250 kmph, DisplaySpeed = 250 kmph

1.2 Main Data Filtering

Main Data Filtering subsystem will be activated for every 10th millisecond

DisplaySpeed1 (t) = ((DisplaySpeed (t) x 0.65)/ Main Filter Speed Value) 0.05

1.3 Auxiliary Data Filtering

Auxiliary Data Filtering subsystem will be activated for every 10th millisecond

DisplaySpeed_Filter (t) = ((DisplaySpeed1 (t) x 0.78)/ Auxillary Filter Speed Value) - 0.03

1.4 TFT Speed Output

If |(DisplaySpeedFilter - DisplaySpeed)| > 1.5

{

Vehicle Speed Display = DisplaySpeed

}

else

{

Vehicle Speed Display = DisplaySpeed Filter

}

ans)

1. Simulink model file

2. SLDD file

3. Requirement tagging report

For the Requirement tagging report First we have to create a requirement set which is .slreqx file.

To create and link requirements go to apps click on requirment manager then click on requirement editor and then create the requirement set as shown below.

For linking requirements go to that subsystem and select that subsystem and then return to the requirement editor and right click on that requirement and then click on a link from "Subsystem name".

Then go to report and click on generate report it will look like shown below image and also attached.

4. Fixed-point Tool

For the Fixed-point tool go to apps and click on fixed point then click on the green button and select optimized fixed-point conversion.

Then click on prepare.

Then click on collect ranges.

Then click on propose datatypes and then click on applied datatypes.

5. Model advisor - JMAAB compliance report

for the model advisor JMAAB compliance report click model advisor and then click on check for JMAAB and then run it.

And then click on generate the report.

6. SLDV Design error detection report

For the SLDV Design error detection report go to apps and select design verifier.

Then select the Design error detection error tool and click on Generate tests so first, it checks model compatibility, and then it generates a report for Design error detection which is shown below.

For Design error detection report is attached.

7. Functional test case, MIL, SIL harness, coverage Reports

The functional test case:

Test cases I write in an excel sheet which is attached.

MIL harness:

For the Test harness model right click on subsystem and click on Test harness and click on Create for "TFT_cluster_Speedometer_SWC"

Then select input as a signal builder and output as To Workspace then the harness model will open as shown below.

Then import your test case into the signal builder and run this harness model.

MIL result is shown below.

SIL harness:

For SIL harness right click on subsystem and then click on generate S-function

Then check the button which is SIL block and click on the build button and connect the SIL block as shown below image.

SIL result:

Run this SIL model.

So here MIL result graph and SIL result graph is equal

coverage Reports:

Coverage report is attached down.

8. SLDV test generation report

For the SLDV Test generation report go to apps and select design verifier.

Then select the Test generation tool and click on first Advisor and then Generate tests so first, it checks model compatibility, and then it generates a report for Test generation which is shown below.

For Test generation report is attached.

9. Auto-code generation report, .c & .h codes :

For code generation goto apps and then Embedded code and click on the build button.

For the code generation report click on open report, it will look below-shown image.

.c Code:

/*
* File: Project2.c
*
* Code generated for Simulink model 'Project2'.
*
* Model version : 1.13
* Simulink Coder version : 9.3 (R2020a) 18-Nov-2019
* C/C++ source code generated on : Thu Nov 17 12:06:27 2022
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include "Project2.h"
#include "Project2_private.h"
/* Block signals (default storage) */
B_Project2_T Project2_B;
/* External inputs (root inport signals with default storage) */
ExtU_Project2_T Project2_U;
/* External outputs (root outports fed by signals with default storage) */
ExtY_Project2_T Project2_Y;
/* Real-time model */
RT_MODEL_Project2_T Project2_M_;
RT_MODEL_Project2_T *const Project2_M = &Project2_M_;
/* Model step function */
void Project2_step(void)
{
int16_T rtb_Abs;
uint16_T tmp;
uint16_T tmp_0;
uint32_T tmp_1;
/* Outputs for Atomic SubSystem: '/TFT_cluster_Speedometer_SWC' */
/* RelationalOperator: '/LowerRelop1' incorporates:
* Inport: '/Avg_SpeedValue'
*/
tmp_1 = Project2_U.Avg_SpeedValue *41943U;
/* Switch: '/Switch2' incorporates:
* Constant: '/Constant'
* Inport: '/Avg_SpeedValue'
* RelationalOperator: '/LowerRelop1'
* RelationalOperator: '/UpperRelop'
* Switch: '/Switch'
*/
if (((tmp_1 & 32U) != 0U) + (tmp_1 >> 6) > 16384000U) {
Project2_Y.Out_VehicleSpeedDisplay=25000U;
} else if (Project2_U.Avg_SpeedValue < 200) {
/* Switch: '/Switch' incorporates:
* Constant: '/Constant1'
*/
Project2_Y.Out_VehicleSpeedDisplay=200U;
} else {
Project2_Y.Out_VehicleSpeedDisplay = Project2_U.Avg_SpeedValue;
}
/* End of Switch: '/Switch2' */
/* Outputs for Enabled SubSystem: '/1.3 Auxiliary Data Filtering' incorporates:
* EnablePort: '/Enable'
*/
/* Outputs for Enabled SubSystem: '/1.2 Main Data Filtering' incorporates:
* EnablePort: '/Enable'
*/
/* RelationalOperator: '/Compare' incorporates:
* Constant: '/Constant'
* Inport: '/Timer_Input'
* Math: '/Rem'
*/
if ((uint16_T)(Project2_U.Timer_Input % 10) == 0) {
/* Sum: '/Add' incorporates:
* Constant: '/Constant'
* Constant: '/Constant'
* Gain: '/Gain'
* Gain: '/Gain'
* Product: '/Divide'
* Product: '/Divide'
* Sum: '/Add'
*/
Project2_B.Add = (uint16_T)((uint16_T)
(Project2_U.In_Auxillaryfleet_SpeedValue == 0U ? MAX_uint32_T :
(((((uint16_T)((uint16_T)(Project2_U.In_Mainfleet_SpeedValue == 0U ?
MAX_uint32_T : ((((65U * Project2_Y.Out_VehicleSpeedDisplay) >> 7) *
41943U)>> 15) / Project2_U.In_Mainfleet_SpeedValue) -5U)
* 39U) >> 6) * 41943U) >> 15) /
Project2_U.In_Auxillaryfleet_SpeedValue) -3U);
}
/* End of RelationalOperator: '/Compare' */
/* End of Outputs for SubSystem: '/1.2 Main Data Filtering' */
/* End of Outputs for SubSystem: '/1.3 Auxiliary Data Filtering' */
/* Sum: '/Add' */
tmp = Project2_B.Add;
if (Project2_B.Add > 32767) {
tmp=32767U;
}
tmp_0 = Project2_Y.Out_VehicleSpeedDisplay;
if (Project2_Y.Out_VehicleSpeedDisplay > 32767) {
tmp_0=32767U;
}
rtb_Abs = (int16_T)(tmp - tmp_0);
/* Abs: '/Abs' incorporates:
* Sum: '/Add'
*/
if (rtb_Abs < 0) {
rtb_Abs = (int16_T)-rtb_Abs;
}
/* End of Abs: '/Abs' */
/* Switch: '/Switch' incorporates:
* RelationalOperator: '/Compare'
*/
if (rtb_Abs <= 150) {
/* Outport: '/Out_VehicleSpeedDisplay' */
Project2_Y.Out_VehicleSpeedDisplay = Project2_B.Add;
}
/* End of Switch: '/Switch' */
/* End of Outputs for SubSystem: '/TFT_cluster_Speedometer_SWC' */
}
/* Model initialize function */
void Project2_initialize(void)
{
/* (no initialization code required) */
}
/* Model terminate function */
void Project2_terminate(void)
{
/* (no terminate code required) */
}
/*
* File trailer for generated code.
*
* [EOF]
*/

.h Code:

/*
* File: Project2.h
*
* Code generated for Simulink model 'Project2'.
*
* Model version : 1.13
* Simulink Coder version : 9.3 (R2020a) 18-Nov-2019
* C/C++ source code generated on : Thu Nov 17 12:06:27 2022
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#ifndef RTW_HEADER_Project2_h_
#define RTW_HEADER_Project2_h_
#ifndef Project2_COMMON_INCLUDES_
# define Project2_COMMON_INCLUDES_
#include "rtwtypes.h"
#endif /* Project2_COMMON_INCLUDES_ */
#include "Project2_types.h"
/* Macros for accessing real-time model data structure */
#ifndef rtmGetErrorStatus
# define rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
#endif
#ifndef rtmSetErrorStatus
# define rtmSetErrorStatus(rtm, val) ((rtm)->errorStatus = (val))
#endif
/* Block signals (default storage) */
typedef struct {
uint16_T Add; /* '/Add' */
} B_Project2_T;
/* External inputs (root inport signals with default storage) */
typedef struct {
uint8_T In_Mainfleet_SpeedValue; /* '/In_Mainfleet_SpeedValue' */
uint8_T In_Auxillaryfleet_SpeedValue;
uint16_T Avg_SpeedValue; /* '/Avg_SpeedValue' */
uint16_T Timer_Input; /* '/Timer_Input' */
} ExtU_Project2_T;
/* External outputs (root outports fed by signals with default storage) */
typedef struct {
uint16_T Out_VehicleSpeedDisplay; /* '/Out_VehicleSpeedDisplay' */
} ExtY_Project2_T;
/* Real-time Model Data Structure */
struct tag_RTM_Project2_T {
const char_T * volatile errorStatus;
};
/* Block signals (default storage) */
extern B_Project2_T Project2_B;
/* External inputs (root inport signals with default storage) */
extern ExtU_Project2_T Project2_U;
/* External outputs (root outports fed by signals with default storage) */
extern ExtY_Project2_T Project2_Y;
/* Model entry point functions */
extern void Project2_initialize(void);
extern void Project2_step(void);
extern void Project2_terminate(void);
/* Real-time Model object */
extern RT_MODEL_Project2_T *const Project2_M;
/*-
* These blocks were eliminated from the model due to optimizations:
*
* Block '/Data Type Duplicate' : Unused code path elimination
* Block '/Data Type Propagation' : Unused code path elimination
*/
/*-
* The generated code includes comments that allow you to trace directly
* back to the appropriate location in the model. The basic format
* is /block_name, where system is the system number (uniquely
* assigned by Simulink) and block_name is the name of the block.
*
* Use the MATLAB hilite_system command to trace the generated code back
* to the model. For example,
*
* hilite_system('') - opens system 3
* hilite_system('/Kp') - opens and selects block Kp which resides in S3
*
* Here is the system hierarchy for this model
*
* '' : 'Project2'
* '' : 'Project2/TFT_cluster_Speedometer_SWC'
* '' : 'Project2/TFT_cluster_Speedometer_SWC/1.1 Calculating TFT Display Speed'
* '' : 'Project2/TFT_cluster_Speedometer_SWC/1.2 Main Data Filtering'
* '' : 'Project2/TFT_cluster_Speedometer_SWC/1.3 Auxiliary Data Filtering'
* '' : 'Project2/TFT_cluster_Speedometer_SWC/1.4 TFT Speed Output'
* '' : 'Project2/TFT_cluster_Speedometer_SWC/Compare To Constant'
* '' : 'Project2/TFT_cluster_Speedometer_SWC/1.1 Calculating TFT Display Speed/Saturation Dynamic'
* '' : 'Project2/TFT_cluster_Speedometer_SWC/1.4 TFT Speed Output/Compare To Constant'
*/
#endif /* RTW_HEADER_Project2_h_ */
/*
* File trailer for generated code.
*
* [EOF]
*/

10. Poly space analysis report/outputs

the analysis report is shown below.

11. Test manager reports – baseline & back-to-back testing

baseline testing:

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.