Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Simulation Laboratory - Manual

Download as pdf or txt
Download as pdf or txt
You are on page 1of 94

SIMULATION LABORATORY MANUAL

IV Semester (19ME4DLSIL)
DEPARTMENT OF MECHANICAL ENGINEERING

Name of the Student :

Semester /Section :

USN :

Batch :

DAYANANDA SAGAR COLLEGE OF ENGINEERING


Accredited by National Assessment & Accreditation Council (NAAC) with ’A’ Grade
(AnAutonomousInstitutionaffiliatedtoVisvesvarayaTechnologicalUniversity,Belagavi
&
ISO 9001:2008 Certified)
MECHANICAL ENGINEERING DEPARTMENT
SHAVIGE MALLESWARA HILLS , KUMARASWAMY LAYOUT
BENGALURU-560078
SIMULATION LABORATORY : [2022]

Vision of the Institute


To impart quality technical education with a focus on
Research and Innovation emphasizing on
Development of Sustainable and Inclusive Technology
for the benefit of society.

Mission of the Institute


 To provide an environment that enhances
creativity and Innovation in pursuit of Excellence.

 To nurture teamwork in order to transform


individuals as responsible leaders and
entrepreneurs.

 To train the students to the changing technical


scenario and make them to understand the
importance of Sustainable and Inclusive
technologies.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 2


SIMULATION LABORATORY : [2022]

SIMULATION LABORATORY MANUAL


VII Semester (17ME7DLSIL)

Name of the Student :

Semester /Section :

USN :

Batch :

DAYANANDA SAGAR COLLEGE OF ENGINEERING


(AnAutonomousInstitutionaffiliatedtoVisvesvarayaTechnologicalUniversity,Belagavi)
MECHANICAL ENGINEERING DEPARTMENT
SHAVIGE MALLESWARA HILLS
KUMARASWAMY LAYOUT
BENGALURU-560078

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 3


SIMULATION LABORATORY : [2022]

VISION OF THE DEPARTMENT


To Prepare Mechanical Engineers having technical competency and Managerial
Skills driven by human values and ignite the young minds capable of addressing ever-
changing global issues by Research and Innovation.
MISSION OF THE DEPARTMENT
 To Provide a platform that imparts Scientific Knowledge and Technical skills.
 To Train students to demonstrate their Communication and Managerial skills with
Ethical practices.
 To Engage students in professional activities through Research, Higher Education
and Life Long Learning.
PROGRAMME EDUCATIONAL OBJECTIVES [PEOs]
 PEO1 - Graduates shall exhibit the Knowledge and Competency for successful
career in Mechanical Engineering and pursue higher studies.
 PEO2 – Graduates shall exhibit the necessary skills and manage to interact in the
field of profession with different Cross Functional Groups.
 PEO3 - Graduates shall demonstrate their Engineering Profession by adopting
Ethical and Professional practices.
 PEO4 - Graduates shall engage in Professional society interaction, training and
research to enable Life Long Learning.

PROGRAMME SPECIFIC OUTCOMES [PSOs]


 PSO1-Graduates will be able to apply basic science, mathematics and engineering
knowledge to conceptualize, model, design and manufacture physical systems and
processes.
 PSO2-Graduates will be able to utilize the knowledge of advanced engineering
tools in design &thermal engineering domain.
 PSO3-Graduates will be able to lead professionally in an industrial environment by
applying the management principles related to organizational planning, leadership,
research, production and service activities.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 4


SIMULATION LABORATORY : [2022]

DAYANANDA SAGAR COLLEGE OF ENGINEERING


(AnAutonomousInstitutionaffiliatedtoVisvesvarayaTechnologicalUniversity,Belagavi)
DEPARTMENT OF MECHANICAL ENGINEERING, BENGALURU-560078

SIMULATION LABORATORY
Course code: 19ME4DLSIL Credits: 02
L: P: T: S: 1: 2: 0: 0 CIE Marks: 50
Exam Hours: 03 SEE Marks: 50
Total Hours: 40
Course outcome: Student will be able to
CO1 Use software tool to create and animate four bar mechanism
CO2 Do kinematic analysis of four bar mechanisms
CO3 Write part program for CNC turning operations
CO4 Write part program for CNC milling operations
CO5 Use MATLAB software to solve mathematical problems
CO6 Use MATLAB software tool to solve basic mechanical engineering problems

PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2 PSO3
CO1 3 3 2 2 3 3 3
CO2 3 3 3 2 3 3 3
CO3 3 3 3 2 3 3 3
CO4 3 3 3 2 3 3 3
CO5 3 3 2 2 3 3 3
CO6 3 3 2 2 3 3 3

Part Course Content Hours


1. Modeling of Mechanisms (Four bar mechanisms)
2. Exercises on Kinematic analysis (Four bar mechanisms)
A 20
3. Simulation of Turning, and Milling operations (CNC
Programming)
MATLAB – Exercises
4. Introduction- MATLAB basics, commands, variables,
Arithmetical operations, scripts, Matrix operations, Polynomials,
B Programming in MATLAB, Basic 2D Plots. 20
5. Solve problems related to engineering mechanics
6. Solve beam problems for deformation, stress, SFD and BMD
results

CIE Assessment (50 Marks)

Class work - 25 Marks


Test – 25Marks
------------
Total: 50 Marks

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 5


SIMULATION LABORATORY : [2022]

Internal Assessment test to be conducted as per SEE scheme

SEE Assessment (50 Marks)


Scheme of Examination:
One question form Part A – 20 Marks (5 Write up +15)
One questions from Part B - 20 Marks (5 Write up +15)
Viva - Voce - 10 Marks
------------
Total: 50 Marks

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 6


SIMULATION LABORATORY : [2022]

DAYANANDA SAGAR COLLEGE OF ENGINEERING


DEPARTMENT OF AUTOMOBILE ENGINEERING
BENGALURU – 560078

DO’s
DO’S
 Come prepared with correct materials.
 Respect yourself, other people and all property
 Keep your behavior in check and follow all the rules
 If you need help, ask for it
 Learn and explore through your course! Work steadily and diligently in each lab
period!

DONT’s
 No food, gum or drink is allowed in the lab.
 Do not, under any circumstances change anything on the computer.
 Unauthorized access to any software is prohibited
 Don’t disturb your neighbors, they are busy completing their program
 No use of cell phones, iPod or any other mobile devices permitted inside the lab

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 7


SIMULATION LABORATORY : [2022]

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 8


SIMULATION LABORATORY : [2022]

PART-A
Exercise: 1 - Modeling of Mechanisms (Four bar mechanisms and inversions)

MECHANISM
David H. Myszka describes that, mechanisms of machines are used to convert and transit forces from
one point to the other to complete some objective of machine. Therefore, Mechanism is the main part
of machine. For instance, if we would consider the usual Lever (Figure 2), it is demonstrating how
small input force could be amplified to larger output force. The objective of lever is gaining a
mechanical advantage.

Figure 2. Schematic example of simple mechanism – Lever


Mechanisms consist of connected parts with the objective of transferring motion and force from a
power source to an output (Myszka, 2012):
• • Links are parts of mechanism, connected with at least two nodes, in objective to transmit
motion and forces. Simple link contains only two joints, but complex links contains more.

Links are considered to be rigid in mechanisms. They are connected with joints.
• • Joint is a movable connection between two links. Primary joints could be two types:
revolute (pin, hinge point) and sliding (piston, prismatic joint). Revolute joint allows rotation
of connected links. The sliding joint allows linear sliding between connected

