Project 1- Traffic Jam Assistant Feature
Aim:
To develop one specific requirement of Traffic Jam Assistant algorithm which would predominantly feature in the IPC algorithm.
Description:
Step1-Simulink Data Dictionary must be create for the model.
Step2-The model has been be developed in MATLAB Simulink as per Requirement 1 & Requirement 2.
Step3-Then change the configuration parameters of solver selection and code generation is Embedded coder.
Step4-Run the MAB guidelines and generate the Model Advisory Report and generate the Embedded Code.
Code generation:
/*
* Event Support License -- for demonstration use and event support. Not
* for government, research, commercial, or other organizational use.
*
* File: Traffic_Jam_Assistant.c
*
* Code generated for Simulink model 'Traffic_Jam_Assistant'.
*
* Model version : 1.8
* Simulink Coder version : 9.7 (R2022a) 13-Nov-2021
* C/C++ source code generated on : Wed Dec 14 21:35:35 2022
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives:
* 1. Execution efficiency
* 2. RAM efficiency
* Validation result: Not run
*/
#include "Traffic_Jam_Assistant.h"
#include "rtwtypes.h"
/* External inputs (root inport signals with default storage) */
ExtU rtU;
/* External outputs (root outports fed by signals with default storage) */
ExtY rtY;
/* Model step function */
void Traffic_Jam_Assistant_step(void)
{
/* Switch: '<S2>/Switch' incorporates:
* Inport: '<Root>/Input_Switch'
* Inport: '<Root>/Input_Voltage'
* Inport: '<Root>/VOLTAGE_MAXIMUM_RANGE'
* Inport: '<Root>/VOLTAGE_MINIMUM_RANGE'
* Logic: '<S1>/AND'
* Logic: '<S2>/AND'
* Logic: '<S2>/NOT'
* RelationalOperator: '<S1>/GreaterThanOrEqual'
* RelationalOperator: '<S1>/GreaterThanOrEqual1'
*/
if ((rtU.Input_Voltage >= rtU.VOLTAGE_MINIMUM_RANGE) && (rtU.Input_Voltage <=
rtU.VOLTAGE_MAXIMUM_RANGE) && (!rtU.Input_Switch)) {
real_T tmp;
/* Saturate: '<S2>/Saturation' incorporates:
* Inport: '<Root>/Enable_Display '
*/
if (rtU.Enable_Display > 0.5) {
tmp = 0.5;
} else if (rtU.Enable_Display < -0.5) {
tmp = -0.5;
} else {
tmp = rtU.Enable_Display;
}
/* End of Saturate: '<S2>/Saturation' */
/* MultiPortSwitch: '<S2>/Multiport Switch' */
if ((int32_T)tmp == 1) {
/* Outport: '<Root>/Output_Display' incorporates:
* Constant: '<S2>/ON_MODE'
*/
rtY.Output_Display = 1.0;
} else {
/* Outport: '<Root>/Output_Display' incorporates:
* Constant: '<S2>/STANDBY_MODE'
*/
rtY.Output_Display = 3.0;
}