Modeling static Coulomb friction in a multibody system I have a multibody system with Coulomb friction:

I'm able to write horizontal linear momentum conservation equations:


*

*$m_1 \ddot{x}_1 = F_1 - F_{f12}$

*$m_2 \ddot{x}_2 = F_2 + F_{f12} - F_{f23}$

*$m_3 \ddot{x}_3 = F_3 + F_{f23} - F_{f34}$

*$m_4 \ddot{x}_4 = F_4 + F_{f34}$


And I'm also able to calculate $F_{f12}$ and $F_{f34}$ as below:


*

*$F_{f12}=\left\{\begin{matrix}
  if \, \dot{x_1}=\dot{x_2} \, and \, \left| F_1-m_1 \ddot{x}_1 \right|<\mu_s F_{n12} \, then &  F_1-m_1 \ddot{x}_1 \\
  else &  \mu_k F_{n12}sgn\left(\dot{x_1}-\dot{x_2}\right)
 \end{matrix}\right.$

*$F_{f34}=\left\{\begin{matrix}
  if \, \dot{x_3}=\dot{x_4} \, and \, \left| F_4+m_4 \ddot{x}_4 \right|<\mu_s F_{n34} \, then &  -F_4-m_4 \ddot{x}_4 \\
  else &  \mu_k F_{n12}sgn\left(\dot{x_4}-\dot{x_3}\right)
 \end{matrix}\right.$


Here the static friction opposes any external force up to the maximum static friction. 
I have two issues:


*

*when the conditions for static friction $\dot{x_i}=\dot{x_j} \, and \, \left| F_i-m_i \ddot{x}_i \right|<\mu_s F_{nij}$ are valid the equation becomes the exact same equation as the linear momenta, and I end up with less equations than my unknowns.

*I'm not able to write $F_{f23}$ because the opposing forces here include other static frictions and we end up with two different equations! 
For example if we write $F_{f23}$ based on mass 3:
$F_{f23}=\left\{\begin{matrix}
  if \, \dot{x_2}=\dot{x_3} \, and \, \left|  F_{f34} -F_3 -m_3 \ddot{x}_3\right|<\mu_s F_{n23} \, then &  F_{f34} -F_3 -m_3 \ddot{x}_3   \\
  else &  \mu_k F_{n23}sgn\left(\dot{x_2}-\dot{x_3}\right)
 \end{matrix}\right.$
But if we write $F_{f23}$ based on mass 2 we get:
$F_{f23}=\left\{\begin{matrix}
  if \, \dot{x_2}=\dot{x_3} \, and \, \left| F_2 + F_{f12}-m_2 \ddot{x}_2\right|<\mu_s F_{n23} \, then &  F_2 + F_{f12} -m_2 \ddot{x}_2  \\
  else &  \mu_k F_{n23}sgn\left(\dot{x_2}-\dot{x_3}\right)
 \end{matrix}\right.$
And the equality of $F_2 + F_{f12}=F_{f34}-F_3$ is not necessarily valid.  
I would appreciate if you could help me know


*

*if my math is correct so far?

*how to write  $F_{f23}$?

 A: New:
Since posting this question I was able to rewrite the equations in a more elegant way. Actually regardless of being a multibody problem friction between each individual bodies is the same and other frictional forces are just forces! Static friction tries to keep two bodies as one as far as it can. it means for a two body problem:



*

*$m_1 \ddot{x}_1 = F_1 - F_{f12}$

*$m_2 \ddot{x}_2 = F_2 + F_{f12}$

*$\ddot{x}_1=\ddot{x}_2$

*$\implies \, F_{s12}=\frac{m_2 F_1-m_1F_2}{m_1+m_2}$


considering that the maximum static friction is $F_{s_{max}12}=\mu_s F_{n12}$
$\implies F_{f12}=\left\{\begin{matrix}
  if \, \dot{x_1}=\dot{x_2} \, and \, \left| F_{s12} \right|<F_{s_{max}12} \,\, then &  F_{s12} \\
  else &  \mu_k F_{n12}sgn\left(\dot{x_1}-\dot{x_2}\right)
 \end{matrix}\right.$
I have also implemented this in Modelica language and SIMULINK. you may see them here and here
Old:
I think I have figured the issue out. Thanks to the questions asked in the comments I had to rewrite some of the equations and then the main misunderstanding was revealed to me. Actually when the conditions for static frictions hold the two parts act as one. we can write the 3 frictions as below:


*

*If $\dot{x_1}=\dot{x_2}$ and $\left| F_1-m_1 \ddot{x}_1 \right|<\mu_s F_{n12}$ and $\left| m_2 \ddot{x}_2-F_2+F_{f23} \right|<\mu_s F_{n12}$ then $\ddot{x}_1=\ddot{x}_2$ , else $F_{f12}=\mu_k F_{n12}sgn\left(\dot{x_1}-\dot{x_2}\right)$

*If $\dot{x_3}=\dot{x_4}$ and $\left| F_4-m_4 \ddot{x}_4 \right|<\mu_s F_{n34}$ and $\left|  F_3 + F_{f23}-m_3 \ddot{x}_3 \right|<\mu_s F_{n34}$ then $\ddot{x}_3=\ddot{x}_4$ , else $F_{f34}=\mu_k F_{n34}sgn\left(\dot{x_4}-\dot{x_3}\right)$

*If $\dot{x_2}=\dot{x_3}$ and $ \left| F_2 + F_{f12}-m_2 \ddot{x}_2\right|<\mu_s F_{n23} $ and $ \left|  F_{f34} -F_3 -m_3 \ddot{x}_3\right|<\mu_s F_{n23} $ then $\ddot{x}_3=\ddot{x}_2$ , 
else $F_{f23}=\mu_k F_{n23}sgn\left(\dot{x_2}-\dot{x_3}\right)$
