You are on page 1of 6

Ex.

No: 11

Simulation of Vapour compression refrigeration

Aim:
To perform simulation of a vapour compression refrigerator using C.
Problem Statement:
A Vapour compression refrigerator uses R12 as refrigerant and the liquid evaporates
in the evaporator at -15C. The temperature of this refrigerant at the delivery from
compressor is 20C when vapour is condensed at 10C. Find COP if there is no undercooling.
Write a computer program using C or Matlab.
Take specific heat at constant pressure for the speculated vapour as 0.64 KJ/KgK. Other
properties are:
Temperature (C)
hf(KJ/Kg)
hg(KJ/Kg)
hfg(KJ/Kg)
-15
22.33
180.975
159.145
10
45.37
191.74
146.37
Programming Language: C
Program:
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
main()
{
float hfg5,tc1,tc2,te,cp,hg1,h2,hg2,hf3,hf4,hg4,hfg4,cop,copi,eff,x;
printf("\nEnter the temperature of compressor exit<Celsius> ");
scanf("%f",&tc1);
printf("\nEnter the temperature of condenser<Celsius> ");
scanf("%f",&tc2);
printf("\nEnter temperature of evaporator<Celcius> ");
scanf("%f",&te);
printf("\nEnter the value of cp ");
scanf("%f",&cp);
printf("\nEnter the value of Enthalpy at 1(hg1) ");
scanf("%f",&hg1);
printf("\nEnter the value of Enthalpy at 3(hf3) ");
scanf("%f",&hf3);
printf("\nEnter the value of Enthalpy at 2`(hg2`) ");
scanf("%f",&hg2);
printf("\nEnter the value of Enthalpy at 4(hfg4) ");

scanf("%f",&hfg4);
hf4=hf3;
hfg5=hg1-hf4;
x=hfg5/hfg4;
h2=hg2+cp*(tc1-tc2);
copi=(te+273.0)/(tc2-te);
cop=(hg1-hf4)/(h2-hg1);
eff=(cop/copi)*100;
printf("\nThe actual cop is %f",cop);
printf("\nThe friction after expansion is %f",x);
printf("\nThe ideal cop =%f",copi);
printf("\nSecond law efficiency of the system = %f",eff);
printf("\n%f",h2);
getch();
}

Input Parameters:
Temperature of compressor
Temperature of condenser
Temperature of evaporator
Cp
Value of Enthalpy at 1, 2`, 3, 4
Output Parameters:
Actual COP = 9.242357
Ideal COP = 10.320000
Dryness factor = 0.996846
Second law efficiency = 89.557732
Result:
Thus simulation of vapour compression refrigerator has been done using C.

Ex. No: 12

Simulation of an accumulator

Aim:
To perform simulation of an accumulator using C.
Problem Statement:
An accumulator is loaded with 400 kN weight. The diameter of ram is 300 mm and
has a stroke length of 6 m. If friction is taken as 5%, It takes two minutes to fall through full
stroke. Find the total work supplied and power delivered using C or Matlab. The flow rate of
the fluid is 0.0075 m3/sec while accumulator descends with stated velocity. Take density of
fluid as 1000 N/m3
Programming Language: C
Program:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
float sl=0.0,w=0.0,d=0.0,f=0.0,a=0.0,p=0.0,h=0.0,ds=0.0,wd=0.0,fl=0.0;
float ls=0.0,t=0.0,nl=0.0,ws=0.0,tw=0.0,pd=0.0,ns=0.0,l=0.0;
printf("\nEnter stroke length<m> ");
scanf("%f",&sl);
printf("\nEnter time taken for completion of stroke<s> ");
scanf("%f",&t);
printf("\nEnter the piston force<kN> ");
scanf("%f",&w);
printf("\nEnter friction value<%> ");
scanf("%f",&fl);
printf("\nEnter the diameter of ram<m> ");
scanf("%f",&d);
printf("\nEnter the flow rate<m^3/s> ");
scanf("%f",&ls);
f=fl/100;
a=(3.14/4)*(d*d);
nl=w*(1-f);
wd=nl*(sl/t);

p=(nl/a);
h=p/(1000*9.81);
ws=(9810*ls)*h;
tw=wd+ws;
printf("\nTotal work supplied to the hydraulic machine in kNm= %f",tw);
pd=tw/t;
printf("\nPower delivered in kw= %f",pd);
getch();
}
Input Parameters:
Stroke length
Time taken for completion of a stroke
Piston force
Friction value
Diameter of ram
Flow rate
Output Parameters:
Total work supplied to the hydraulic machine in kNm = 59.339699
Power delivered in kw = 0.494497
Result:
Thus simulation of an accumulator has been done using C.

Ex. No: 13

Simulation of cam and follower

Aim:
To perform simulation of cam and follower using C.
Problem Statement:
A cam is to operate a flat faced follower having uniform acceleration and
deceleration. The least radius of cam is 50 mm. During descent the deceleration period is half
of the acceleration period. The ascent lift is 37.5 mm. The ascent is for one fourth period,
dwell for one third and remaining is descent. The cam rotates at 600 rpm. Simulate using C or
Matlab to determine the maximum velocity during ascent and descent.
Programming Language: C
Program:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int main()
{
int a1,a2;
float n,w,s1,s,out,in,outr,inr,vo,ao,vr,ar;
printf("\nEnter speed of rotation<rpm> ");
scanf("%f",&n);
w=(2*3.14*n)/60;
printf("\nEnter the cam lift<mm> ");
scanf("%f",&s1);
s=s1/1000;
printf("\nEnter cam ascent period<degrees> ");
scanf("%f",&out);
printf("\nEnter cam descent period<degrees> ");
scanf("%f",&in);
outr=(3.14/180)*out;
inr=(3.14/180)*in;
vo=(2*w*s)/outr;
ao=(4*w*w*s)/(outr*outr);
vr=(2*w*s)/inr;
ar=(4*w*w*s)/(inr*inr);
printf("\nAngular velocity = %f <rad/s>",w);
printf("\n\nOUTWARD STROKE");

printf("\nMaximum velocity = %f <m/s>",vo);


printf("\nMaximum acceleration = %f <m/s^2>",ao);
printf("\n\nRETURN STROKE");
printf("\nMaximum velocity = %f <m/s>",vr);
printf("\nMaximum acceleration = %f <m/s^2>",ar);
getch();
}
Input Parameters:
Speed of rotation
Cam lift
Cam ascent period
Cam descent period
Output Parameters:
Angular velocity = 25.120001
OUTWARD STROKE
Maximum velocity = 1.280000
Maximum acceleration = 40.959999
RETURN STROKE
Maximum velocity = 1.920000
Maximum acceleration = 92.160011
Result:
Thus simulation of an accumulator has been done using C.

You might also like