You are on page 1of 10

Simulation and Analysis Laboratory Mechanical Engineering

SIMULATION OF VAPOUR COMPRESSION REFRIGERATION


Ex. No:15
DATE:
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 -15°C. The temperature of this refrigerant at the delivery
from compressor is 20°C when vapour is condensed at 10°C. 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 at3(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;

Velammal Institute of Technology 65


Simulation and Analysis Laboratory Mechanical Engineering

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.
Viva voice
1.What are the types of loops does MATLAB provides?
Matlab provides loops like
• While Loop
• For Loop
• Nested Loops
2.Explain what is Simulink?

Simulink is an add-on product to MatLab, it provides an interactive, simulating,


graphical environment for modeling and analyzing of dynamic systems.

Velammal Institute of Technology 66


Simulation and Analysis Laboratory Mechanical Engineering

LINEAR DAMPING FORCE

EX.NO:16
DATE:
Aim

The model for a mass attached to a spring with a linear damping force.

Problem Statement:

The response of an undamped single degree of freedom oscillator subject to varied


mass and stiffness parameters. Here we will do the same for a damped single degree of
freedom system.
Again, we begin with the equation of motion, given the system of Figure 3.1. A
simple static analysis …nds that our equation is:

If we divide through by m, we introduce the dimensionless parameters! And

x + 2 !nx + !n2 x = 0:

In the above, !n represents the undamped natural frequency, and is the viscous
damping ratio. For the purposes of this example, we will assume the under damped case
(<1). The solution to this equation is:

x(t) = Ae !nt sin(!dt + ):

This equation is more useful if we write all of the terms as functions of


parameters!n and :

PROGRAM

Programming Language: C

%Initial value entry.

%The while loop in the zeta initialization section prevents %certain values for zeta
from being entered, since such %values would crash the program.

%wn=input(’Enter the natural frequency. ’);


x0=input(’Enter the initial displacement. ’);
v0=input(’Enter the initial velocity. ’);

tf=input(’Enter the time duration to test, in seconds. ’); for


zi=1:3 zeta(zi)=12;
while(zeta(zi)<0 j zeta(zi)>=1) % The pipe (j) means “or”. zeta(zi)=input([’Enter
damping coe¢ cient value ’, num2str(zi),’.’]);

if (zeta(zi)>=1 j zeta(zi)<0)
fprintf(’Zeta must be between 0 and 1!’); zeta(zi)=12;
end
end
end

Velammal Institute of Technology 67


Simulation and Analysis Laboratory Mechanical Engineering

%
%Now, having !n and , the !d values can be found.
%
for i=1:3 wd(i)=wn*sqrt(1-zeta(i)^2);
end
%
%Solving for the response. Note the use of the array %multiplication command (.*) in the
expression for x(t). %This command is necessary, else the program gives a
%multiplication error.

t=0:tf/1000:tf; for j=1:3


a=sqrt((wn*x0*zeta(j)+v0)^2+(x0*wd(j))^2)/wd(j);

phi=atan2(wd(j)*x0,v0+zeta(j)*wn*x0); x(j,:)=a*exp(-zeta(j)*wn*t).*sin(wd(j)*t+phi);
end
%
%Now, the program plots the results in a subplot format.
%
subplot(3,1,1)
plot(t,x(1,:))
title([’Response for zeta=’,num2str(zeta(1))]) ylabel(’Response x’)
grid subplot(3,1,2) plot(t,x(2,:))
title([’Response for zeta=’, num2str(zeta(2))]) ylabel(’Response x’)
grid subplot(3,1,3) plot(t,x(3,:))
title([’Response for zeta=’, num2str(zeta(3))]) ylabel(’Response x’)
xlabel(’Time, seconds’) grid

Result:
The model for a mass attached to a spring with a linear damping force has been done using C.

Viva voice
1. What is the damping force?
Damping Coefficient. When a damped oscillator is subject to a damping force which
is linearly dependent upon the velocity, such as viscous damping, the oscillation will
have exponential decay terms which depend upon a damping coefficient.

2. What are the effects of damping?


In physics, damping is any effect that tends to reduce the amplitude of vibrations. In
mechanics, the internal friction may be one of the causes of such damping effect.

Velammal Institute of Technology 68


Simulation and Analysis Laboratory Mechanical Engineering

Compression on a Two Column Structure


EXPT NO:1

DATE:

AIM:

To calculate the displacement of a structure consisting of two circular columns of


equal length but different diameters (as seen below). The lower member is fixed and a 10000
pound load is applied to the top so that both members are placed in compression.

PROCEDURE:

Step 1 - Create a new Patran database.


1) Click on New from the File menu or from the Defaults Toolbar as shown.

