I spent some time reading the source code. It looks like when a coupling is compressed by the sum of .fiz parameter
fiz parameter BuffCoupl.::DMaxB of the couplings of the wagons, then the source code
forces the wagons to collide.
Maximum compression is set to 5 cm (0.05) on all couplings of EN57AKL, This value is clearly too low for the existing spring/damping constants. Unless Scharfenberg is known to be extremely weak in reality, I think a reasonable fix is to increase kB (coupler compression spring constant) and DmaxB (maximum allowed coupler compression). This is what I did in the .fiz files in my previous post, so I will not post another attachment here.
Note1: I am not sure why the source code causes a collision in this case but I guess that maybe it is to prevent wagons getting too compressed or streched (which would be a graphical glitch).
note2: If I read the code correctly, a slack of 1cm is applied on
line 5290. This means that in combination with the small 5cm operating range for compression, a significant proportion of the restorative force is deleted (minimum delection: 20% @ 5cm compression; maximum deletion: 100% @ 1cm or less). Assuming the unit of force in the source code is kilonewton, then two en57 wagons will 'collide' when compression forces reach
kb*(DMaxB-0.01) =
4200 *0.04=
168 kN. This value is probably easy to reach when including slack/jerk.
note3: Perhaps maszyna should perform some other behaviour when the maximum values are exceeded. Perhaps this collision behaviour could be replaced with exponentially increasing buffer force and damping to prevent wagons from visually merging with each other
note4: I am worried about line of code
5275, because it will hard clamp the maximum coupler forces to some value depending on DmaxB. This risks causing infinite stretch/compression if such force is exceeded. If the collision logic was inserted to prevent infinite stretch, then a better fix would be to delete the collision logic and delete line 5275. I think clamping effect line 5275 also prevents the coupler break logic from ever executing in some .fiz files (in the case of EN57AKŁ, line 5275 means that CF will never exceed 168kN in compression, meaning that breaking force FmaxB (1.74 MN) can never be reached).