Mostly working minus correct calculation

I need to further work on the calculation, still not quite right.....
Code works, Engine does not calculate correctly at the moment.  Could be how time period is calculated, or how math is built.  I do not know.