Simulation Laboratory - Manual
Simulation Laboratory - Manual
Simulation Laboratory - Manual
IV Semester (19ME4DLSIL)
DEPARTMENT OF MECHANICAL ENGINEERING
Semester /Section :
USN :
Batch :
Semester /Section :
USN :
Batch :
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
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
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.
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
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.
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)
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.
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]
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.
Drawing detail
Procedure – Part Modeling
Procedure – Assembly
LIST OF SYMBOLS
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.
• 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:
ACCELERATION ANALYSIS
Linear Acceleration of Rectilinear Points
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
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.
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
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;
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.
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.
Result
displacements behavior
velocities behavior
accelerations behaviour
SIMULATION
Analyze Mechanisms
After completing this phase, you will be able to:
n Use Dynamic Simulation to analyze four-bar linkage mechanisms.
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.
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.
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.
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.
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.
Example 2
5. In the browser, under Standard Joints, right click Revolution:2. Click Properties.
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.
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.
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.
5. Click Cancel.
6. On the Simulation Player, click Rewind to the Beginning of the Simulation.
7. On the Simulation Player, click Run or Replay the Simulation. You can now see the motion
path of the two joints.
9. Do not return to the construction environment. You must be in the simulation environment to create
the animation.
Create an Animation
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.
4. Click OK.
8. In the Animate Parameters dialog box, under Action, for End, enter 300.
9. Under Time, click Specify.
13. On the Output tab, under Time Range, click Entire Animation.
14. Select the Launch Player check box.
15. Click Open an Existing Folder.
VEX - Unit 15
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
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).
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’.
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
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.
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
Format
N_ G00 X_ Z_
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.
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
_______
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
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
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…
…
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
POINT X Z
P1 7 0
N3 Z-15 P2 9 -2
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
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
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.
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
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.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
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
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)
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
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
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
MATLAB
1. Introduction- MATLAB basics, commands, variables, Arithmetical operations, scripts,
Matrix operations, Polynomials, Programming in MATLAB, Basic 2D Plots.
Solve beam problems for deformation, stress, SFD and BMD results
PART-B
MATLAB – Exercises
1. Introduction to vector and Matrix conventions and their manipulations, Variables, scripts,
and operations
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
arithmetic operations
Assignment operator
Complex numbers
Example :
Given z=3-5*i
>> real(z)
ans =
3
>> imag(z)
ans =
-5
>> abs(z)
ans =
5.8310
>> angle(z)
ans =
-1.0304
Example:
Matrix Operations
Polynomials
Ex:
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.
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.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
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
if/else/elseif
For loop
Relational operator
Logical operator
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).
% 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;
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.
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 α.
4. Write a MATLAB program to plot deflection, stress, shear and bending moment
diagrams for the beam shown in Fig
%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')
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
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
3. Plot bending moment and shear force diagrams for different beams
a. Cantilever
b. Simply supported beam
c. Fixed beams