home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
cpm
/
educatin
/
mdlplne2.lbr
/
FOIL22.PQS
/
FOIL22.PAS
Wrap
Pascal/Delphi Source File
|
1986-08-09
|
16KB
|
512 lines
PROGRAM Foil22;
{Foil22.pas version 2.2 14 July 1986 Curtis W. Givens, Dayton,Oh. Versions}
{1.0 thru 1.4 not released. Version 1.5 released on CIS-ModelNet 11 Apr 86}
{This program will accept up to 20 sets of user provided airfoil ordinates}
{and output the calculated co-ordiantes to either}
{the screen or the printer. It will allow the user to change the chord without}
{re-entering the ordinates for the current airfoil. Writen with Turbo 2.0 and}
{tested under CPM 2.2. Further developments anticipated as time permitts.}
{The intent of this release is to allow the program to save the input data}
{to disk in order to eliminate the necessity of entering the ordinates each time}
{you wish to do calculations on a given airfoil. In the author's experience}
{this is the area with the greatest potential for error. A procedure has also}
{been added to take into account those airfoils that have their leading edge,}
{LE,and/or trailing edge,TE, specified as some percentage of the chord.}
{Suggestion, problems etc should be addressed}
{to the author on CIS ppn 75136,2356,or GEnie mail:Balsadust}
VAR
Chord: Real;
O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12, O13, O14,
O15, O16, O17, O18, O19, O20:Real;{offset from leading edge}
U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14,
U15, U16, U17, U18, U19, U20:Real;{points above the chord line}
L1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11, L12, L13, L14,
L15, L16, L17, L18, L19, L20:Real;{points below the Chord line}
LE:Real;{value for leading edge radius calculations}
TE:Real;{value for trailing edge radius calculations}
AirfoilName:String[8];
LeadingEdge : Boolean;
TrailingEdge : Boolean;
PROCEDURE GetName;
BEGIN
WRITELN('This program will calculate airfoil plotting coordinates from user provide ordinate data.');
WRITELN;
WRITELN('Please input the airfoil name - no more than 8 characters');
READLN(AirfoilName);
WRITELN('The airfoil name is ',AirfoilName); {Allows user to check input}
END; {GetName}
PROCEDURE AreEdgesSpecified;
{This procedure properly sets the LeadingEdge and TrailingEdge variables}
{for the procedures that follow.}
VAR
AnswerLE : integer;
AnswerTE : integer;
Begin
WRITELN('Some airfoils have the Leading Edge radius expressed as');
WRITELN('a precentage of the chord. If your airfoil is one of these');
WRITELN('input a 1 otherwise please input a 2.');
READLN(AnswerLE);
IF AnswerLE = 1 THEN LeadingEdge:=True
ELSE LeadingEdge:=False;
WRITELN('Some airfoils have the trailing edge radius expressed as a');
WRITELN('percentage of the chord. If your airfoil has this feature enter');
WRITELN('a 1 otherwise please enter a 2.');
READLN(AnswerTE);
IF AnswerTE = 1 THEN TrailingEdge:=True
ELSE TrailingEdge:=False;
END;
PROCEDURE GetChord;
BEGIN
WRITELN('Please input the chord - decimal fractions only');
READLN(Chord);
WRITELN('The chord is',Chord:7:3); {Allow user to check input}
END; {GetChord}
PROCEDURE GetOrdinates;
BEGIN
WRITELN('Please input the data from the airfoil ordinate table');
WRITELN('as follows: Offset Upper Lower. Convert percentages to decimal');
WRITELN('fractions i.e., 3.5% should be entered as .035. Example - the first');
WRITELN('set of entries for a Clark - Y would be 0 .035 .035 <cr>.');
WRITELN('Note do not insert commas between entries');
WRITELN('Input 0.0 where the ordinate table lacks entries.Program will');
WRITELN('allow up to 20 sets of data.');
WRITELN('Input first set.');
READLN(O1, U1, L1);
WRITELN('Input second set');
READLN(O2, U2, L2);
WRITELN('Input third set');
READLN(O3, U3, L3);
WRITELN('Input 4th set');
READLN(O4, U4, L4);
WRITELN('Input 5th set');
READLN(O5, U5, L5);
WRITELN('Input 6th set');
READLN(O6, U6, L6);
WRITELN('Input 7th set');
READLN(O7, U7, L7);
WRITELN('Input 8th set');
READLN(O8, U8, L8);
WRITELN('Input 9th set');
READLN(O9, U9, L9);
WRITELN('Input 10th set');
READLN(O10, U10, L10);
WRITELN('Input 11th set');
READLN(O11, U11, L11);
WRITELN('Input 12th set');
READLN(O12, U12, L12);
WRITELN('Input 13th set');
READLN(O13, U13, L13);
WRITELN('Input 14th set');
READLN(O14, U14, L14);
WRITELN('Input 15th set');
READLN(O15, U15, L15);
WRITELN('Input 16th set');
READLN(O16, U16, L16);
WRITELN('Input 17th set');
READLN(O17, U17, L17);
WRITELN('Input 18th set');
READLN(O18, U18, L18);
WRITELN('Input 19th set');
READLN(O19, U19, L19);
WRITELN('Input 20th set');
READLN(O20, U20, L20);
IF LeadingEdge THEN
BEGIN
WRITELN('Input the percentage for LE radius as a decimal fraction');
READLN(LE);
IF TrailingEdge THEN
BEGIN
WRITELN('Input the Trailing Edge percentage as a decimal fraction.');
READLN(TE);
END;
END;
END;{GetOrdinates}
PROCEDURE SaveOrd;
VAR
Answer: Integer;
FileName: String[12];
OrdFile: text;
Disk: Boolean;
BEGIN
WRITELN('Do you want to save these ordinates to a disk file?');
WRITELN('Yes = 1 No = 2');
READLN(Answer);
IF Answer=1 THEN Disk:=True
ELSE Disk:=False;
IF Disk THEN
BEGIN
WRITELN('Please input the name for this disk file.');
WRITELN('In CPM suggested form is "airfoilname.ord"');
READLN(FileName);
ASSIGN(OrdFile,FileName);
REWRITE(OrdFIle);
WRITELN(OrdFile,O1,U1,L1);
WRITELN(OrdFile,O2,U2,L2);
WRITELN(OrdFile,O3,U3,L3);
WRITELN(OrdFile,O4,U4,L4);
WRITELN(OrdFile,O5,U5,L4);
WRITELN(OrdFile,O6,U6,L6);
WRITELN(OrdFile,O7,U7,L7);
WRITELN(OrdFile,O8,U8,L8);
WRITELN(OrdFile,O9,U9,L9);
WRITELN(OrdFile,O10,U10,L10);
WRITELN(OrdFile,O11,U11,L11);
WRITELN(OrdFile,O12,U12,L12);
WRITELN(OrdFile,O13,U13,L13);
WRITELN(OrdFile,O14,U14,L14);
WRITELN(OrdFile,O15,U15,L15);
WRITELN(OrdFile,O16,U16,L16);
WRITELN(OrdFile,O17,U17,L17);
WRITELN(OrdFile,O18,U18,L18);
WRITELN(OrdFile,O19,U19,L19);
WRITELN(OrdFile,O20,U20,L20);
IF LeadingEdge THEN
WRITELN(OrdFile,LE);
IF TrailingEdge THEN
WRITELN(OrdFile,TE);
CLOSE(OrdFile);
END;
END;
PROCEDURE OutputResults;
BEGIN
CLRSCR;
WRITELN('Plotting dimensions for ',AirfoilName,' with chord = ',Chord:7:3);
WRITELN;
WRITELN('STATION OFFSET UPPER LOWER');
WRITELN('============================================');
WRITELN;
WRITE(O1*100:6:2,' ');
WRITE(O1*Chord:7:3,' ');
WRITE(U1*Chord:7:3,' ');
WRITELN(L1*Chord:7:3);
WRITE(O2*100:6:2,' ');
WRITE(O2*Chord:7:3,' ');
WRITE(U2*Chord:7:3,' ');
WRITELN(L2*Chord:7:3);
WRITE(O3*100:6:2,' ');
WRITE(O3*Chord:7:3,' ');
WRITE(U3*Chord:7:3,' ');
WRITELN(L3*Chord:7:3);
WRITE(O4*100:6:2,' ');
WRITE(O4*Chord:7:3,' ');
WRITE(U4*Chord:7:3,' ');
WRITELN(L4*Chord:7:3);
WRITE(O5*100:6:2,' ');
WRITE(O5*Chord:7:3,' ');
WRITE(U5*Chord:7:3,' ');
WRITELN(L5*Chord:7:3);
WRITE(O6*100:6:2,' ');
WRITE(O6*Chord:7:3,' ');
WRITE(U6*Chord:7:3,' ');
WRITELN(L6*Chord:7:3);
WRITE(O7*100:6:2,' ');
WRITE(O7*Chord:7:3,' ');
WRITE(U7*Chord:7:3,' ');
WRITELN(L7*Chord:7:3);
WRITE(O8*100:6:2,' ');
WRITE(O8*Chord:7:3,' ');
WRITE(U8*Chord:7:3,' ');
WRITELN(L8*Chord:7:3);
WRITE(O9*100:6:2,' ');
WRITE(O9*Chord:7:3,' ');
WRITE(U9*Chord:7:3,' ');
WRITELN(L9*Chord:7:3);
WRITE(O10*100:6:2,' ');
WRITE(O10*Chord:7:3,' ');
WRITE(U10*Chord:7:3,' ');
WRITELN(L10*Chord:7:3);
WRITE(O11*100:6:2,' ');
WRITE(O11*Chord:7:3,' ');
WRITE(U11*Chord:7:3,' ');
WRITELN(L11*Chord:7:3);
WRITE(O12*100:6:2,' ');
WRITE(O12*Chord:7:3,' ');
WRITE(U12*Chord:7:3,' ');
WRITELN(L12*Chord:7:3);
WRITE(O13*100:6:2,' ');
WRITE(O13*Chord:7:3,' ');
WRITE(U13*Chord:7:3,' ');
WRITELN(L13*Chord:7:3);
WRITE(O14*100:6:2,' ');
WRITE(O14*Chord:7:3,' ');
WRITE(U14*Chord:7:3,' ');
WRITELN(L14*Chord:7:3);
WRITE(O15*100:6:2,' ');
WRITE(O15*Chord:7:3,' ');
WRITE(U15*Chord:7:3,' ');
WRITELN(L15*Chord:7:3);
WRITE(O16*100:6:2,' ');
WRITE(O16*Chord:7:3,' ');
WRITE(U16*Chord:7:3,' ');
WRITELN(L16*Chord:7:3);
WRITE(O17*100:6:2,' ');
WRITE(O17*Chord:7:3,' ');
WRITE(U17*Chord:7:3,' ');
WRITELN(L17*Chord:7:3);
WRITE(O18*100:6:2,' ');
WRITE(O18*Chord:7:3,' ');
WRITE(U18*Chord:7:3,' ');
WRITELN(L18*Chord:7:3);
WRITE(O19*100:6:2,' ');
WRITE(O19*Chord:7:3,' ');
WRITE(U19*Chord:7:3,' ');
WRITELN(L19*Chord:7:3);
WRITE(O20*100:6:2,' ');
WRITE(O20*Chord:7:3,' ');
WRITE(U20*Chord:7:3,' ');
WRITELN(L20*Chord:7:3);
IF LeadingEdge THEN
WRITELN('Leading Edge Radius is', LE*Chord:7:3);
IF TrailingEdge THEN
WRITELN('Trailing Edge Radius is', TE*Chord:7:3);
END;{procedure OutPutResults}
PROCEDURE PrintCopy;
VAR
Answer : Integer;
HardCopy: Boolean;
BEGIN
WRITELN('Do you want a hard copy? yes = 1, no = 2');
READLN(Answer);
IF Answer = 1 THEN HardCopy:=True
ELSE HardCopy:=False;
IF HardCopy THEN
BEGIN
WRITELN(LST,'Plotting dimensions for ',AirfoilName,' with chord = ',Chord:7:3);
WRITELN(LST);
WRITELN(LST,'STATION OFFSET UPPER LOWER');
WRITELN(LST,'================================================');
WRITE(LST,O1*100:6:2,' ');
WRITE(LST,O1*Chord:7:3,' ');
WRITE(LST,U1*Chord:7:3,' ');
WRITELN(LST,L1*Chord:7:3);
WRITE(LST,O2*100:6:2,' ');
WRITE(LST,O2*Chord:7:3,' ');
WRITE(LST,U2*Chord:7:3,' ');
WRITELN(LST,L2*Chord:7:3);
WRITE(LST,O3*100:6:2,' ');
WRITE(LST,O3*Chord:7:3,' ');
WRITE(LST,U3*Chord:7:3,' ');
WRITELN(LST,L3*Chord:7:3);
WRITE(LST,O4*100:6:2,' ');
WRITE(LST,O4*Chord:7:3,' ');
WRITE(LST,U4*Chord:7:3,' ');
WRITELN(LST,L4*Chord:7:3);
WRITE(LST,O5*100:6:2,' ');
WRITE(LST,O5*Chord:7:3,' ');
WRITE(LST,U5*Chord:7:3,' ');
WRITELN(LST,L5*Chord:7:3);
WRITE(LST,O6*100:6:2,' ');
WRITE(LST,O6*Chord:7:3,' ');
WRITE(LST,U6*Chord:7:3,' ');
WRITELN(LST,L6*Chord:7:3);
WRITE(LST,O7*100:6:2,' ');
WRITE(LST,O7*Chord:7:3,' ');
WRITE(LST,U7*Chord:7:3,' ');
WRITELN(LST,L7*Chord:7:3);
WRITE(LST,O8*100:6:2,' ');
WRITE(LST,O8*Chord:7:3,' ');
WRITE(LST,U8*Chord:7:3,' ');
WRITELN(LST,L8*Chord:7:3);
WRITE(LST,O9*100:6:2,' ');
WRITE(LST,O9*Chord:7:3,' ');
WRITE(LST,U9*Chord:7:3,' ');
WRITELN(LST,L9*Chord:7:3);
WRITE(LST,O10*100:6:2,' ');
WRITE(LST,O10*Chord:7:3,' ');
WRITE(LST,U10*Chord:7:3,' ');
WRITELN(LST,L10*Chord:7:3);
WRITE(LST,O11*100:6:2,' ');
WRITE(LST,O11*Chord:7:3,' ');
WRITE(LST,U11*Chord:7:3,' ');
WRITELN(LST,L11*Chord:7:3);
WRITE(LST,O12*100:6:2,' ');
WRITE(LST,O12*Chord:7:3,' ');
WRITE(LST,U12*Chord:7:3,' ');
WRITELN(LST,L12*Chord:7:3);
WRITE(LST,O13*100:6:2,' ');
WRITE(LST,O13*Chord:7:3,' ');
WRITE(LST,U13*Chord:7:3,' ');
WRITELN(LST,L13*Chord:7:3);
WRITE(LST,O14*100:6:2,' ');
WRITE(LST,O14*Chord:7:3,' ');
WRITE(LST,U14*Chord:7:3,' ');
WRITELN(LST,L14*Chord:7:3);
WRITE(LST,O15*100:6:2,' ');
WRITE(LST,O15*Chord:7:3,' ');
WRITE(LST,U15*Chord:7:3,' ');
WRITELN(LST,L15*Chord:7:3);
WRITE(LST,O16*100:6:2,' ');
WRITE(LST,O16*Chord:7:3,' ');
WRITE(LST,U16*Chord:7:3,' ');
WRITELN(LST,L16*Chord:7:3);
WRITE(LST,O17*100:6:2,' ');
WRITE(LST,O17*Chord:7:3,' ');
WRITE(LST,U17*Chord:7:3,' ');
WRITELN(LST,L17*Chord:7:3);
WRITE(LST,O18*100:6:2,' ');
WRITE(LST,O18*Chord:7:3,' ');
WRITE(LST,U18*Chord:7:3,' ');
WRITELN(LST,L18*Chord:7:3);
WRITE(LST,O19*100:6:2,' ');
WRITE(LST,O19*Chord:7:3,' ');
WRITE(LST,U19*Chord:7:3,' ');
WRITELN(LST,L19*Chord:7:3);
WRITE(LST,O20*100:6:2,' ');
WRITE(LST,O20*Chord:7:3,' ');
WRITE(LST,U20*Chord:7:3,' ');
WRITELN(LST,L20*Chord:7:3);
WRITELN;
IF LeadingEdge THEN
WRITELN(LST,'Leading Edge Radius is', LE*Chord:7:3);
WRITELN;
IF TrailingEdge THEN
WRITELN(LST,'Trailing Edge Raius is', TE*Chord:7:3);
WRITELN;
END;
END;
PROCEDURE ChangeChord;
VAR
Answer : Integer;
NewChord: Boolean;
BEGIN
WRITELN('Do you wish to do the same airfoil with a different');
WRITELN('chord? yes = 1, no = 2');
READLN(Answer);
IF answer = 1 THEN NewChord:=True
ELSE NewChord:=False;
IF NewChord THEN
BEGIN
WRITELN('Input new chord');
READLN(Chord);
OutputResults;
PrintCopy;
ChangeChord;
END;
END;
PROCEDURE GetDisk;
VAR
FileName : String[14];
InFile : text;
BEGIN
WRITELN('Please input the name of the file you wish to have read.');
READLN(FileName);
ASSIGN(InFile,FileName);
RESET(InFile);
READLN(InFile,O1, U1, L1);
READLN(InFile,O2, U2, L2);
READLN(InFile,O3, U3, L3);
READLN(InFile,O4, U4, L4);
READLN(InFile,O5, U5, L5);
READLN(InFile,O6, U6, L6);
READLN(InFile,O7, U7, L7);
READLN(InFile,O8, U8, L8);
READLN(InFile,O9, U9, L9);
READLN(InFile,O10, U10, L10);
READLN(InFile,O11, U11, L11);
READLN(InFile,O12, U12, L12);
READLN(InFile,O13, U13, L13);
READLN(InFile,O14, U14, L14);
READLN(InFile,O15, U15, L15);
READLN(InFile,O16, U16, L16);
READLN(InFile,O17, U17, L17);
READLN(InFile,O18, U18, L18);
READLN(InFile,O19, U19, L19);
READLN(InFile,O20, U20, L20);
IF LeadingEdge THEN
BEGIN
READLN(InFile,LE);
IF TrailingEdge THEN
BEGIN
READLN(InFile,TE);
CLOSE(InFile);
END;
END;
END;{GetDisk}
PROCEDURE A;
BEGIN
GetOrdinates;
OutPutResults;
SaveOrd;
PrintCopy;
ChangeChord;
END;
PROCEDURE B;
BEGIN
GetDisk;
OutPutResults;
PrintCopy;
ChangeChord;
END;
PROCEDURE InputSource;
VAR
Answer: Integer;
Choice: Boolean;
BEGIN
WRITELN('Will the data for this run be entered from the keyboard = 1');
WRITELN('or from a disk file = 2 ?');
READLN(Answer);
IF Answer = 1 THEN Choice:=True
ELSE Choice:=False;
IF Choice THEN A
ELSE B
END;{InputSource}
PROCEDURE DiffRun;
VAR
Answer : Integer;
NewRun: Boolean;
BEGIN
WRITELN('Do you want to do another run with a different');
WRITELN('airfoil? yes = 1, no = 2');
READLN(Answer);
IF Answer = 1 THEN NewRun:=True
ELSE NewRun:=False;
IF NewRun THEN
BEGIN
GetName;
AreEdgesSpecified;
GetChord;
InputSource;
DiffRun;
END;
END;
BEGIN
GetName;
AreEdgesSpecified;
GetChord;
InputSource;
DiffRun;
END.