Chapter 7

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

MECHATRONICS

CHAPTER - 7

Basics of Digital Logic

By;- Mr. Kine T. ( Msc.)


1
• Digital Signals have two basic states:
1 (logic “high”, or H, or “on”)
0 (logic “low”, or L, or “off”)
• Digital values are in a binary format. Binary
means 2 states. These two states may represent
levels of ON or OFF, OPEN or CLOSE, YES or NO,
TRUE or FALSE e.t.c.
• A good example of binary is a light (only on or
off)

2
In Binary, there are only 0’s and 1’s

000 = 0
• Voltages are used to represent logic values:
001 = 1 • A voltage present (called Vcc )= 1
Binary to Decimal

010 = 2 • Zero Volts or ground (called Gnd) = 0


011 = 3
100 = 4 A simple switch can provide a logic high or a logic low.
101 = 5
110 = 6 Vcc
Vcc
111 = 7
Vcc, or 1 Gnd, or 0
…=…

3
• Basic Digital logic is based on 3 primary
functions (the basic gates):

– AND

– OR

– NOT

4
• The AND function:
– If all the inputs are high, the output is high
– If any input is low, the output is low
• “If this input AND this input are high, the
output is high”

5
Inputs Output

If both inputs are 1, the output is 1

If any input is 0, the output is 0

Example: Machine tool interlock control system


If the safeguard is in place and gives a 1 signal and the
powers is on, giving a 1 signal, then there will be an output, a
1 signal, the machine operates.

6
0
Inputs 0 Output
0

Determine the output

7
0
Inputs 0 Output
1

Determine the output

8
Inputs
1 Output
1 1

Determine the output

9
• To help understand the function of a digital device, a Truth Table is
used. The Truth Table tabulates the relationship between the
inputs and the output of a logic gate

Inputs Output
0 0 0

Every possible
0 1 0
input combination 1 0 0
1 1 1

AND Function

10
• It is possible to have AND gates with more
than 2 inputs. The same logic rules apply –
“if any input…”

A
B A+B+C ABC
C C
B

A A
B A+B+C ABC
B
C
C

11
• The OR function:
– if any input is high, the output is high
– if all inputs are low, the output is low
• “If this input OR this input is high, the output is
high”

12
Inputs Output

If any input is 1, the output is 1

If all inputs are 0, the output is 0

13
0
Inputs 0 Output
0

Determine the output

14
0
Inputs 1 Output
1

Determine the output

15
1
Inputs 1 Output
1

Determine the output

16
• Truth Table
Inputs Output
0 0 0
0 1 1
1 0 1
1 1 1

OR Function

17
• The NOT function:
– If any input is high, the output is low
– If any input is low, the output is high

• “The output is the opposite state of the input”

• The NOT function is often called INVERTER.

18
Input Output

If the input is 1, the output is 0

If the input is 0, the output is 1

19
Input 0 1
Output

Determine the output

20
Input 1 0
Output

Determine the output

21
• Truth Table
Input Output
0 1
1 0

NOT Function

22
• A circuit that utilizes more that 1 basic logic
function is called Combinational Logic.

• As an example, if a circuit has an AND gate


connected to an Inverter(NOT) gate, this
circuit has combinational logic.

23
• The NAND gate is the combination of an NOT
gate with an AND gate.

AND NOT NAND

Note: The circle in front of the NAND gate indicates an inverter.

24
• The NOR gate is the combination of the NOT
gate with the OR gate.

OR NOT NOR

Note: The circle in front of the NAND gate indicates an inverter.

25
Complete the Truth Table for the NAND and NOR Gates?

NAND NOR
Input Output Input Output
0 0 1 0 0 1
0 1 1 0 1 0
1 0 1 1 0 0
1 1 0 1 1 0
Hint: Think of the AND and OR truth tables. The outputs for the NAND and NOR are inverted.

26
The XOR gate
• The EXCLUSIVE-OR gate can be considered to be an OR gate with a NOT gate
applied to one of the inputs to invert it before the inputs reach the OR gate.
• Alternatively it can be considered as an AND gate with a NOT gate applied to one
of the inputs to invert it before the inputs reach the AND gate

Symbol A
A Q
B
Q