• links. In addition, they are also called full joints. The other type of joints is called half joint
(cam, gear joint). They have more complex motion, involving rotation and sliding.
A point of interest is a point on a link where the motion is of special interest. Once kinematic
analysis is performed, the displacement, velocity, and accelerations of that point are determined.
• • An actuator is the component that drives the mechanism. Common actuators include motors
(electric and hydraulic), engines, cylinders (hydraulic and pneumatic), ball-screw motors, and
solenoids. Manually operated machines utilize human motion, such as turning a crank, as the
actuator.
First of all, to analyze the mechanism, there should be defined the principles of basic science
branches, which are Kinematics, Statics and Kinetics.

KINEMATICS

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 9


SIMULATION LABORATORY : [2022]

Kinematics – study of the geometry motion, how the things move. It includes also determination of
position, rotation, displacement, velocity, speed and acceleration of mechanism.
To analyze the mechanism, first thing to do is design the kinematic diagram, which represents the
links of mechanism. It should be drawn to scale proportional to the analyzed mechanism.

Figure 4. Example of Kinematic representation. (Myszka, 2012)

MOBILITY
Mobility defines the linkage degrees of freedom, which is the number of actuators needed to operate
the mechanism. The symbol of mobility is M and it could be calculated through the Gruebler’s
Equation.

where:
M – degrees of freedom
N – total number of links, including ground
jp - total number of primary joints (full joints)
jh - total number of higher-order joints (half joints)

The four-bar mechanism


The Four-Bar mechanism is the easiest and most often linkage. It is chain of pin-collected links, that
allows relative motion between the links. One of links is designated as a frame.
The mobility of a 4-bar mechanism is:

As it was calculated, it has one degree of freedom, as a result it demonstrates that 4-bar mechanism is
fully operated with one driver.

Figure 9. Degree of freedom (M=1) of 4-bar mechanism,

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 10


SIMULATION LABORATORY : [2022]

Grashof’s equation
the Grashof’s equation states that a 4-bar mechanism has at least one revolving link (will rotate
trough 360⁰) if:

where:
S – shortest link
L – longest link
P, Q – other two links
If the Grashof’s equation is not true, then no will rotate through 360⁰.
Categories of 4-bar mechanisms:
Table 1. 4-bar mechanisms categories
Criteria Shortest Link Category
𝑆+𝐿<𝑃+𝑄 Frame Double crank
𝑆+𝐿<𝑃+𝑄 Side Crank-rocker
𝑆+𝐿<𝑃+𝑄 Coupler Double rocker
𝑆+𝐿≤𝑃+𝑄 Any Change point
𝑆+𝐿>𝑃+𝑄 Any Triple rocker

4 Bar Mechanism
Figure 13. illustrate the sketch of mechanism, which was used in following calculations.
𝐿1=60, 𝐿2=25, 𝐿3=70, 𝐿4=45 [mm]

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 11


SIMULATION LABORATORY : [2022]

For analyzing 4-bar mechanism there had been chosen, which is also defined as Crank-rocker
mechanism.
In Crank-rocker formula is introduced as:
𝑆+𝐿<𝑃+𝑄
We insert dimensions of our links in the equation:
25+70<60+45;
95<105, which determines, the link dimensions of our mechanism satisfy required concepts of
Crank-rocker mechanism.
Crank-rocker is a 4-bar mechanism, which shortest link is connected to the frame. The shortest link is
defined as “crank” and has continuous rotation. The “rocker” is output link of mechanism
and it oscillates between two limiting angles. Those two limiting angles is also called as “dead-
center” positions.

Calculate Mobility

To calculate the mobility, it was determined that there are four links in this mechanism and four pin
joints. Therefore,
𝑁 = 4, 𝑗𝑝 = 4 pins, 𝑗ℎ = 0.
𝑀=3×(𝑁−1)−2𝑗𝑝−𝑗ℎ=3×(4−1)−2(4)−0=1
With one degree of freedom, if we move L2, it set precisely positions of other links in the
mechanism.

Inversions of mechanism: A mechanism is one in which one of the links of a kinematic chain is
fixed. Different mechanisms can be obtained by fixing different links of the same kinematic chain.
These are called as inversions of the mechanism. By changing the fixed link, the number of
mechanisms which can be obtained is equal to the number of links. Excepting the original
mechanism, all other mechanisms will be known as inversions of original mechanism. The inversion
of a mechanism does not change the motion of its links relative to each other.

Figure: inversion of 4 bar mechanism

Modeling and Simulation – 4 Bar Mechanism

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 12


SIMULATION LABORATORY : [2022]

Drawing detail
Procedure – Part Modeling
Procedure – Assembly

Exercise: 2 - Kinematic analysis of four bar mechanisms and its inversions

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 13


SIMULATION LABORATORY : [2022]

LIST OF SYMBOLS

𝐴𝑡 – tangential acceleration, [rad/s2]


𝐿1 ,2 ,𝐿3,𝐿4 – links, [mm]
𝜃2 – certain crank angle, [deg]
𝜃3 – interior joint angles, [deg]
𝜃4 – interior joint angle, [deg]
𝐴 – linear acceleration [m/s2]
𝑉- linear velocity of a point [m/s]
𝑟 - distance from the center of rotation to the point, [mm]
𝑣 - magnitude of the linear velocity of the point, [mm]
𝛥𝑅 – linear displacement, [mm]
𝛥𝜃 – angular distance, [deg]
𝛼 – angular acceleration, [deg/s2]
𝛾 – interior joint angle [deg]
𝜔 – angular velocity [deg/s]

2.5 POSITION ANALYSIS


2.5.1 Position of a point
Position is a term of the location of an object, if it is a point. The position of a point on a mechanism
can be specified by its distance from predefined origin and angle from a reference axis. Alternately,
if we work in the polar coordinate system, then we identify the position of a point by its rectangular
components of the position vector. (J.Rider, 2015)
2.5.2 Angular Position of a Link
An angular position, 𝜃, is defined as the angle a line between two points on that link forms with a
reference axis.
Angular Position is specified by J. Rider:
• • As positive, if the angle is measured counterclockwise from the reference axis.
• • As negative, if the angle is measured as clockwise from the reference axis.

2.5.3 Position of a Mechanism


The main objective of analyzing a mechanism is to study its motion. Motion proceeds, as the position
of links is changed and happens the moving of mechanism configuration by forces.
2.5.4 Position: analytical analysis
To collect results with a high degree of accuracy, we use analytical methods in the position analysis,
defined by Myszka. During analyzing the mechanisms in this thesis, there would be used triangle
method of position analysis.
Triangle method includes fitting reference lines within a mechanism and studying the triangles.
The detailed using of triangle method for a 4-bar linkage is demonstrated in the following topic.

2.5.6 Position Equations for a Four-Bar Linkage

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 14


SIMULATION LABORATORY : [2022]

Figure 10. Illustration of 4-bar linkage (Myszka, 2012)

𝜃2 – certain crank angle,


𝜃3,4 ,𝛾 – interior joint angles
𝐿1 ,2 ,𝐿3,𝐿4 – length of links

The equations are applicable to any four-bar mechanism configuration. (Myszka, 2012)

VELOCITY ANALYSIS
Linear velocity method:
• • 𝑉- linear velocity of a point. It is defined as a linear displacement of that point per 𝑡, time.

ΔR- vector, which refers to a change in position of that point.


Linear displacement of a point could be calculated with the following formula:

Therefore, if time is short period, velocity could be calculated by:

• Angular velocity, 𝜔, is the angular displacement of that link per unit of time, 𝑡.
From a displacement theory topic, we use rotational displacement of a link, 𝛥𝜃, to calculate the
angular velocity via formula:

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 15


SIMULATION LABORATORY : [2022]

For short time intervals

