I think the GAP model is based on tons of statistics about the change in speed based on grade, HR, temperature and so on, so I don't know if there's a 'formula'. You could gather lots of data controlling for temperature and HR to see the affect of grade on speed, and maybe the results will let you make your own formula.