0% found this document useful (0 votes)
35 views18 pages

PLC Lab File

Uploaded by

amitkumar5788
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views18 pages

PLC Lab File

Uploaded by

amitkumar5788
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Experiment-1

Implementation Of PLC Arithmatic Instructions

Aim: To Study computational / arithmatic instructions used in PLC ladder pogramming

Objective:

1. Study Comutational Instructions available in PLC


2. Understand the use of arithmatic instructions

Theory:

Implementation Of PLC Arithmatic Instructions

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

Enable input. If cleared, the instruction does not


EnableIn BOOL
execute and outputs are not updated

Source A REAL Value to add to Source B

Source B REAL Value to add to Source A

Output Parameter Data Type Description

EnableOut BOOL Enable output

Dest REAL Result of the math instruction

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

prescan The rung-condition-out is set to false.

rung-condition-in is
The rung-condition-out is set to false.
false

Destination = Source A + Source B.The rung-condition-out is set to


rung-condition-in is true
true
SUB instruction: The SUB instruction subtracts Source B from Source A 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
The rung-condition-out is set to false.
false

Destination = Source A - Source B.The rung-condition-out is set to


rung-condition-in is true
true

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

prescan The rung-condition-out is set to false.

rung-condition-in is
The rung-condition-out is set to false.
false

rung-condition-in is Destination = Source A*Source B.The rung-condition-out


true is set to true

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

Aim: To simulate analog and digital function blocks

Objective:

1. Study various Function Blocks available in DCS.


2. Develop FBD program using basic digital and analog function blocks.

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:

1. Ladder Logic (LD)


2. Structured Text (ST)
3. Instruction List (IL)
4. Sequential Flow Charts (SFC)
5. Functional Block Diagram (FBD)

Generally in DCS Functional Block Diagram (FBD) is used for programming


and Sequential Flow Charts (SFC) is preferred for batch control applications.

Functional Block Diagram (FBD) Basics:


This language basically is a graphical language wherein the users are allowed to
program elements in the form of blocks. The blocks then can be wired together
like electrical circuits. It describes a function between input and output
variables. It is a graphical method of programming DCS. Functional algorithms
and control strategies for a particular plant can be implemented by FBD. The
control modules are treated as unique entity in DCS system. Each function
block contains specific algorithm such as AI, AO, DI, DO, PID and the
parameters required for the algorithm. Function blocks ranges from simple input
conversion block to a complex control strategy.
Generally available Function blocks are:

1. Input/ Output (I/O)


2. Math
3. Logical
4. Timer/ Counter
5. Analog Control
6. Advanced control

A Typical Function block -

The description of the various parameters associated with this block:

 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.

Following functions blocks are generally available in the libraries.

1.Input Output library

 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

4.Timer / Counter Library

 On Delay Timer
 Off Delay Timer
 Counter
 Retentive Timer
 Timed Pulse

5.Analog Control Library

 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.

Analog Input function Block


Analog Input (AI) Function Block accesses a single Analog measurement value
and its status on the AI channel. In manual mode, when AI block is configured,
input has to be in engineering units as well as output is indicated in engineering
units on the screen. In automatic mode, output of the block will reflect process
variable value. Input to the block could be 4-20mA or digitally communicated
variable from HART based transmitter.

Analog Output function Block


Analog output (AO) function block assigns any output value to a field devices
like control valve through a specific AO channel. In manual mode, the output
parameter value can be set manually. In automatic mode, OUT is set
automatically based on set point and process variable value in engineering units.
A feedback can also be set for the output parameter.

Discrete (digital) Input (DI) Function Block


The Discrete Input (DI) Function blocks accesses a single digital input value
with its status between two states of the field devices. The block gives processed
physical input for other function blocks. In automatic mode, Process variable is
copied to output which can be either 0 or 1. In manual mode, the digital input
can be toggled manually and output follows the same.

Discrete (digital) Output (DO) Function Block


