Thread: 13 Horsepower
View Single Post
  #9  
Old July 31st 08, 12:25 AM posted to rec.aviation.homebuilt
cavelamb himself[_4_]
external usenet poster
 
Posts: 474
Default 13 Horsepower

This was origonally written on a TRS80 (with line numbers and no WHILE)
As it, it should run under Qbasic interpreter, or compiled with QB45.

Anyone who wants to play with it but doesn't have the software to run
it can email me and I'll send a compiled executible file.



FF = 0

TT = NOT FF

doRun = TT



KK$ = "LVSCQ?"



'initial values:

L = 555

W = L

A = 55

V = A * 1.4666

CL = 1.2

S = 125



CLS

PRINT "Finite Wing Theory: ---== R. Lamb 1983 ==---"; : PRINT

WHILE doRun = TT

PRINT "solve for Lift Velocity Surface Clift Quit [LVSCQ?] ";

Z$ = ""

WHILE Z$ = ""

Z$ = UCASE$(INKEY$):

IF Z$ = CHR$(13) THEN Z$ = ""

IF Z$ = CHR$(27) THEN Z$ = "Q"

IF INSTR(KK$, Z$) = 0 THEN Z$ = ""

WEND



PRINT

SELECT CASE UCASE$(Z$)

CASE "L"

PRINT " Calculate LIFT.............."

GOSUB doLift

CASE "V"

PRINT " Calculate Velocity.........."

GOSUB doVel

CASE "S"

PRINT " Calculate Wing Area........."

GOSUB doSurf

CASE "C"

PRINT " Calculate Coef. of Lift....."

GOSUB doCL

CASE "?"

'GOSUB doDump

PRINT

PRINT " Variable dump:---------------------------"

PRINT " Lift / Weight "; L; " lbs"

PRINT " Airspeed "; A; " mph = "; V; " fps"

PRINT " Coefec of Lift "; CL

PRINT " Wing Area "; S; " sq ft"

PRINT " -----------------------------------------"

CASE "Q"

doRun = FF

END SELECT



PRINT



WEND

END





doLift:

GOSUB GetSurf

GOSUB GetVel

GOSUB GetCL

L = .001188 * CL * V * V * S

PRINT " Lift = "; L

RETURN



doVel:

GOSUB GetSurf

GOSUB GetCL

GOSUB GetWgt

V = SQR(L / (.001188 * CL * S))

A = V * .681

PRINT " Velocity = ";

PRINT USING "#,###.#"; A;

PRINT " MPH = ";

PRINT USING "#,###.#"; V;

PRINT " FPS"

RETURN



doSurf:

GOSUB GetCL

GOSUB GetWgt

GOSUB GetVel

S = L / (.001188 * CL * V * V)

PRINT " Surface = "; S

RETURN



doCL:

GOSUB GetWgt

GOSUB GetVel

GOSUB GetSurf

CL = L / (.001188 * S * V * V)

PRINT " Coeff. Lift = "; CL

RETURN



GetSurf:

PRINT " Wing Area (sq ft) ["; S; "]";

INPUT ""; X

IF X 0 THEN S = X

RETURN



GetVel:

PRINT " Airspeed (mph) ["; A; "]";

INPUT ""; X

IF X 0 THEN

A = X

V = X * 1.467

END IF

RETURN



GetCL:

PRINT " Coeff. Lift (#.##) ["; CL; "]";

INPUT ""; X

IF X 0 THEN CL = X

RETURN



GetWgt:

PRINT " Gross Weight (lbs) ["; L; "}";

INPUT ""; X

IF X 0 THEN

W = X ' steady state W = L

L = X

END IF

RETURN