User Tools

Site Tools


prime:ucpl

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

prime:ucpl [2013/10/28 18:22]
geoffqf created
prime:ucpl [2013/10/28 18:24] (current)
geoffqf
Line 1: Line 1:
 +Break schedules: 
 +calculates break periods. 
 +  
 +*Initialize: 
 +this menu.
 +variables ending in A are HMS format.
 +variables ending in B are decimal format.
  
 +Input times.
 +prompts for off and on times. 
 +    these are the airborne and landing times. 
 +break out and in times.
 +    these are the delay and early return 
 +    times in minutes after takeoff and 
 +    before landing.
 +number of breaks.
 +  
 +equal breaks: 
 +4, 6 typically.
 +E,E,E,E or E,E,E,E,E,E
 +  
 +weighted breaks: 
 +input desired long break.
 +front or back.
 +    allows the front half or rear half of the
 +    breaks to be longer by choice.
 +4 or 6 typically. 
 +S,S,L,L or L,L,S,S or S,S,S,L,L,L or L,L,L,S,S,S
 +  
 +*2 short followed by 3 long and short: 
 +− places the sleep period outside the dinner
 +  service.
 +− S,S,L,L,L,S
 +
 +where S=Short and L=Long
 +
 +
 +
 +
 +**********APPLICATION SECTION**********
 +
 +
 +
 +MIDNIGHT();
 +
 +//All variables ending in A
 +//are hexagesimal, decimals
 +//end in B.
 +
 +//declare variables.
 +
 +EXPORT IN,OUT,NUM,EQL,TIM;
 +EXPORT OFA,OFB,ONA,ONB;
 +EXPORT TOA,TOB,CAA,CAB;  
 +EXPORT SHA,SHB,LGA,LGB;
 +EXPORT WTA,WTB,WTC;
 +
 +//title of program within app
 +
 +EXPORT Break_schedules() 
 +BEGIN
 +END;
 +
 +//menu display for prepping the calculator.
 +
 +VIEW "Initialize",IT()
 +
 +BEGIN 
 +  HFormat:=1; 
 +  HDigits:=4; 
 +  HAngle:=1;
 +  STARTVIEW(6,1);
 +  LOCAL A;
 +END;
 +
 +// input times
 +
 +VIEW "Input times/# of breaks",OO()
 +
 +BEGIN
 +  INPUT(OFA,"Wheels off time","off time = ","off time"); 
 +  INPUT(ONA,"Wheels on time","on time = ","on time"); 
 +  INPUT(OUT,"Out time","out time = ","out time"); 
 +  INPUT(IN,"In time","in time = ","in time"); 
 +  INPUT(NUM,"# of breaks","# of breaks = ","# of breaks");
 +
 +//convert times to decimal.
 +
 +  OFB:=(FP(OFA)/60)*100+IP(OFA);
 +  ONB:=(FP(ONA)/60)*100+IP(ONA);
 +  OUT:=(FP(OUT)/60)*100+IP(OUT);
 +  IN:=(FP(IN)/60)*100+IP(IN);
 +
 +//correct for landing time less then takeoff time,
 +//that is flight passes through midnight GMT.
 +
 +IF OFB>ONB 
 +  THEN ONB:=ONB+24 
 +    ELSE ONB:=ONB;
 +      END;
 +
 +//calculate common variables used by each section.
 +
 +  ONB:=ONB-IN;
 +  OFB:=OFB+OUT;
 +  TOB:=ONB-OFB; 
 +  TOA:=→HMS(TOB);
 +  EQL:=→HMS(TOB/NUM);
 +    MSGBOX("Equal = "+EQL);
 +    MSGBOX("Total = "+TOA);
 +      END;
 +
 +//Equal break section of the the app
 +//accessed via "View"
 +
 +VIEW "EQUAL BREAK",EQ()
 +
 +//loop the following by NUM to display each
 +//consecutive time.
 +
 +BEGIN
 +  FOR N FROM 1 TO NUM DO
 +    TIM:=→HMS(OFB+EQL);
 +    TIM:=MIDNIGHT(TIM);
 +    OFB:=TIM;
 +      MSGBOX("Time = " +TIM+"");
 +        END;
 +END;
 +
 +//end loop
 +
 +//Weighted break section of the the app
 +//accessed via "View"
 +
 +VIEW "WEIGHTED BREAK",WB()
 +
 +//label screen title, variable title, variable.
 +//ask for specific variable to this section and
 +//display.
 +
 +BEGIN
 +  INPUT (WTA,"Weighted time","weighted time = ","weighted time");
 +    WTB:=(FP(WTA)/60)*100+IP(WTA);
 +    CAB:=(TOB-(NUM/2*WTB))/(NUM/2); 
 +    CAA:=→HMS(CAB);
 +      MSGBOX("Calculated = " +CAA+"");
 +
 +//Choose menu for placing weighted break at 
 +//front or back of the break periods.
 +
 +CHOOSE(A,"Period","Front","Back");
 +
 +//test and loop for creating the period with specified
 +//break time based on choose menu.
 +
 +IF  A==1 
 +  THEN WTC:=WTB
 +    ELSE WTC:=CAB;
 +      END;
 + 
 +  FOR N FROM 1 TO NUM/2 DO
 +    TIM:=→HMS(OFB+WTC);
 +    TIM:=MIDNIGHT(TIM);
 +    OFB:=TIM;
 +      MSGBOX("Time = " +TIM+"")
 +        END;
 +
 +//test and loop for finishing the period with remaining
 +//break time.
 +
 +IF  A==2
 +  THEN WTC:=WTB
 +    ELSE WTC:=CAB;
 +      END;
 +    
 +  FOR N FROM 1 TO NUM/2 DO
 +    TIM:=→HMS(OFB+WTC);
 +    TIM:=MIDNIGHT(TIM);
 +    OFB:=TIM;
 +      MSGBOX("Time = " +TIM+"");
 +        END;
 +END;
 +
 +//long and short break section of the the app
 +//accessed via "View".
 +
 +VIEW "LONG SHORT BREAK",LS()
 +
 +//label screen title, variable title, variable.
 +//ask for specific variable to this section and
 +//display.
 +
 +BEGIN
 +  INPUT (LGA,"Long","long time = ","long time");
 +    LGB:=(FP(LGA)/60)*100+IP(LGA);
 +    SHB:=(TOB-(LGB*3))/3; 
 +    SHA:=→HMS(SHB);
 +      MSGBOX("Short = " +SHA+"");
 +
 +//loop for first 2 short breaks.
 +
 +  FOR N FROM 1 TO 2 DO
 +    TIM:=→HMS(OFB+SHB);
 +    TIM:=MIDNIGHT(TIM);
 +    OFB:=TIM;
 +      MSGBOX("Time = " +TIM+"")
 +        END;
 +
 +//loop for 3 long breaks.
 +
 +  FOR N FROM 1 TO 3 DO
 +    TIM:=→HMS(OFB+LGB);
 +    TIM:=MIDNIGHT(TIM);
 +    OFB:=TIM;
 +      MSGBOX("Time = " +TIM+"")
 +        END;
 +
 +//final short break added to end.
 +
 +      TIM:=→HMS(OFB+SHB);
 +      TIM:=MIDNIGHT(TIM);
 +      OFB:=TIM;
 +        MSGBOX("Time = " +TIM+"")
 +          END;
 +END;
prime/ucpl.txt · Last modified: 2013/10/28 18:24 by geoffqf