Digital Output block takes value from the process and writes it to specific
digital output channel. One can confirm physical output operation by
configuring a hardware discrete input to it. In automatic mode, when the signal
from process changes the output of the block which will be connected to AO
channel which in turn connects to field outputs e.g a solenoid valve, changes.

Logical Library:
Commonly used logical blocks under logical library are described here

AND Function Block:


AND function block is used as an AND operator. For 2 input AND gate if both
the inputs are high the output of the function block is high.
The function block and the truth table is as given below:

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:

NOT Function Block:


NOT function block is used as NOT operator, wherein if the input to the block
is high or active the output is opposite i.e. low and vice versa. The function
block and the truth table are as given below:

Let us look at how programming is done using these blocks. The details are
given in under procedure tab.

The procedure for using simulator is as follows:


Click on the link provided under simulator tab to open the simulator. You need
to configure the required logic.

Part 1: Understanding the operation of AI and AO function block

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.

Part 2: Understanding the operation of DI and DO function block


Follow same procedure as above to get the bolcks in the workspace and connect
DI and DO blocks. In RUN mode, change the digital input value to 0 from1 or
vice-versa and observe the effect.

Part 3: Understanding the operation of Logic function block


To configure the logic circuit, first reload the page by clicking Clear tab

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

Implementation Of On-Delay Timer


Aim : To develop an application using On-Delay timer.

Objective:

1. Study the timing diagram of On Delay Timer


2. Solve the assignment of Ton timer

Theory

Implementation Of On-Delay Timer


PLC timers instruction is used to activate or deactivate a device after a
preset interval of time.

Types of Timers available are:

1. On-Delay timer (TON)


2. Off-Delay timer (TOF)
3. Retentive timer on (RTO)

On-Delay Timer (TON)


It is used when an action is to begin a specified time after the input
becomes true. Consider an example wherein a certain step in the
manufacturing process is to begin 30 seconds after a signal is received
from a limit switch. The 30 seconds delay is the ON-delay timer's preset
value. The figure below shows a symbolic representation of the timer.
The instruction mainly includes three status bits namely EN, TT, DN.
Their significance is as follows:
Enable (EN) Bit: - The enable bit indicates the TON instruction is
enabled Timer-Timing (TT) Bit: - The timing bit indicates that a timing
operation is in process. Done (DN) Bit: - The done bit changes state
whenever the accumulated value reaches the preset
value. Accumulator (ACC) Bit: - The accumulated value specifies the
number of milliseconds that have elapsed since the TON instruction was
enabled. Preset (PRE) Bit: - The preset value specifies the value
(1msec units) which the accumulated value must reach before the
instruction sets the .DN bit.
The figure shows the timing diagram which illustrates the functioning of
all the bits in sequence.
The following example, after running, will illustrate the function of each
bit.

Before toggling the Start, all the lamps namely Lamp_1, Lamp_2 and
Lamp_3 are OFF.
Experiment-04

To study, understand and perform experiments on


timers and counters
Aim: To study, understand and perform experiments on timers
and counters.

Objective:

1. To understand timers and counters used in DCS


2. Development of application using Timer and Counter blocks

Theory

To study, understand and perform experiments on


timers and counters
Concept of Timer
The controller used in DCS has an inbuilt clock for its functioning. This
clock is used for executing the instruction cycle or scan cycle or in case
any of important actions.
There are two types of delay required or available in the entire operation

 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.

1) On Delay Timer (OND):

On delay timers are preferred in most of the applications. The example


to demonstrate the function and operation of a timer is a firecracker. The
firecracker when it is lighted it takes some time to burst because of the
lead present which we light. Thus after burning the lead, which is the
delay the cracker burst. Now in terms of On Delay Timer when a
high/true/active signal is given at the input, time duration specified, the
output of the timer block becomes high only after the specified time
duration is elapsed. The function block and timing diagram for On Delay
Timer is shown below:
2) Off Delay Timer (OFFD):

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:

3) Retentive Timer (RET):

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:

You might also like