The algorithm considers the effect of ends of travel, dry friction passive forces and external load.
The computing algorithm is intended to describe the dynamic behavior of a mechanical component or assembly characterized by mechanical ends of travel, under the action of dry friction passive forces (or torques), besides generic active. The mathematical algorithm is based upon the widely accepted hypothesis of Coulomb friction physical model, well suited to the dynamic simulation of motion transmissions of the mechanical systems, subjected to external loads. According to the Coulomb friction hypothesis, the friction force or torque depends on the velocity.
The proposed model is able to take into account both the friction forces (or torques) independent and dependent on the external load, both in case of load opposing and aiding the motion; nevertheless, it considers the interaction between the mechanical element and its two eventual ends of travel.
The proposed model considers the friction force FF as a sum of two terms: the former is the load invariant term (FDJ) and the latter is the load dependent one. The relationship between FR and the related friction term is obtained by means of the proper amount of efficiency characterizing the mechanical element. When FR is opposing the motion, the efficiency to be considered is EtO (expressed as the ratio between resisting and driving power) and the related friction force is obtained as (1/EtO1)• FR; when FR is aiding the motion, the efficiency to be considered is EtA (defined as the inverse ratio with respect to EtO) and the related friction force is obtained as (1EtA)• FR. The mentioned efficiencies are conventionally defined as above reported, in order to assign current values anyhow lower than 1, as it is usual.So, the total friction force (or torque) in slipping condition is FD=FDJ+(1/EtO1)•FR under an opposing load and FD=FDJ+(1EtA)•FR under an aiding one. It must be noted that the amount of EtO must lie in the interval between 0 and 1 in order to allow the motor drives the system, while the value of EtA must be not greater than 1; if the mechanical system is reversible the amount of EtA must lie in the interval between 0 and 1, if it is irreversible EtA must be not greater than 0 and the negative value is an expression of the irreversibility degree of the mechanical system.
In fact, in slipping and aiding conditions, if EtA=0, the load produces a friction force FF that is equal and opposing to the load itself (FF=FR) and their net effect is null, so requiring no action by the motor (neither driving nor breaking); if EtA=0.5 (or EtA=1), FR develops an opposing amount of FF=1.5•FR (or FF=2•FR) and their net effect results in a force opposing the motion and amounting to 0.5•FR (or 1•FR), so requiring a driving action of 0.5•FR (or 1•FR) by the motor. All these conditions are properly simulated by the algorithm.
The model is conceived to compute the friction force (or torque) FF in slipping conditions; in case of sticking conditions, the maximum value which can be assumed by FF is obtained multiplying the slipping one by FSD (static to dynamic friction ratio equal or greater than 1). When the sticking condition persists, the absolute actual amount of FF – requested to balance the active force – is not greater than the above considered maximum value.
In conclusion, the proposed dynamic simulation algorithm is able to distinguish among the four possible conditions which can occur in each computational step as follows:
 Mechanical element initially sticking which must persist in sticking condition, being the absolute value of the active forces (and consequently of FF) not greater than FSD•FD;
 Mechanical element initially sticking which must breakaway, so turning to slipping condition, being the absolute value of the active forces greater than FF=FSD•FD;
 Mechanical element initially slipping which must persist in slipping condition (not necessarily having the active forces an absolute value greater than FF=FD, but simply having the element velocity nosign reversion within the computational step under all the forces acting on it, with respect to its inertia);
 Mechanical element initially slipping which must stop, so turning to sticking condition (having the velocity a sign reversion within the computational step, as a consequence of inertia and applied forces).
All these abilities are performed in case of both opposing and aiding load with respect to the actual movement or the eventual breakaway (incipient motion). It must be noted that, when the external load aids the breakaway, the friction force to be considered is obtained through EtA, while when the external load opposes the breakaway, the incipient motion is performed against a friction force amount depending on EtO; so the procedure, evaluating the eventual breakaway, constrains the FF amount within two different limits, ruled by EtO and EtA respectively besides by FSD (turning the slipping friction value into the sticking as previously said).
1.14  This zipped file contains the matlab files with the comments correctly translated in english 

1.10  I have modified the files translating in english the italian text. 

1.11  I have modified the file comments translating in english the italian comments. 

1.9  As requested, I removed the Creative Commons license statement from the files ... 
steve (view profile)
no clear, use English language, bad diagrams and plots. not useful to use.