Velocity calculations for 4-bar mechanism


the theory of “Position Equations for a Four-Bar Linkage” and illustration of Figure 10 to
determine the velocities of links.

𝜃2 – certain crank angle,


𝜃3,4 ,𝛾 – interior joint angles
𝐿1 ,2 ,𝐿3,𝐿4 – links

ACCELERATION ANALYSIS
Linear Acceleration of Rectilinear Points

For short time periods:

Linear acceleration unit is [m/s2].


1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 16
SIMULATION LABORATORY : [2022]

Velocity change that appears in the period of constant acceleration is calculated with:
𝛥𝑉=𝑣𝑓𝑖𝑛𝑎𝑙−𝑣𝑖𝑛𝑖𝑡𝑖𝑎𝑙=𝐴𝛥𝑡
Displacement change that appears in the period of constant acceleration is calculated with:
𝛥𝑅=12𝐴𝛥𝑡2+𝑣𝑖𝑛𝑖𝑡𝑖𝑎𝑙𝛥𝑡
Combining the velocity change and displacement change formulas we get:
(𝑉𝑓𝑖𝑛𝑎𝑙)2=(𝑉𝑖𝑛𝑖𝑡𝑖𝑎𝑙)2+2𝐴𝛥𝑅
(Myszka, 2012)

Angular Acceleration

For short time periods:

Linear Acceleration of a general point

Figure 12. Acceleration of point A. (Myszka, 2012)

1. The magnitude of the velocity changes. In that case acceleration occurs in the path of motion and
is defined as tangential acceleration, 𝐴𝑡.
Mathematically tangential acceleration of point A on a rotating link 2 is expressed:

2. The direction of the velocity vector changes over time. As the link acts the rotational motional at
the associated point, it causes a centrifugal acceleration that is perpendicular to the motion path
direction. It is defined as normal acceleration, An. It is always directed toward the link rotation
center.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 17


SIMULATION LABORATORY : [2022]

To calculate the magnitude of normal acceleration point A on a rotating link 2, we use the
relationships between equations of the linear velocity and angular velocity.

Total Acceleration

Acceleration analysis for 4-bar mechanism


𝜃2 – certain crank angle,
𝜃3,4 ,𝛾 – interior joint angles
𝐿1 ,2 ,𝐿3,𝐿4 – links

Calculations
For analyzing 4-bar mechanism there had been chosen, which is also defined as Crank-rocker
mechanism.
In Crank-rocker formula is introduced as:
𝑆+𝐿<𝑃+𝑄
We insert dimensions of our links in the equation:
25+70<60+45;

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 18


SIMULATION LABORATORY : [2022]

95<105, which determines, the link dimensions of our mechanism satisfy required concepts of
Crank-rocker mechanism. (Myszka, 2012, p. 21)
Crank-rocker is a 4-bar mechanism, which shortest link is connected to the frame. The shortest
link is defined as “crank” and has continuous rotation. The “rocker” is output link of mechanism

and it oscillates between two limiting angles. Those two limiting angles is also called as “dead-
center” positions.

Figure 14. Illustration of Crank-rocker

Calculate Mobility
To calculate the mobility, it was determined that there are four links in this mechanism and four
pin joints. Therefore,

𝑁 = 4, 𝑗𝑝 = 4 pins, 𝑗ℎ = 0.
𝑀=3×(𝑁−1)−2𝑗𝑝−𝑗ℎ=3×(4−1)−2(4)−0=1

With one degree of freedom, if we move L2, it set precisely positions of other links in the
mechanism.

Theoretical calculations to find angle values


Firstly, we set links and angle values.
𝐿1=60, 𝐿2=25, 𝐿3=70, 𝐿4=45 [mm]
𝜃2=900. (We choose this magnitude for convenient theoretical calculations, in the following
Excel chapters there would be calculated also 00≤𝜃2≤3600)

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 19


SIMULATION LABORATORY : [2022]

Theoretical angular velocity calculations


As in previous chapter, we use same link and angle values, but add value of 𝜔2 and use obtained
angle dimensions.
𝐿1=60, 𝐿2=25, 𝐿3=70, 𝐿4=45 [mm]
𝜃2=900, 𝜃3=16,1°,𝜃4=80,72°, 𝛾=64,62°
𝜔2=10 [rpm]
For following calculations, we convert the 𝜔2 from [rpm] magnitude to [rad/s]. We use
conversion method introduced by Myszka. (Myszka, 2012, p. 126)

Theoretical angular accelerations calculations


𝐿1=60, 𝐿2=25, 𝐿3=70, 𝐿4=45 [mm]
𝜃2=900, 𝜃3=16,1°,𝜃4=80,72°, 𝛾=64,62°
𝜔2=1,05 [rad/s], 𝜔3=0,07 [rad/s], 𝜔4=0,62[rad/s]
As value of 𝜔2 is constant, then 𝛼2=0 [rad/s2]

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 20


SIMULATION LABORATORY : [2022]

Result

displacements behavior

velocities behavior

accelerations behaviour

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 21


SIMULATION LABORATORY : [2022]

SIMULATION

Analyze Mechanisms
After completing this phase, you will be able to:
n Use Dynamic Simulation to analyze four-bar linkage mechanisms.

The following Autodesk Inventor tools are used in this phase:

Open the File


1. Make IFI_Unit15.ipj the active project file.
2. Open Drag_Link.iam. It is important to note that the length of 1 + 4 is not greater than 2 + 3.
3. Drag bar 2 to review the motion of the four-bar linkage. Undo to return the mechanism to its original
position.

Start Dynamic Simulation


We use Dynamic Simulation to analyze products under real-world conditions without having to build
physical prototypes. In this section of the exercise,

To determine the motion of the four-bar linkage.

1. On the Environments tab, Begin panel, click Dynamic Simulation.

2. If required, click No to close the tutorial dialog box.


3. Review the browser. The assembly constraints are automatically converted into joints.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 22


SIMULATION LABORATORY : [2022]

4. On the Simulation Player, click Run or Replay the Simulation. No parameters are applied to the
mechanism, so there is no motion.
5. On the Simulation Player, click Construction Mode.

6. In the browser, under Standard Joints, right click Revolution:6. Click Properties.

7. On the dof 1 (R) tab, click Edit Imposed Motion.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 23


SIMULATION LABORATORY : [2022]

8. Select the Enable Imposed Motion check box.

9. Click the arrow beside Input Grapher. Click Constant Value.

10. Enter 300 rpm.


11. Click OK. Review the joint axes and direction of rotation.

12. On the Simulation Player, click Run or Replay the Simulation. The mechanism moves for one second.
In this example, bars 2, 3, and 4 have continuous motion.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 24


SIMULATION LABORATORY : [2022]

13. In the browser, click Revolution:2. Review the location of the joint.
14. On the Results panel, click Output Grapher.

15. Under Drag_Link > Standard Joints, expand Revolution:2 > Accelerations. Select the A [1]
check box.

16. Review the Output Grapher. The acceleration of the joint is displayed.

17. In the Output Grapher window, double-click on the graph. A vertical line is displayed and the
mechanism moves to the matching position.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 25


SIMULATION LABORATORY : [2022]

18. On the keyboard, press the forward or back arrow keys to cycle the mechanism. Note the position of
the mechanism and the position of the line on the graph.

Create Traces
Dynamic Simulation can create a trace of the trajectory path and velocity and/or acceleration vectors in
the graphics window by activating the Output Grapher and setting up the traces you want displayed. In
this exercise, you trace the path of two joints on the mechanism.
1. On the Output Grapher toolbar, click Add Trace.

2. In the graphics window, select the corner of the joint between bars 2 and 3.

