Closed k4kfh closed 7 years ago
It seems to not be limited to just brakes, but also include rolling resistance.
It had nothing to do with the rolling stock specifically! It had everything to do with a mistake in curly braces. I accidentally put all the totaling code inside the main sim.accel()
for
loop, which cycles through the whole train and does the math for each element. This caused it to redo the totaling math in the middle of redoing the forces math, and it created all sorts of weird timing issues. It also screwed up the acceleration for a train with anything other than 1 locomotive and no cars, because it basically sped up time.
For some reason the rolling stock brake system circumvents the forced-zero-crossing feature. The zero crossing code recognizes that it's crossing zero, but the brakes don't seem to notice and continue to apply negative force just long enough to make the speed negative, and then they notice and switch to positive force. This repeats over and over again, effectively nullifying the zero crossing feature as the entire train bounces back and forth between a very low forward speed and a very low reverse speed.