B NOT
Truth table
Boolean equation Inputs Output
A B Q
0 0 0
0 1 1
1 0 1
1 1 0
• Digital Electronics devices are usually in a chip
format.
• The chip is identified with a part number or a
model number.
• A standard series starts with numbers 74, 4, or
14.
– 7404 is an inverter
– 7408 is an AND
– 7432 is an OR
– 4011B is a NAND

28
• Basic logic chips often come
Pin 14 Pin 8
in 14-pin packages.
• Package sizes and styles
vary.
• Pin 1 is indicated with a dot
or half-circle
• Numbers are read counter-
clockwise from pin 1 (viewed
from the top)

Pin 1 Pin 7

29
• Chips require a voltage to
Pin 14 Pin 8
function

• Vcc is equal to 5 volts and is


typically pin 14

• Ground is typically pin 7

Pin 1 Pin 7

30
Voltage

The voltage and


ground pins must be
connected for the
device to function.
Check the specification
sheet to make sure.

Ground

Diagram from http://www.onsemi.com


31
A

D Diagrams from http://www.onsemi.com


32
IN

Vcc IN

OUT

Vcc Probe

33
Boolean algebra
• Defines the rules for expressing and binar log
statements.The
simplifing basic Boolean laws and identities y ic
follows laws
Fundamental
OR AND NOT

Comutative laws

Associative laws

Distributive laws
De Morgan’s laws
• Useful in rearranging or simplifying longer
boolean expressions or converting between AND and OR
gate:

 If we invert both sides of these equations and apply the double


NOT law we can write De Morgan’s law in the alternative form:
Design of logic
• networks
The following steps facilitate the design of a digital circuit to solve
a problem:
1) Define the problem in words.
2) Write the quasi-logic statement in English that can be translated
in to Boolean expression
3) Write the Boolean expression
4) Simplify and optimize the Boolean expressions if possible
5) Write an all-AND, all-NAND, all-OR, or all-NOR realization of
the circuitto minimise the number of required logic gate IC
components.
6) Draw the logic schematic for the electronic realization of the
circuit.
Example: simple security protection system for a
house
• Design a circuit for a simple secutity protection system for a
home.
• The home owner wants an alarm to sound if someone breaks
into the house through a door or window or if something is
moving around in the house while the occupants are
away.Under certain conditions, the users may also want to
disable portions of the alarm system.We assume that there are
sensors to detect if windows or doors are disturbed and to
detect motion.To accomplish the goals of this security system,
design a combinational logic circuit using two switches that
can be set by the owner.
Step 1:Define the problem in
1) words
An active state where the alarm will sound only if the windows or doors are
disturbed.This state is useful when the occupantsare sleeping.
2) An active state where the alarm will sound if the windows or doors are disturbed
or if there is motion in the house.This state is useful when occupantsare away.
3) A disable state where the alarm will not sound.This state is useful during normal
household activity.
 Define Boolean variables that will represent the inputs and outputs of the
circuit. A (input): state of the door and window sensors
B (input): state of the motion detectors
Y(output): output used to sound the alarm
CD(input): 2bit code set by the user to select the operating state defined by

Operating state 1
Operating state 2
Operating state 3
Step 2: write quasi-logic
statements
• We further translate the word
statements into logic like
statements.The quasi-logic statements for the security system
are:
Activate the alarm (Y=1) if A is high and the code
CD is 01 or
activate the alarm if Aor B is high and the code is 10.
• Note the italicized quasi-Boolean operators, which should aid
in writing the Boolean expression.
Step 3&4: Write the Boolean expression & simplify
• To create a product of 1 for the active control code 10, we need to
form the expresssion . Based on this, the complete Boolean
expression for the security system is

 The alarm will sound (Y =1) if the is 1


expresso
in or(Y = 0).
is 1; otherwise, the alarm will not sound
 The first expression will be 1 if and only if A is 1 and C is 0
and D is h
1te
; second expression will be 1 if and only if C is 1 and D is
0 and A or B is 1.
 Note that
