|setting up subroutines that are called many times...|
Message #1 Posted by Geoff Quickfall on 17 Oct 2013, 3:46 a.m.
Hello all, still working on the programming which when I get the code right is fantastic.
I must admit that I have very crude programming abilities at the moment but here goes:
I have the following dilema, I need to create a subroutine, easy in Basic and RPN with label, xeq and gto commands but I am having problems with the HPPL.
In essence I am creating a break schedule program that takes the following variables:
OFF the GMT takeoff (wheels up time) of the aircraft.
ONA the GMT landing (wheels down time).
ONB the scratch pad for a corrected wheels landing time;
actually the landing time if the landing time is less
then the OFF time, ie the flight goes through midnight.
IN the time returning to the flight deck before landing.
OUT the time leaving the flight deck after takeoff.
NUM number of breaks.
EQL the time if all breaks are equal.
So the break schedule follows:
the input functions prompt for OFF, ON, IN, OUT, NUM.
// the next line tests for takeoff time greater then landing time
// and corrects that by adding 24 hours to ONB. This is so total
// time for breaks can be calculated.
// the reason for ONA versus ONB as ONA must remain untouched for
// display purposes at the end of the program.
IF OFF>ONA THEN ONB:=ONA+24 ELSE ONB:=ONA
Now that little routine is used every time a time period is added to a time period making it a perfect subroutine. This is because any additional time period may traverse 24 hours.
My problem is how do I set up a subroutine which is called multiple times. As I am typing I see that it could be a program that is called for each calculation but how is a subroutine within a created APP done.
Still reading and trying but lazy me, any help would be appreciated.
Looking for SYNTAX something like:
IF OFF>ONA THEN ONB:=ONA + 24 ELSE ONB:=ONA