How to simulate a vehicle mechanically hitch to the another vehicle in simulink

6 views (last 30 days)
Hello,
I am trying to simulate a scenario where a 3 DOF vehicle is mechanically hitched to the another 3 DOF vehicle and following the leading vehicle, in Simulink. I am following this example Tractor-towing-trailer and created a model in simulink. My simulink model is attached in the attachment. I am getting some errors like:
An error occurred during simulation and the simulation was terminated
Caused by:
Input value of block 'Two_Vehicle_Hitched/Hitch/3DOF/Subsystem3/Trailer Hitch Contact Moment/Hitch Contact Yaw Moment' exceeds range of breakpoint vector for dimension 1.
Can anyone please help me figure out what I am doing wrong. Because therotically my model seems correct. Any suggestion would be highly appreciated.
Thanks in advance.

Answers (1)

Anay
Anay on 28 Apr 2025
Edited: Anay on 28 Apr 2025
Hi Nupur,
By looking at your error, it appears that the problem is an out of range input to the Lookup Table block named “Hitch Contact Yaw Moment”. This problem can be tackled by putting a Saturation block before the input to the Lookup Table:
This resolves the current error in your model but it reveals another runtime error: Derivative of state '2' in block 'Two_Vehicle_Hitched/Leading Vehicle/state/xdot ext/Integrator' at time 0.2875 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)
Increasing Solver Step Size is infeasible for your model. So, we change the Solver to ODE14 which can run the simulation at the current Step Size. According to me, changing solver to ODE14 worked for your model because, the error “Derivative of state '2' is not finite” suggests a division by zero or algebraic loop in the model. ODE14x’s extrapolation handles such cases by dynamically adjusting integration order and iterative refinement. ODE3 cannot handle abrupt changes in the signal. Thus, it might overshoot and produce numerical instabilities like non-finite derivatives. Using the ODE14x solver fixes the error you were having with the Lookup Table as well so you don't need to use the Saturation block like above. This could be because of the reduced instability in your model after changing the solver, it does not produce out of range inputs for Lookup Table.
In a nutshell, changing solver type to ODE14x solves the issue and your model runs without error. I have attached the working model for your reference.
You can follow the below links to take a look at MATLAB documentation to learn more about solvers:
I hope this solves the issue!

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!