2) Type the name of the new database as two_columns and click OK.

Step 2 - Create the geometry of the columns using the information from the problem
statement.
1) Under the Geometry tab, click on Point and select XYZ.

2)Input the following point coordinates and click Apply after each point: [0 0 0], [0 10 0],
and [0 -10 0]. There are no units in Patran, and therefore it is important to stay consistent in
units.

3) Under the Geometry tab, click on Curves and select Point.

4) With Auto Execute checked, click on Point 1 then Point 2, and Point 1 then Point 3.

Step 3 - Create the isotropic material: elastic modulus of 10×106.


1) Under the Properties tab, select Isotropic.

2) Input Material as the Material Name and then select Input Properties .

3) Input 10×106 as the Elastic Modulus. Click OK and Apply.

Step 4- Create a 1D surface physical property and apply the isotropic material to the
model.
1) Click on Rod under the 1D Properties section.

2) Input Top_Column as the Property Set Name and then click on Input Properties.

3)Click on Select Material and select Material. Enter 1.5 as the Area. Click OK.

4) Click on Select Application Region and then click on the Select Members box. Screen pick
the top curve. Click Add, OK then Apply.

5) Repeat the above steps for the bottom curve except input Bottom_Column as the Property
Set Name and enter 2 as the area.

Velammal Institute of Technology 70


Simulation and Analysis Laboratory Mechanical Engineering

Step 5 - Create boundary conditions: Constrain all degrees of freedom along the bottom of the
structure.
1) Under the Load/BCs tab, select Displacement Constraint.

2) Input fixed_end as the New Set Name and then click on Input Data.

3) Input <0,0,0> for Translations (to prevent any translational movement), but leave the
Rotations blank, < > (to NOT prevent any rotational movement). Click OK.

4) Click on Select Application Region and then click on the Select Geometry Entries box.
Screen select Click Point 3. Click Add, OK then Apply.

Step 6 - Create the load of 10000 lb to the top of the structure.


1) Click on Force under the Nodal section.

2) Input top_load and click on Input Data.

3) Input <0,-10000,0> as the Force. Click OK.

4) Click on Select Application Region and then click on the Select Geometry Entries box.
Screen select Point 2. Click Add, OK, then Apply.

Step 7 - Create a mesh seed and a finite element curve mesh.


1) Under the Meshing tab, click on Uniform Mesh Seeds.

2)Set the Number of Elements to 1, and with Auto Execute checked, select each curve.

3) Under the Meshing tab, click on Curve Meshers.

4) Click on the Select Curve List box. Screen click both curves using the Shift key. Click
Apply.

5) Set Action to Equivalence and click Apply (This will eliminate duplicate nodes at the
intersection of the two curves).

Step 8 - Run a steady state analysis using MSC Nastran.


1) Under the Analysis tab, select Entire Model. Ensure that the Job Name box is filled with a
name and click Apply.

Step 9 - Attach results file, then create fringe and deformation plots. Record maximum displacement
and stresses.
1) Click on XDB under the Access Results submenu. .

2) Ensure the appropriate Job Name is selected and click Apply.

3) Under the Results tab, select Fringe/Deformation.

4)Plot Displacements, Translational and Displacements, Translational. Click Apply.

Velammal Institute of Technolog0 71


Simulation and Analysis Laboratory Mechanical Engineering

Fig17.1 Compression on a Two Column Structure