0 0 0 0
1 0 0 1 and
0 1 1 0 For the given control code combinations,If we dis allow
CD=1 1 the above equation can be simplified as
Step 5: AND/OR
• It is desirablerealizati
onall operations to a prefered type of
to convert
gate(AND or OR). The reason for this is that logic gates come
packaged on integrated circuit chips in groups of four, six, or
eight. Therefore, we may be able to reduce the total number of
chips required by using all of one type of gate.
• Converting from one gate type to another is easily
accomplished with a repeated application of De Morgan’s
laws.
Step 6: Draw the circuit
• Case 1: Usindi
gaAND
gram& OR gates
only
C

A
Y

D
Step 6: Draw the circuit
• Case 2: UsindigaAND
gram& NOT
gates

A B C D

A.D

Y
~END
~
8.BASICS OF MICROPROCESSORS
INTRODUCTION
 For a simple control problem it is possible to solve it by
a
n electronic control system involving combinational
and sequential logic integrated circuits.
 Eg:sequencing of red, yellow, green lights at a traffic crossing
:Simple security protection system for a house
 However with a more complex situation there might be
many more variables to control in a more complex sequence.
 A more satisfactory approach in complex digital design
involves the use of a microprocessor-based system to
implement a software solution.
 Software is aprocedural program consisting of a set of
instructions to execute logic and aritmetic functions and
to access input signals and to control output signals.
 An advantage of a software solution is that, with out
making changes in hardware ,the program can be easily
modified to alter the mechatronic system functionality.
MICROPROCESSOR AND MICROCOMPUTER
 A microprocessor is a single, Very-Large Scale
Integration (VLSI) chip that contains many digital
circuits that perform arithmetic, logic, communication
and control functions.
 When a microprocessor is packaged on aprinted
circuit board with other components, such as interface
and memory chips, the resulting assembly is reffered
to as a microcomputer or single-board computer.
 Microcomputer has three sections
 CPU:- to carry out programs instructions
 Input & Output interfaces:-to
handle communication between the computer
and the outside world.
 Memory:- to hold program instructions and data.
BUSES
 Digital signals move from one section to another along pathes
called buses.
 A bus in a physical sence, is just a number of conductors
along which electrical signals can be carried.It might be tracks on a
printed circuit board or wires in a ribbon cable.
 Data bus:- Used to transport data from/to the CPU and the
memory or the input/output devices. Data length could be 4, 8, 16,
32, or 64 bit.
 Adress bus:- carries signal which indicates where data is to b e
found. Each memory location has an address that must be
specified before the contents of that location can be
accessed.
 Control bus:- Used to synchronize the operation of the different
elements.It transmits read and write signals, system clock signals,
and other control signals.
Address bus
Data bus
Control bus Memory CPU Input/Output
CENTRAL PROCESSING UNIT- CPU
 Processes the data by executing a program stored
in the memory.
 Consists of:
 Arithmetic and Logic Unit (ALU):- performs the
data manipulations or executes mathematical
functions on data structured as binary words.
 Registers:-are memory locations with in the
microprocessor and used to store information
involved in program execution.
 Control unit:- determines the timing and
sequence of operations. Responsible for the control
of address, data and control buses.
 All actions within µP synchronized to the CPU via a
clock signal
Registe
1. r
Accumulator register:- temporary holding register for data
to be operated on by ALU and after operation holds the
results.
2. Status register/flag register:- carries information
concerning the results of the latest process carried out
in ALU.
3. Program counter register:- it allows the CPU to keep track
of its position in the program.
4. Memory address register:- contains the address of data.
5. Instruction register :- stores instructions.
6. General purpose register:- temporary storage of
data or addresses, involved in the transfer
between registers.
7. Stack pointer register:- content of this register form an
address which defines the top of stack in RAM. Stack is a
Memor
y
 Memory units store binary data.
 Size of memory determined by the number of
wires in the address bus.
 Memory unit consists of large number of storage
cells with each cell capable of storing 0 or 1 bit.
 Storage cells grouped into a location
with each location storing a word.
 In order to access the stored
word each location is identified by a unique word.
 Size of memory specified in terms
of number of memory locations available.
 1K is 2^10=1024
 4K memory has 4096 locations.
Memory:-
Classification

CMOS Memories

RAM ROM’
s

SRAM DRAM ROM

EPROM EEPROM

Volatile Flash
Content lost when power off
Non-volatile
Content will be kept safely when power off
Memory:-
 RAM
