Project 1- Traffic Jam Assistant Feature
Problem Statement:
To develop one specific requirement of Traffic Jam Assistant algorithm which would predominantly feature in the IPC algorithm.Please note that the whole Traffic Jam Assistant is a very huge algorithm & only one small part of the logic is implemented here. Idea is to familiarize with concepts of Model Based Development in MATLAB Environment. The Project must be done keeping in mind the following processes & steps.
- This model must be developed in MATLAB Simulink as per MBD guidelines.
- Code Generation Profile must be in Embedded Coder.
- Simulink Data Dictionary must be created for the model & must be linked to the model.
- Model Advisor Report is mandatory & this will be followed by Code Generation.
Ans.

#include "Project_1.h"
#include "Project_1_private.h"
/* External inputs (root inport signals with default storage) */
ExtU_Project_1_T Project_1_U;
/* External outputs (root outports fed by signals with default storage) */
ExtY_Project_1_T Project_1_Y;
/* Real-time model */
static RT_MODEL_Project_1_T Project_1_M_;
RT_MODEL_Project_1_T *const Project_1_M = &Project_1_M_;
/* Model step function */
void Project_1_step(void)
{
real_T tmp;
/* Switch: '<S1>/Switch' incorporates:
* Inport: '<Root>/INTERRUPT_1'
* Inport: '<Root>/INTERRUPT_2'
* Inport: '<Root>/Input_Switch'
* Inport: '<Root>/Input_Voltage'
* Inport: '<Root>/VOLTAGE_MAXIMUM_RANGE'
* Inport: '<Root>/VOLTAGE_MINIMUM_RANGE'
* Logic: '<S1>/Logical Operator'
* Logic: '<S1>/Logical Operator1'
* Logic: '<S2>/Logical Operator'
* RelationalOperator: '<S1>/Relational Operator'
* RelationalOperator: '<S2>/Relational Operator'
* RelationalOperator: '<S2>/Relational Operator1'
*/
if ((!Project_1_U.Input_Switch) && ((Project_1_U.Input_Voltage >=
Project_1_U.VOLTAGE_MINIMUM_RANGE) && (Project_1_U.Input_Voltage <=
Project_1_U.VOLTAGE_MAXIMUM_RANGE)) && (Project_1_U.INTERRUPT_1 ==
Project_1_U.INTERRUPT_2)) {
/* Saturate: '<S1>/Saturation' incorporates:
* Inport: '<Root>/Enable_Display'
*/
if (Project_1_U.Enable_Display > 7.0) {
tmp = 7.0;
} else if (Project_1_U.Enable_Display < 1.0) {
tmp = 1.0;
} else {
tmp = Project_1_U.Enable_Display;
}
/* End of Saturate: '<S1>/Saturation' */
/* MultiPortSwitch: '<S1>/Multiport Switch' */
switch ((int32_T)tmp) {
case 1:
/* Outport: '<Root>/Output_Display' incorporates:
* Inport: '<Root>/ON_MODE'
*/
Project_1_Y.Output_Display = Project_1_U.ON_MODE;
break;
case 2:
/* Outport: '<Root>/Output_Display' incorporates:
* Inport: '<Root>/ON_MODE'
*/
Project_1_Y.Output_Display = Project_1_U.ON_MODE;
break;
case 3:
/* Outport: '<Root>/Output_Display' incorporates:
* Inport: '<Root>/OFF_MODE'
*/
Project_1_Y.Output_Display = Project_1_U.OFF_MODE;
break;
case 4:
/* Outport: '<Root>/Output_Display' incorporates:
* Inport: '<Root>/OFF_MODE'
*/
Project_1_Y.Output_Display = Project_1_U.OFF_MODE;
break;
default:
/* Outport: '<Root>/Output_Display' incorporates:
* Inport: '<Root>/STANDBY_MODE'
*/
Project_1_Y.Output_Display = Project_1_U.STANDBY_MODE;
break;
}
/* End of MultiPortSwitch: '<S1>/Multiport Switch' */
} else {
/* Outport: '<Root>/Output_Display' incorporates:
* Inport: '<Root>/NO_DISPLAY'
*/
Project_1_Y.Output_Display = Project_1_U.NO_DISPLAY;
}
/* End of Switch: '<S1>/Switch' */
}
/* Model initialize function */
void Project_1_initialize(void)
{
/* (no initialization code required) */
}
/* Model terminate function */
void Project_1_terminate(void)
{
/* (no terminate code required) */
}
/*
* File trailer for generated code.
*
* [EOF]
*/