RESULT:

Hence the displacement of a structure consisting of two circular columns is


analyzed by MSC Nastran.

Velammal Institute of Technology 72


Simulation and Analysis Laboratory Mechanical Engineering

Design and analysis of Crane Hook


EXPT NO:2
DATE:
AIM:

To calculate the stresses at point A and point B by a 5000 lb load is placed at the
center of the radius and center of the thickness of a crane hook with a rectangular cross
section: b = 0.75 in. and h = 4 in.

PROCEDURE:

Step 1 - Create a new Patran database.


1) Click on New from the File menu or from the Default Toolbar.

2) Type the name of the new database as hook then click OK.

3) Click OK on the New Model Preference.

Step 2 - Create a Curve using 2 Points


1) First click on the Geometry tab, select Points, and choose XYZ.

2)IType [0 0 0] for the Point Coordinates list, then uncheck Auto Execute and then click
Apply. If Auto Execute is checked, then once the Points are entered it will automatically
create the point after hitting enter, without the need to click Apply. Becareful if Auto Execute
is on and Apply is clicked then a duplicate point will be created.

3) Change the Point Coordinates List to [4 0 0] then click Apply.

4)Now change the Object to Curve then choose the Starting Point List as Point 1 and Ending
Point List as Point 2 then click Apply.

Step 3 - Create a Surface using 2 Curves.


1) First lets create another curve using XYZ method. Change the Method to XYZ then
change the Vector Coordinates List to <4 0 0>, and change the Orgin Coordinate List to [0 4
0]. Then click Apply since Auto Execute is not turned on.

2) Now change the Object to Surface. The surface will be created using 2 curves, so set the
Method to Curve and then choose Curve 2 as the Starting Curve List and choose Curve 1 as
the Ending Curve List. Since Auto Execute is on it will automatically generate the surface
without the need to click Apply.

Step 4- Create a Solid using a Surface.


1)First change the Object to Solid and the Method to Extrude.

2) Change the Translation Vector to <0 0 0.75> and for Surface List choose Surface 1. The
Translation Vector shows that the surface is being extruded 0.75 in the Z direction.

Velammal Institute of Technology 73


Simulation and Analysis Laboratory Mechanical Engineering

Step 5 - Create a Coordinate system using 3 Points.


1) Change the Object to Coord and the Method to 3Point.

2) For the Orgin type [-2 0 0], change the Point on Axis 3 to[-2 0 1] and change the Point on
Plane 1-3 to [1 0 0].

Step 6 - Create a Solid by Revolving a Surface.


1) First choose Object as Solid, and Method as Revolve.

2) Choose Coord 1 for the Refer. Coordinate Frame, type Coord 1.3 for the Axis. This means
that it is using coordinate 1 with rotation in the 3rd axis. Finally change the Total Angle to -
180.0.

3)Choose the Surface Solid 1.5. Solid 1.5 means that the surface is in solid 1 with a surface
number 5.

Step 7 - Create a Primitive Solid Cylinder.


1) First change the Object to Solid, the Method to Primitive and choose the Cylinder.

2)For the Height List type 0.75, the Radius List type 2.0 and for the Thickness List type 0.0.

3) For the Base Center Point List type [-6 0 0], for the Axis List type Coord 0.3, and then
click Apply.

Step 8 - Use Boolean to merge the solids together.


1) Set the Action to Edit, Object to Solid and the Method to Boolean.

2) Click on the Add icon, which is to merge 2 solids together. The second icon subtract one
solid from another and the thrid icon keeps the intersection of 2 solids.

3) For the Solid List Choose Solid 1:3 then click Apply.

4) Now let change the view to smooth shaded by Right Clicking, choose ViewPort Display
and choose Smooth Shaded.

Velammal Institute of Technology 74


Simulation and Analysis Laboratory Mechanical Engineering

Fig 18.1 Hook Design

Fig 18.1 Hook Analysis Report

RESULT:

Hence the stresses at point A and point B of crane hook is analyzed by MSC Nastran

Velammal Institute of Technology 75

You might also like