Lecture 3 3. Boolean operations –fundamentals 3.1 Basic logic functions 3.2 Further logic...

Preview:

Citation preview

Lecture 3

3. Boolean operations –fundamentals

3.1 Basic logic functions

3.2 Further logic operations

3.3 Establishing switching functions

3.4 Simplification of logic functions

3.5 Karnaugh-Veitch diagram

3.1 Basic logic functions

• As described in the previous, any computer and equally any PLC operates using the number system to the base 2.

• This also applies to the octal (2 powered by 3) and the hexadecimal systems (2 powered by 4).

• The individual variable can therefore assume only two values, „0" or "1".

• Special algorithms have been introduced to be able to link these variables - the so-called boolean algebra.

• This can be clearly represented by means of electrical contacts.

Basic logic functions – 2 Negation (NOT function)

Situation

Basic logic functions – 3 Negation (NOT function)

Description of the functionThe push button shown represents normally

closed contact (NCC). When this is unactuated, lamp H1 is illuminated, whereas in the actuated state, lamp H1 goes off.

Push button S1 acts as signal input (I), the lamp H1 forms the output (O).

The actual status can be recorded in a truth table.

Basic logic functions – 4 Negation (NOT function)

Block diagram (of the system)

• Push button S1 acts as signal input, the lamp H1 forms the output.

S1 H1

I O

Basic logic functions - 5 Negation (NOT function)

Truth table

Example Generally

The boolean equation is therefore as follows:

_

O = I (read: O equals Not I )

S1 H10 11 0

Basic logic functions – 6 Negation (NOT function)

Logic symbol

I O

Basic logic functions - 7 Negation (NOT function)

• If two negations are switched in succession, then these cancel one another

I1 O1=neg.I1=I2 O2=neg.I2=neg.neg.I1=I1

Basic logic functions - 8 Conjunction (AND function)

Situation

See the overview ( snap No.67)

Basic logic functions - 9 Conjunction (AND function)

Description of the function

If two normally open contacts (NOC) S1 and S2 are switched in series, the actuated lamp H1 is illuminated only if both push buttons are actuated.

Basic logic functions - 10 Conjunction (AND function)

Block diagram (of the system)

S1

S2

H1

Basic logic functions – 11 Conjunction (AND function)

Truth table example generally S1 S2 H1 I1 I2 O 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 1 1 1 1 1 1

Basic logic functions - 12 Conjunction (AND function)

Logic symbol

I1

I2

O&

Basic logic functions - 13 Conjunction (AND function)

Important equations

a . 0 = 0

a . 1 = a

a . Na =0

a . a = a

Basic logic functions - 14 Disjunction (OR function)

Situation

See the overview ( snap No.67)

Basic logic functions - 15 Disjunction (OR function)

Description of the function

If the 2 normally open contacts (NOC) S1 and S2 are switched in parallel, then the lamp H1 is illuminated whenever at least one push button is pressed.

Basic logic functions - 16 Disjunction (OR function)

Block diagram (of the system)

S2

S1

H1

Basic logic functions - 17 Disjunction (OR function)

Truth table

example generally

S1 S2 H1 I1 I2 O

0 1 0 0 1 0

0 1 1 0 1 1

0 1 1 0 1 1

0 1 1 0 1 1

Basic logic functions - 18 Disjunction (OR function)

Logic symbol

I1

I2

O>=1

Basic logic functions – 19 Disjunction (OR function)

Important equations

a + 0 = a

a + 1 = 1

a + a = a

a + Na = 1

3.2 Further logic operationsvarious realisations

The electrical realisation of a NOT -/AND-/OR-operation has already been described in previous.

Each of these operations can of course also be realised pneumatically or electronically.

Boolean algebra also recognises the following logic operations.

The following tables provide an overview of these.

Further logic operations various realisations -2

Further logic operations various realisations -3

3.3 Establishing switching functions

Deriving boolean equations from the truth table

Often, the basic logic operations shown in the previous section are not enough to adequately describe a function in control technology. Very often, there is a combination of different logic operations. The logic connection in the form of a boolean equation can be easily established from the truth table.The example below should clarify this:

Establishing switching functions-2

Example: Sorting station taskVarious parts for built-in kitchens are to be

machined in a production system (milling and drilling machine). The wall and door sections for certain types of kitchen are to be provided with different drill holes. Sen- sors B1 to B4 are intended for the detection of the holes.

Establishing switching functions-3

Situation

Establishing switching functions-4

• Parts with the following hole patterns are for the 'Standard' kitchen type. These parts are to be advanced via the double-acting cylinder 1.0.

• Technological process Logical variable B1 a

B2 b B3 c B4 d----------------------------------------------------------------- 1.0 y

Establishing switching functions-5

• Assuming that a drilled hole is read as a 1-signal, the following truth table results.

a

b d

c

Establishing switching functions-6

