Clear Filters
Clear Filters

How to properly change the sampling time of Vehicle Control Unit subsystem?

42 views (last 30 days)
I'm designing a Model Predictive Controller (MPC) inside the Vehicle Control Unit (VCU) subsystem, a part of a virtual vehicle model configured from Virtual Vechicle Composer, and I wonder how to properly change the sampling time of the VCU.
My desire is to design an MPC with sampling time 20 [ms], so I need measurement updates every 20 [ms]. However, the VCU operates with solver ode4 at fixed-step size 10 [ms]. I tried overriding this value to 20 [ms], as in the below image.
However, the overall system solver, ode23tb still detects the max step size to be 10 [ms], as in the following image.
Thus, I would appreciate it if you could tell me how to change the sampling time of VCU properly.
Additionally, I wonder if I can create a subsystem inside VCU to contain my MPC. This MPC subsystem operates at 20 [ms] while the outside VCU still runs at 10 [ms]. In that case, is it possible to use the Rate transition block to pass measurements to this MPC subsystem?
Any other ideas are much appreciated. Thank you very much in advance.

Answers (1)

Hitesh
Hitesh on 20 Sep 2024 at 12:35
Hi Duc Giap Nguyen,
I am assuming that the VCU is a referenced subsystem within a larger system, and it contains an MPC subsystem. However, if the VCU was an independent system, you could potentially set its fixed step size as 20 ms. You can follow the below-mentioned steps to fix the issue:
  1. Ensure that the parent system's step size is set to 20 ms, which would result in the solver using a 20 ms step size during simulation.
  2. Additionally, if you have created a subsystem within the Vehicle Control Unit (VCU) to contain a Model Predictive Controller (MPC), where the MPC operates at a 20 ms interval and the VCU operates at a 10 ms interval, you should use Rate Transition blocks. Place a Rate Transition block at the interface where the VCU output serves as the input to the MPC, and another at the MPC output. For the firstRate Transition block, set the output port sample time to 20 ms. For the secondRate Transition block, specify the sample time as 10 ms under the sample time options.

Categories

Find more on Vehicle Scenarios in Help Center and File Exchange

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!