home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hacker Chronicles 2
/
HACKER2.BIN
/
284.WINGIT.INC
< prev
next >
Wrap
Text File
|
1986-05-13
|
44KB
|
829 lines
(* Procedures used by Wing Program and loaded as Include (.INC) Files. *)
(*************************************************************************)
(* Loosely Derived from articles in Soar Tech # 2, 1983, by Armin Saxer, *)
(* pgs 38..42, Chuck Anderson, pgs 130..191, and the Schlosser Brothers, *)
(* pgs 16..22, and Soar Tech # 1, 1982, the article by Martin Simons. *)
(* Converted from BASIC, TI-59 and HP-41 Languages to Turbo Pascal. *)
(* Program Source Code By Ed Karns with help from Rolf Unternaehrer *)
(* VERSION 2.06 May 1986. CopyRight 1986 *)
(* *)
(* This program source code is offered on a "free ware" basis. *)
(* If you find the WING PROGRAM of value, send $25.00 to : *)
(* Departure Company, 16 Jess Ave., Petaluma, Ca. 94952 *)
(* In return we will send a copy of Soar Tech #2 an excellent sailplane *)
(* publication and the source for much of this program's documentation *)
(* and latest version of this program. *)
(*************************************************************************)
Procedure Display; Begin (* Displays All Fixed Calculation Results *)
ClrScr; (* Clears the Screen *) Writeln; LowVideo;
Writeln (' Fixed Dimensions for the Wing'); NormVideo;
Writeln;
Write ('Root Chord ');
If Metric = False Then Writeln ( RC :2:2, ' Inches')
Else Writeln ( Root_Chord :2:2, ' Centimeters');
Write (' Root Chord Thickness ');
If Metric = False Then Writeln ( RFT :2:2, ' Inches')
Else Writeln ( Root_Foil_Thickness :2:2, ' Centimeters');
Write ('Tip Chord ');
If Metric = False Then Writeln ( TC :2:2, ' Inches')
Else Writeln ( Tip_Chord :2:2, ' Centimeters');
Write (' Tip Chord Thickness ');
If Metric = False Then Writeln ( TFT :2:2, ' Inches')
Else Writeln ( Tip_Foil_Thickness :2:2, ' Centimeters');
Write (' Wing Sweep RC to TC ');
If Metric = False Then Writeln ( WW :2:2, ' Inches')
Else Writeln ( ' ', Wing_Sweep :2:2, ' CentiMeters');
Write (' Mean Wing Chord ');
If Metric = False Then Writeln ( TM :2:2, ' Inches')
Else Writeln (( Mean_Chord * 100 ) :2:2, ' CentiMeters');
Write (' Mean Chord Thickness ');
If Metric = False Then
Writeln (( TM * Percent_Thickness / 100.0 ) :2:2, ' Inches')
Else
Writeln (( Mean_Chord * Percent_Thickness ) :2:2, ' CentiMeters');
Writeln (' Mean % Chord Thickness ', Percent_Thickness :2:2, ' %');
Writeln;
Write ('Wing Span ');
If Metric = False Then Writeln ( S :3:2, ' Inches')
Else Writeln (' ', Wing_Span :3:2, ' Meters');
Write (' Wing Surface Area ');
If Metric = False Then Writeln ( WA :5:1, ' Square Inches')
Else Writeln (' ', Wing_Area :2:3, ' Square Meters');
Writeln (' Wing Aspect Ratio ',
Aspect_Ratio :5:2, ' * No Units *');
Write (' All Up Flying Weight ');
If Metric = False Then Writeln (( GM + BGM ) : 2:2, ' Pounds')
Else Writeln (( Weight + B_Weight ) : 2:2, ' Kilograms');
Write (' Wing Loading ');
If Metric = False Then
Writeln (( FB * 144.0 ) :5:2, ' Ounces / Square Foot')
Else
Writeln ( Wing_Load :5:2, ' Kgrams / Square Meter');
Write (' Wing Geo. Aero. Center ');
If Metric = False Then Writeln (( Wing_GAC / 2.540 ) :5:2, ' Inches')
Else Writeln ( Wing_GAC :5:2, ' CentiMeters');
Write (' Wing LE to CG Point ');
If Metric = False Then Writeln (( P + WG ) :2:2, ' Inches - Suggested')
Else
Writeln (( CG_Distance + Wing_GAC ) :2:2, ' CentiMeters - Suggested');
Writeln;
Writeln ('Stability Factor ',
Stability_Factor :1:5, ' * No Units * Negative Number');
Writeln (' Wing Dihedral Angle ',
Wing_Dihedral :2:2, ' Degrees - Suggested');
Writeln; LowVideo;
Write (' Press any Key to continue');
Read ( Kbd, Ans ); NormVideo;
End; (* of Procedure Display *)
Procedure Display_Extras; Begin (* Displays Fixed Tail Calculation Results *)
ClrScr; Writeln; LowVideo;
Writeln (' Fixed Calculation Results for the Tail');
Writeln; Normvideo;
Write ('Tail Fin & Rud. Root Chord ');
If Metric = False Then
Writeln ( FR :2:2, ' Inches')
Else
Writeln ( Fin_Root :3:2, ' CentiMeters');
Write (' Tail Fin & Rud. Tip Chord ');
If Metric = False Then
Writeln ( FT:2:2, ' Inches')
Else
Writeln ( ' ', Fin_Tip:3:2, ' CentiMeters');
Write (' Tail Fin & Rudder Height ');
If Metric = False Then
Writeln ( HT :2:2, ' Inches')
Else
Writeln ( Fin_Height :3:2, ' CentiMeters');
Write (' Tail Fin & Rudder Sweep ');
If Metric = False Then
Writeln ( FW :2:2, ' Inches')
Else
Writeln ( Fin_Sweep :3:2, ' CentiMeters');
Writeln
(' Tail Fin Aspect Ratio ', Fin_Ratio :5:2, ' * No Units *' );
Write (' Wing LE to Fin LE ');
If Metric = False Then
Writeln ( WF :2:2, ' Inches')
Else
Writeln ( Wing_Fin :3:2, ' CentiMeters');
Write (' Fin Geo. Aero. Center ');
If Metric = False Then
Writeln ( FG :5:2, ' Inches')
Else
Writeln ( Fin_GAC :5:2, ' CentiMeters');
Write (' Tail Fin & Rudder Area ');
If Metric = False Then
Writeln ( SV : 5:1, ' Square Inches')
Else
Writeln ( Fin_Area : 5:1, ' Square CentiMeters');
Result1 := (Wing_Span/2) / 2 * (Root_Chord+Tip_Chord); (* S1 *)
Result2 := 3 * (Wing_Span/2) * Result1 / 50 * F_Distance;
Writeln (' Area Change Suggested ',
(100*Result2/Fin_Area) :3:1, ' Percent ( % ) or ');
Write (' Suggested Fin Area ');
If Metric = False Then
Writeln (( SV * Result2/Fin_Area ) : 5:1, ' Square Inches')
Else
Writeln (( Result2 ) : 5:1, ' Square CentiMeters');
Writeln;
Write ('Horiz. Stabilizer Root ');
If Metric = False Then
Writeln ( SR :2:2, ' Inches')
Else
Writeln ( Stab_Root :3:2, ' CentiMeters');
Write (' Horiz. Stabilizer Tip ');
If Metric = False Then
Writeln ( ST :2:2, ' Inches')
Else
Writeln ( Stab_Tip :3:2, ' CentiMeters');
Write (' Horiz. Stabilizer Sweep ');
If Metric = False Then
Writeln ( SW :2:2, ' Inches')
Else
Writeln ( Stab_Sweep :3:2, ' CentiMeters');
Write (' Horiz. Stabilizer Span ');
If Metric = False Then
Writeln ( SS :2:2, ' Inches')
Else
Writeln ( Stab_Span :3:2, ' CentiMeters');
Write (' Horiz. Stabilizer Area ');
If Metric = False Then
Writeln ( ' ', SA :5:1, ' Square Inches')
Else
Writeln ( ' ', Stab_Area :5:1, ' Square CentiMeters');
Write (' Stab Geo. Aero. Center ');
If Metric = False Then
Writeln ( SG :5:2, ' Inches')
Else
Writeln ( Stab_GAC :5:2, ' CentiMeters');
Writeln
(' Stabilizer Aspect Ratio ', Stab_Ratio :5:2, ' * No Units *' );
Write (' Wing LE to Horiz. Stab. LE ');
If Metric = False Then
Writeln ( WS :2:2, ' Inches')
Else
Writeln ( Wing_Stab :3:2, ' CentiMeters');
Writeln; LowVideo;
Write (' Press any Key to Continue ');
Read ( Kbd, Ans ); NormVideo;
End; (* of Procedure Display_Extras *)
Procedure Change_Foil_Records; Begin (* Changes Air Foil, sets R #'s, etc *)
ClrScr; (* Clears the Screen *) LowVideo;
Writeln
(' You may chose an Air Foil Record from this list. .. One Moment Please ..');
Writeln
(' * indicates real ( wind tunnel ) data. c indicate calculated data.');
Writeln
(' Enter the number of the Foil to be used. Return <CR> Selects E 387 Foil.');
X := 1; Y := 5; File_Pointer := 1; (* Reset Counters *)
Assign ( Foil_File, 'AIRFOIL.DAT'); ReSet ( Foil_File ); NormVideo;
Repeat (* Repeat Until Y > 19 *)
Repeat (* Repeat Until X > 50 *)
If Y > 19 Then X := X + 25;
If Y > 19 Then Y := 5;
Seek ( Foil_File, File_Pointer - 1 ); Read ( Foil_File, Foil_Record );
With Foil_Record Do Foil_Name := Name;
GotoXY ( X, Y );
If File_Pointer < 10 Then Write ( File_Pointer, ' ', Foil_Name )
Else Write ( File_Pointer, ' ', Foil_Name );
Y := Y + 1; File_Pointer := File_Pointer + 1; (* Increment Counters *)
Until X > 50;
Until Y > 19; (* Now X > 50 and Y > 19, Out *)
Close ( Foil_File );
GotoXY ( 1, 22 );
Write ('Enter number of the Air Foil you wish work with > ');
Readln ( File_Pointer );
If File_Pointer in [ 2..Number_of_Records ] Then Else File_Pointer := 1;
ClrScr; (* Clears Screen *)
GotoXY ( 1,15 );
Write ('Getting Air Foil Information ... One Moment ...');
Assign ( Foil_File, 'AIRFOIL.DAT'); ReSet ( Foil_File );
Seek ( Foil_File, File_Pointer - 1 ); Read ( Foil_File, Foil_Record );
With Foil_Record Do Begin
Foil_Name := Name;
Reynolds1 := R_Number1; Reynolds2 := R_Number2;
Reynolds3 := R_Number3; Reynolds4 := R_Number4;
For I := 1 to 64 Do Begin
Foil1 [I] := Drag_Array1 [I]; Foil2 [I] := Drag_Array2 [I];
Foil3 [I] := Drag_Array3 [I]; Foil4 [I] := Drag_Array4 [I];
End; (* of For I to 64 *)
End; (* of With Foil_Record Do *)
Close ( Foil_File );
End; (* of Procedure Change_Foil_Records *)
Procedure Calculate_Display; Begin (* Calculates & Displays Simulation *)
If Foil_Name = '' Then Change_Foil_Records;
ClrScr; (* Clears the Screen *) GotoXY ( 10, 10 );
Write ('Calculating ..... One Moment ..... ');
I := 1; (* ReInit for ReCalculations *)
Result := Calc_CD; (* Calls Function to fill arrays *)
Result3 := 1.0; Result4 := 0.0; Result5 := -0.1; Result6 := 0.01;
Lift_Coef := 0.0; X := 1; Y := 3; I := 1;
ClrScr; (* Clears the Screen *) LowVideo;
Write ('Foil = '); NormVideo;
Write ( Foil_Name ); GotoXY ( 28, 1 ); LowVideo;
Write ('R# = V =');
If Metric = False Then Writeln (' MPH Feet/Sec')
Else Writeln (' KPH Meters/Sec');
Write
(' CL VX VY L/D | CL VX VY L/D | CL VX VY L/D');
GotoXY ( 1, 24 );
Write (' <Cntl> S = Stop, any key to resume ');
GotoXY ( 42, 24 );
Write ('Total Drag C.= '); NormVideo;
Repeat (* Repeat Until Y > 23 *)
Repeat (* Repeat Until X > 52 *)
Profile_Drag_Coef := Foil [I]; (* Looks at Foil Array before Calc *)
Result := Flight_Speed; (* Call Functions to get Results *)
If Y > 23 Then X := X + 26;
If Y > 23 Then Y := 3;
If Metric = False Then Speed := Speed / 0.3048;
If Metric = False Then Horiz_Speed := Horiz_Speed / 0.3048;
If Metric = False Then Vert_Speed := Vert_Speed / 0.3048;
(* Conversion to British units *) (* Following Display Results *)
GotoXY ( 34, 1 ); Write ( Reynolds :7:0 ); GotoXY ( 48, 1 );
If Metric = False Then Write ( Speed * ( 3600/5280 ) :3:1 )
Else Write ( Speed * ( 3600/1000 ) :3:1 ); (* Writel MPH or KPH *)
GotoXY ( 60, 1 ); Write ( Speed :3:1 );
If ( Profile_Drag_Coef / Total_Drag_Coef ) < Result6 Then LowVideo;
GotoXY ( X, Y ); Write ( Lift_Coef :2:2 ); NormVideo;
If Horiz_Speed >= Result3 Then LowVideo;
GotoXY ( X + 5, Y ); Write ( Horiz_Speed :2:2 ); NormVideo;
If Vert_Speed >= Result4 Then LowVideo;
GotoXY ( X + 12, Y ); Write ( Vert_Speed:2:2 ); NormVideo;
If Glide_Ratio <= Result5 Then LowVideo;
GotoXY ( X + 18, Y ); Write ( Glide_Ratio:2:2 ); NormVideo;
If Glide_Ratio < ( Result5 / 1.25 ) Then
If ( Profile_Drag_Coef / Total_Drag_Coef ) > ( Result6 * 0.1 ) Then
If Lift_Coef > 0.5 Then Stall := True;
If Stall = True Then Begin
GotoXY ( X, Y + 1 );
Write (' > Stall <');
GotoXY ( X, Y + 1 ); LowVideo;
Write (' >> <<'); NormVideo;
GotoXY ( X, Y + 1 );
Write (' >>> Stall <<<');
GotoXY ( X, Y + 1 ); LowVideo;
Write (' >>>> <<<<'); NormVideo;
GotoXY ( X, Y + 1 );
Write (' >>>>> Stall <<<<<');
GotoXY ( X, Y + 1 ); LowVideo;
Write (' >>>>>> <<<<<<'); NormVideo;
GotoXY ( X, Y + 1 );
Write (' >>>>>>> <<<<<<<');
GotoXY ( X, Y + 1 ); LowVideo;
Write (' >>>>>>>> <<<<<<<<'); NormVideo;
GotoXY ( X, Y + 1 );
Write (' >>>>>>>>> <<<<<<<<<');
GotoXY ( X, Y + 1 ); LowVideo;
Write (' *******************'); NormVideo;
GotoXY ( X, Y + 1 );
Write (' <<<<<<<<< >>>>>>>>>');
GotoXY ( X, Y + 1 );
Write (' <<<<<<<< >>>>>>>>');
GotoXY ( X, Y + 1 ); LowVideo;
Write (' <<<<<<< >>>>>>>'); NormVideo;
GotoXY ( X, Y + 1 );
Write (' <<<<<< >>>>>>');
GotoXY ( X, Y + 1 );
Write (' <<<<< Stall >>>>>');
GotoXY ( X, Y + 1 ); LowVideo;
Write (' <<< >>>'); NormVideo;
GotoXY ( X, Y + 1 );
Write (' < Stall >');
GotoXY ( X, Y + 1 ); LowVideo;
Write (' *******************'); NormVideo;
End; (* of If Stall *)
GotoXY ( 54, 24 ); Write (' ', Total_Drag_Coef : 1:4 );
GotoXY ( 60, 24 );
Write
(' ', ((Profile_Drag_Coef/Total_Drag_Coef)*100):2:1, ' % ');
(* End of Display, Begin Save Results for Next Comparisons *)
Result3 := Horiz_Speed; Result4 := Vert_Speed;
Result5 := Glide_Ratio; Result6 := Profile_Drag_Coef / Total_Drag_Coef;
Lift_Coef := Lift_Coef + 0.020; (* Increase CL for next Display *)
Y := Y + 1; I := I + 1; (* Increment Counters *)
Until X > 52;
Until Y > 23; (* Now X > 52 and Y > 23, Out *)
GotoXY ( 1, 24 );
Write (' Press any Key to continue '); Read ( Kbd, Ans );
Stall := False; (* turns off Stall Warning *)
End; (* of Procedure Calculate *)
Procedure Change_Units; Begin
(* Changes Metric to British Units or Back to Metric and Temp/Press *)
ClrScr; (* Clears the Screen *) LowVideo;
GotoXY ( 1, 4 ); LowVideo;
Writeln (' Entering a Return <CR> accepts initial value.');
Writeln; NormVideo;
Writeln (' Enter your choice for Units of Measure');
Writeln (' Enter "B" for British Inches and Pounds');
Writeln (' or "M" for Metric CentiMeters and KiloGrams');
Writeln; LowVideo;
If Metric = False Then Write (' < British > ')
Else Write (' < Metric > '); NormVideo;
Read ( Kbd, Ans );
If UpCase ( Ans ) = 'B' Then Metric := False;
If UpCase ( Ans ) = 'M' Then Metric := True;
If Metric = True Then Writeln (' >> Changed to Metric Units <<')
Else Writeln (' >> Changed to British Units <<');
Writeln;
(* Changes Temperature and Air Pressure *)
If Metric = False Then Units := 'Degrees Fahrenheit, F.'
Else Units := 'Degrees Centigrade, C.';
Writeln ('Enter Temperature in ', Units );
Write (' < '); LowVideo;
If Metric = False Then Write ( T:3:1, ' ', Units )
Else Write ( Temperature :3:1, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( T ) Else Readln ( Temperature );
If Metric = False Then Temperature := ( 5 / 9 ) * ( T - 32.0 )
Else T := (( 9 / 5 ) * Temperature ) + 32.0;
Writeln;
(* Get Air Pressure *)
If Metric = False Then Units := 'Pounds per Square Foot'
Else Units := 'KiloGrams per Square Meter';
Writeln ('Enter Air Pressure in ', Units );
Write (' < '); LowVideo;
If Metric = False Then Write ( Pr :6:0, ' ', Units )
Else Write ( Air_Press :6:0, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( Pr ) Else Readln ( Air_Press );
If Metric = False Then Air_Press := ( 10132.0 / 2116.0 ) * Pr
Else Pr := ( 2116.0 / 10132.0 ) * Air_Press;
Writeln;
(* Get Flying Weight *)
If Metric = False Then Units := 'Pounds' Else Units := 'KiloGrams';
Write ('Enter Flying Weight in ', Units,' < '); LowVideo;
If Metric = False Then Write ( GM :2:2, ' ', Units )
Else Write ( Weight :2:2, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( GM ) Else Readln ( Weight );
If Metric = False Then Weight := GM * 0.45359237
Else GM := Weight / 0.45359237; (* Lbs to Kilos *)
Writeln;
(* Get Ballast Weight *)
If Metric = False Then Units := 'Pounds' Else Units := 'KiloGrams';
Write ('Enter Ballast Weight ( if any ) in ', Units,' < '); LowVideo;
If Metric = False Then Write ( BGM :2:2, ' ', Units )
Else Write ( B_Weight :2:2, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( BGM ) Else Readln ( B_Weight );
If Metric = False Then B_Weight := BGM * 0.45359237
Else BGM := B_Weight / 0.45359237; (* Lbs to Kilos *)
End; (* of Procedure Units and Change_Temp_Press *)
Procedure Change_Wing; Begin (* Changes Wing Dimensions *)
ClrScr; (* Clears Screen *)
GotoXY ( 1, 4 ); LowVideo;
Writeln (' Entering a Return <CR> accepts initial value.');
Writeln; NormVideo;
(* Get Root Chord *)
If Metric = False Then Units := 'Inches' Else Units := 'CentiMeters';
Write ('Enter ROOT Wing Chord in ', Units, ' < '); LowVideo;
If Metric = False Then Write ( RC:5:2, ' ', Units )
Else Write ( Root_Chord :5:2, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( RC ) Else Readln ( Root_Chord );
If Metric = False Then Root_Chord := RC * 2.540
Else RC := Root_Chord / 2.540;
Writeln;
(* Get Tip Chord *)
If Metric = False Then Units := 'Inches' Else Units := 'CentiMeters';
Write ('Enter TIP Wing Chord in ', Units, ' < '); LowVideo;
If Metric = False Then Write ( TC:5:2, ' ', Units )
Else Write ( Tip_Chord :5:2, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( TC ) Else Readln ( Tip_Chord );
If Metric = False Then Tip_Chord := TC * 2.540
Else TC := Tip_Chord / 2.540;
Writeln;
(* Lead in for Percent or Measurement of Foil Thickness *)
Writeln (' Change Foil Thickness by Measurement or Percentage ??');
Write (' Enter "P" for Percentage, "M" for Measurement >>');
Read ( Kbd, Ans ); Writeln; Writeln;
If UpCase ( Ans ) = 'M' Then Begin
(* Get Root Foil Thickness *)
If Metric = False Then Units := 'Inches' Else Units := 'CentiMeters';
Write ('Enter ROOT Foil Thickness in ', Units, ' < '); LowVideo;
If Metric = False Then Write ( RFT:5:2, ' ', Units )
Else Write ( Root_Foil_Thickness :5:2, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( RFT )
Else Readln ( Root_Foil_Thickness );
If Metric = False Then Root_Foil_Thickness := RFT * 2.540
Else RFT := Root_Foil_Thickness / 2.540;
Writeln;
(* Get Tip Foil Thickness *)
If Metric = False Then Units := 'Inches' Else Units := 'CentiMeters';
Write ('Enter TIP Foil Thickness in ', Units, ' < '); LowVideo;
If Metric = False Then Write ( TFT:5:2, ' ', Units )
Else Write ( Tip_Foil_Thickness :5:2, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( TFT )
Else Readln ( Tip_Foil_Thickness );
If Metric = False Then Tip_Foil_Thickness := TFT * 2.540
Else TFT := Tip_Foil_Thickness / 2.540;
Writeln;
Percent_Thickness :=
((Root_Foil_Thickness/Root_Chord + Tip_Foil_Thickness/Tip_Chord)/2) * 100;
(* PD = 100 * ( DMean / TMean ) yields % *)
End; (* of answer is M for Measurement *)
(* Get Percentage of Foil_Thickness *)
If UpCase ( Ans ) = 'P' Then Begin
Write (' Enter Percentage of Foil Thickness in Percent < '); LowVideo;
Write ( Percent_Thickness : 2:2 ); NormVideo;
Write (' > '); Readln ( Percent_Thickness );
Root_Foil_Thickness := ( Root_Chord * Percent_Thickness ) / 100.0;
RFT := Root_Foil_Thickness / 2.540;
Tip_Foil_Thickness := ( Tip_Chord * Percent_Thickness ) / 100.0;
TFT := Tip_Foil_Thickness / 2.540;
Writeln;
End; (* of Percentage Change *)
(* Get Wing Span *)
If Metric = False Then Units := 'Inches' Else Units := 'METERS';
Write ('Enter Wing Span in ', Units, ' < '); LowVideo;
If Metric = False Then Write ( S :5:2, ' ', Units )
Else Write ( Wing_Span :5:2, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( S ) Else Readln ( Wing_Span );
If Metric = False Then Wing_Span := S * ( 0.9144 / 36 )
Else S := Wing_Span * ( 36 / 0.9144 ); (* Meters to Inches *)
Writeln;
(* Get Wing Root to Tip Sweep *)
If Metric = False Then Units := 'Inches' Else Units := 'CentiMeters';
Write ('Enter Wing Sweep ( Root to Tip ) in ', Units, ' < '); LowVideo;
If Metric = False Then Write ( WW:5:2, ' ', Units )
Else Write ( Wing_Sweep :5:2, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( WW ) Else Readln ( Wing_Sweep );
If Metric = False Then Wing_Sweep := WW * 2.540
Else WW := Wing_Sweep / 2.540;
Writeln;
(* Get Wing Mount Type *)
Writeln ('Enter Wing Type, M for Mid, S for Shoulder, H for High Mount');
Write (' < '); LowVideo;
If Wing_Position = 'S' Then Write ('Shoulder Mount');
If Wing_Position = 'H' Then Write ('High Mount');
If Wing_Position = 'M' Then Write ('Mid Section Mount'); NormVideo;
Write (' > '); Read ( Kbd, Ans );
If Upcase ( Ans ) = 'S' Then Wing_Position := Upcase (Ans);
If Upcase ( Ans ) = 'H' Then Wing_Position := Upcase (Ans);
If Upcase ( Ans ) = 'M' Then Wing_Position := Upcase (Ans);
End; (* of Procedure Change_Wing *)
Procedure Change_Stab; Begin
ClrScr; (* Clears the Screen *)
GotoXY ( 1, 6 ); LowVideo;
Writeln (' Entering a Return <CR> accepts initial value.');
Writeln; NormVideo;
(* Get Stab Span *)
If Metric = False Then Units := 'Inches' Else Units := 'CentiMeters';
Write ('Enter Total Horiz. Stab Span in ', Units, ' < '); LowVideo;
If Metric = False Then Write ( SS :5:2, ' ', Units )
Else Write ( Stab_Span :5:2, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( SS ) Else Readln ( Stab_Span );
If Metric = False Then Stab_Span := SS * 2.540
Else SS := Stab_Span / 2.540;
Writeln;
(* Get Stab Root Chord *)
If Metric = False Then Units := 'Inches' Else Units := 'CentiMeters';
Write ('Enter Horiz. Stabilizer Root Chord in ', Units, ' < '); LowVideo;
If Metric = False Then Write ( SR :5:2, ' ', Units )
Else Write ( Stab_Root :5:2, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( SR ) Else Readln ( Stab_Root );
If Metric = False Then Stab_Root := SR * 2.540
Else SR := Stab_Root / 2.540;
Writeln;
(* Get Stab Tip Chord *)
If Metric = False Then Units := 'Inches' Else Units := 'CentiMeters';
Write ('Enter Horiz. Stabilizer Tip Chord in ', Units, ' < '); LowVideo;
If Metric = False Then Write ( ST :5:2, ' ', Units )
Else Write ( Stab_Tip :5:2, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( ST ) Else Readln ( Stab_Tip );
If Metric = False Then Stab_Tip := ST * 2.540
Else ST := Stab_Tip / 2.540;
Writeln;
(* Get Stab Sweep Back *)
If Metric = False Then Units := 'Inches' Else Units := 'CentiMeters';
Write ('Enter Stab Sweep Back ( Root - Tip ) in ', Units, ' < '); LowVideo;
If Metric = False Then Write ( SW :5:2, ' ', Units )
Else Write ( Stab_Sweep :5:2, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( SW ) Else Readln ( Stab_Sweep );
If Metric = False Then Stab_Sweep := SW * 2.540
Else SW := Stab_Sweep / 2.540;
Writeln;
(* Get Distance from Stab LE to Wing LE at Root Chords *)
If Metric = False Then Units := 'Inches' Else Units := 'CentiMeters';
Writeln ('Enter Distance from Wing LE to Stabilizer LE at Roots ');
Write (' Wing LE to Stab LE in ', Units, ' < '); LowVideo;
If Metric = False Then Write ( WS :5:2, ' ', Units )
Else Write ( Wing_Stab :5:2, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( WS ) Else Readln ( Wing_Stab );
If Metric = False Then Wing_Stab := WS * 2.540
Else WS := Wing_Stab / 2.540;
End; (* of Procedure Change_Stab *)
Procedure Change_Fin; Begin
ClrScr; (* Clears the Screen *)
GotoXY ( 1, 3 ); LowVideo;
Writeln (' Entering a Return <CR> accepts initial value.');
Writeln; NormVideo;
(* Get Tail Type, T Tail or Standard and V Tail *)
Writeln
(' Enter T for a T-Tail. Enter S for Standard or V-Tail');
Write (' < '); LowVideo;
If T_Tail = True Then Write ('T-Tail')
Else Write ( 'Standard or V-Tail' ); NormVideo;
Write (' > '); Read ( Kbd, Ans ); Writeln; Writeln;
If Upcase ( Ans ) = 'T' Then T_Tail := True;
If Upcase ( Ans ) = 'S' Then T_Tail := False;
If Upcase ( Ans ) = 'V' Then T_Tail := False;
(* Get Rudder Height *)
If Metric = False Then Units := 'Inches' Else Units := 'CentiMeters';
Write ('Enter Fin and Rudder Height in ', Units, ' < '); LowVideo;
If Metric = False Then Write ( HT :5:2, ' ', Units )
Else Write ( Fin_Height :5:2, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( HT ) Else Readln ( Fin_Height );
If Metric = False Then Fin_Height := HT * 2.540
Else HT := Fin_Height / 2.540;
Writeln;
(* Get Rudder Root Chord *)
If Metric = False Then Units := 'Inches' Else Units := 'CentiMeters';
Write ('Enter Fin and Rudder Root Chord in ', Units, ' < '); LowVideo;
If Metric = False Then Write ( FR :5:2, ' ', Units )
Else Write ( Fin_Root :5:2, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( FR ) Else Readln ( Fin_Root );
If Metric = False Then Fin_Root := FR * 2.540
Else FR := Fin_Root / 2.540;
Writeln;
(* Get Rudder Tip Chord *)
If Metric = False Then Units := 'Inches' Else Units := 'CentiMeters';
Write ('Enter Fin and Rudder Tip Chord in ', Units, ' < '); LowVideo;
If Metric = False Then Write ( FT :5:2, ' ', Units )
Else Write ( Fin_Tip :5:2, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( FT ) Else Readln ( Fin_Tip );
If Metric = False Then Fin_Tip := FT * 2.540
Else FT := Fin_Tip / 2.540;
Writeln;
(* Get Rudder Sweep Back *)
If Metric = False Then Units := 'Inches' Else Units := 'CentiMeters';
Write ('Enter Fin Sweep Back ( Root - Tip ) in ', Units, ' < '); LowVideo;
If Metric = False Then Write ( FW :5:2, ' ', Units )
Else Write ( Fin_Sweep :5:2, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( FW ) Else Readln ( Fin_Sweep );
If Metric = False Then Fin_Sweep := FW * 2.540
Else FW := Fin_Sweep / 2.540;
Writeln;
(* Get Distance from Rudder LE to Wing LE at Root Chords *)
If Metric = False Then Units := 'Inches' Else Units := 'CentiMeters';
Writeln ('Enter Approximate Distance from Wing LE to Fin LE at Roots ');
Write (' Wing LE to Fin LE ', Units, ' < '); LowVideo;
If Metric = False Then Write ( WF :5:2, ' ', Units )
Else Write ( Wing_Fin :5:2, ' ', Units ); NormVideo;
Write (' > ');
If Metric = False Then Readln ( WF ) Else Readln ( Wing_Fin );
If Metric = False Then Wing_Fin := WF * 2.540
Else WF := Wing_Fin / 2.540;
End; (* of Procedure Change_Fin *)
Procedure Edit_AirFoil; Begin (* This does the actual editing of the data *)
(* Below Changes Foil_Name and Reynolds Numbers *)
Change_Foil_Records; ClrScr; (* Clears Screen *)
GotoXY ( 1, 10 );
Write (' Current Air Foil Name is < ');
Write ( Foil_Name );
Write (' >');
GotoXY ( 1, 12 );
Writeln (' Enter new name. Use up to 20 charactures.');
Writeln;
Writeln (' Just hit Return <CR> to keep the same name.');
Writeln;
Writeln (' < >');
GotoXY ( 16, 16 );
Units := ''; (* Units used here for Foil name buffer *)
Readln ( Units ); (* Double reverse to make sure file_name is correct *)
If Units = '' Then Foil_Name := Foil_Name
Else Foil_Name := Units;
ClrScr; (* Clears Screen *)
GotoXY ( 1, 10 );
Write (' Current Air Foil Name is < ');
Write ( Foil_Name );
Write (' >');
GotoXY ( 1, 12 );
Writeln (' Enter new Reynolds Numbers. Use Numbers Only');
Writeln;
Writeln (' Just hit Return <CR> to keep the same Reynolds Numbers.');
Writeln; LowVideo;
Writeln (' ', Reynolds1 : 7:0, ' < >');
Writeln (' ', Reynolds2 : 7:0, ' < >');
Writeln (' ', Reynolds3 : 7:0, ' < >');
Writeln (' ', Reynolds4 : 7:0, ' < >');
GotoXY ( 25, 16 ); NormVideo; Readln ( Reynolds1 );
GotoXY ( 25, 17 ); Readln ( Reynolds2 );
GotoXY ( 25, 18 ); Readln ( Reynolds3 );
GotoXY ( 25, 19 ); Readln ( Reynolds4 );
(* Displays foist Foil Information page, F Name, R1, Foil1, CD *)
I := 1; X := 1; Y := 3; Lift_Coef := 0.000; (* Reset Counters *)
ClrScr; (* Clears Screen *) LowVideo;
Write ('Reynolds Number is '); NormVideo;
Write ( Reynolds1 :7:0 ); (* Reynolds from file *) LowVideo;
Write (' ');
Write ('Foil Name is '); NormVideo;
Writeln ( Foil_Name ); (* Name from File *) LowVideo;
Writeln
(' CL CD new CD | CL CD new CD | CL CD new CD ');
GotoXY ( 1, 24 ); NormVideo;
Write
('Enter new CD, <Return> keeps old CD the same, CD > 1 ends entrys');
Repeat (* Repeat Until Y > 23 *)
Repeat (* Repeat Until X > 50 *)
If Y > 23 Then X := X + 25; If Y > 23 Then Y := 3;
GotoXY ( X, Y ); Write ( Lift_Coef :2:2 );
GotoXY ( X + 6, Y );
If Foil1 [I] = 0.0 Then Write ( Foil1 [I] : 1:1 )
Else Write ( Foil1 [I] :1:4 );
Lift_Coef := Lift_Coef + 0.020; (* Increment CL for next Display *)
Y := Y + 1; I := I + 1; (* Increment Counter *)
Until X > 50;
Until Y > 23; (* Now X > 50 and Y > 23, Out *)
I := 1; X := 1; Y := 3; (* Reset Counters *)
(* Following Display is for Edit of CD vrs CL, Group 1 *)
Repeat (* Until CD > 1 *)
If Y > 23 Then X := X + 25;
If Y > 23 Then Y := 3; (* Double reverse keeps X & Y in line *)
GotoXY ( X + 14, Y );
Profile_Drag_Coef := Foil1 [I];
Readln ( Profile_Drag_Coef );
If Profile_Drag_Coef < 0.99999999 Then
If Profile_Drag_Coef <> Foil1 [I] Then
Foil1 [I] := Profile_Drag_Coef;
(* Makes sure nothing unseemly gets into the array *)
Y := Y + 1; I := I + 1; (* Increment Counters *)
If I > 63 Then Profile_Drag_Coef := 1.01;
Until Profile_Drag_Coef > 0.9999;
(* Displays second Foil Information, F Name, R2, Foil2, CD *)
I := 1; X := 1; Y := 3; Lift_Coef := 0.000; (* Reset Counters *)
ClrScr; (* Clears Screen *) LowVideo;
Write ('Reynolds Number is '); NormVideo;
Write ( Reynolds2 :7:0 ); (* Reynolds from file *) LowVideo;
Write (' ');
Write ('Foil Name is '); NormVideo;
Writeln ( Foil_Name ); (* Name from File *) LowVideo;
Writeln
(' CL CD new CD | CL CD new CD | CL CD new CD ');
GotoXY ( 1, 24 ); NormVideo;
Write
('Enter new CD, <Return> keeps old CD the same, CD > 1.00 ends entrys');
Repeat (* Repeat Until Y > 23 *)
Repeat (* Repeat Until X > 50 *)
If Y > 23 Then X := X + 25; If Y > 23 Then Y := 3;
GotoXY ( X, Y );
Write ( Lift_Coef:2:2 );
GotoXY ( X + 6, Y );
If Foil2 [I] = 0.0 Then Write ( Foil2 [I] : 1:1 ) Else
Write ( Foil2 [I] :1:4 );
I := I + 1; Y := Y + 1; (* Increment Counter *)
Lift_Coef := Lift_Coef + 0.020; (* Increase CL for next Display *)
Until X > 50;
Until Y > 23; (* Now X > 50 and Y > 23, Out *)
I := 1; X := 1; Y := 3; (* Reset Counters *)
(* Following Display is for Edit of CD vrs CL, Group 2 *)
Repeat (* Until CD > 1 *)
If Y > 23 Then X := X + 25;
If Y > 23 Then Y := 3; (* Double reverse keeps X & Y in line *)
GotoXY ( X + 14, Y );
Profile_Drag_Coef := Foil2 [I];
Readln ( Profile_Drag_Coef );
If Profile_Drag_Coef < 0.99999999 Then
If Profile_Drag_Coef <> Foil2 [I] Then
Foil2 [I] := Profile_Drag_Coef;
(* Makes sure nothing unseemly gets into the array *)
Y := Y + 1; I := I + 1; (* Increment Counters *)
If I > 63 Then Profile_Drag_Coef := 1.01;
Until Profile_Drag_Coef > 0.9999;
(* Displays third Foil Information, F Name, R3, Foil3, CD *)
I := 1; X := 1; Y := 3; Lift_Coef := 0.000; (* Reset Counters *)
ClrScr; (* Clears Screen *) LowVideo;
Write ('Reynolds Number is '); NormVideo;
Write ( Reynolds3 :7:0 ); (* Reynolds from file *) LowVideo;
Write (' ');
Write ('Foil Name is '); NormVideo;
Writeln ( Foil_Name ); (* Name from File *) LowVideo;
Writeln
(' CL CD new CD | CL CD new CD | CL CD new CD ');
GotoXY ( 1, 24 ); NormVideo;
Write
('Enter new CD, <Return> keeps old CD the same, CD > 1.00 ends entrys');
Repeat (* Repeat Until Y > 23 *)
Repeat (* Repeat Until X > 50 *)
If Y > 23 Then X := X + 25; If Y > 23 Then Y := 3;
GotoXY ( X, Y );
Write ( Lift_Coef:2:2 );
GotoXY ( X + 6, Y );
If Foil3 [I] = 0.0 Then Write ( Foil3 [I] : 1:1 ) Else
Write ( Foil3 [I] :1:4 );
Lift_Coef := Lift_Coef + 0.020; (* Increase CL for next Display *)
Y := Y + 1; I := I + 1; (* Increment Counter *)
Until X > 50;
Until Y > 23; (* Now X > 50 and Y > 23, Out *)
I := 1; X := 1; Y := 3; (* Reset Counters *)
(* Following Display is for Edit of CD vrs CL, Group 3 *)
Repeat (* Until CD > 1 *)
If Y > 23 Then X := X + 25;
If Y > 23 Then Y := 3; (* Double reverse keeps X & Y in line *)
GotoXY ( X + 14, Y );
Profile_Drag_Coef := Foil3 [I];
Readln ( Profile_Drag_Coef );
If Profile_Drag_Coef < 0.99999999 Then
If Profile_Drag_Coef <> Foil3 [I] Then
Foil3 [I] := Profile_Drag_Coef;
(* Makes sure nothing unseemly gets into the array *)
Y := Y + 1; I := I + 1; (* Increment Counters *)
If I > 63 Then Profile_Drag_Coef := 1.01;
Until Profile_Drag_Coef > 0.9999;
(* Displays 4th & last Foil Information, F Name, R4, Foil4, CD *)
I := 1; X := 1; Y := 3; Lift_Coef := 0.000; (* Reset Counters *)
ClrScr; (* Clears Screen *) LowVideo;
Write ('Reynolds Number is '); NormVideo;
Write ( Reynolds4 :7:0 ); (* Reynolds from file *) LowVideo;
Write (' ');
Write ('Foil Name is '); NormVideo;
Writeln ( Foil_Name ); (* Name from File *) LowVideo;
Writeln
(' CL CD new CD | CL CD new CD | CL CD new CD ');
GotoXY ( 1, 24 ); NormVideo;
Write
('Enter new CD, <Return> keeps old CD the same, CD > 1.00 ends entrys');
Repeat (* Repeat Until Y > 23 *)
Repeat (* Repeat Until X > 50 *)
If Y > 23 Then X := X + 25; If Y > 23 Then Y := 3;
GotoXY ( X, Y );
Write ( Lift_Coef:2:2 );
GotoXY ( X + 6, Y );
If Foil4 [I] = 0.0 Then Write ( Foil4 [I] : 1:1 ) Else
Write ( Foil4 [I] :1:4 );
Lift_Coef := Lift_Coef + 0.020; (* Increase CL for next Display *)
I := I + 1; Y := Y + 1; (* Increment Counter *)
Until X > 50;
Until Y > 23; (* Now X > 50 and Y > 23, Out *)
I := 1; X := 1; Y := 3; (* Reset Counters *)
(* Following Display is for Edit of CD vrs CL, Group 4 *)
Repeat (* Until CD > 1 *)
If Y > 23 Then X := X + 25;
If Y > 23 Then Y := 3; (* Double reverse keeps X & Y in line *)
GotoXY ( X + 14, Y );
Profile_Drag_Coef := Foil4 [I];
Readln ( Profile_Drag_Coef );
If Profile_Drag_Coef < 0.99999999 Then
If Profile_Drag_Coef <> Foil4 [I] Then
Foil4 [I] := Profile_Drag_Coef;
(* Makes sure nothing unseemly gets into the array *)
Y := Y + 1; I := I + 1; (* Increment Counters *)
If I > 63 Then Profile_Drag_Coef := 1.01;
Until Profile_Drag_Coef > 0.9999;
GotoXY ( 1, 24 ); LowVideo;
Write
(' > SAVING this Air Foil data on the disk < ');
If File_Pointer in [ 2 .. Number_of_Records ] Then Begin
(* Allows the saving of any airfoil except #1, E 387 *)
Assign ( Foil_File, 'AIRFOIL.DAT'); ReSet ( Foil_File );
Seek ( Foil_File, File_Pointer - 1 );
With Foil_Record Do Begin
Name := Foil_Name;
R_Number1 := Reynolds1;
R_Number2 := Reynolds2;
R_Number3 := Reynolds3;
R_Number4 := Reynolds4;
For I := 1 to 64 Do Begin
Drag_Array1 [I] := Foil1 [I]; Drag_Array2 [I] := Foil2 [I];
Drag_Array3 [I] := Foil3 [I]; Drag_Array4 [I] := Foil4 [I];
End; (* of For I to 64 *)
Rec_Number := File_Pointer; (* ?? I don't know, but it seems to help *)
End; (* of With Foil_Record Do *)
Seek ( Foil_File, File_Pointer - 1 ); Write ( Foil_File, Foil_Record );
Close ( Foil_File );
End; (* of If File_Pointer in Number_of_Records *)
End; (* of Procedure Edit_Foil *)