• Two options (Standard form disjunctive and Standard form conjunctive) are available in order to derive the logic equation from this table, which lead to two different expressions.

• The same result is obtained, of course, since the same circumstances are described.

Establishing switching functions-7

• Standard form, disjunctiveIn the disjunctive standard form, all conjunctions (AND-operations) of input variables with the result 1, are carried out as a disjunctive operation (OR-operation). With signal status 0, the input variable is carried out as a negated one and with signal status 1 as a non-negated one.

disjunction of minterms

Establishing switching functions-8

• In the case of the example given, the logic function is therefore as follows:

y=a.b.c.d+a.b.Nc.d+a.Nb.c.d+a.Nb.Nc.d++Na.b.Nc.d+Na.Nb.Nc.d

Negated variable x(complement of x)…………………………Nxnon-negated variable x ………………..…x

Establishing switching functions-9

Standard form, conjunctive

In the conjunctive standard form, all disjunctions (OR-operations) of the input variable producing the result 0, are carried out as a conjunctive operation (AND-operation). In contrast with the disjunctive standard form, in this instance, the input variable is negated with signal status "1" and a non-negated operation carried out with signal status „0".conjunction of maxterms

Establishing switching functions-10

logic function is therefore as follows:

y=(a+b+c+d). (a+b+Nc+d). (a+b+Nc+Nd). (a+Nb+c+d). (a+Nb+Nc+d). (a+Nb+Nc+Nd).

(Na+b+c+d). (Na+b+Nc+d). (Na+Nb+c+d).

(Na+Nb+Nc+d).

3.4 Simplification of logic functions• Both equations for the example given are

rather extensive• Standard form disjunctive – more clear,

shorter• Standard form conjunctive – here very

long• Criteria for using the disjunctive form or

conjunctive form: the decision is made in favour of the shorter form of the equation

• In this case disjunctive form is better (shorter)

Simplification methods• The aim of the simplification is to shorten

the total number of the literals (variables in true form …a, b,.. or variables in complemented form …Na, Nb….) and total number of logical operators (OR,AND,…) in the logical equation

• Two methods are usually used:– Boolean algebra – Karnaugh map (application of Boolean

algebra rules in a special way)

Postulates of Boolean algebra

Definition:A set B of elements (a,b,c, ….) with an

equivalence relation (denoted =), two binary operations, one of them denoted by + (disjunction) and the other denoted by . (conjunction) and a unary operation, complementation (denoted by ‘ or N) is a Boolean algebra if and only if the following postulates are satisfied:

Postulates of Boolean algebra-2

• P1 Associativity:

The + and . operations are associative

(a+b)+c=a+(b+c)=a+b+c

(a.b).c=a.(b.c)=a.b.c

• P2 Commutativity:

The + and . operations are associative

a+b=b+a

a.b=b.a

Postulates of Boolean algebra -3

• P3 Distributivity:

The two operations are distributive over each other

a+b.c=(a+b).(a+c)

a.(b+c)=a.b+a.c

Postulates of Boolean algebra-4

• P4 Identity elements:

There exists an identity element (denoted by 0, called zero) for the + operation and another (denoted by 1 and called one ore unity) for the . operation within B such that

a+0=a

a.1=a

Postulates of Boolean algebra-5

• P5 Complement

Each member of B has a complement within B such that if a’ (Na) is the complement of a, then

a+Na=1

a.Na=0

Postulates of Boolean algebra-6

It should be noted that 0 and 1, which denote two identity elements of the Boolean algebra, should not be misinterpreted as the numbers 0 and 1 of the ordinary algebra.

It should also be mentioned here that as in ordinary algebra, so also in a Boolean algebra, the . operation is performed before the + operation! (priority)

Thus a+b.c=a+(b.c)=/ (a+b).c

Fundamental theorems of Boolean algebra-1

• T1 Closure of Identity Elements

For all a e B

a+1=1

a.0=0

• T2 Equality Theorem

For all a,b,c e B if a+b=a+c and a.b=a.c, then b=c

Fundamental theorems of Boolean algebra-2

• T3 Complementarity Theorem

For all a,b e B if a+b=1 and a.b=0, then a=Nb and b=Na

T4

The identity elements 0 and 1 are complements of each other

0=N1 and 1=N0

Uniqueness properties of Boolean algebra

• T5

The identity elements 0 and 1 are unique.

• T6

The complement of an element is uniqueBounds of Boolean algebra

Laws of Boolean algebra-1

• T7 the law of involutionFor all a e B, N(Na)=a• T8 the law of idempotenceFor all a e B, a+a=aand a.a=a• T9 the law of absorptionFor all a,b a+a.b=aand a(a+b)=a

Laws of Boolean algebra-2

• T10 DeMorgan’s theorem

N(a+b)=Na.Nb

N(a.b)=Na+Nb

• T11 Bounds of Boolean algebra

Identity elements 0 and 1 constitute the lower and upper bouds respectivelly for all the elements of a Boolean algebra.