Classification
(Random Access Memory):- can be read from or
written to at any time provided power is there.Data is
considered volatile because it is lost when power goes.
 ROM (Read Only Memory):- permanent storage of data that
CPU can read but CPU cannot write data on ROM. It does
not require a power supply to retain its data so called non
volatile memory.
 PROM(programmable ROM):- is used for ROM chips that
can b e programmed by the user.
 EPROM (Erasable & Programmable ROM):- data stored
can b e erased with ultraviolet light through a transparent
window at the top of the EPROM IC then new data can be
stored on the EPROM.
 EEPROM (Electrically Erasable & Programmable ROM):-
Uses a special programming pin (usually uses higher voltage)
to erase then write new program.
Input /
Output
 Communication to and from the microprocessor
occurs through I/O devices connected to the bus.
 External computer peripheral I/O devices are
keyboards, printers, displays, modems, network device.
 For Mechatronic applications A/D, D/A and digital
O
/I provides interfaces to switches, sensors and
actuators.
 Since the speed and characteristic of the peripheral
devices differ with microprocessor, microprocessor
are connected via an interface chip.
 Microprocessor accept valid data from interface
chip which is indicated by the interrupt or polling
(status bit set to 1).
 Polling is the process of repeated checking each
peripheral device to see if it is ready to send or accept
a new byte of data.
Microcontrolle
r
 The microcontroller contains a
microprocessor, memory, I/O capabilities, and
other on-chip resources.
 It is basically a microcomputer on a single IC.
 The components of a microcontroller are the:
 CPU
 RAM and ROM
 Digital Input/Output ports
 A/D and D/A converters
 Timers
 Popular microcontrollers that have being in
great demand for realizing mechatronics
systems are:
 Microchip's PIC;
 Motorola's 68HC11; and
 Intel's 8051.
Microcontroller
s
Motorola
M68HC11
Intel
8051
Cont
 …software stored in
The CPU executes the
ROM and controls all the microcontroller
components.
 The RAM is used to store settings and values used
by a
n executing program.
 The ROM is used to store the program and any
permanent data. A designer can have a program and
data permanently stored in ROM by the chip
manufacturer, or the ROM can be in the form of
EPROM or EEPROM, which can be reprogrammed by
the user.
 The digital I/O ports allow binary data to be
transferred to and from the microcontroller using
external pins on the IC.
 These pins can be used to read the state of
switches and on-off sensors, to interface to external
analog-to-digital (ADC) and digital-to-analog (DAC)
converters, to control digital displays, and to
control on-off actuators.
Cont
 … be used to transmit signals
The I/O ports can also
to and from other microcontrollers to coordinate
various functions.
 The ADC allows the microcontroller to convert
an external analog voltage (e.g. from a sensor)
to a digital value that can be processed or stored
by the CPU.
 The DAC allows the microcontroller to output an
analog voltage to a non-digital device (e.g. a motor
amplifier).
 Microcontrollers typically have less than 1 kB to
several tens of kilobytes of program memory,
compared with microcomputers where RAM
memory is measured in megabytes or gigabytes.
 Also, microcontroller clock speeds are slower
PIC MICROCONTROLLER
 In this course we will discuss the PIC
microcontroller unit (PIC MCU) manufactured by
Microchip Technology, Inc.
 There are many other microcontrollers on the market
today (such as those made by Atmel (AVR), Freescale
(HCS12), Intel (MCS-51 family), and Motorola (68HC)).
 The PIC microcontrollers are selected due to their
widespread use (several billions of PIC MCUs have been
manufactured so far), low cost, and ease of use.
Cont

 We will focus specifically on the PIC16F84 device,


which is a low-cost 8-bit microcontroller with EEPROM
flash memory for program and data storage.
 It does not have a built-in ADC, DAC or serial
communication capability, but it supports 13 digital
I/O lines and serves as a good learning platform
because of its low cost and ease of programming.
Features of the PIC16F84
 It microcontroller
has 35 single word instructions.
 It has 13 I/O pins for individual direction control.
 Operates on a regulated 5 V supply can be operated
with dry cells for long hours.
 The PIC16F84 is available as an 18-pin dual-in-line
