The APM board can be programmed with a HIL (hardware in loop) version of the regular firmware that enables it to send and receive data from Xplane flight simulator. This is how the autopilot is tested and goes like this:
APM 2.0 beta HIL is loaded onto the APM board
APM is connected to a computer via USB and the receiver is powered with a battery
Software is used to connect the APM to Xplane so they can send data to each other
Xplane sends all the location data to the APM board, basically replacing all the sensors including the GPS.
the APM process this data and instead of sending it to the servos, feeds it back to Xplane to move the plane in the Sim. The plane is fully controllable with the RC controller because the APM processes the RC inputs too! This makes it act like an RC flight simulator like RealFlight.
I did have some issues with the channels being reversed (again) and at first the plane would fly upside down in the auto modes. At first I fixed this by reversing the channels on the interface software and just dealing with inverted controls on the 7C controller. Now I have a new model stored in the 7C just for the simulator with the correct control configuration. Now whenever I fly in the HIL I do not have to manually reverse these channels, I can just select the model for simulator.