Laws of Boolean algebra-3• T12 Duality in Boolean algebra Every theorem in Boolean algebra has its dual,

which is also true.Notice, that all five postulates that form the basis

of Boolean algebra is presented in a pair of equations. An important property exhibited by the pairs is that one element of a pair can be obtained from the other by interchanging the + and . Operations and the identity elements 0 and 1.This property is known as the principle of duality and one of the pair of equations is called the dual of the other.

Two-valued Boolean algebra

• There are also for example eight-valued and four-valued Boolean algebra. In industrial control, PLCs and PCs we usually use two-valued , so called switching algebra

Simplification using Boolean algebra (previous example)-1

y=Na.Nb.Nc.d+Na.b.Nc.d+a.Nb.Nc.d+a.Nb.c.d+ +a.b.Nc.d+ a.b.c.d==Na.Nb.Nc.d+Na.b.Nc.d+a.Nb.Nc.d+a.Nb.c.d++a.b.d.(Nc+ c)==Na.Nb.Nc.d+Na.b.Nc.d+a.Nb.Nc.d+a.Nb.c.d++a.b.d=Na.Nc.d(Nb+b)+a.Nb.d(Nc+c)+ a.b.d== Na.Nc.d+ a.Nb.d+ a.b.d=

Simplification using Boolean algebra (previous example)-2

= Na.Nc.d+ a.Nb.d+ a.b.d=

= Na.Nc.d+ a.d(Nb + b) =

= Na.Nc.d+ a.d =

=d.(Na.Nc+a)= /absorption of negation/

=d(Nc+a)=

= Nc.d+a.d

Simplification using Boolean algebra (previous example)-3

• a+Na.b=a+b

• Na+a.b=Na+b

• a.(Na+b)=a.b

• Na.(a+b)=Na.b

Absorption of negation

Simplification using Boolean algebra (previous example)-4

• The basic principle of simplification is the factoring out of variables and reducing to defined expressions.

• However this method does require a sound knowledge of Boolean algorithms plus a certain amount of practice.

• Another option for simplification will be introduced in the following section

(Karnaugh map)

3.5 Karnaugh-Veitch diagramKarnaugh map

• The truth table has 16 rows ( 2 powered by 3, 3 is number of variables)

• The related Karnaugh map must have 16 positions for function values (eg. 4x4)

• Each position in K-map has its index (binary value related to the value of input variables combinations)

• Index has values from 0 to 15

The truth table and index• index (binary value related to the value of input

variables combinations - minterms) d c b a binary value index--------------------------------------------------Nd.Nc.Nb.Na 0 0 0 0 0Nd.Nc.Nb.a 0 0 0 1 1Nd.Nc.b.Na 0 0 1 0 2……..Nd.c.b.Na 0 1 1 0 6d.c.b.a 1 1 1 1 15

Karnaugh map - index

index Nc.Nd Nc.d c.d c.Nd

Na.Nb 0

0000

1

0001

3

0011

2

0010

Na.b 4

0100

5

0101

7

0111

6

0110

a.b 12

1100

13

1101

15

1111

14

1110

a.Nb 8

1000

9

1001

11

1011

10

1010

Karnaugh map – function values for our example

Index

y

Nc.Nd Nc.d c.d c.Nd

Na.Nb 0

0

1

1

3

0

2

0

Na.b 4

0

5

1

7

0

6

0

a.b 12

0

13

1

15

1

14

0

a.Nb 8

0

9

1

11

1

10

0

Karnaugh map – simplification-1

Index

y

Nc.Nd Nc.d c.d c.Nd

Na.Nb 0

0

1

1

3

0

2

0

Na.b 4

0

5

1

7

0

6

0

a.b 12

0

13

1

15

1

14

0

a.Nb 8

0

9

1

11

1

10

0

Karnaugh map – simplification-2

What variable values are common for all this rectangular ?

Nc.d

Karnaugh map – simplification-3

Index

y

Nc.Nd Nc.d c.d c.Nd

Na.Nb 0

0

1

1

3

0

2

0

Na.b 4

0

5

1

7

0

6

0

a.b 12

0

13

1

15

1

14

0

a.Nb 8

0

9

1

11

1

10

0

Karnaugh map – simplification-4

What variable values are common for all this rectangular ?

a.d

Karnaugh map – simplification-5

Function value is disjunction of this two possibilities:

Nc.d + a.d

OR

y=Nc.d + ad

Karnaugh map – simplification-6

• The combining statuses in the K-map must be in the form of a rectangle or a square

• The number of combining statuses must be a result of 2 power by x

• All „ones“ from the K-map must have related minterm in the resulting simplified function

• „one“ from the K-map can be used repeatly for a minterm

Literature

• Nripendra N. Biswas: Logic Design Theory,Prentice Hall International,1993,ISBN 0-13-010695-X

Recommended