Is there a way to lock a prismatic joint during a SimScape simulation?
I'm modeling a linear brake between two bodies connected by a prismatic joint in SimScape second generation. Until now, I've implemented this by applying an actuator force to the prismatic joint equal to F_act = F_n*Cf*tanh(k*v_rel), where F_n is the normal force, Cf is a kinetic coefficient of friction, v_rel is the relative velocity, and k is a coefficient such that the tanh function approximates the combined Coulomb and viscous friction effects.
This approach works, but when the brake is applied, the simulation solves very slowly, because it becomes an extremely stiff system. I would like to replace this formulation with something that locks the bodies together when the relative velocity is below a certain threshold.
I've tried putting a motion-actuation prismatic joint in parallel with the first joint. The idea was to switch the motion input between zeros (i.e. locked together) and the motion output of the first prismatic joint. But this results in algebraic loops, and the simulation freezes after a few seconds.
I'd welcome any better ideas.
PS I think what I'm trying to do is similar to the behavior of the Loaded-Contact Translational Friction block in Simscape Driveline. But I'd like to implement a solution that doesn't depend on another SimScape package.