Why does my model throw an error when I set my hard stop's initial position variable to zero?

3 views (last 30 days)
I am creating a simple mechanical translational system with a spring and a hard stop using Simscape (see attached model, "hardStop_withError"). Based on the given parameters and the initial conditions I am setting, I am expecting my display to read "0". Instead, I get the following error.
 
Error:
An error occurred while running the simulation and the simulation was terminated
Caused by:
Failed to update switched linear model, due to system singularity in current configuration.
Cannot solve for one or more variables...
If I change the initial position of the "hard stop" block to anything less than zero (such as -1e-6), I do not get this error. Why is my model not performing as expected?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 2 Oct 2017
Adding a damper in parallel with the spring and the hard stop will allow you to set the initial hard stop position to zero without causing an error. The solver was able to initialize when the initial hard stop position was a non-zero number because a non-zero position caused the hard stop's damping to be non-zero as well. Adding a damper in parallel works around the initial zero damping in the hard stop derived from the zero initial position. See the attached model "hardStop_withoutError" as an example.
 

More Answers (0)

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!