PLC Lab File
PLC Lab File
Objective:
Theory:
Instruction Description
ADD Add two values
SUB Subtract two values
MUL Multiply two values
DIV Divide two values
MOD Determine the remainder after one value is divided by another
SQR Calculate the square root of a value
NEG Take the opposite sign of a value
ABS Take the absolute value of a value
In case of PLC various instructions are available which can be used for computational purpose.
The compute/math instructions evaluate arithmetic operations using an expression or a specific
arithmetic instruction. Various instructions PLC can support are as follows.
When these operations are carried out in the PLC, the type should be the same for source and
destination e.g. real, integer etc. You can use mix data types, but loss of accuracy and rounding
error occurs. The instruction may take more time to execute. A compute/math instruction
executes once each time the instruction is scanned as long as the rung-condition-in is true. Out of
the above; ADD, SUB, MUL and DIV instructions are available in the PLC simulator. The input
and output parameters associated with these instructions are:
Input Data
Description
Parameter Type
ADD instruction: The ADD instruction adds Source A to Source B and places the result in the
Destination. When the instruction is used in Relay Ladder the output parameter conditions are
defined as mentioned below.
Condition Action
rung-condition-in is
The rung-condition-out is set to false.
false
Condition Action
rung-condition-in is
The rung-condition-out is set to false.
false
MUL instruction: The MUL instruction multiplies Source A with Source B and places the result
in the Destination. When the instruction is used in Relay Ladder the output parameter conditions
are defined as mentioned below.
Condition Action
rung-condition-in is
The rung-condition-out is set to false.
false
DIV instruction: The DIV instruction divides Source A by Source B and places the result in the
Destination. When the instruction is used in Relay Ladder the output parameter conditions are
defined as mentioned below.
Condition Action
prescan The rung-condition-out is set to false.
rung-condition-in is false The rung-condition-out is set to false.
Experiment-02
Objective:
Theory
In the previous experiment the hardware and software associated with
Distributed Control System is discussed. In this experiment the software and
programming concept is discussed. There are several programming languages
used for logic development. The IEC 61131 standard part3 specifies these
languages as:
Definition name: This is the name by which the block is identified in the
library.
Usage name: This name can be user defined as per his/her convention.
Parameters: These are part of the function block available for standard
connection.
Execution number: The number by which the function block is executed.
Analog Input
Analog Output
Discrete Input
Discrete Output
Pulse Input
2.Math Library
Add
Comparator
Divide
Multiply
Subtract
Absolute value
Integrator
3.Logical Library
And
Or
Condition
Not
Negative Edge Trigger
Positive Edge Trigger
Multiplexer
De multiplexer
On Delay Timer
Off Delay Timer
Counter
Retentive Timer
Timed Pulse
Input Selector
Limit
PID
Ratio
Ramp
Filter
Scalar
Signal Characterizer
Signal Generator
Signal Selector
Splitter
Let us discuss about the commonly used Input/ Output library function blocks.
Logical Library:
Commonly used logical blocks under logical library are described here
OR Function Block:
OR function block is used as an OR operator. For 2 input OR gate if any one
inputs is high, the output of the functions block is high. The function block and
the truth table is as given below:
Let us look at how programming is done using these blocks. The details are
given in under procedure tab.
1. First left click on AI block available under IO tab. Drag this block to
required position preferably left side and vertically at center.
2. Now left click on AO block. Drag it and put it next to AI block.
3. Take the cursor to the color dot at the output side of AI block. Move it
by left clicking and take it to the color dot at the Input side of AO block.
4. Now click on Compile tab. If any compilation errors are there, it will be
shown. Otherwise Run tab gets activated.
5. When user clicks on Run tab, default value of AI will get displayed on
wired connection. To change the input value and observe the output
change, right click on the AI block. Select edit and enter an input value in
the range 0-100. You will observe the change at the AO block output.
When you click on the block, the properties of the block gets displayed at
left hand bottom corner. To delete the connection, click on the
wire question mark at the output side of the block and press delete key.
Other options like delete, disable and configure are available on right
clicking the block. For modifying the logic, user need to first press Stop
tab and enter into Configure tab. For clearing the workspace, Clear tab is
available.
1. First left click on digital input (DI) block to get it in the workspace.
Repeat this procedure for getting 2 DI blocks. They will be by default DI1
and DI2. Similarly get 1 DO block in the workspace.
2. Left click on any logic function block e.g. AND function from Logic Tab
available in the left hand panel.
3. Connect output of DI1 to one of the inputs of AND block.
Initially only one input connection is available with the logic block. As you
make DI connection with this input, another connection appears for this
logic block. Connect DI2 output to this second AND block input. Connect
output of AND block to input of DO. 4. Now click on Compile tab. If any
compilation errors are there, it will be shown. Otherwise Run tab gets activated.
5. Now change one of the inputs to AND gate by toggling DI value from 0 to 1.
Observe the DO status. 6. Change another input to AND gate in the similar
manner and observe DO status. 7. Verify the AND gate truth table by changing
DI status. Similarly verify the truth tables for OR and NOT Logic Gates.
Experiment-03
Objective:
Theory
Before toggling the Start, all the lamps namely Lamp_1, Lamp_2 and
Lamp_3 are OFF.
Experiment-04
Objective:
Theory
Logical delay
Process delay This internal clock is used as a reference when it is
necessary to have a logical delay in the program. Depending on
number of cycles of the clock the calculation of the delay is
calculated. The base time of the delay can vary for different
manufacturers e.g. 1ms, 10ms or 1s. It is based on the crystal
oscillator present in the controller whose time is taken as the
reference for the calculation.
Concept of Counter
In timer, the internal clock of the controller is considered for calculation
of the delay, the same clock can be used to calculate the external pulses
of the physical world. Suppose there is an application where inwe need
to count the number of balls entering the vessel. A limit switch as a
sensor can sense the ball as it comes to the vessel. The high to low
transition at the sensor output can be counted by taking the reference of
the internal clock pulse of the controller.
TYPES OF TIMERS
Three types of timers available in DCS are On delay, Off delay and
Retentive timer.
In Off Delay Timer, the output remains high until a high to low pulse is
applied at the input terminal. The output goes low after the time duration
specified has elapsed if a high to low transition is applied at input. The
functional block diagram and timing diagram of the same is shown
below:
In the above timers if the input signal changes its value back to original,
before the specified time duration is elapsed, the timer resets. It does not
retain its value. In order to overcome this problem retentive timer is
used. As the name suggests, it retains the value even if the input signal
changes back to original state before time duration has elapsed. These
type of timers are used in real time clocks where retention of time value
is important. The block diagram and timing diagram of the same is
shown below:
TYPES OF COUNTERS
Two types of counters are generally used in DCS.
1) Up Counter: Up Counter counts input pulses in incremental manner
i.e. it starts counting from 0 to the value specified as preset value. When
the preset value and no of counts becomes equal the output of the
counter becomes high.
2) Down Counter: Down Counter counts input pulses in decrement
manner i.e. it starts counting from the value specified in preset to 0
values. This can be done when input goes from high to low or low to high
as we select in the function block. When the preset decrements to 0
value, the output of the counter becomes high.
Note: The up and down counter function can be implemented in same
counter block. We need to select the type as up or down counting.The
input signal form in which counting is to be done i.e. from low to high or
from high to low is also selectable. The block diagram of counter and its
timing diagram: