Homework 2 Simulink
Homework 2 Simulink
Release Notes:
Version 0: Initial release
0 Assignment overview
In this homework, you will implement a constant time gap controller in Simulink, and simulate its behavior
using some of the conditions from Homework 1. You will demonstrate the ability to identify crashes, validate
steady-state behavior, and create time-varying behaviors for the lead vehicle to demonstrate performance of
your car-following system.
Answers to the following questions should be typed in a suitable editor (e.g., Word or LaTex) with appropriate
references (if you used them), figures, and text, as needed to explain your results. You are free to use your
favorite data analysis tools (python, Matlab, C++, an abacus, etc.; just use what you are comfortable with
and show your work).
Your MATLAB/Simulink files must be included with your submission, and must work correctly on the first
try. Please upload your complete submission to Brightspace by midnight of the deadline. Your report should
clearly describe your systems. You may depend on the grader to know how to run your models, if they are
correctly named.
1
CE3890/CE5999, CS3891/CS5891 AV&T – Fall 2024 HW 2 2
Question 1.4 From the Simulink library, add a switch that allows the user to select either the reference
input from a constant of 20 m/s, or a sinusoidal source that you add to your model with values from
Homework 1. Select one of the input signals from Homework 1 as a reference speed for the car, and plot
the results. Ensure that the output speed trajectory is periodic, and compare it to the input speed. What
do you observe? Note: most answers will differ in this case, depending on the controller you implement and
the sinusoidal function you choose.
Note: your submitted hw2_lead_car.slx file will be able to run any of the questions, depending on how you
select the ’switch’ status before playing your model.
• A sum block that correctly subtracts to obtain the relative position of the two cars to obtain the space
gap
• A sum block that correctly subtracts to obtain the relative speed of the two cars to obtain the time
gap.
• a CTG (constant time gap) controller that is based on Homework 1, Question 3. For any system
parameters, consider having those as input values to your controller, rather than hardcoded values.
Hint: the desired acceleration of the ego car may already be expressed as part of the car following model.
1. In class we implemented a constant space gap, not a constant speed gap, controller.
2. You must define a vehicle length in order to calculate the space gap, and you can assume the lead car
is the same length.
3. You may want to extend the simulation time in your model to see steady-state behaviors.
Question 2.5 Using the constant reference input for the lead car, show that your ego car behavior results
in a constant time gap by plotting and labeling all the needed signals. What values did you choose for τ and
α?
Question 2.6 Switching the input to the lead car, plot your ego car behavior, including the time gap, as
a signal. Does the speed oscillation of the lead car dissipate, or grow, over time? What other behaviors do
you see? Plot your results and provide discussion.
Question 2.7 Create a simulation with specific values for τ and α and oscillating behavior of the lead
vehicle, that results in a crash. Provide the values of the parameters that produce the crash, and the details
of the oscillating speed signal of the lead car. How do you identify that a crash occurred? Provide a plot
and description that shows you were able to identify this occurrence.
CE3890/CE5999, CS3891/CS5891 AV&T – Fall 2024 HW 2 3
Question 2.8 Could you automate crash detection behavior in Simulink, to stop the simulation or cause
an error when a crash occurs? What methods might you choose to do this? Does it work?
Question 2.9 Select your favorite parameters that maintain safe, constant time gap control. Do your
parameters from Homework 1 provide a reliable result? Provide a plot and discussion, including your
parameters.