Вы находитесь на странице: 1из 7

Manipulate

(*Input Variables*)

Module{t, Vt, Xde, Xdc, Xr, a, S, B, c, P, Ve, Vc, v, We, Wc, Wi, Li, e, Ptot, Pe, Pc},

(*Phase Angle*)
dx = 90;

(*Temperature Ratio*)
Tc
t= ;
Te

(*Swept Volume Ratio*)


Vsc
v= ;
Vse

(*Dead Volume Expansion Ratio*)


Vde
Xde = ;
Vse

(*Dead Volume Compression Ratio*)


Vdc
Xdc = ;
Vse

(*Dead Volume Ratio of Regenerator*)


Vr
Xr = ;
Vse

(*Calculating the change in angle and hypotenuse*)


v Sin[dx]
a = ArcTan ;
t + Cos[dx]
4 t Xr
S = t + 2 t Xde + + v + 2 Xdc;
1+t
B = Sqrtt2 + 2 t v Cos[dx] + v2 ;
B
c= ;
S

(*Engine pressure is calculated


using the following equation when crank angle x=0 deg*)
Pm Sqrt1 - c2 
P[x_] = ;
1 - c Cos[x - a]

(* Each momental volume is calculated with the


following equation starting with x=0 degree crank angle*)
2 Stirling Simulation.nb

Vse
Ve[x_] = 1 - Cos[x] + Vde ;
2

(*Momental compression volume*)


Vsc
Vc[x_] = 1 - Cos[x - dx] + Vde ;
2

(*Total momental volume*)


Vt[x_] = Ve[x] + Vc[x] + Vr;
(*Indicated Expansion Energy*)
Pm * Vse * 3.14 * c * Sin[a]
We = ;
1 + Sqrt1 - c2 
(*Indicated energy in compression space*)
Pm * Vse * 3.14 * c * t * Sin[a]
Wc = - ;
1 + Sqrt1 - c2 
(*Indicated enery per one cycle of this engine (J)*)
Wi = We + Wc;

(*Indicated Pressure*)
Pe = We * n;
Pc = Wc * n;

(*Indicated Power of the engine*)


Wi * n
Ptot = ;
60

(*Thermal Efficiency using Carnot Principle*)


Wi
e= * 100;
We

TextGrid[
{
{Style["Results for 100% Regenerator Efficiency", 18], SpanFromLeft},
{Style["Work of Expansion", 18],
Style["=", 18], Style[We, 18], Style["Joules", 18]},
{Style["Work of Compression", 18], Style["=", 18],
Style[Wc, 18], Style["Joules", 18]},
{Style["Total Work Done", 18, Red], Style["=", 18, Red],
Style[Wi, 18, Red], Style["Joules", 18, Red]},
{Style["Pressure", 18], Style["=", 18], Style[P[x], 18], Style["Pa", 18]},
{Style["Volume", 18], Style["=", 18], Style[Vt[x], 18], Style["m^3", 18]},
{Style["Power", 18, Red],
Style["=", 18, Red], Style[Ptot, 18, Red], Style["W", 18, Red]},
Stirling Simulation.nb 3

{Style["Thermal Efficiency", 18, Red], Style["=", 18, Red],


Style[e, 18, Red], Style["%", 18, Red]}

}, Frame → All]

(*This code below calculates the change in pressure and volume as the
crank rotates from 0 to 90 degrees and displays the PV diagram*)

GraphicsGridShow
ParametricPlot[{Vt[a], P[a]}, {a, 0, 90},
PlotRange → Directive[Red, Thick], Exclusions → None],
Axes → False, Frame → True, PlotRangePadding → Scaled[0.1],
FrameLabel → "Volume (m3 )", "Pressure (Pa)", AspectRatio → 1,
Epilog → Dynamic[{PointSize[0.05], Black, Point[{Vt[x], P[x]}]}],
LabelStyle → 14, ImageSize → 400, FrameLabel → Automatic, GridLines →
{{0.00155, 0.00364}, {}}, GridLinesStyle → Directive[Black, Thick],

