1 /****************************************************************** 2 * FUNCTION operat - determine operating parameters, * 3 * do Schmidt analysis * 4 * FILENAME operat.c * 5 * PROGRAMMER I.Urieli (FORTRAN) * 6 * E. Malroy (C Translation) * 7 * DATE: 03/01/93 (FORTRAN), 02/26/96 (C Translation) * 8 * LAST MODIFICATION: 12/24/97 by I.Urieli * 9 * INCLUDE: , , "define.h" * 10 * GLOBAL VARIABLES: * 11 * FILE *infile - pointer to the input data file * 12 * FILE *outfile - pointer to the output data file * 13 * FILE *printfile - pointer to the print output file * 14 * pmean: nominal mean operating pressure (Pa) * 15 * omega: operating frequency (rads/sec) * 16 * freq: operating frequency (herz) * 17 * tk: cold sink temperature (K) * 18 * th: hot source temperature (K) * 19 * tr: effective regenerator temperature (K) * 20 * SYMBOLIC CONSTANTS: PI 3.14159265359 * 21 * PROTOTYPE: void operat(void); * 22 * PRE: infile, outfile, printfile * 23 * POST: pmean, tk, th, freq, tr, omega have been specified * 24 * Schmidt analysis done, mgas determined. * 25 ******************************************************************/ 26 #include 27 #include 28 #include "define.h" 29 30 void schmidt(void); /* Schmidt analysis, determine mgas */ 31 32 void operat(void) 33 { 34 35 double dqwr; /* regenerator wall heat leakage(Watts) */ 36 37 printf("\n enter mean pres(Pa), tk, th(K), freq(Hz)\n"); 38 fscanf(infile, "%lf %lf %lf %lf", &pmean,&tk,&th,&freq); 39 fprintf(outfile," %e %.1f %.1f %.1f\n", pmean,tk,th,freq); 40 fprintf(printfile," mean pres(Pa), tk, th(K), freq(Hz):\n"); 41 fprintf(printfile," %e %.1f %.1f %.1f\n", pmean,tk,th,freq); 42 tr = (th - tk)/log(th/tk); 43 printf("effective regenerator temperature (K): %.1f\n",tr); 44 fprintf(printfile,"effective regenerator temperature (K): %.1f\n",tr); 45 omega = 2.0*PI*freq; 46 47 schmidt(); 48 49 /* ***regenerator wall heat loss */ 50 dqwr = cqwr*(th - tk); 51 printf(" regen. wall heat leakage(Watts) %.1f\n", dqwr); 52 fprintf(printfile," regen. wall heat leakage(Watts) %.1f\n", dqwr); 53 } 54 55 /****************************************************************** 56 * FUNCTION schmidt - evaluate total mas of working gas (mgas), * 57 * Schmidt analysis of the system * 58 * FILENAME operat.c * 59 * PROGRAMMER I.Urieli (FORTRAN) * 60 * E. Malroy (C Translation) * 61 * DATE: 03/01/93 (FORTRAN), 02/26/96 (C Translation) * 62 * LAST MODIFICATION: 12/24/97 by I.Urieli * 63 * INCLUDE: , , "define.h" * 64 * GLOBAL VARIABLES: * 65 * FILE *printfile - pointer to the print output file * 66 * vclc: compression clearance volume (cu.m) * 67 * vcle: expansion clearance volume (cu.m) * 68 * vswc: compression swept volume (cu.m) * 69 * vswe: expansion swept volume (cu.m) * 70 * alpha: expansion space phase angle advance (radians) * 71 * vk: cooler void volume (cu.m) * 72 * vr: regenerator void volume (cu.m) * 73 * vh: heater void volume (cu.m) * 74 * rgas: gas constant (Joules/kg.K) * 75 * pmean: nominal mean operating pressure (Pa) * 76 * freq: operating frequency (herz) * 77 * tk: cold sink operating temperatures * 78 * th: hot sink operating temperatures * 79 * tr: effective regenerator temperature (K) * 80 * mgas: mass of working gas in the system (kg) * 81 * SYMBOLIC CONSTANTS: PI 3.14159265359 * 82 * PROTOTYPE: void schmidt(void); * 83 * PRE: vswc, vswe, vclc, vcle, alpha (engine volumes, phase) * 84 * vk, vr, vh (heat exchanger void volumes) * 85 * rgas (working gas constant) * 86 * tk, tr, th, pmean, freq (operational parameters) * 87 * POST: mgas has been determined * 88 * Schmidt analysis results have been output * 89 ******************************************************************/ 90 91 void schmidt(void) 92 { 93 double c, s, b, sqrtb, bf, beta, /* Schmidt analysis parameters */ 94 w, wc, we, /* work done (Joules/cycle) total, comp, exp */ 95 power, eff; /* power (Watts), thermal efficiency */ 96 97 c = sqrt(pow((vswe/th),2.0) + pow((vswc/tk),2.0) 98 + 2.0*(vswe/th)*(vswc/tk)*cos(alpha))/2.0; 99 s = (vswc/2.0 + vclc + vk)/tk + vr/tr 100 + (vswe/2.0 + vcle + vh)/th; 101 b = c/s; 102 sqrtb = sqrt(1.0 - b*b); 103 bf = (1.0 - 1.0/sqrtb); 104 beta = atan(vswe*sin(alpha)/th/ 105 (vswe*cos(alpha)/th + vswc/tk)); 106 107 /***total mass of working gas in machine */ 108 mgas = pmean*s*sqrtb/rgas; 109 printf(" Total mass of gas (gm) %.3f",mgas*1.0e3); 110 fprintf(printfile," Total mass of gas (gm) %.3f",mgas*1.0e3); 111 112 /***work output */ 113 wc = PI*vswc*mgas*rgas*sin(beta)*bf/c; 114 we = PI*vswe*mgas*rgas*sin(beta - alpha)*bf/c; 115 w = wc + we; 116 power = w*freq; 117 eff = w/we; 118 119 printf("\n Schmidt analysis\n"); 120 printf(" Work(joules) %.1f, Power(watts) %.1f\n", w,power); 121 printf(" Qexp(joules) %.1f, Qcom(joules) %.1f\n", we,wc); 122 printf(" indicated efficiency %.3f\n", eff); 123 fprintf(printfile,"\nSchmidt analysis\n"); 124 fprintf(printfile," Work(joules) %.1f, Power(watts) %.1f\n", w,power); 125 fprintf(printfile," Qexp(joules) %.1f, Qcom(joules) %.1f\n", we,wc); 126 fprintf(printfile," indicated efficiency %.3f\n", eff); 127 } condor{t.gentry}18: