# awk script # # the begin command is executed BEFORE anything else is done BEGIN {FS=" "; "date" | getline date; print date {freqout=0.} } # {N=N+1} {if(N==1) {printf "Input file [ %12s ]\n",FILENAME ; print "#----------------------Input---------------------#"}} {if($1=="OD") {OD=$2;print$0}} {if($1=="ID") {ID=$2;print$0}} {if($1=="Span") {span=$2;print$0}} {if($1=="Length") {lgth=$2;print$0}} {if($1=="Added_Weight") {addweight=$2;print$0}} {if($1=="BrgSpringRate") {brgk=$2;print$0}} {if($1=="DampingRatio") {brgdamp=$2;print$0}} {if($1=="Elastic_Modulus") {emodul=$2;print$0}} {if($1=="Density") {rodens=$2;print$0}} {if($1=="Midunbalance") {midunbal=$2;print$0}} {if($1=="Shear_Modulus") {shmodul=$2;print$0}} {if($1=="Yield_Strength") {yieldtress=$2;print$0}} {if($1=="Endurance_Limit") {endlimit=$2*1000.;print$0}} # # END { {area=.7854*(OD^2-ID^2)} {mominertia=.04909*(OD^4-ID^4)} {roweight=rodens*area*lgth} {totweight=roweight+addweight} {brgdefl=totweight/2/brgk} {rotordefl=5*totweight*(span^3)/384/emodul/mominertia} {rotork=totweight/rotordefl} {totdefl=brgdefl+rotordefl} {totalk=totweight/totdefl} {pinbendfreq=sqrt(rotork*386.04/totweight)/6.28} {bendfreq=sqrt(totalk*386.04/totweight)/6.28} {bouncefreq=sqrt(2*brgk*386.04/totweight)/6.28} # {scr99=midunbal*4*3.1416*3.1416/16/386.04} {scr101=scr99*totdefl*bendfreq*bendfreq/totweight} {scr102=scr99*bendfreq*bendfreq} # # response plot..... x[] is the varying frequency *ratio* {x[1]=0.;Funb[1]=scr102*x[1]*x[1];scratch4=(1-x[1]^2)^2;scratch5=(2*brgdamp*x[1])^2;scratch6=sqrt(scratch4+scratch5); y[1]=Funb[1]/totalk/scratch6 } # # freqout is the increment in Hz {for(jk=2;jk<=36;jk++) {freqout=freqout+2;x[jk]=freqout/bendfreq;Funb[jk]=scr102*x[jk]*x[jk];scratch4=(1-x[jk]^2)^2;scratch5=(2*brgdamp*x[jk])^2;scratch6=sqrt(scratch4+scratch5);y[jk]=Funb[jk]/totalk/scratch6}} # -------------------------- #{for(jk=11;jk<=14;jk++) {x[jk]=x[jk-1]+.05;Funb[jk]=scr102*x[jk]*x[jk];scratch4=(1-x[jk]^2)^2;scratch5=(2*brgdamp*x[jk])^2; #scratch6=sqrt(scratch4+scratch5);y[jk]=Funb[jk]/totalk/scratch6}} #{for(jk=15;jk<=23;jk++) {x[jk]=x[jk-1]+.10;Funb[jk]=scr102*x[jk]*x[jk];scratch4=(1-x[jk]^2)^2;scratch5=(2*brgdamp*x[jk])^2; #scratch6=sqrt(scratch4+scratch5);y[jk]=Funb[jk]/totalk/scratch6}} # -------------------------- #plotting routine (max stars = 20): {for(jk=1;jk<=36;jk++) {if(y[jk]>ymax) {ymax=y[jk]}}} {for(jk=1;jk<=36;jk++) {yratio[jk]=int(20*y[jk]/ymax)}} {for(jk=1;jk<=36;jk++) {km=0;scratch=""; while(km<=yratio[jk]) {scratch=scratch "#";km=km+1}; ystars[jk]=scratch}} # {print "#----------------------Output--------------------#"} {print"#"} {printf("%-30s %12.0f\n","X-section Area",area)} {printf("%-30s %12.0f\n","Mom. of Inertia",mominertia)} {printf("%-30s %12.0f\n","Rotor Weight",roweight)} {printf("%-30s %12.0f\n","Total Weight",totweight)} {printf("%-30s %12.0f\n","Rotor Spring Rate",rotork)} {printf("%-30s %12.0f\n","Total Spring Rate",totalk)} {printf("%-30s %12.4f\n","Bearing 1G Deflection",brgdefl)} {printf("%-30s %12.4f\n","Rotor 1G Deflection",rotordefl)} {printf("%-30s %12.4f\n","Total 1G Deflection",totdefl)} {print" "} {print"Major Frequencies (Hz): "} {printf("%-30s %12.1f\n","Bouncing Freq",bouncefreq)} {printf("%-30s %12.1f\n","Pinned-Bending Freq",pinbendfreq)} {printf("%-30s %12.1f\n","Actual-Bending Freq",bendfreq)} {print"#"} {print"Unbalance Response Plot: "} {printf("%-8s %-8s %-8s %-12s %-8s\n","RPM","Hz","FR","Ampl","UnblFrc")} {for(jk=1;jk<=36;jk++) {printf("%-8.1f %-8.2f %-8.2f %-12.5f %-8.2f %s\n",x[jk]*bendfreq*60,x[jk]*bendfreq,x[jk],y[jk],Funb[jk],ystars[jk])}} # {print" "} {print "#.......................End of File..............#"} }