(*For Displaying the 3D Graphics*)


ShowGraphics3D
(*Piston 1*)
Ifx >= 0 && x < π || x >= 2 π && x < 3 π, Blue, Gray,
π π
Cylinder0, 0.88 + .25 Sinx + , 1 + .25 Sinx + ,
2 2
π π
0, 1.23 + .25 Sinx + , 1.35 + .25 Sinx + , .4,
2 2
(*Piston 2*)
Ifx ≥ 1.45 && x < 4.9 || x ≥ 7.6 && x < 11.21, Yellow, Gray,
Cylinder[{{0, - 0.88 - .25 Sin[(x)], 1 + .25 Sin[x]},
{0, - 1.23 - .25 Sin[(x)], 1.35 + 0.25 Sin[(x)]}}, .4],

(*Connecting Rod 1*)


π π
Gray, Cylinder0, - .5 Sinx - , .5 Sinx + ,
4 4
π π
0, 0.92 + 0.25 Sinx + , 1.1 + 0.25 Sinx + , .1,
2 2
(*Connecting Rod 2*)
π π
Gray, Cylinder0, - .5 Sinx - , .5 Sinx +
,
4 4
{0, - 0.92 - 0.25 Sin[(x)], 1.1 + 0.25 Sin[(x)]}, .1,

(*Crank Mechanism*)
Opacity[0.8], Gray, Cylinder[{{0.2, 0, 0}, {0.4, 0, 0}}, .65],
Opacity[0.8], Gray, Cylinder[{{- 0.2, 0, 0}, {- 0.4, 0, 0}}, .65],
4 Stirling Simulation.nb

(*Crank Shafts*)
Opacity[0.8], Gray, Cylinder[{{- 0.4, 0, 0}, {- 0.8, 0, 0}}, .2],
Opacity[0.8], Gray, Cylinder[{{0.4, 0, 0}, {0.7, 0, 0}}, .2],

(*Flywheel*)
Opacity[0.8], Gray, Cylinder[{{- 0.8, 0, 0}, {- 1.1, 0, 0}}, 1],
π π
Gray, Cylinder- 0.8, - .8 Sinx - , 0.8 Sinx + ,
4 4
π π
- 1.1, - 0.8 Sinx - , 0.8 Sinx + , .1,
4 4

(*Crank Pin*)
π π
Gray, Cylinder0.4, - .5 Sinx - , .5 Sinx + ,
4 4
π π
- 0.4, - .5 Sinx - , .5 Sinx + , .1,
4 4

