INITIATION TO BOOLEAN ALGEBRA

Boolean algebra is the algebra of logic. It is a symbolic representation of statements that evaluate to TRUE or FALSE.

There are three basic operations : AND, OR and NOT.

The symbols used in this article are respectively : &, !, and '

We may write for instance : X=A&B. This means that X is true if and only if both A and B are true.

"You can park your car"="there is a space"&"parking is permitted"

The AND (&) operation follows the following rules : X=A&B

X A B
FalseFalseFalse
False FalseTrue
FalseTrue False
TrueTrueTrue

The OR (!) operation follows the following rules: X=A!B

X A B
FalseFalseFalse
True FalseTrue
TrueTrue False
TrueTrueTrue

The NOT ( ' ) operation follows the following rules: X=A'

X A
TrueFalse
FalseTrue

The symbols &,!,' are called boolean operators. You may combine several boolean operators in the same expression to render a given logical condition.

For instance : X=A!B&C'. This means that X is true if either A is true or if B is true and C is false.

The (NOT) operations are always executed first and apply to the operand that immediately precedes the operator. Then the & operations are executed. Then the ! operations.

You may - just like in numeric algebra- use brackets to alter the order in which the operations are executed.

For instance : X=A&(B!C) which means that X is true if A is true and either B or C is true. In this expression, the ! is executed first, the result becomes an operand used for the & operation.

"You can park"="There is a space"&("It is after 6PM"!"It is Sunday")

Here are certain basic theorems that often allow us to reduce - or simplify - complex boolean expressions .(I will leave you with the task of demonstrating them.)

A!A' is always TRUE
A&A' is always FALSE
A!A&B is equivalent to A
A!A'&B is equivalent to A!B
(A&B)' is equivalent to A'!B'
(A!B)' is equivalent to A'&B'

Both & and ! are distributive:
A&(B!C) is equivalent to A&B!A&C
A!(B&C) is equivalent to (A!B)&(A!C)

It is often practical to represent FALSE by 0 and TRUE by 1. In which case the language
becomes:
1&1 is 1
1&0 is 0
1!0 is 1
etc.

Boolean algebra is extensively used in relay logic or "ladder diagrams", and in electronic circuitry to build computers and other logic circuits.


However a ladder diagram cannot represent all boolean expressions. eg X=(A!B)'.

Various techniques have been developed to handle systematically the design of control sequences
using boolean algebra. Most people however use the "trial and error" method quite efficiently.

One very important boolean expression to remember is the MEMORY : M=(M!ON)&OFF'.

M becomes true when ON is true momentarily. M remains true until OFF becomes true momentarily. This expression is used to control motors with a START/STOP pair of momentary push buttons. It can just as well be used in more complex situations : all you have to do is define the boolean expression for ON (the set of conditions that make M true) and the boolean expression for OFF (the set of conditions that make M false).

RTES (Real Time Expert System) allows the basic boolean operators to co-exist in the same expression with conventional algebra operators (+,-,*,/,etc.) as well as comparison operators (greater-than, less-tan, greater-than-or-equal, less-than-or-equal) so that it becomes possible to handle logic that involves analog operands (variables) just as easily as strictly binary logic.

For example :

PUMP=(PUMP!LEVEL<BOTTOM)&(LEVEL<TOP)

Given two limits called BOTTOM and TOP, PUMP will start when LEVEL goes below
BOTTOM then keep on running until LEVEL reaches TOP. (Note how the memory is used here to create a dead-band)

Here is an example on how to use the Memory model to design a sequence.

We have an momentary input BUTTON and an output LIGHT.
Initially, BUTTON is released and LIGHT is off.
LIGHT comes on when we press BUTTON
LIGHT stays on when we release BUTTON
LIGHT goes off when we press BUTTON
LIGHT stays off when we release BUTTON

This is a sequence, since the last state is identical to the beginning state (thus, it can be repeated)

Using the memory model (on ! LIGHT)&(off)', on=LIGHT'&BUTTON and off=LIGHT&BUTTON
The rule for LIGHT would be:
LIGHT=(LIGHT'&BUTTON!LIGHT)&(LIGHT&BUTTON)'

The above rule may be used without any changes. However, as an illustration of how boolean algebra works, let's try and simplify it, using the basic theorems of boolean algebra:
LIGHT=(LIGHT!BUTTON)&(LIGHT&BUTTON)' [a!a'&b=a!b]
LIGHT=(LIGHT!BUTTON)&(LIGHT'!BUTTON') [(a&b)'=a'!b']
LIGHT=LIGHT&LIGHT'!LIGHT&BUTTON'!BUTTON&LIGHT'&BUTTON&BUTTON' [& is distributive]
LIGHT=LIGHT&BUTTON'!BUTTON&LIGHT' [a&a' is always false]
There is nothing else we can remove, so the rule is LIGHT=LIGHT&BUTTON'!BUTTON&LIGHT'

Try it. It does work.

Note: this would not work with a PLC, because PLC's do not have an Inference Engine - they do not think, they simply scan - so you must 'cover'the transition between BUTTON and BUTTON', using an 'auxiliary relay'.

Part 2 - Sequence Charts