Magnetic Acceleration Problem

Hello everyone, I'm new to the forums, currently in grade 12. I'm planning to build a linear multi-stage coilgun as a class/personal project and had a few questions. I'm currently in the initial brainstorming stage. I need to be able to have the coils fire just before the projectile reaches the coil in the barrel. Setting up an optical detection system like this is complicated and so I decided to try an approach with physics. The system is even more complicated by the plan to have the coils reverse polarity once after the first half of projectile passes out the end of a coil.

What equations would I need and what would I have to do to calculate when an accelerating projectile is going to reach a certain distance after being accelerated at each point? The good part is that all the coils are going to have the same magnetic force.