Challenge

Project 1- Traffic Jam Assistant Feature

Project1_Traffic_Jam_Assistant_Feature.c
/*
* File: Project1_Traffic_Jam_Assistant_Feature.c
*
* Code generated for Simulink model 'Project1_Traffic_Jam_Assistant_Feature'.
*
* Model version : 1.13
* Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
* C/C++ source code generated on : Mon Jun 13 23:47:04 2022
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include "Project1_Traffic_Jam_Assistant_Feature.h"
#include "Project1_Traffic_Jam_Assistant_Feature_private.h"
/* Exported block signals */
uint8_T Output_Display; /* '<S2>/Switch' */
/* Exported data definition */
/* ConstVolatile memory section */
/* Definition for custom storage class: ConstVolatile */
const volatile boolean_T INTERRUPT_1 = 1;/* Referenced by: '<S2>/Constant3' */
const volatile boolean_T INTERRUPT_2 = 1;/* Referenced by: '<S2>/Constant4' */
const volatile uint8_T NO_DISPLAY = 0U;/* Referenced by: '<S2>/Constant5' */
const volatile uint8_T OFF_MODE = 2U; /* Referenced by: '<S2>/Constant1' */
const volatile uint8_T ON_MODE = 1U; /* Referenced by: '<S2>/Constant' */
const volatile uint8_T STANDBY_MODE = 3U;/* Referenced by: '<S2>/Constant2' */
const volatile uint8_T VOLTAGE_MAXIMUM_RANGE = 50U;/* Referenced by: '<S3>/Constant1' */
const volatile uint8_T VOLTAGE_MINIMUM_RANGE = 30U;/* Referenced by: '<S3>/Constant' */
/* Real-time model */
static RT_MODEL_Project1_Traffic_Jam_T Project1_Traffic_Jam_Assista_M_;
RT_MODEL_Project1_Traffic_Jam_T *const Project1_Traffic_Jam_Assista_M =
&Project1_Traffic_Jam_Assista_M_;
/* Model step function */
void Project1_Traffic_Jam_Assistant_Feature_step(void)
{
/* local block i/o variables */
boolean_T Optimum_Voltage;
uint8_T tmp;
/* Logic: '<S3>/AND' incorporates:
* Constant: '<S3>/Constant'
* Constant: '<S3>/Constant1'
* Inport: '<Root>/Input_Voltage'
* RelationalOperator: '<S3>/Relational Operator'
* RelationalOperator: '<S3>/Relational Operator1'
*/
Optimum_Voltage = ((Input_Voltage >= VOLTAGE_MINIMUM_RANGE) && (Input_Voltage <=
VOLTAGE_MAXIMUM_RANGE));
/* Switch: '<S2>/Switch' incorporates:
* Constant: '<S2>/Constant3'
* Constant: '<S2>/Constant4'
* Inport: '<Root>/Input_Switch'
* Logic: '<S2>/AND'
* Logic: '<S2>/NOT'
* RelationalOperator: '<S2>/Relational Operator'
*/
if (Optimum_Voltage && (!Input_Switch) && (INTERRUPT_1 == INTERRUPT_2)) {
/* Saturate: '<S2>/Saturation' incorporates:
* Inport: '<Root>/Enable_Display'
*/
if (Enable_Display < 7) {
tmp = Enable_Display;
} else {
tmp = 7U;
}
/* End of Saturate: '<S2>/Saturation' */
/* MultiPortSwitch: '<S2>/Multiport Switch' */
switch (tmp) {
case 0:
/* Switch: '<S2>/Switch' incorporates:
* Constant: '<S2>/Constant'
*/
Output_Display = ON_MODE;
break;
case 1:
/* Switch: '<S2>/Switch' incorporates:
* Constant: '<S2>/Constant'
*/
Output_Display = ON_MODE;
break;
case 2:
/* Switch: '<S2>/Switch' incorporates:
* Constant: '<S2>/Constant1'
*/
Output_Display = OFF_MODE;
break;
case 3:
/* Switch: '<S2>/Switch' incorporates:
* Constant: '<S2>/Constant1'
*/
Output_Display = OFF_MODE;
break;
default:
/* Switch: '<S2>/Switch' incorporates:
* Constant: '<S2>/Constant2'
*/
Output_Display = STANDBY_MODE;
break;
}
/* End of MultiPortSwitch: '<S2>/Multiport Switch' */
} else {
/* Switch: '<S2>/Switch' incorporates:
* Constant: '<S2>/Constant5'
*/
Output_Display = NO_DISPLAY;
}
/* End of Switch: '<S2>/Switch' */
}
/* Model initialize function */
void Project1_Traffic_Jam_Assistant_Feature_initialize(void)
{
/* (no initialization code required) */
}
/* Model terminate function */
void Project1_Traffic_Jam_Assistant_Feature_terminate(void)
{
/* (no terminate code required) */
}
/*
* File trailer for generated code.
*
* [EOF]
*/

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.