/*
EngineSim - Design and Wind Tunnel Mode
Program to perform turbomachinery design and analysis
a) dry turbojet
b) afterburning turbojet
c) turbofan with separate nozzle
d) ramjet
Version 1.7b - 18 Oct 12
Written by Tom Benson
NASA Glenn Research Center
> NOTICE
>This software is in the Public Domain. It may be freely copied and used in
>non-commercial products, assuming proper credit to the author is given. IT
>MAY NOT BE RESOLD. If you want to use the software for commercial
>products, contact the author.
>No copyright is claimed in the United States under Title 17, U. S. Code.
>This software is provided "as is" without any warranty of any kind, either
>express, implied, or statutory, including, but not limited to, any warranty
>that the software will conform to specifications, any implied warranties of
>merchantability, fitness for a particular purpose, and freedom from
>infringement, and any warranty that the documentation will conform to the
>program, or any warranty that the software will be error free.
>In no event shall NASA be liable for any damages, including, but not
>limited to direct, indirect, special or consequential damages, arising out
>of, resulting from, or in any way connected with this software, whether or
>not based on warranty, contract, tort or otherwise, whether or not injury
>was sustained by persons or property or otherwise, and whether or not loss
>was sustained from, or arose out of the results of, or use of, the software
>or services provided hereunder.
New Test -
* size for the portal
* re-size graphics
* re-size the .gifs
* change outputs
* add pexit, pfexit and M2 to output
* update EngineSimU
* update application
* fix translation for viewer
* correct gross thrust calculation
* change view box for title
add CPR to output
fix bug in turbofan weight calculation
Old Test -
clean up
TJB 5 Feb 13
*/
import java.awt.*;
import java.lang.Math ;
public class Turbo extends java.applet.Applet {
final double convdr = 3.14515926/180.;
int abflag,entype,lunits,inflag,varflag,pt2flag,wtflag ;
int abkeep,pltkeep,move ;
int numeng,gamopt,arsched,plttyp,showcom ;
int athsched,aexsched,fueltype,inptype,siztype ;
// Flow variables
static double g0d,g0,rgas,gama,cpair ;
static double tt4,tt4d,tt7,tt7d,t8,p3p2d,p3fp2d,byprat,throtl;
static double fsmach,altd,alt,ts0,ps0,q0,u0d,u0,a0,rho0,tsout,psout;
static double epr,etr,npr,snpr,fnet,fgros,dram,sfc,fa,eair,uexit,ues;
static double fnd,fnlb,fglb,drlb,flflo,fuelrat,fntot,eteng;
static double arth,arthd,arexit,arexitd ;
static double mexit,pexit,pfexit ;
static double arthmn,arthmx,arexmn,arexmx ;
static double a8,a8rat,a8d,afan,a7,m2,isp;
static double acap,a2,a2d,acore,a4,a4p,fhv,fhvd,mfr,diameng ;
static double altmin,altmax,u0min,u0max,thrmin,thrmax,pmax,tmin,tmax;
static double etmin,etmax,cprmin,cprmax,t4min,t4max;
static double a2min,a2max,a8min,a8max,t7min,t7max,diamin,diamax;
static double bypmin,bypmax,fprmin,fprmax;
static double vmn1,vmn2,vmn3,vmn4,vmx1,vmx2,vmx3,vmx4 ;
static double lconv1,lconv2,fconv,pconv,tconv,tref,mconv1,mconv2,econv,econv2 ;
static double aconv,bconv,dconv,flconv ;
// weight and materials
static double weight,wtref,wfref ;
static int mcomp,mfan,mturbin,mburner,minlt,mnozl,mnozr ;
static int ncflag,ncomp,ntflag,nturb,fireflag;
static double dcomp,dfan,dturbin,dburner ;
static double tcomp,tfan,tturbin,tburner ;
static double tinlt,dinlt,tnozl,dnozl,tnozr,dnozr ;
static double lcomp,lburn,lturb,lnoz; // component length
// Station Variables
static double[] trat = new double[20] ;
static double[] tt = new double[20] ;
static double[] prat = new double[20] ;
static double[] pt = new double[20] ;
static double[] eta = new double[20] ;
static double[] gam = new double[20] ;
static double[] cp = new double[20] ;
static double[] s = new double[20] ;
static double[] v = new double[20] ;
/* drawing geometry */
static double xtrans,ytrans,factor,gains,scale ;
static double xtranp,ytranp,factp ;
static double xg[][] = new double[13][45] ;
static double yg[][] = new double[13][45] ;
static int sldloc,sldplt,ncompd;
static int antim,ancol ;
// Percentage variables
static double u0ref,altref,thrref,a2ref,et2ref,fpref,et13ref,bpref ;
static double cpref,et3ref,et4ref,et5ref,t4ref,p4ref,t7ref,et7ref,a8ref;
static double fnref,fuelref,sfcref,airref,epref,etref,faref ;
// save design
int ensav,absav,gamosav,ptfsav,arssav,arthsav,arxsav,flsav ;
static double fhsav,t4sav,t7sav,p3sav,p3fsav,bysav,acsav ;
static double a2sav,a4sav,a4psav,gamsav,et2sav,pr2sav,pr4sav ;
static double et3sav,et4sav,et5sav,et7sav,et13sav,a8sav,a8mxsav ;
static double a8rtsav,u0mxsav,u0sav,altsav ;
static double trsav,artsav,arexsav ;
// save materials info
int wtfsav,minsav,mfnsav,mcmsav,mbrsav,mtrsav,mnlsav,mnrsav,ncsav,ntsav;
static double wtsav, dinsav, tinsav, dfnsav, tfnsav, dcmsav, tcmsav;
static double dbrsav, tbrsav, dtrsav, ttrsav, dnlsav, tnlsav, dnrsav, tnrsav;
// plot variables
int lines,nord,nabs,param,npt,ntikx,ntiky ;
int counter ;
int ordkeep,abskeep ;
static double begx,endx,begy,endy ;
static double[] pltx = new double[26] ;
static double[] plty = new double[26] ;
static String labx,laby,labyu,labxu ;
Solver solve ;
Viewer view ;
CardLayout layin,layout ;
Con con ;
In in ;
Out out ;
Image offscreenImg ;
Graphics offsGg ;
Image[] anabimg = new Image[3] ;
Image[] anfnimg = new Image[3] ;
Image[] antjimg = new Image[3] ;
Image[] anrmimg = new Image[3] ;
Image partimg ;
Image offImg1 ;
Graphics off1Gg ;
public void init() {
int i;
solve = new Solver() ;
for (i = 1; i <= 3; i++ ) {
anabimg[3-i] = getImage(getCodeBase(),
"ab" + i + ".gif") ;
anfnimg[3-i] = getImage(getCodeBase(),
"fn" + i + ".gif") ;
antjimg[3-i] = getImage(getCodeBase(),
"tj" + i + ".gif") ;
anrmimg[3-i] = getImage(getCodeBase(),
"rm" + i + ".gif") ;
}
offscreenImg = createImage(this.size().width,
this.size().height) ;
offsGg = offscreenImg.getGraphics() ;
offImg1 = createImage(this.size().width,
this.size().height) ;
off1Gg = offImg1.getGraphics() ;
setLayout(new GridLayout(2,2,5,5)) ;
solve.setDefaults () ;
view = new Viewer(this) ;
con = new Con(this) ;
in = new In(this) ;
out = new Out(this) ;
add(view) ;
add(con) ;
add(in) ;
add(out) ;
solve.comPute() ;
partimg = getImage(getCodeBase(),"photo.gif");
layout.show(out, "second") ;
out.plot.repaint() ;
view.start() ;
}
public Insets insets() {
return new Insets(10,10,10,10) ;
}
public int filter0(double inumbr) {
// output only to .
float number ;
int intermed ;
intermed = (int) (inumbr) ;
number = (float) (intermed);
return intermed ;
}
public float filter1(double i