FINAL INDEPENDENT PROJECT "STIRLING CYCLE PLOTTING USING MATLAB"
TITLE: Stirling Cycle Plotting using MATLAB
AIM: Plot P-V diagram of Stirling Cycle
OBJECTIVES:
1) Calculation of parameters at each point of cycle (Pressure, Volume, Temperature).
2) Make a function to calculate the trace of volume for compression & expansion process.
3) Plot P-V diagram of Stirling cycle.
STIRLING CYCLE:
> The Stirling cycle is a thermodynamic cycle that describes the general class of Stirling devices. This includes the original Stirling engine that was invented, developed and patented in 1816 by Robert Stirling with help from his brother, an engineer.
> The cycle is reversible, meaning that if supplied with mechanical power, it can function as a heat pump for heating or cooling, and even for cryogenic cooling. The cycle is defined as a closed regenerative cycle with a gaseous working fluid. "Closed cycle" means the working fluid is permanently contained within the thermodynamic system. This also categorizes the engine device as an expernal heat engine.
The Stirling cycle consists of four thermodynamic processes acting on the working fluid
- 1-2 Isothermal heat addition (expansion).
- 2-3 Isochoric heat removal (constant volume).
- 3-4 Isothermal heat removal (compression).
- 4-1 Isochoric heat addition (constant volume).
VOLUME VARIACTION:
> Generally the phase angle difference between the piston motions is not the same as the phase angle of the volume variations. However, in the alpha Stirling, they are the same. The rest of the article assumes sinusoidal volume variations, as in an alpha Stirling with co-linear pistons, so named an "opposed piston" alpha device.
> The formula for volume trace is given as:
`V = [1 + (1/2)*(c_r-1)*(R+1-cosd(theta)-(R^2-sind(theta)^2)^(1/2))]*V_c`
> For calculating the trace of the volume we need to make a function for tracing the volume as per the Isothermal Process (T = Constant).
PROGRAM TO MAKE FUNCTION FOR VOLUME TRACE:
%Defining function for getting volume trace in STIRLING cycle
function [V] = piston_motion(L,con_r,c_r,start_crank,end_crank)
%where L = stroke length
% con_r = connecting rod length
% c_r = compression ratio
% start_crank = starting angle of crank
% end_crank = ending angle of crank
%Inputs
%crank pin radius
cp_r = L/2;
%ration of connecting rod length to crank pin radius
R = con_r/cp_r;
%Swpet Volume
V_s = 0.06; %(m^3)
%Clearance Volume
V_c = 0.03; %(m^3)
%Crank angle range
theta = linspace(start_crank,end_crank,180);
%volume trace formula-> V = [1 + (1/2)*(c_r-1)*(R+1-cosd(theta)-(R^2-sind(theta)^2)^(1/2))]*V_c
%The above formula is separated in three variables as menstioned below
A = 0.5*(c_r-1);
B = R+1-cosd(theta);
C = (R^2-sind(theta).^2).^0.5;
%the volume trace formula can be written as
V = (1 + A*(B - C)).*V_c;
end
> In this code the formula is inserted for the cycle using the repeatation of the formula to calculate the volume for each value's of the crank ancles from start to end.
PROGRAM TO PLOT P-V DIAGRAM OF STIRLING CYCLE:
clear all
close all
clc
%Program to simulate Stirling Cycle
%I have picked one Stirling clycle problem data from P. K. Nag Thermodynamics book
%Inputs to the cycle
%Stroke length (m)
L = 0.2
%Connecting Rod length (m)
con_r = 0.3
%Higher Temperature Range of cycle = 813 (K)
%Lower Temperature Range of cycle = 543 (K)
%Volume range of cycle is = 0.03 (m^3) to 0.06 (m^3)
%Swpet Volume
V_s = 0.06 %(m^3)
%Clearance Volume
V_c = 0.03 %(m^3)
%compression ratio
c_r = V_s/V_c
%State 1 Variables
P1 = 200 %(kPa)
V1 = V_c
T1 = 813 %(K)
%Trace of volume during expansion
V_exp = piston_motion(L,con_r,c_r,0,180);
constant = P1*V1;
P_exp = constant./V_exp;
%State 2 Variables
V2 = V_s
T2 = T1 %Isothermal Process
P2 = P1*(V1/V2) %from P1*V1 = P2*V2
%State 3 Variables
V3 = V2 %Isochoric Process
T3 = 543 %(K)
P3 = P2*(T3/T2) %from P2/T2 = P3/T3
%Trace of volume during compression
V_comp = piston_motion(L,con_r,c_r,180,0);
constant = P3*V3;
P_comp = constant./V_comp;
%State 4 Variables
V4 = V1 %Isochoric Process
T4 = T3 %Isothermal Process
P4 = P3*(V3/V4) %from P3*V3 = P4*V4
%Plotting
figure(1)
hold on
plot(V1,P1,'*','color','r')
plot(V_exp,P_exp,'linewidth',3)
plot(V2,P2,'*','color','r')
plot([V2 V3],[P2 P3],'linewidth',3)
plot(V3,P3,'*','color','r')
plot(V_comp,P_comp,'linewidth',3)
plot(V4,P4,'*','color','r')
plot([V4 V1],[P4 P1],'linewidth',3)
axis([0.025 0.065 50 225])
xlabel('Volume')
ylabel('Pressure')
title('P-V diagram of Stirling cycle')
EXPLAINATION:
> In this code first of all the input values are added to calculate the parameters values.
> At each 4 states the values of the presssure, Volume & Temperature are to be mesured using the stirling cycle formulas.
> The volume trace function is added to the code for compression and expansion processes.
> The crank angle are set to be 0 to 180 degrees for expansion & 180 to 0 degrees for compression processes.
> At the end the Plot command used to mark all 4 points, lines and volume trace curves.
OUTPUT:
> The P-V diagram for the cycle is onobtained from the programm: