Challenge

Project 1- Traffic Jam Assistant Feature

Project 1- Traffic Jam Assistant Feature:

The simulink model,SLDD file ,model advisor report and code generation file is attched below .

steps are given with screenshot below.

SLDD file is created as given information shown in screenshot below.

Requirement No 1:

Requirement No 2 (DisplayUnit Subsystem):

Subsystem:

Final model :

Model Advisor Report:

Embedded coder is selected in configuration anf code generation is done.

code generation:

/*
 * File: traffic_assistant.c
 *
 * Code generated for Simulink model 'traffic_assistant'.
 *
 * Model version                  : 1.32
 * Simulink Coder version         : 9.5 (R2021a) 14-Nov-2020
 * C/C++ source code generated on : Tue Jan  3 01:13:17 2023
 *
 * Target selection: ert.tlc
 * Embedded hardware selection: Intel->x86-64 (Windows64)
 * Code generation objectives: Unspecified
 * Validation result: Not run
 */

#include "traffic_assistant.h"
#include "traffic_assistant_private.h"

/* Exported data definition */

/* Definition for custom storage class: ExportToFile */
uint8_T Output_Display;                /* '<S2>/Switch' */

/* 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_traffic_assistant_T traffic_assistant_M_;
RT_MODEL_traffic_assistant_T *const traffic_assistant_M = &traffic_assistant_M_;

/* Model step function */
void traffic_assistant_step(void)
{
  /* Switch: '<S2>/Switch' incorporates:
   *  Constant: '<S2>/Constant3'
   *  Constant: '<S2>/Constant4'
   *  Constant: '<S3>/Constant'
   *  Constant: '<S3>/Constant1'
   *  Inport: '<Root>/Input_Switch'
   *  Inport: '<Root>/Input_Voltage'
   *  Logic: '<S2>/AND'
   *  Logic: '<S2>/AND1'
   *  Logic: '<S2>/NOT'
   *  RelationalOperator: '<S2>/Equal'
   *  RelationalOperator: '<S3>/Relational Operator'
   *  RelationalOperator: '<S3>/Relational Operator1'
   */
  if ((!Input_Switch) && ((uint32_T)(Input_Voltage >= VOLTAGE_MINIMUM_RANGE) <=
                          VOLTAGE_MAXIMUM_RANGE) && (INTERRUPT_1 == INTERRUPT_2))
  {
    /* MultiPortSwitch: '<S2>/Multiport Switch' incorporates:
     *  Constant: '<S2>/Constant'
     *  Switch: '<S2>/Switch'
     */
    Output_Display = ON_MODE;
  } else {
    /* Switch: '<S2>/Switch' incorporates:
     *  Constant: '<S2>/Constant5'
     */
    Output_Display = NO_DISPLAY;
  }

  /* End of Switch: '<S2>/Switch' */
}

/* Model initialize function */
void traffic_assistant_initialize(void)
{
  /* (no initialization code required) */
}

/* Model terminate function */
void traffic_assistant_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.