Challenge

Project 2 Adaptive Cruise Control

SLDD CREATION:

The SLDD data files are related to the MATLAB/Simulink. Mathworks Simulink is a multidomain simulation and Model-Based Design for dynamic systems. The SLDD file stores some kind of data used by MATLAB. The following procedure shows how to create and add data to the SLDD file.

  • To create a SLDD file, Open the simulink model and go to Modeling section.
  • Then select Link to Data Dictionary option from Modeling section. Which is shown in the following figure.
  • After clicking on the Link to Data Dictionary, the following popup window will appears which ask us about data dictionary. If already created and to open SLDD, click on browse option and then select the respective file then click on ok. Here we are creating the new SLDD file so,

    • Click on New and then save with a name. After saving the new SLDD file, uncheck the enable model access to base workspace because as it is new file there is no data to add workspace. If it is already created one then we can click on enable model access to base workspace.
  • After saving the file the above popup window will closes.

    • To open the SLDD file go to the Modeling section and then select Model explorer. Which is showing in the following figure.
    • After clicking on the Model explorer, the following window will opens. Where we can see our created SLDD file at left side of the window if we extend that will be able to see Design Data. By clicking on that we can add our given signals or parameters.

      • I have given the name as ACC to the SLDD file, if we extend the file design data option appears as shown in the following figure.
      • Now enter all signals and parameters according to the given signals and calibration data.

        • To avoid the errors just copy paste the given signal/calibration name.
        • And fill all the respective details accordingly.
        • The given details are: Signal type, Data type, Dimension, Min & Max value, Storage class and Value for calibration parameter.
        • The following figure shows the all designed data according to the given table.

        This section of the dictionary stores variables that are visible to the Simulink models that reference this dictionary. These variables can be used to parameterize model, block and signal data

      • After designing the SLDD file, right click on the SLDD form here it is saved as ACC. Righ click on it and save changes. Which is shown through following figure.

        • After saving the data we can close the model explorer window and we can start modelling.
  • MODELING:

    The modeling can be done according to the given requirements. So as we have three given requirements, we are taking a main subsystem first and naming it as Adaptive_Cruise_Control.

    • Added a subsystem to the empty simulink model. And named it as Adaptive_Cruise_Control.
    • Taken its inports and outports according to the given data.
    • After making a subsystem, double click on it to model the given requirements. The following figure shows the three subsystems under the Adaptive_Cruise_Control subsystem.

      • These three subsystems are named as Lead_Vehicle, Cruise_Vehicle and ACC_Algorithm.
      • The inports and outports are considered according to the given data.
      • Now will see how these subsystems are modeled.
      • Requirement 1– Lead Vehicle:

        • Lead Vehicle is a vehicle which is driving in the road ahead of our drive vehicle. Two input signals (Signal Name: CameraInput_LeadVehicle & RadarInput_LeadVehicle).
        • Ideally sensor fusion techniques will be deployed to process & analyze data from camera & radar. For complexity reasons, let’s not adapt to any such algorithms.
        • We can simply add both the radar & camera inputs & the corresponding output is read as Speed profile output (Signal Name: LeadVehicle_Speed).
        • Speed data of the lead vehicle is critical in implementing the Adaptive Cruise Control algorithm.

        The signal names and calibration values are copy pasted to avoide the errors. Because we have taken exact values in SLDD form so to match them again i have did the same. All the ports and blocks are named according to the requirement. To add the given inputs we have taken an Add block. The following figure shows the model under requirement1 subsystem.

      • Requirement 2 – Drive Vehicle:

        • Drive Vehicle is the vehicle driven by the user & this is the vehicle which has ACC algorithm in it.
        • Like the Lead Vehicle, Drive Vehicle algorithm also has 2 input signals (Signal Name: CameraInput_DriveVehicle, RadarInput_DriveVehicle) & one signal coming as an Input to this subsystem (Signal Name: Acceleration_Mode) – three inputs into this requirement in total.
        • Like the above requirement, sensor fusion techniques will also be deployed here, for complexity reasons we are ignoring them.
        • Two output signals come from this subsystem (Signal Name: DriveVehicle_Speed & LeadVehicle_Detected).
        • Signal DriveVehicle_Speed is summation of three input signals mentioned above & LeadVehicle_Detected is renamed from Input Signal RadarInput_DriveVehicle by mere use of Signal Conversion block.

        The following figure shows the Drive_Vehicle subsytem modeled as per the given requirement data.

    • Requirement 3 – Adaptive Cruise Control Algorithm:

      • Adaptive Cruise Control feature has 3 major modes of operation: OFF Mode, STANDBY Mode & ON Mode. This particular requirement has to be implemented as state machine logic in Simulink.
      • The input signals to this state machine system are (Signal Name: Time_Gap, Set_Speed, Set_Gap, CruiseSwitch, SetSwitch).
      • Also, the output signals (Signal Name: DriveVehicle_Speed & LeadVehicle_Detected) from requirement-2 is fed back as an input signal into this state machine block.
      • Additionally, output signal (Signal Name: LeadVehicle_Speed) from requirement-1 is given as an input signal to this state machine block as well.
      • Output from this subsystem is a signal (Signal Name: Acceleration_Mode) which governs the vehicular speed of the drive vehicle which automatically adjusts its speed & velocity to match the lead vehicle.

      The following figure shows the chart taken under ACC_Algorithm subsystem with the given inputs and output.

    • RESOLVING & PROPAGATING:

      By resolving and propagrating the signals we can migrate design attributes from existing simulink signal objects into the model by using block parameters and signal properties here in the model explorer we have designed the attributes in SLDD form. To force signal resolution for a signal in a MATLAB Function block, follow these steps:

      • In the Simulink model, right-click the signal line connected to the respective input or output that you want to resolve and select Properties from the context menu.
      • In the Signal Properties dialog, enter a name for the signal that corresponds to the signal object.

      The following figure shows the process of signal Resolving. As said right click on signal go to properties then the following procedure should follow. Give exact same as the input or output we have used and click on resolve to simulink object. Then a symbol with name shows at the signal line.

      After clicking on the properties a window will appears as follows, where you have to give name and tick the resolving option as shown in the following figure.

      • Repeat the same procedure to al the signals which are to be resolved.
      • Once the signal is resolved then no need to resolve again and again just propagate the signal from its originating place. After making all siganls resolved and propagated the Adaptive_Cruise_Control subsystem is shown as below.

        • The two inputs are resolved at input side. The output will be resolved at its intial condition then it will propagate till final output.
        • TAGGING:

          To perform Tagging first we have to create a word file with all details reagarding about the model we are creating. Not only a word file we can also take excel sheet or MATLAB file etc, here we are taking word file. Tagging enables us to view the procedure which is used to build the model or to know more details about the designed model. To tag the given requirement blocks the followinng procedure has been followed.

          • First we need select the respective heading in the word file. Like in the followinng figure we can see that Requirement1 is a heading in which the procedure to build the model has been given.
          • The word file which is created must be saved in the same folder of our simulink model.

      SOLVER SETTINGS:

      Solver settings are important to simulate the model. To open the solver setings, go to the Modeling section which is at the top of simulink window. And select the Model settings under the modeling section. Which is shown in the following figure.

      After clicking on model settings the following window will appears. The window presents the configuration of the parameters in our simulink mode.

      • In the configuration window, click on solver to model the solver parameters.
      • Now change the type to Fixed-step, Solver to discrete(no continuous states) and take sample time as 0.01sec. Then click Ok.
      • This settings are shown in the following figure.
      • MAB GUIDEINES:

        The MAB (MathWorks Advisory Board) Guidelines are a set of modeling guidelines developed by an independent industry working group for the usage of MATLAB, Simulink, Stateflow and Embedded Coder. The guidelines are the culmination of years of engineering expertise and best practices for developing, maintaining and documenting control algorithm models used in the development of production software.

        • To perform the MAB guidelines test on our simulink model, go to modeling section and select Model Advisor which is at the top left corner of the window.
        • You can use the Model Advisor to verify compliance of your model with the MathWorks Advisory Board (MAB) guidelines.
        • In the Model advisor there are number of guidelines, among them will select only Modeling Standards fro MAB.

          • If we expand the section will be able to see which are tested under the MAB guidelins. If we again expand there will be many sub sections in each section.
          • After selecting MAB guidelines, click on Run Selected checks.
          • Then it asks again for confirmation, click on continue. Then the testing will begins. It takes time to perform the guidelines test.
          • After the MAB guidelined test completion, it should be mandatory that 0 fail conditions. If any fail conditions are there rectify them and again make them to 0. The warnings are permittable to some limit.

            • After getting 0 fails click on Generate report. This report will gives all data about the smulink model we have created.
            • After clicking Generate report in the above window, a popup window will appears as shown in the followinng figure.

              • It shows the directory, at where the report is going to save. It will save in the same folder of our simulink model.
              • Give a name to the report. Then click on OK.
              • After clicking on Ok. It will save in the folder and opens as shown in the followig diagram.

                • The report shows all the checks performed under MAB guidelines.
      • C CODING:

        Now we are converting all our model in terms of C Code. To create C code of our simulink model, follow the procedure as explained below.

        • Go to the Apps section which is at top of the window.
        • Under Apps section, click on Embedder coder which is shown in the followinng figure.
        • After clicking on EMbedded codel option, aother window will creates as C CODE, which is shown in the following figure.

          • Go to the C Code section, and click on Build option to build the code.
          • After clicking on Build it will generate the C Code of our simulink as shown inn the following figure.

            • The C code shows all the data of our simulink model. The C code file is also saved in the same folder of our simulink model.

      SLDD FILE:

      REQUIREMENT TAGGING:

      REQUIREMENT 1:

      REQUIREMENT2:

      ADAPTIVE CRUSIE CONTROL MODEL:

      CONCLUSION:

      The Adaptive Cruise Control is modeled as per the given requirements, all the signals and calibrated values are defined in the Simulink Data Dictionary(SLDD). All input and output signals are resolved and propagated. The respective subsystems are Tagged according to their requirement. Model Advisory check is done with MAB guidelines and there is 0 fail conditions. Since there are no errors in Model Advisory report C Code has been generated by using Embedded code

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.