package.
 These features are now summarized below.
 8-bit wide data bus CMOS microcontroller;
 1792 bytes of flash EEPROM program memory
 68 bytes of RAM data memory;
 64 bytes of non-volatile EEPROM data memory;
 1024 (1 kB) instructions capability;
 4 MHz clock speed (maximum 10 MHz);
 15 special function hardware registers;
 36 general purpose registers (SRAM);
Cont
 … on an 18-pin DIP IC that
The PIC16F84 is packaged
has the pin schematic (pinout) shown below. The figure
also shows the minimum set of external components
recommended for the PIC to function properly.
Cont…
 The five pins RA0 through RA4 are digital I/O pins
collectively referred to as PORTA, and the eight pins RB0
through RB7 are digital I/O pins collectively referred to as
PORTB.
 In total, there are 13
I/O lines, called bi-
directional lines
because each can be
individually configured
in software as an input
or output.
 Power and ground are
connected to the PIC
through pins Vdd and Vss.
The voltage levels (e.g.
Vdd = 5V and Vss
= 0V) can be provided using
a
d.c. power supply or
batteries (e.g. four AA
batteries in series or a 9 V
battery connected
Cont

 The master clear pin (MCLR) is active low and provides a reset
feature. Grounding this pin causes the PIC to reset and restart the
program stored in EEPROM.

 The PIC clock frequency can be


controlled using different methods,
including an external RC circuit, an
external clock source, or a clock crystal.
 Figure above shows the use
of a clock crystal to provide an
accurate and stable clock frequency
at relatively low cost.
Connecting a 4 MHz crystal across the
OSC1 and OSC2 pins with the 22 pF
capacitors grounded as shown, sets the
clock frequency.
Programming a PIC using assembly
language
 To use a microcontroller in mechatronics system
design, software must be written, tested, and stored
in the microcontroller ROM.
 Usually, the software is written and compiled
using a personal computer (PC) and then
downloaded to the microcontroller ROM as
machine code.
 If the program is written in assembly language,
the PC must have software called a cross-assembler
that generates machine code for the
microcontroller.
 An assembler is software that generates machine
code for the microprocessor in the PC, whereas a
cross-assembler generates machine code for a
different microprocessor, in this case the
Cont

 Various software development tools can assist in testing


and debugging assembly language programs written for a
microcontroller.
Cont
 … that runs on a PC and
Simulator: This is software
allows the microcontroller code to be simulated (run) on
the PC. Most programming errors can be identified and
corrected during simulation.
 Emulator: This is a hardware that connects a PC to the
microcontroller in a prototype mechatronics system. It
usually consists of a printed circuit board connected to the
mechatronics system through ribbon cables.
 The emulator can be used to load and run a program
on the actual microcontroller attached to the
mechatronics system hardware (containing sensors,
actuators, and control circuits).
 The emulator allows the PC to monitor and control
the operation of the microcontroller while it is
embedded in the mechatronics system.
 The assembly language used to program a PIC16F84
consists of 35 commands that control all functions of the
PIC.
 Every microcontroller brand and family has its own
specific instruction set that provides access to the
resources available on the chip.
Programming a PIC using
 C
PIC programs can be written in a form of C called
CC5X.
 The CC5X compiler can compile these programs,
producing their assembly language equivalents, and
this assembly code can then be converted to
hexadecimal machine code (hex code) that can be
downloaded directly to the PIC flash EEPROM through
a programming device attached to a PC.
 Once loaded, the program begins to execute when
power si applied to the PIC.
 NB:Here an introduction is present to some of the basic programming principles, and then provide some examples. A compiler
manual is available on the Internet and it is a necessary supplement to this section if the user needs to solve problems requiring
more functionality.

 The first set of codes defines the PICmicro device.


This si most commonly done in C by
#include "16F84.h"
 This statement will make reference to the header
file of the 16F84 device for register address and other
information. It must be noted that the header file
Cont
 One of the first tasks…in the main function is to
initialize and define the ports. This is done by the
following codes.
PORTA = 0b.0000.0000; //Initialize all Port A bits (first 5 bits)
TRISA = 0b.0000.0000; //Sets Port A bits as outputs (0-
output) PORTB = 0b. 0000. 0000; //Initialize all Port B bits
(all 8 bits) TRISB = 0b.1111.1111; //Sets Port B
bits as inputs (1- input)
 The first statement initializes the pins. If a nibble