A sphere is displayed at the location.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 26


SIMULATION LABORATORY : [2022]

3. Click Apply. The trace is displayed.

4. Repeat this workflow for the joint between bars 3 and 4.

5. Click Cancel. Since you have already run a simulation, the traces are displayed.
6. On the Simulation Player, click Rewind to the Beginning of the Simulation.

The trace is no longer displayed.


7. On the Simulation Player, click Run or Replay Simulation. You can now see the motion path of the two
joints.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 27


SIMULATION LABORATORY : [2022]

8. Close the Output Grapher.


9. On the Simulation Player, click Construction Mode.

10. Close the file.

Example 2

Analyze a Second Mechanism


In this section of the exercise, you analyze a second mechanism to determine the motion.

1. Open Crank_Rocker.iam. It is important to note t3h +a t4 t.he length of 2 + 3 is not great

2. On the Environments tab, Begin panel, click Dynamic Simulation.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 28


SIMULATION LABORATORY : [2022]

3. If required, click No to close the tutorial dialog box.


4. Review the browser. The assembly constraints are automatically converted into joints.

5. In the browser, under Standard Joints, right click Revolution:2. Click Properties.

6. On the dof 1 (R) tab, click Edit Imposed Motion.

7. Select the Enable Imposed Motion check box.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 29


SIMULATION LABORATORY : [2022]

8. Click the arrow beside Input Grapher. Constant Value should be selected.
9. Enter 60 rpm. You will be creating an animation of this mechanism, so you are setting a low value.
10. Click OK. Review the joint axes and direction of rotation.

11. On the Simulation Panel, enter 3 for Final Time.

12. On the Simulation Player, click Run or Replay the Simulation. The mechanism moves for three
seconds. In this example, bar 2 has continuous motion. Bars 3 and 4 have oscillating motion.
13. In the browser, click Revolution:5. Review the location of the joint.
14. On the Results panel, click Output Grapher.

15. Under Standard Joints, expand Revolution:5 >Accelerations. Select the A [1] check box.
16. Review the Output Grapher. The acceleration of the joint is displayed.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 30


SIMULATION LABORATORY : [2022]

17. In the Output Grapher window, double-click the graph. A vertical line is displayed and the
mechanism moves to matching position.
18. On the keyboard, press the forward or back arrow keys to cycle the mechanism. Note the position of
the mechanism and the position of the line on the graph.

Use Traces
1. On the Output Grapher toolbar, click Add Trace.

2. In the graphics window, select the corner of the joint between bars 2 and 3. A sphere is displayed at
the location.
3. Click Apply. The trace is displayed.

4. Repeat this workflow for the joint between bars 3 and 4.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 31


SIMULATION LABORATORY : [2022]

5. Click Cancel.
6. On the Simulation Player, click Rewind to the Beginning of the Simulation.

The trace is no longer displayed.

7. On the Simulation Player, click Run or Replay the Simulation. You can now see the motion
path of the two joints.

8. Close the Output Grapher.

9. Do not return to the construction environment. You must be in the simulation environment to create
the animation.

Create an Animation

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 32


SIMULATION LABORATORY : [2022]

Dynamic Simulation creates parameters for Inventor Studio that make the creation of an animation
much simpler. In this section of the exercise, you create a studio animation.
1. On the Animate panel, click Publish to Studio.

2. On the Animation Timeline, click Animation Options.

3. Under Length, for Seconds, enter 5.

4. Click OK.

5. On the Animation Timeline, drag the slider to 4 seconds.

6. In the browser, expand Animation Favorites.


7. Right-click Simulation_Timeline. Click AnimateParameters.

8. In the Animate Parameters dialog box, under Action, for End, enter 300.
9. Under Time, click Specify.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 33


SIMULATION LABORATORY : [2022]

10. For Start, enter 1. For End, enter 4.


11. Click OK.
12. On the Render panel, click Render Animation.

13. On the Output tab, under Time Range, click Entire Animation.
14. Select the Launch Player check box.
15. Click Open an Existing Folder.

16. For File Name, enter Crank_Rocker.


17. Click Save.
18. Click Render.
19. Click OK. The animation is created. This may take a few minutes.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 34


SIMULATION LABORATORY : [2022]

VEX - Unit 15

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 35


SIMULATION LABORATORY : [2022]

1. INTRODUCTION TO CNC TURNING, PROGRAMS ON


TURNING

NC TECHNOLOGY
1.1 Numerical Control (NC):
It is the acronym for ‘Numerical Control’. Numerical Control refers to the use of coded
numerical information in the automatic control of equipment. NC can be defined as a kind of
programmable automation in which the process is controlled by numbers, letters & symbols. The
numbers letters & symbols are arranged as a ‘program of instructions’ for a particular job. Such a
program is called a part program.
NC can be applied to various operations in engineering, like drafting, machining,
assembly, inspection, etc. The main area of NC application is metal machining
operations.
1.2 Basic Components of an NC System:
An NC system consists of three basic components.
1. Program of instructions
2. Machine control unit
3. Machine tool

PROGRAM OF MACHINE
MACHINE TOOL
INSTRUCTIONS CONTROL UNIT

Above Figure shows the block diagram of an NC machine. The program of instructions sends
commands to the Machine Control Unit, which in turn controls the machine tool.
1.3 NC Coordinate systems:
The relative movement of the machine tool spindle & worktable is due to the individual slides
being operated by instructions from the part program.
Normally, three slides are required in a NC machine tool.
 Longitudinal
 Vertical

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 36


SIMULATION LABORATORY : [2022]

 Transverse
The position and direction of movement of each slide is given by the right hand coordinate
system. Here we have three axes X, Y & Z mutually perpendicular to each other.
Position of axes: Usually the Z axis is located (positioned) along the machine tool spindle. The
X axis is positioned parallel to the machine worktable and perpendicular to the Z axis. The Y
axis is perpendicular to both Z & X axis.
Direction of axes: If the movement of the slide is such that the tool moves away from the work
piece, the direction of that slide axis is positive (+ ve). Similarly, if the movement of the slide is
such that the tool moves nearer to or into the work piece, the direction of that slide axis is
negative ( - ve).
Zero points & Reference points:
The accurate position of the machine tool slides with the machine tool is established by the ‘Zero
Point’. The Zero Points may be (a) Machine Zero Point & (b) Work Zero Point.
Machine Zero Point is specified by the manufacturer of the machine. This is the zero point for
the coordinate systems and other reference points in the machine.
Workpiece Zero Point determines the workpiece coordinate system in relation to the machine
zero point. This point is chosen by the programmer, and input into the CNC system when setting
up the machine. The position of this point can be freely chosen by the programmer within the
workpiece envelope of the machine. Its position is chosen such that the dimensions in the
workpiece drawing can be conveniently converted into coordinate values and also to effectively
take care about the clamping/chucking, setting up, etc.
Reference Point or Home Position serves for calibrating and controlling the measuring systems
of the slides and tool traverses. The position of the reference point is accurately predetermined in
every traverse axis by the trip dogs and the limit switches. Therefore the reference point
coordinates always have the same precisely known numerical values in relation to the machine
zero point. After initiating the control system, the reference point must always be approached
from all axes to calibrate the traverse measuring system.
Dimension System: Dimensional information in the work piece drawing can be stated in 2
methods – Absolute Dimensioning & Incremental Dimensioning.
In Absolute dimensioning, the coordinate data are taken with respect to a fixed reference point on
the workpiece drawing (usually the workpiece zero).

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 37


SIMULATION LABORATORY : [2022]

In Incremental Dimensioning, the coordinate data are taken with respect to the previous
coordinate value. i.e., every coordinate programmed will be the origin for the next coordinate to
be programmed.

