Are Powered Explicit Guidance calculations done before or during launch?

Space shuttle orbital insertion was done using a powered explicit guidance algorithm.

At the surface, the algorithm is simple, as it gives the instantaneous pitch as a linear function of time:

$$\phi = \arctan(at + b )$$ which is ~$$at + b$$ at small pitch angles.

Sadly, the simplicity is illusion, as the coefficients a and b aren't trivial to find. The calculations are fairly elaborate---so elaborate, in fact, they I wonder if they did them all in real time during launch...

...or if they instead did the calculations on the ground in order to get the Powered Explicit Guidance trajectory they would need to feed their attitude controllers.

Thing is... the calculations seem to require knowledge of your instantaneous state vector, which is a variable known with reasonable certainty only in flight. You could simulate on the ground and get some approximate numbers that way, and if you can live with the error that comes with conditions that are not nominal---unexpected differences in wind, engine performance, etc...

Does anyone know where/when the P.E.G. calculations were done? On the ground before flight or in the rocket computers during launch?

It was in the onboard flight software, at least for shuttle.

The second stage guidance software uses a cyclic, closed loop scheme to calculate the necessary commands to take the mated vehicle to a specified set of target MECO conditions. These conditions include cutoff velocity, radius from the Earth, flight path angle, orbital inclination, and longitude of the ascending node. The name of the targeting scheme is PEG (powered explicit guidance) 1. The predicted time of MECO (TMECO) is calculated by both PASS and BFS and displayed on their respective ASCENT TRAJ displays for the crew to evaluate. (A discrepancy between PASS and BFS may indicate a guidance error, requiring the crew to take manual control.) Following SRB separation, it may take the PEG 1 guidance algorithm several cycles to converge and for TMECO to become stable. Forty seconds prior to MECO, guidance begins targeting only for the desired cutoff velocity.

Shuttle Crew Operations Manual page 2.13-56

PASS and BFS were names of the onboard computer software systems. Primary Avionics Software System in the 4 primary onboard computers and Backup Flight System in the backup.

• Thanks again!! I'll have to look at that section very closely. I'm overwhelmed by what I've seen of the PEG and iterative guidance algorithms. I wish there was a clear comprehensive description of this, but there doesn't seem to be. Maybe the section you've linked to will get me going. But there really seems to be a void on the web about this stuff: the info is there but it's just a wall that is difficult to climb.
– user36480
Jan 13, 2021 at 1:54
• @Alex It's probably ITAR restricted too but I am not a lawyer. Jan 13, 2021 at 1:55
• If the papers are available on the web, aren't they available worldwide? The info is all there, it's just not easily understandable and usable by the public. The scientists and engineers who do this for a living abroad would have no problem with the difficult technical papers shared by NASA. The information barrier that exists now exists only for amateurs and hobbyists and enthusiasts---people who just want to simulate and animate because it's cool :D
– user36480
Jan 13, 2021 at 2:00
• Like I said, I'm not a lawyer. Jan 13, 2021 at 2:01
• I'm not either, so I who's to say. I'm sure it doesn't help that it could be ITAR-restricted, since space stuff generally is, because then all companies with the right info would think thrice before sharing anything even if it was in their best interest to share. That would definitely exacerbate the info void. Maybe that's why the only papers publicly available on this are by NASA---they've gotten the green light to share this, but those in private industry don't know what's safe to share, so they just keep everything under a lid out of caution. Either way, it would be nice to know more.
– user36480
Jan 13, 2021 at 2:06