It may be possible to use DFHack to progress a moving cart into a faster moving cart, but you'd probably suffer a massive FPS decay while you're utilizing this. I wouldn't count on it at all.
However, what I would count on is some timing tests. We need to determine the max speed of a roller and the max speed of a ramp, as well as the acceleration rate of ramps. The dwarven railgun is very unlikely to be a huge ramp, but it's entirely more likely to be a long circular roller section ending in a very short ramp. The rollers get it up to 750 speed and the ramp boosts it to the final terminal velocity of 780, for instance.
The actual design for a railgun will probably look more like this:
v Point C
#####
#v<<# <- Point B
#|#^#
#|#^#
#|#^#
#|#^#
#|#|# <- Point A
#|###
#|#
Arrows are rollers, | is a ramp/railway.
Point A: The cart is loaded in the barrel and sent on its way.
Point B: The cart makes the first turn, where the length of track from A to B relies on the velocity of the cart and the derailing speed of a turning cart.
Point C: The cart will make this turn directly at crash velocity. Whatever the speed is needed for a cart to jump off the tracks on a corner, the cart should be moving that fast when it hits C.
Afterwards it goes over a few more rollers to reach final rolling speed, then down a few ramps to reach terminal velocity.
This will require some calculations to work right. Since the cart should be at the derailing threshold by C, then it should be going at Derail - 3 when it hits B, because once it reaches B then it still has to go over 3 more rollers before it hits the gun barrel and terminal speed. Thus, the big factor of science will be determining the length of rollers to place between A and B. Too few rollers and you don't get terminal velocity, too many rollers and it jumps the track and jams the barrel. There will need to be significant science made to determine the acceleration rate of different weights of cart - if they even have different speeds or not.
Coincidentally, if they do have different acceleration rates based on their weight, you can automate it. Pressure plates on the level above could control a very small logic gate and a series of bridges. If a cart is very light and accelerates quickly, then it could be allowed to moved very close to Point B, drop through an open bridge, and enter the barrel of the gun. If it weighs more, then it will drop closer to A and have more rollers to bolster the speed. If timed up just right, you could push any cart into the loader and it would automatically adjust for weight and fire it at maximum possible speed.
Of course, it's also possible that a solid lead minecart will travel just as quickly as a featherwood, so we can't make any assumptions that weight-triggers will be needed.