1.4 NC & CNC: During the early period of NC technology, most of the control activities in the
controller were performed by electronic hardware devices like diode valves. The electronics
consisted of many mechanical devices which frequently posed problems of non-contact. The
machine tools and processes then controlled by such controllers were called as NC Machines.
With the improvement of technology and with the evolution of ‘integrated circuits’ mechanical
problems with electronic devices were solved. Also with the very fast development of
computers, almost all the control activities, performed by the hardware of the controller unit,
could then be tackled by software (programs). The machine tools and processes presently being
controlled by powerful computers is termed as CNC Machines. CNC is the acronym for
‘Computer Numerical Control’.
1.5 CNC Part Program:
It consists of a set of properly arranged sequence of instructions which when executed
initiates the controller to send various signals to different machine tool drives in accordance with
the program sequence so as to perform the desired work/job.
The CNC program (also called as the CNC part program) is made up of number of ‘lines of
instructions’. Each ‘line of instruction’ is called a Block. Each Block in turn consists of a few
‘alpha-numeric words’ called as ‘CNC Words’
Figure here shows a sample part program depicting the ‘Blocks’ and ‘CNC Words’.
Also, it may be noted that each CNC word starts
with a Word Address (upper-case alphabet)
followed by a numeric data.
Such a CNC program format is called ‘Word
Address Format’.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 38


SIMULATION LABORATORY : [2022]

CNC Words: The different types of CNC words used in CNC programming are as follows.
a) Sequence Number (N-word): It is used to identify a block.
b) Preparatory function word (G-code): This command prepares the machine controller to
follow a given instruction. E.g. G00 stands for Rapid Movement (point-to-point position)
c) Coordinate Data(X, Y & Z words): These words specify the coordinate position of the
cutting tool. E.g. X15, Y-40, Z-2
Coordinate Data may also contain the I, J & K words which specify the coordinate values
of the arc. I, J & K values are also called as the ‘interpolation parameters’.
d) Arc Radius (R-word): Instead of programming the interpolation parameters (arc-center-
coordinates) I, J & K, the arc radius can be programmed using the R-word.
e) Feed Rate (F-word): These words specify the feed rate of the tool in a machining
operation. It is usually expressed in mm/min. E.g. F30
f) Cutting Speed (S-word): These words specify the cutting speed of the tool/spindle
rotation in RPM. E.g. S1200
g) Tool Selection (T-word): This command is used to access a required tool from a tool
turret or an automatic tool changer. This command is usually used in CNC machines with
Automatic Tool Changing facility. E.g. T10 may specify that a 10 mm drill must be
selected from position number 10 of a tool magazine (holder).
h) Miscellaneous Functions (M-code): These are used to specify certain miscellaneous or
auxiliary functions (coolant on, coolant off, spindle on CW/CCW, spindle stop, etc)
available on the given machine.
NC LATHE

Chuck
X Face

Z
Dia

(0,0)

Z– Z+

Length

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 39


SIMULATION LABORATORY : [2022]

1.6 Dimensional Notations used in CNC lathe are:


1. Absolute Dimensioning – X & Z are used.
2. Incremental Dimensioning – U & W are used.
P6 P5

P4 P3
 30
 25 P2 P1

 20

25 30 25

ABSOLUTE INCREMENTAL
Point
X Z U W
P1 20 0 20 0
P2 20 -25 0 -25
P3 25 -25 5 0
P4 25 -55 0 -30
P5 30 -55 5 0
P6 30 -80 0 -25

Note: Incremental program is easy to program but tedious to change values in between. Error
committed in any block is carried over to the consecutive blocks. Whereas, absolute
programming is a bit inconvenient as all coordinates are measured from a fixed point. Error
committed in any block will affect only that block. Consecutive blocks are not affected.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 40


SIMULATION LABORATORY : [2022]

1.7 Zero points & Reference points on a CNC lathe:


R

Max X
X

M W Z
(0,0
)
Max
Z
M: Machine Zero Point W : Workpiece(Program)
Zero Point
R: Reference point OR Home Position
Above figure shows the location and the relationship between Zero Points & Reference Point on
a CNC lathe.
1.8 Commonly used G-codes on the XLTURN machine:
G00 Positioning(Rapid Feed)
G01 Linear Interpolation(Cutting Feed)
G02 Circular Interpolation CW
G03 Circular Interpolation CCW
G04 Dwell
G17 XY Plane
G18 ZX Plane
G19 YZ Plane
G20 Inch Mode Input
G21 Metric Mode Input
G28 Return To Reference Point(Homing)
G70 Finishing Cycle
G71 Profile Turning Cycle
G72 Profile Facing Cycle
G74 Drilling Cycle
G75 Grooving Cycle
G76 Threading cycle

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 41


SIMULATION LABORATORY : [2022]

G90 Turning Cycle


G92 Treading Cycle
G94 Facing Cycle
G98 Feed per Minute
G99 Feed per Revolution

1.9 Commonly used M-codes on the XLTURN machine:


M00 Program Stop
M01 Optional Stop
M02 Program Reset
M03 Spindle Forward
M04 Spindle Reverse
M05 Spindle Stop
M06 Auto Tool Change
M08 Coolant ON
M09 Coolant OFF
M13 Spindle Forward and Coolant ON
M14 Spindle Reverse and Coolant ON
M98 Sub Program Call
M99 Sub Program Exit
M30 Program Reset and Rewind

G00 Rapid traverse


When the tool being positioned at a point preparatory to a cutting motion, to save time it is
moved along a straight line at Rapid traverse, at a fixed traverse rate which is pre-programmed
into the machine's control system. Typical rapid traverse rates are 10 to 25 m /min., but can be as
high as 80 m/min.

Format
N_ G00 X_ Z_

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 42


SIMULATION LABORATORY : [2022]

G01 Linear interpolation (feed traverse)


The tool moves along a straight line in one or two axis simultaneously at a programmed linear
speed, the feed rate.
Format
N__ G01 X__ Z__ F__

G02/03 Circular interpolation

Format
N__ G02/03 X__ Z__ I__ K__ F__ using the arc center
OR
N__ G02/03 X__ Z__ R__ F__ using the arc radius
G02 moves along a CW arc
G03 moves along a CCW arc
Arc center
The arc center is specified by addresses I and K. I and K are the X and Z co-ordinates of the arc
center with reference to the arc start point.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 43


SIMULATION LABORATORY : [2022]

I =(X coord. of
center - X coord. of
start point)/2
K=Z coord. of
center - Z coord. of start point
I and K must be written with their signs.
Arc radius
The radius is

Specified with address R.


G02 X__ Z__ R__ F__
N__ G03 X__ Z__ R__ F__
If the radius is used, only arcs of less than 180 deg. can be programmed in a block. An arc with
included angle greater than 180 deg. must be specified in two blocks.
1.10 Canned cycles
A canned cycle simplifies a program by using a few blocks containing G-codes functions to
specify the machining operations usually specified in several blocks
I. Turning Cycle - G71
Format
G71 U (d) R (e)
G71 P(n) Q(n) U(u) W(w) F(f)
N (n) _ _ _ _
_______

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 44


SIMULATION LABORATORY : [2022]

