How can I extract throttle and brake pedal behavior profiles with values at the interval of 0.1 s for the entire Sim runtime?

7 views (last 30 days)
Good Day all,
I am working on my masters thesis and i am using Highway lane following testbench for that.
I am trying to extract throttle pedal and brake pedal positions at the interval of 0.1 s through the runtime so that I can plot the profiles against time. However, I could not find a way to extract those values from the simulink model or from the setup & Scenario files itself. I am using Curved-stop-and-go scenario. I need to plot those results along with the velocity profiles, acceleration profiles, relative distance between ego and MIO as well as throttle and brake pedal behaviors as it has been shown in the documentation via hfigure functionality.
Any suggestions?
Thank you

Answers (1)

Priyank Pandey
Priyank Pandey on 17 May 2023
Hi Manan,
To extract throttle pedal and brake pedal positions at regular intervals during the runtime of your Highway lane following testbench in Simulink, you can use the following approach:
  1. In the Simulink model, locate the blocks or subsystems responsible for controlling the throttle pedal and brake pedal positions. These blocks are typically connected to the vehicle dynamics or control system.
  2. Add a "Signal Logging block" to the output of each of these blocks or subsystems. The Signal Logging block allows you to log the values of the signals at specific time intervals.
  3. Configure the Signal Logging blocks to log the signals at a sample time of 0.1 seconds or whatever interval you desire. You can set the sample time in the block parameters.
  4. Run the simulation of your model. The Signal Logging blocks will record the values of the throttle and brake pedal positions at the specified intervals.
  5. Once the simulation is complete, you can access the logged data in the MATLAB workspace. The logged signals will be stored as MATLAB timeseries objects.
  6. Use MATLAB plotting functions to plot the profiles against time. You can plot the velocity profiles, acceleration profiles, relative distance between ego and MIO, throttle pedal positions, and brake pedal positions all in the same plot or separate plots, depending on your preference.
Please refer to the following link to know more about Signal logging block:
I hope this helps!
Regards
Priyank
  1 Comment
Manan Vyas
Manan Vyas on 17 May 2023
Hi Priyank, The problem is: The simulink model itself does not indicate or generate any kind dataset just specific to the names: "Throttle" or "Brake". In terms of input, I only have set speed, Ego_Velocity and Leader_Velocity. Everything else is calculated based on the input values. So, ultimately, in the output, I do not have "throttle pedal position" or "Brake pedal position" -- variables directly visible in the model itself. Even there is no mention of throttle or brake in the .m files.

Sign in to comment.

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!