high si required initially, these bits can be rewritten
as 1s. The first bit written is the MSB.
 The TRIS statement decides whether the bit is to
behave as an input or as an output. When a bit is
given TRIS= 1, it is an input, TRIS = 0 refers to
output. In both the statements, the last letter
determines the port. PORTA and TRISA refer to the
Cont
 … the definition of the PIC
Thereafter, in between
device and the main function, the pins have to be
assigned.
CC5X allows each pin to be named. This makes
the program logical to read and easy to
program.
 The following statement assigns bit 2 of port b
the name 'motor'. That means, in the source codes,
Motor will always refer to Port B bit 2.
bit Motor @ PORTB . 2 ;
 Once these are done, the actual programming
begins. The programming uses most of the features of
C.
 In order to send outputs, the pin names
(assignments) have to be referred to.
 If Port B bit 2 is to be turned high, the code will
read
Motor = 1 ;
Cont

 The rest of the operations such as generation of
pulses and duty cycles follow this. Implementing an
output response is the only way of testing inputs. Hence,
there can be conditional statements to check if the bit is
high or low.
 The following code will check a pin assigned the name
Trigger.
 If Trigger is high, motor will turn on.
I f (Trigger = = l)
{
motor = 1;
}
 C programs are compiled by CC5X and converted
into assembly. These then get transferred into hex files.
Hex files are downloaded to PIC.
 For more information (e.g. detailed descriptions and examples of each
assembly statement), refer to the PIC16F8X data sheet available on
Microchip's website (www. microchip. com).
Example:Security system
circuit
The CC5X source code for the example is given as
follows:
#include "16F84.H“ //Header of the PIC used
bit DOOR_WINDOW @ PORTB . 0 ; //assign bit 0 of Port B to DOOR_WINDOW
bit MOTION @ PORTB . 1 ;
bit C @ PORTB.2;
bit D @ PORTB.3;
bit ALARM @
PORTA. 0 ;
void main()
{ //Initialize all Port A bits (Low Nibble)
PORTA = Ob.0000.0000 ; //Sets Port A bits as outputs (0 - output)
TRISA = 0b.0000.0000 ; //Initialize all Port B bits (Low Nibble)
PORTB = 0b.0000.0000 ; //Sets Port B bits as inputs (1 - input)
TRISB = 0b.1111.1111 ; //Keeps alarm always running
while
if(C = =(1)
0&&D = = l && DOOR_WINDOW = = 1) //Operating State 1
{
ALARM = 1 ;
if (C = = l ScSc D = = 0)
{
i f (DOOR_WINDOW = = 1 | |MOTION = = l ) // Operating State 2
{
ALARM = 1 ;
}
}
}
}
Example:

LEDcircuit and write a CC5X
Design a PIC-based
code for switching two LEDs alternately.
The CC5X source code for the example is given as
follows: #include "16F84.H" //Header of the PIC used
bit switch @ PORTB.O;
bit LED1 @ PORTA. 1;
bit LED2 @ PORTA.2;
void main()
{ PORTA=Ob.0000.000
0 ; TRISA= //Initialize all Port A bits (Low Nibble)
0b.0000.0000 ; //Sets Port A bits as outputs (0 - output)
PORTB=0b.0000.0000 ; //Initialize all Port B bits (Low Nibble)
TRISB=0b.1111.1111 ; //Sets Port B bits as inputs (1 - input)
int counter = 0;
while(1)
{
if (switch = = l)
{ LED1=
1; LED2
= 0;
counter+
+;
}
if
(counter
= = 10)
{
LED2 = 1;
}
else
LED1 = 0 ;
LED2 = 0;
}
~END
~
6.Basic system models
Basic system models
• Mathematical models:
– Are equations which describe the relationship between the
input and output of a system.
– Used to forecast the behavior of system
– The basis is provided by physical laws that govern the
behavior of the system.
System building blocks :
– Systems can be made up from a range of building blocks.
– Each building block has single property or function.
– Eg: an electrical circuit system
• Made from resistor-assumed to have purely property of resistance
capacitor-purely that of a capacitance
inductor-that of an inductance
• By combining these building blocks in different ways a variety of
electrical circuit systems can be built up
– A system built up in this way is called lumped parameter
system. This is b/se each parameter, i.e. is property or 80
function, is considered independently.
Mechanical system building blocks
• l i n e a r s y s t e mer complex,
Mech a n ica ls ys tem s , h o w ev
have stiffness (or springiness), damping and inertia and can
be considered to be composed of basic elements which
can be represented by springs, dashpots and masses.
– Spring:-The 'springiness' or 'stiffness' of a system can be
represented by an ideal spring

– Dashpot:-The 'damping' of a mechanical system can be


represented by a dashpot(forces opposing motion).

– Mass:-The 'inertia' of a system, i.e. how much it resists


being accelerated can be represented by mass.
Energy flow
• Energy is needed to stretch a spring, accelerate mass and move the
piston in the dashpot.
• Both spring and mass stores the energy induced to them in
different forms and are able to release it back when they are not
subjected to a force.
• While, a dashpot dissipates the power rather than storing.
• Spring:- energy is stored as spring compression or extension
E=½ky2
• Mass:- energy is stored as kinetic (inertia) form
E=½mv2
• Dashpot:- there is no energy stored. It does not return to its
original position when there is no force input. Power is dissipated
in the form of friction, heat, light and noise.
P=cv2
• s y s t e mDiagram of
Step 1 : F re e B o dy

system
– (We have one mass so only one free body
diagram)
Net Force = F- k× y- c×
• Step 2 : Determine
dy Net force acting on
dt Mass

• Step 3 : Apply Newton’s Second Law (F = m a)

m y = Net Force = F- k× y- c×
d 2

dy
dt2
• Step 4 : Final Differential Equation
dt

d2 y
m 2  k× y c× 
dy
dt F
dt
MECHANICAL SYSTEM BUILDING BLOCKS
ROTATIONAL SYSTEM

• If there is rotation then the


equivalent three building blocks
are a torsional spring, a rotary
damper and the moment of
inertia:
– Torsional spring

– Rotational Dashpot

– Rotational Mass
Example:- Rotational Mechanical System
• Step 1 : Free Body Diagram of system
– (We have one rotational mass so only one free body
diagram)

• Step 2 : Determine Net Torque acting on Mass


d
Net Torque = T- k  - C dt
• Step 3 : Apply Newton’s Second Law
(T = I α)
d 2
I 2 = T- k -
ddt
C Equation
• Step 4 : Final Differential
dt
d 2
I 2  k  C =
ddt
T
dt
Electrical system building blocks
1. Resistor(Dissipates power in the form of electrical resistance)
For a resistor, resistance R, the potential difference v across it
when there is a current i through it is given by:

2. Inductor(Store energy in the form of magnetic field)


the potential difference v across it at any instant depends on
the rate of change of current i and is:
Cont…
3. Capacitor(Store energy in the form of electrical field)
the potential difference v across it depends on the charge q on
the capacitor plates with v= q/C, where C is the
capacitance.
Thus:

Since current i is the rate of change of movement of charge:


Energy flow
• Both the inductor and capacitor store energy
which can be released at later time.
• A resistor does not store energy but just dissipates
it.
• The energy stored by an inductor when there is a
current i is

• The energy stored by a capacitor when there is a


potential difference v across it is
88
Building up a model for an electrical
system
 The equations describing how the electrical building blocks
can be combined are Kirchhoff's laws. These can be expressed as:

 Kirchhoff’s current law


The total current flowing into any circuit junction is equal to the total
current leaving that junction, i.e. the algebraic sum of the currents at a
junction is zero.

 Kirchhoff’s voltage law


In a closed circuit path, termed a loop, the algebraic sum of the voltages
across the elements that make up the loop is zero. This is the same as saying
that for a loop containing a source of e.m.f., the sum of the potential drops
across each circuit elements is equal to the sum of the applied e.m.f.s.
provided taking in account their directions.
example
…Applying Kirchhoff’s voltage law gives:

Since i=C(dvc/dt), then di/dt=C(d2vc/dt2) and we can write:

The relationship between an input v and output vc is described by a second


order differential equation.
Example: Dc permanent magnet
• When a current flows through the armature coil,
forces act on it as a result of its current carrying
conductors being in the magnetic field provided
by the permanent magnet and so cause the
armature coil to rotate.

• For a coil rotating in a magnetic field, a voltage is


induced in it in such a direction as to oppose
the change producing it and so there is a back
e.m.f Thus, the electrical circuit we can use to
describe the motor has two sources of e.m.f,
that applied to produce the armature current
and the back e.m.f

• Two elements, an inductor and a resistor, are


used to represent the armature coil.
Electrical and mechanical analogies
• The building blocks for electrical and
mechanical systems have many similarities.
• Example:
– Electrical resistor does not store energy but
dissipates it with current i through the resistor, the
mechanical analogue of the resistor is a dashpot, it
does not store energy but dissipates it with force F.
– Taking the current as being analogues to the force,
then the potential difference is analogues to the
velocity and the dashpot constant c to the
reciprocal of the resistance . 92

– These analogues hold for the other building blocks


Hydraulic system building blocks
• In fluid flow system there are three common
building blocks which can be considered to be
equivalent of electrical resistance, capacitance,
and inductance.
• For such systems the input, the equivalent of
electrical current, is the volumetric rate of flow
q, and the output, the equivalent of electrical
potential difference is pressure difference (p - 1

p ).
2

• Hydraulic resistance(R): is the resistance to flow which occurs as a


result of a liquid flowing through valves or changes in pipe
diameter.
– The relationship betwepe1ntph2e voRluqme rate of flow of
liquid q through the resistance element and the resulting
Cont…
• Hydraulic capacitance ( C ) is the term
used to describe energy storage where
the hydraulic liquid is stored in the form
of potential energy.
• A height of liquid in a container so
called pressure head ,is one form of
such storage.
dV dh
q q  q  q A
– Fo1r su2 chdtsysteVm= tAhhe rate of ch ang e
1 2

volume V of liquid stored is equal to the


odfdifference
t between the volumetric rate at
which liquid enters the container q1 and
the rate at which it leaves q2.

Capacitance
Cont…
• Hydraulic inertance ( I ) is the
equivalent of inductance in
electrical. To accelerate a fluid a net
force is required and this i s
provided by the pressure differenc e

• Where a is the acceleration and so


the rate of change of velocity v.
• The mass of fluid being accelerated
is m=ALρ and the rate of flow q=Av
and so:
Example: Dynamic liquid container
• Develop a model for the hydraulic system shown in figure where there is a
liquid entering a container at one rate q1 and leaving at a rate of q2
Thermal system building blocks
• There are only two basic building blocks
for thermal systems: Resistance and
Capacitance
• There is a net flow of heat b/n two points if
there is a temperature difference b/n them. The
electrical equivalent of this is that there is only a
net current i b/n two points if there is a
potential difference v b/n them.
R
• – The thermal resistance R is the resistance offered to the rate
Thermal resistance ( R T)1  T2
of flow of heat q and is defined by:
q 
Cont…
• For heat conduction through a solid
T1  T2
q  Ak L
– A is surface area of solid wall, k is thermal conductivity of solid, L is length or
thickness of solid wall.
– Hence with mode of heat transfer

• For heat transfer by convection between


two points,
q  Ah(T1  T2 )

– h the coefficient of heat transfer


– Hence with mode of heat transfer 98
Cont…
• Thermal capacitance
– is a measure of the store of internal energy in a system. If the
rate of flow of heat into a system is q1 and the rate of flow
out q2 then the rate of change of internal energy of the
system is (q1 – q2).
– An increase in internal energy can result in a change in
temperature
change in internal energy=mc×change in temperature
– m is mass and c is specific heat of solid or medium
Rate of change of internal energy= mc x rate of change of temperature
dT dT
q 1 -q 2 =mc q1 -q =C
dt 2
dt
C = mc is thermal capacitance of system
Example: Thermal modeling room
• Determine a model for the temperature of a room containing a heater which
supplies heat at the rate q1 and the room loses heat at the rate q2

• Step 1 : combined thermal capacity C, since the energy rate to heat the room
is q1 – q2,

dT
q 1 -q 2 =C dt
• Step 2 : If the temperature inside the room is T and that outside the room To
then substituting for q2 in step 1 gives:

and
q  T  T0 q1  T  T0  C dT
• Step 3 : Final equ2ation R R
dt

dT
RC dt  T  Rq 1  0

T
~END~

You might also like