_______
N (n) _ _ _ _
d = Depth of cut
e = Retract amount
n = Number of the first block of the shape
n = Number of the last block of the shape
u = Finishing allowance in X
w =Finishing allowance in Z ,f = Feed rate
II. Step Facing Cycle (G94 Cycle):
It is a ‘Box type’ cutting cycle.
SYNTAX:
G94 X… (U….) Z….. (W…..) F…..
Where,
X is the diameter to which the movement is being made OR U is the incremental distance from
the current tool position to the required final diameter.
Z is the Z axis coordinate to which the movement is being made OR W is the incremental
distance from the current tool position to the required Z axis position.
F is the feed rate.
TP-1. Write a program to perform the step facing of the component as shown in the figure:
O1001
2.5 2.5
([BILLET X30 Z70)
G21 G98
 30
G28 U0 W0 R Tool
Entry
M06 T0101
point
M03 S1200  20
G00 X31 Z0 F R

G94 X10 Z-0.5 F30


 10
Z-1
Z-1.5 F
Z-2
Z-2.5

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 45


SIMULATION LABORATORY : [2022]

X20 Z-3
Z-3.5
Z-4
Z-4.5
Z-5
G28 U0 W0
M05
M30
I. Step Turning Operation using the Box Turning Cycle (G90):
The Step Turning Operation can be performed by using the “Box Turning Cycle – G90 Cycle” as
below. R Tool Entry
SYNTAX: Point
F R
G90 X…..Z……F…….
Where, F
X is the diameter to which movement is being made
Z is the Z axis coordinate to which the movement is being made
F is the feed rate being used
TP-2 Using the G90 Cycle; write a part program to step turn a work piece as
shown below:
O1003
G21 G98
G28 U0 W0
M06 T0101
M03 S1200
G00 X30 Tool Entry point Z1
G90 X30 Z-55 F30
X29
 30
X28
 25
X27
 20
X26
30 25

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 46


SIMULATION LABORATORY : [2022]

X25
G00 X25 Z1
G90 X25 Z-25 F30
X24
X23
X22
X21
X20
G28 U0 W0
M05
M30
I. Multiple Turning Cycle (G71 Cycle):
The Multiple Turning Cycle is used when the major direction of cut is along
the Z axis. This cycle causes the profile to be roughed out by turning. Two G71
blocks are needed to specify all the values.

Syntax: G71
U is the depth of cut.
U……R…… R is the relief or retract
amount
G71 P is the block number of the start of the final profile
Q is the block number of the end of the final profile.
P…..Q……U U is the finishing allowance for the X axis
W is the finishing allowance for the Z axis
F is the feed rate
…..W…..F…

II. Finishing Cycle (G70 Cycle):

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 47


SIMULATION LABORATORY : [2022]

On completion of any roughing operation, the material left as finishing


allowance is removed using the ‘Finishing Cycle’. The same tool path used in the
roughing operation is used in the G70 cycle. The G70 Cycle causes a range of
specified blocks to be executed, then control passes on to the block after the G70
Cycle.

Syntax: G70 P….Q….F…..


Where, P is the block number of the start of the final profile
Q is the block number of the end of the final profile.

TP-3 Write a part program for Multiple Turning operation for the
component shown in the figure.
P10
P9
O1006
 30  28  24
P8
G21 G98 P7 R8
G28 U0 W0
P6 P5
M06 T0101  22
R8
M03 S1200  17 P4

G00 X30 Tool Entry point  14 P3 P2


P1
Z1
9
7
G71 U0.5 R1 5 7 5 5 7 13 2
G71 P1 Q10 U0.5
W0.5 F50
N1 G01 X7
N2 X9 Z-2

POINT X Z
P1 7 0

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 48


SIMULATION LABORATORY : [2022]

N3 Z-15 P2 9 -2

N4 G02 X14 Z-22 R8 P3 9 -15


P4 14 -22
N5 G01 X17 Z-27
P5 17 -27
N6 Z-32
P6 17 -32
P7 22 -39
N7 G03 X22 Z-39 R8
P8 24 -39
N8 G01 X24 P9 28 -44
N9 X28 Z-44 P10 30 -44
N10 X30
G70 P1 Q10 F50
G28 U0 W0
M05
M30

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 49


SIMULATION LABORATORY : [2022]

TP-4 Write a part program for Multiple Turning operation for the
component shown in the figure. Use a finishing tool for the finishing cycle.

O1007
[BILLET X30 Z70
G21 G98  30
G28 U0 W0 R 10
M06 T0101 (Select roughing
tool)  20
M03 S1200
G00 X30 Z1 (Select Entry
 10 8
Point)
10 10 13 2
G71 U0.5 R1
G71 P10 Q20 U0.5 W0.5 F50
N10 G01 X8
X10 Z-2
Z-15
G03 X20 Z-25 R10
N20 G01 X30 Z-35

G28 U0 W0
M06 T0303 Select Finishing Tool

M03 S1450

G00 X30 Z1
G70 P10 Q20 F40

G28 U0 W0

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 50


SIMULATION LABORATORY : [2022]

M05
M30
2. INTRODUCTION TO CNC MILLING, PROGRAMS ON
MILLING
CNC MLL

In CNC Mill we have 3 axes – X axis (along length), Y axis (along breadth)
& Z axis (along thickness). The position of the Z axis is along the spindle axis and
it is +ve in a direction away from the workpiece. The position of the X & Y axis is
parallel to and on the worktable. X axis is along the length and Y axis is along the
breadth of the table. X and Y axes are +ve in directions moving away from the
workpiece.

2.1 Automatic Tool Changer (ATC): It is a facility or device provided on the CNC Mill for
automatically indexing the tool magazine and making the required tool change as indicated in the
CNC program.

2.2 Automatic Pallet Changer (APC): It is a time saving facility provided on the CNC Mill for
automatically loading and unloading the pallets. Pallets are portable work holding devices. While

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 51


SIMULATION LABORATORY : [2022]

a loaded pallet is being used, a machined-component may be unloaded from the pallet and a to-
be-machined workpiece may be loaded on to the pallet.

2.3 Dimensional Notations used in CNC Mill are:


X Coordinate value along the length of the table
Y Coordinate value along the breadth of the table
Z Coordinate value along the vertical to the table

2.4 Programming Method - Absolute & Incremental Programming:


Absolute programming is specified by the G code G90 and incremental programming by G91. In
absolute programming, coordinate values are measured from the program zero point. In
incremental programming, the coordinate values are measured from the previous programmed
point

6 4
0 0
P P
3
3
2 0
P P
4 5
4
0

P P
6
3
0

P P
1 2 8 8
0 0

ABSOLUTE INCREMENTAL
(G90) (G91)
Point X Y X Y
P1 0 0 0 0
P2 0 100 0 100
P3 60 100 60 0
P4 60 70 0 -30
P5 100 70 40 0

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 52


SIMULATION LABORATORY : [2022]

P6 100 30 0 -40
P7 20 30 -80 0
P8 20 0 0 -30
P1 0 0 -20 0

Note: Incremental program is easy to program but tedious to change values in between. Error
committed in any block is carried over to the consecutive blocks. Whereas, absolute
programming is a bit inconvenient as all coordinates are measured from a fixed point. Error
committed in any block will affect only that block. Consecutive blocks are not affected.

2.5 Commonly used G-codes on the FANUC Controller CNC Mill


Rapid Traverse (Tool moves at a predetermined rapid speed
G00 without making contact with the workpiece).
Linear interpolation (Tool moves at a speed specified in the feed
G01 word)
G20 Inches programming
G21 Metric programming
G28 Return to reference point OR home position
G02 Circular Interpolation CW
G03 Circular Interpolation CCW
G90 Absolute Programming
G91 Incremental Programming
G94 Feed programmed in mm/min
G95 Feed programmed in mm/rev

2.6 Commonly used M-codes on the FANUC Controller CNC Mill


M01 Optional stop
M02 Program end
M03 Spindle ON CW
M04 Spindle ON CCW

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 53


SIMULATION LABORATORY : [2022]

M05 Spindle OFF


M06 Tool change
M08 Coolant ON
M09 Coolant OFF
M30 Program stop & rewind
M70 X Mirror ON
M71 Y Mirror ON
M80 X Mirror OFF
M81 Y Mirror OFF
M98 Subprogram Call
M99 Subprogram end

2.7 Subprogram:
A CNC program is divided into a main program & a subprogram. Normally
the CNC operates according to the main program but when a command calling a
subprogram is encountered in the main program, control is passed to the
subprogram. When a command indicating a return to the main program is
encountered in the subprogram, control is returned to the main program. The first
block of the main program & sub program must contain a program number starting
with letter ‘O’.
Use of subprogram: When a program contains certain fixed sequences or
frequently repeated patterns, these sequences or patterns can be entered into the
memory as a subprogram to simplify programming. If a subprogram can call
another subprogram, it is regarded as a one loop sub program call.
Syntax: M98 P0000000

Command used in main


Subprogram program
No. of
repetitions
Subprogram
call Command used in
1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 54
Subprogram
SIMULATION LABORATORY : [2022]

M99
Main Program SubProgram SubProgram
O0001 O2222 O3333
…….. …….. ……..
…….. …….. ……..
M980012222 M980013333 ……..
…….. …….. ……..
…….. …….. ……..
…….. …….. ……..
M30 M99 M99

MP 1. Write a part program to perform the contour slotting operation on the component as
shown in the figure. The
10 60
slot should have a width of R 10
8 mm and a depth of 1 mm.
10

P4 P5
10

O0003 X Y
P6
P3
([BILLET X100 Y100 P1 20 10
Z10) P2 10 20
60

80
0

([TOOLDEF T01 D8) P3 10 80


([EDGEMOVE X0 Y0) P2
R 10 P4 20 90
G21 G94 P5 80 90
P1 P7
20

G91 G28 Z0 P6 90 80
G28 X0 Y0
Billet PSize 90 x 10 mm
7 100 x 100 10
G90 20 70 10
P 20 10
Cutter Dia:1 8 mm
M06 T01
M03 S1200
G00 X20 Y10 Z5
G01 Z-1 F50 (P1)
G03 X10 Y20 R10 (P2)
G01 X10 Y80 (P3)

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 55


SIMULATION LABORATORY : [2022]

X20 Y90 (P4)


X80 Y90 (P5)
G02 X90 Y80 R10 (P6)
G01 X90 Y10 (P7)
X20 Y10 (P1)
G00 Z5
G91 G28 Z0
G28 X0 Y0
G90
M05
M30
Slab Milling
MP 2. Write a part program to perform the square slab milling operation on a workpiece of
dimensions 100mm100mm10 mm. The slab’s dimension is 64mm64mm6mm and is
located at the centre of the workpiece. Use a cutter diameter of 10 mm. Take program zero at the
left bottom end of the workpiece.
O1122 64 mm 6 mm

10 mm
G21 G94
G91 G28 Z0
G28 X0 Y0
G90
M06 T01
M03 S1000
64 mm

mm

G00 X0 Y0 Z5
100

G01 Z0 F30
M98 P0063456
G01 Z5
G91 G28 Z0
G28 X0 Y0 100 mm

G90
M05 M30

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 56


SIMULATION LABORATORY : [2022]

O3456
G91 G01 Z-1 F30
G90
G01 X100 Y0
X100 Y100
X0 Y100
X0 Y0
X5 Y5
X95 Y5
X95 Y95
X5 Y95
X5 Y5
X10 Y10
X90 Y10
X90 Y90
X10 Y90
X10 Y10
G42 G01 X18 Y18
X82 Y18
X82 Y82
X18 Y82
X18 Y18
X50 Y18
X50 Y10
G40
G01 X0 Y0
M99

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 57


SIMULATION LABORATORY : [2022]

Circular Pocket Milling


MP 3.Write a part program to perform the Circular Pocket Milling operation on a workpiece of
dimensions 100mm100mm10 mm. The pocket’s dimension is R376mm depth and is located
at the centre of the workpiece. Use a cutter diameter of 10 mm. Take program zero at the top
face center of the workpiece.
O1123
G21 G94
G91 G28 Z0
G28 X0 Y0
G90
M06 T01
M03 S1000
G00 X0 Y0 Z5
G01 Z0 F30
M98 P0065973
G01 Z5
G91 G28 Z0
G28 X0 Y0
G90
M05
M30
O5973
G91 G01 Z-1 F30
G90
G01 X5 Y0
G03 X-5 Y0 R5

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 58


SIMULATION LABORATORY : [2022]

X5 Y0 R5
G01 X10 Y0
G03 X-10 Y0 R10
X10 Y0 R10
G01 X15 Y0
G03 X-15 Y0 R15
X15 Y0 R15G01 X20 Y0
G03 X-20 Y0 R20
X20 Y0 R20
G01 X25 Y0
G03 X-25 Y0 R25
X25 Y0 R25
G01 X30 Y0
G03 X-30 Y0 R30
X30 Y0 R30
G41 G01 X37 Y0
G03 X-37 Y0 R37
X37 Y0 R37
X0 Y37 R37
G01 X0 Y25
G40
G01 X0 Y0
M99

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 59


SIMULATION LABORATORY : [2022]

MATLAB
1. Introduction- MATLAB basics, commands, variables, Arithmetical operations, scripts,
Matrix operations, Polynomials, Programming in MATLAB, Basic 2D Plots.

2. Solve problems related to engineering mechanics

Solve beam problems for deformation, stress, SFD and BMD results

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 60


SIMULATION LABORATORY : [2022]

Exercise: 4 - Simulation of Turning, Drilling and Milling operations (CNC Programming)

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 61


SIMULATION LABORATORY : [2022]

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 62


SIMULATION LABORATORY : [2022]

PART-B
MATLAB – Exercises

1. Introduction to vector and Matrix conventions and their manipulations, Variables, scripts,
and operations

 MATLAB is a high-level technical computing language and interactive environment for


algorithm development, data visualization, data analysis, and numeric computation.
 Using the MATLAB product, you can solve technical computing problems faster than
with traditional programming languages, such as C, C++, and Fortran.
 You can use MATLAB in a wide range of applications, including signal and image
processing, communications, control design, test and measurement, financial modelling
and analysis, and computational biology.
 Add-on toolboxes (collections of special-purpose MATLAB functions, available
separately) extend the MATLAB environment to solve particular classes of problems in
these application areas.
MATLAB provides a number of features for documenting and sharing your work. You can
integrate your MATLAB code with other languages and applications, and distribute your
MATLAB algorithms and applications. Features include:

 High-level language for technical computing


 Development environment for managing code, files, and data
 Interactive tools for iterative exploration, design, and problem solving
 Mathematical functions for linear algebra, statistics, Fourier analysis, filtering,
optimization, and numerical integration
 2-D and 3-D graphics functions for visualizing data
 Tools for building custom graphical user interfaces
 Functions for integrating MATLAB based algorithms with external applications and
languages, such as C, C++, Fortran, Java™, COM, and Microsoft® Excel®

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 63


SIMULATION LABORATORY : [2022]

Making Folders
 Use folders to keep your programs organized
• To make a new folder, click the ‘Browse’button next to ‘Current Directory’
• Click the ‘Make New Folder’button, and change the name of the folder. Do NOT use spaces
in folder names. In the MATLAB folder, make two new folders: IAPMATLAB\day1
• Highlight the folder you just made and click ‘OK’
• The current directory is now the folder you just created

Help/Doc
 The most important function for learning MATLAB on your own
help
•To get info on how to use a function:
help sin
Help lists related functions at the bottom and links to the doc
To get a nicer version of help with examples and easy-to-read descriptions:
doc sin

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 64


SIMULATION LABORATORY : [2022]

arithmetic operations

Using MATLAB as a calculator

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 65


SIMULATION LABORATORY : [2022]

Rules about variable names

Assignment operator

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 66


SIMULATION LABORATORY : [2022]

Complex numbers
Example :
Given z=3-5*i
>> real(z)

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 67


SIMULATION LABORATORY : [2022]

ans =
3
>> imag(z)
ans =
-5

>> abs(z)
ans =
5.8310
>> angle(z)
ans =
-1.0304

Examples of elementary functions

Examples for Trigonometric Math function

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 68


SIMULATION LABORATORY : [2022]

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 69


SIMULATION LABORATORY : [2022]

Example:

Matrix Operations

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 70


SIMULATION LABORATORY : [2022]

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 71


SIMULATION LABORATORY : [2022]

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 72


SIMULATION LABORATORY : [2022]

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 73


SIMULATION LABORATORY : [2022]

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 74


SIMULATION LABORATORY : [2022]

Polynomials

 A polynomial is a function of a single variable that can be expressed in the following


form:
 where the variable is x and the coefficients of the polynomial are represented by the
values a0, a1, … and so on.
 The degree of a polynomial is equal to the largest value used as an exponent.

Ex:

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 75


SIMULATION LABORATORY : [2022]

Graphics
 MATLAB has many commands that can be used to create plots
 basic 2-D plots,
 specialized 2-D plots,
 3-D plots, mesh and surface plots.

Basic 2-D Plots


 The basic command for producing a simple 2-D plot is
plot(x values, y values, ‘style option’)
where
x values and y values are vectors containing the x- and y-coordinates of points on the graph.
Style option is an optional argument that specifies the color, line-style and the point-marker
style.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 76


SIMULATION LABORATORY : [2022]

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 77


SIMULATION LABORATORY : [2022]

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 78


SIMULATION LABORATORY : [2022]

Script files
Operations in MATLAB can be in two ways:

1.In the interactive mode: all commands are entered directly in the Command window,
2.In the script file mode: By running a MATLAB program stored in script file. This type of file
contains MATLAB commands, so running it is equivalent to typing all the commands—one at a
time—at the Command window prompt. You can run the file by typing its name at the Command
window prompt.

Scripts are
 collection of commands executed in sequence
 written in the MATLAB editor
 saved as MATLAB files (.m extension)
 To create an MATLAB file from command-line
»edit helloWorld.m
•or click

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 79


SIMULATION LABORATORY : [2022]

1.The name of a script file must begin with a letter, and may include digits and the underscore
character, up to 63 characters.
2.Do not give a script file the same name as a variable.
3.Do not give a script file the same name as a MATLAB command or function. You can check to
see if a command, function or file name already exists by using the exist command.

Exercise 1: Scripts

Make a helloWorld script


•When run, the script should display the following text:
Hello World!
I am going to learn MATLAB!
•Hint: use disp to display strings. Strings are written between single quotes, like 'This is a
string'
•Open the editor and save a script as helloWorld.m. This is an easy script, containing two lines of
code:
% helloWorld.m
% my first hello world program in MATLAB
disp('Hello World!');
disp('I am going to learn MATLAB!');

Exercise 2
 The surface area of a sphere depends on its radius r as follows
 A=4Pi r^2
 Write a script file that prompts the user to enter the radius of sphere as input and
calculates the surface area of the sphere and displays the result
 Save your script file as sphere

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 80


SIMULATION LABORATORY : [2022]

 Write a new script file


 Save script file with name sphere
 Save file
 In command prompt enter the file name sphere and press enter
 (please note: name is case sensitive)
 Script file sphere will be executed

if/else/elseif

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 81


SIMULATION LABORATORY : [2022]

For loop

>> for i = 0:50:200


fprintf(‘%d\n’,i)
end

Relational operator

Logical operator

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 82


SIMULATION LABORATORY : [2022]

Exercise 2: Write a Script file for

Engineering Mechanics

1. Figure shows two forces, one 500 N and the other P applied by cables on each side
of the obstruction A in order to remove the spike. Write a MATLAB program to determine:
(a) the magnitude of P necessary to such that the resultant T is directed along the spike
(b) the magnitude of T
(c) plot P and T as a function of d. (Range of d between 1 and 20 mm).

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 83


SIMULATION LABORATORY : [2022]

% Range of d
d = 1:1:20;
% Define alpha
alpha = atan (5./d);
%Define beta
beta = atan(7./d);
% Compute force P
P = 500*sin(beta)./sin(alpha);
% Define force T
T=500*(sin (beta).*cot (alpha) +cos (beta));
plot (d, P,‘–*’, d, T,‘–p’)
xlabel (‘d (mm)’);
ylabel (‘Force (N)’);
legend(‘Force P’, ‘Net force T’);
grid on;

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 84


SIMULATION LABORATORY : [2022]

2. Figure shows a weight W hung from the end of a horizontal pole of negligible weight.
The pole is attached to the wall by a pivot and is supported by a cable attached to the wall
at a higher point. The tension T, in the cable is given by

Write a MATLAB program to (a) determine the distance (d) at which the cable can be
attached to the pole in order to minimize the tension in the cable, (b) plot the tension in
the cable as a function of d.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 85


SIMULATION LABORATORY : [2022]

3. Figure shows a frame in which the structural members support the 5 kN load. The
load may be applied at any angle α (–90º to + 90º). The pins at A and B need to be
designed to support the maximum force transmitted to them. Write a MATLAB
program to plot the forces at A and B as a function of α and find their maximum values
and corresponding angles α.

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 86


SIMULATION LABORATORY : [2022]

4. Write a MATLAB program to plot deflection, stress, shear and bending moment
diagrams for the beam shown in Fig

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 87


SIMULATION LABORATORY : [2022]

%cantilever beam
b = 20;
h = 10;
l = 1000;
E = 200000;
p = 1000;
disp('cross section area of beam is');
a =b*h
disp('moment of inertia');
I=(b*h^3)/12
x = 0:(l/10):l;
mbm=p*l;
y=-(p*x.^3)/(3*E*I);
plot(x,y), grid on
title('DEFORMATION PLOT')
savefig('defplot')
ht=-h/2:1:h/2;
stress=(mbm*ht/I);
plot(ht,stress), grid on
title('STRESS PLOT')
savefig('stessplot')
v1 = p;
plot (x,v1), grid on
title('SFD')
savefig('sfd')

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 88


SIMULATION LABORATORY : [2022]

bm=p*(l-x);
plot (x,bm), grid on
title('BMD')
savefig('bmd')

5. Write a MATLAB program to plot deflection, stress, shear and bending moment
diagrams for the beam shown in Fig

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 89


SIMULATION LABORATORY : [2022]

Publishing Reports

 use MATLAB 's built-in publisher for publishing reports of your MATLAB work as
attractive HTML or MS Word documents (other options such as LATEX and
PowerPoint are also available)

First , open a new file in the editor and enter the following lines

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 90


SIMULATION LABORATORY : [2022]

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 91


SIMULATION LABORATORY : [2022]

2. Representation of Fourier series

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 92


SIMULATION LABORATORY : [2022]

3. Plot bending moment and shear force diagrams for different beams
a. Cantilever
b. Simply supported beam
c. Fixed beams

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 93


SIMULATION LABORATORY : [2022]

5. Fins: Plot Heat transfer 1D (fin with different end conditions)

1. Mechanical Engg, Dept., Dayananda Sagar College of Engineering Bengaluru Page 94

You might also like