(*Piston's Pin 1*)


π π
Cylinder- 0.4, 0.88 + .25 Sinx + , 1.2 + .25 Sinx + ,
2 2
π π
0.4, 1 + .25 Sinx + , 1.1 + .25 Sinx + , .1,
2 2
(*Piston's Pin 2*)
Cylinder[{{- 0.4, - 0.88 - .25 Sin[(x)], 1.2 + .25 Sin[(x)]},
{0.4, - 1 - .25 Sin[(x)], 1.1 + .25 Sin[(x)]}}, .1],

(*Regenerator*)
Opacity[0.8], Blue, Cylinder[{{0, - .5, 2.2}, {0, .5, 2.2}}, .2],

(*Connecting Pipes*)
Opacity[0.2], Red, Tube[BSplineCurve[
{{0, - 1.5, 1.6}, {0, - 2, 2.4}, {0, - 1.6, 2.1}, {0, - .5, 2.2}}, 0.1]],
Opacity[0.2], Blue, Tube[BSplineCurve[{{0, 1.5, 1.6},
{0, 2, 2.4}, {0, 1.6, 2.1}, {0, .5, 2.2}}, 0.1]],

(*Cylinder 1*)
Opacity[0.2], Blue, Cylinder[{{0, .62, .75}, {0, 1.48, 1.6}}, 0.41],
(*Cylinder 2*)
Opacity[0.2], Red, Cylinder[{{0, - .62, .75}, {0, - 1.48, 1.6}}, 0.41]

(*Gray, Cuboid0,0,0.1,1,3,2*)
, PlotRange → {{- 1, 1}, {- 2, 2}, {- 1, 2.5}},
ViewPoint → {6, 0, 2}, ImageSize → {350, 350}

,
Stirling Simulation.nb 5

{{ Te, 650, "Expansion Gas Temperature(K)"}, 500, 3000, Appearance → "Labeled"},


{{ Tc, 300, "Compression Gas Temperature(K)"}, 250, 400, Appearance → "Labeled"},
{{ Pm, 101 300, "Mean Pressure(Pa)"}, 100, 400 000, Appearance → "Labeled"},
 Vse, 0.002, "Swept Volume of Expansion Piston(m3 )",
0, 1, Appearance → "Labeled",
 Vsc, 0.002, "Swept Volume of Compression Piston(m3 )",
0, 1, Appearance → "Labeled",
 Vde, 0.0002, "Dead Volume of Expansion Piston(m3 )",
0, 0.1, Appearance → "Labeled",
 Vdc, 0.0002, "Dead Volume of Compression Piston(m3 )",
0, 0.11, Appearance → "Labeled",
 Vr, 0.0002, "Regenerator Volume(m3 )", 0, 1, Appearance → "Labeled",
{{ n, 2225, "Engine Speed(rad/s)"}, 100, 3000, Appearance → "Labeled"},
{{x, 0, "Revolutions"}, 0, 2 π, Animator,
AnimationRunning → False, Appearance → "Labeled"},
ControlPlacement → Top
6 Stirling Simulation.nb

Expansion Gas Temperature(K) 650

Compression Gas Temperature(K) 300

Mean Pressure(Pa) 97 000.

Swept Volume of Expansion Piston(m3 ) 0.002

Swept Volume of Compression Piston(m3 ) 0.002

Dead Volume of Expansion Piston(m3 ) 0.0002

Dead Volume of Compression Piston(m3 ) 0.0002

Regenerator Volume(m3 ) 0.0002

Engine Speed(rad/s) 2225

Revolutions 0.658607

General::prng : Value of option PlotRange -> Directive[ , Thickness[Large]] is


not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications.

ParametricPlot::prng : Value of option PlotRange -> Directive[ , Thickness[Large]] is


not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications. 
Stirling Simulation.nb 7

General::prng : Value of option PlotRange -> Directive[ , Thickness[Large]] is


not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications.

ParametricPlot::prng : Value of option PlotRange -> Directive[ , Thickness[Large]] is


not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications. 

General::prng : Value of option PlotRange -> Directive[ , Thickness[Large]] is


not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications.

ParametricPlot::prng : Value of option PlotRange -> Directive[ , Thickness[Large]] is


not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications. 

General::prng : Value of option PlotRange -> Directive[ , Thickness[Large]] is


not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications.

ParametricPlot::prng : Value of option PlotRange -> Directive[ , Thickness[Large]] is


not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications. 

General::prng : Value of option PlotRange -> Directive[ , Thickness[Large]] is


not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications.

ParametricPlot::prng : Value of option PlotRange -> Directive[ , Thickness[Large]] is


not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications. 

General::prng : Value of option PlotRange -> Directive[ , Thickness[Large]] is


not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications.

ParametricPlot::prng : Value of option PlotRange -> Directive[ , Thickness[Large]] is


not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications. 

General::prng : Value of option PlotRange -> Directive[ , Thickness[Large]] is


not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications.

ParametricPlot::prng : Value of option PlotRange -> Directive[ , Thickness[Large]] is


not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications. 

General::prng : Value of option PlotRange -> Directive[ , Thickness[Large]] is


not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications.

ParametricPlot::prng : Value of option PlotRange -> Directive[ , Thickness[Large]] is


not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications. 

General::prng : Value of option PlotRange -> Directive[ , Thickness[Large]] is


not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications.

ParametricPlot::prng : Value of option PlotRange -> Directive[ , Thickness[Large]] is


not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications. 

Вам также может понравиться