0% found this document useful (0 votes)
21 views37 pages

D06 - PLC Programming II

Uploaded by

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

D06 - PLC Programming II

Uploaded by

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

PLC Programming

System Programming And Implementation


Control Task Definition and Planing of the Solution
❑ Control Task Definition
A user should begin the problem-solving process by defining the control task, that is,
determining what needs to be done.
Control task definition occurs at many levels. All of the departments involved
must work together to determine what inputs are required, so that everyone
understands the purpose and scope of the project. If the control task is currently
done manually or through relay logic, the user should review the steps of the
manual procedure to determine what improvements, if any, can be made.
❑ Control Strategy
This procedure commonly involves determining a control strategy, the sequence of
steps that must occur within the program to produce the desired output control.
think first, program later
Adopting this philosophy will shorten programming time, reduce debugging time,
accelerate start-up, and focus attention where it is needed—on design when
designing and on programming when programming.
Implementation Guidelines
There are many ways to approach a problem; but if the application is approached in a
systematic manner, the probability of mistakes is less.

New applications are new systems, while modernizations are upgraded existing control systems
that have functioned previously without a PLC (i.e., through electromechanical control or
individual, analog, loop controllers).
Program Organization and Implementation
❑ Creating flowcharts

Flowcharting is a technique
often used when planning a
program after a written
description has been developed.
A flowchart is a pictorial
representation that records,
analyzes, and communicates
information, as well as describes
the operational process in a
sequential manner.
Program Organization and Implementation
❑ Configuring the PLC system

PLC configuration should be considered during flowcharting and logic sequencing.


The PLC’s configuration defines which I/O modules will be used with which types of
I/O signals, as well as where the modules will be located in the local or remote rack
enclosures. The modules’ locations determine the I/O addresses that will be used
in the control program.
During system configuration, the user should consider the following:
• Possible future expansions;
• Special I/O modules, such as fast-response or wire fault inputs;
• Placement of interfaces within a rack (all AC I/O together, all DC and low-level
analog I/O together, etc.).
Consideration of these details, along with system configuration documentation,
will result in a better system design.
Program Organization and Implementation
❑ Real and internal I/O assignment

The assignment of inputs and outputs is one of the most important procedures that occurs
during the programming organization and implementation stages.
The I/O assignment table indicates which PLC inputs are connected to which input devices
and which PLC outputs drive which output devices.
The assignment of internals, including timers, counters, and MCRs, also takes place here.
These assignments are the actual contact and coil representations that are used in the
ladder diagram program.
In applications where electromechanical relay diagrams are available (e.g., modernization of
a machine or process), identification of real I/O can be done by circling the devices and then
assigning them I/O addresses
Program Organization and Implementation
❑ Real and internal I/O assignment
Example
For the circuit shown in the fugure,

(a) identify the real inputs and outputs


(b) assign the I/O addresses
(c) assign the internal addresses (if required)
(d) draw the I/O connection diagram

Assume that the PLC used has a modularity of 8


points per module. Each rack has 8 module slots, and
the master rack is number 0. Inputs and outputs can
have any address as long as the correct module is
used. The PLC determines whether an input or
output module is connected in a slot.
The number system is octal, and internals start at
address 10008.
Program Organization and Implementation
❑ Real and internal I/O assignment
Example
I/O address assignment table for real inputs and
outputs.
Program Organization and Implementation
❑ Real and internal I/O assignment
Example
I/O address assignment table for internal outputs.

I/O connection
diagram.
Program Organization and Implementation
❑ Register address assignment
The assignment of addresses to the registers used in the control program is another important
aspect of PLC organization.
The easiest way to assign registers is to list all of the available PLC registers. Then, as they are
used, describe each register’s contents, description, and function in a register assignment
table.
Program Organization and Implementation
❑ Elements to leave hardwired
Decide which devices will not be wired to
the controller.
These elements will remain part of the
electromechanical control logic.
• These elements usually include devices
that are not frequently switched off
after start, such as compressors and
hydraulic pumps.
• Components like emergency stops and
master start push buttons should also
remain hardwired, principally for safety
purposes.
This way, if the controller is faulty and
an emergency occurs, the user can
shut down the system without PLC
intervention.
Program Organization and Implementation
❑ Special input device programming
Normally Closed Devices. An input device that is wired as a normally open input can be
programmed to act as either a normally open or a normally closed device.
If a device is wired as a normally closed input and it must act as a normally closed input, its
reference address is programmed as normally open.

Wiring Programing Acting as

NO NO NO
NO NC NC
NC NO NC
NC NC NO
Program Organization and Implementation
❑ Special input device programming
Master Control Relays. In electromechanical circuit diagrams, an master control relay
(MCR) coil controls several rungs in a circuit by switching ON or OFF the power to those
rungs.

In a hardwired circuit, there is no In a PLC programinng, we can define


definite end to an MCR except when the thethe sections of the circuit that will be
circuit is followed all the way through. under the control of a PLC MCR
Program Organization and Implementation
❑ Special input device programming
Instantaneous Timer Contacts. Electromechanical circuits specifies an instantaneous timer
contact (the normally open TDR1 contact in line 10). This type of contact, however, is
usually unavailable in PLCs.
To implement an instantaneous timer contact (i.e., a contact that closes or opens once the
timer is enabled), the programmer must use an internal output to trap the timer, then use
the internal’s contact as an instantaneous contact to drive the timer’s logic.
Discrete I/O Control Programming
Modernization applications involve the transfer of a machine or process’s control from
conventional relay logic to a programmable controller.
Conventional hardwired relay panels, which house the control logic, usually present
maintenance problems, such as contact chatter, contact welding, and other
electromechanical problems. Switching to a PLC can improve the performance of the
machine, as well as optimize its control. The machine’s “new” programmable controller
program is actually based on the instructions and control requirements of the original
hardwired system.
Discrete I/O Control Programming
Example: Simple start/stop motor circuit

Using a midsized PLC capable of handling


Wiring diagram for a three-phase motor
up to 512 I/O points (000 to 777 octal)

Step 1: Determine which control devices will


be part of the PLC I/O system

Relay control circuit for a three-


phase motor
Discrete I/O Control Programming
Example: Simple start/stop motor circuit
Discrete I/O Control Programming
Example: Simple start/stop motor circuit

If the motor is running and the overloads


open, the motor will stop, but the circuit
will still be ON. Once the overloads cool off
and the overload contacts close, the motor
will start again immediately.
Discrete I/O Control Programming
Assignment: Forward/reverse motor interlocking
Discrete I/O Control Programming
Assignment 2: Continuous bottle-filling control
Implementing a control program that
1) detects the position of a bottle via a limit switch,
2) waits 0.5 seconds,
3) fills the bottle until a photosensor detects a filled condition
4) After the bottle is filled, the control program will wait 0.7 seconds before moving to the
next bottle.
The program will include start and stop circuits for the outfeed motor and the start of the
process.
Analog I/O control programming
Analog input comparison and data linearization

Task: Compare the input signal from a temperature transducer (0°C to 1000°C) with two
alarm set points (a low alarm and a high alarm).
• The PLC receives set point data via two sets of 4-digit switches (BCD).
• The valid range of this set point data is 100 to 850°C.
• The analog input module receives a signal, which is proportional to the temperature,
that ranges between –10 and +10 VDC.
• When the signal is over or under either of the two set points, an indicator light is
illuminated.
Analog I/O control programming
The analog input relationship between counts and degrees Celsuis
Analog I/O control programming
Analog I/O control programming
Subroutine 1100:
Check for valid TWS range and convert to decimal
Reading the low/high limit alarm
TWS (BCD)

Convert BCD to BIN

Go SUB to check the correct range

Reading the temperature

Go SUB to linearizing the temperature


(convert analog counts to degrees)

Comparing the measured temperature


and the low limit temperature Subroutine 1200:
Convert analog counts to degrees

Turn on the alarm (if necessary)

Comparing the measured temperature


and the high limit temperature

Turn on the alarm (if necessary)


PLC system documentation
Documentation is an orderly collection of recorded information about both the operation of a
machine or process and the hardware and software components of its control system. These
records are a valuable reference during system design, installation, start-up, debugging, and
maintenance.
• They will provide an easy way to communicate accurate information to all those involved
with the system.
• They will serve as a reference to the designer during and after the design phase.
• They will help the designer, or someone else, answer questions, diagnose possible
problems, and modify the program if requirements change.
• They will serve as training material both for the operators who will interface with the
system and for the maintenance personnel who will maintain it.
• They will allow the system to be reproduced or altered to serve other purp
PLC system documentation
PLC system documentation
❑ System abstract
A system abstract should provide
the following:
• A clear statement of the control
problem or task
• A description of the design
strategy or philosophy used to
implement the solution to the
problem, which defines the
functions of the major hardware
and software components of
the system, as well as why they
were selected
• A statement of the objectives to
be achieved
PLC system documentation
❑ System configuration
The system configuration is a system arrangement diagram. In fact, it is a pictorial drawing of
the hardware elements defined in the system abstract. It shows the location, simplified
connections, and minimum details of the system’s major hardware components (i.e., CPU,
subsystems, peripherals, GUIs, etc.).

If the programmable controller system


involves a network framework with other
components, the system configuration
should show a general block diagram of the
whole network (all nodes) and the major
devices connected to it.
PLC system documentation
❑ System configuration
If the programmable controller system involves a network framework with other
components, the system configuration should show a general block diagram of the whole
network (all nodes) and the major devices connected to it.
PLC system documentation
❑ I/O wiring connection diagram

An I/O wiring connection diagram shows the actual connections of field input and output
devices to the PLC module. This drawing normally includes power supplies and subsystem
connections to the CPU.
If the field devices are not wired directly to the I/O module, then the diagram should show
terminal block numbers
PLC system documentation
❑ I/O address assignment document
An I/O address assignment document identifies each field device by address (rack, group,
and terminal), the type of input or output module (e.g., 115 VAC, 24 VAC), the type of field
device (e.g., limit switch, solenoid), and the function the device performs in the field.
❑ Internal storage address assignment document
The internal address assignment document indicates the address, type, and function of
each internal in the program.
❑ Storage register assignment
Each available system register, whether a user storage register or an I/O register, should be
properly identified. Most applications use registers to store or hold information for timers,
counters, or comparisons.
❑ Variable declaration
A proper variable declaration, which includes the name of the input, output, or internal,
should be included in each of the assignment documents (e.g., I/O assignment, storage
register assignment).
PLC system documentation
PLC system documentation
❑ Control program printout
The control program printout is a hard
copy of the control logic program stored in
the controller’s memory. Whether stored
in ladder form or some other language, the
hard copy should be an exact replica of the
controller’s memory.
Discrete I/O Control Programming
Example: Wiring diagram for a three-phase motor and its corresponding three-wire control
circuit, where the auxiliary contacts of the starter seal the start push button.

S7-1200

Step 1: Determine which control devices will


be part of the PLC I/O system

Relay control circuit for a three-


phase motor
Discrete I/O Control Programming
Example: PLC implementation of the electromechanical circuit.
The hardware timer TMR1 requires
instantaneous contacts in the first rung,
which are used to latch the rung. If the
instantaneous TMR1 contacts are
implemented using a PLC timedelay
contact, then PB1 must be pushed for the
timer’s required time preset to latch the
rung. This instantaneous contact will be
implemented by trapping the timer with
an internal output.

S7-1200
Discrete I/O Control Programming
Example: PLC implementation of the electromechanical circuit.
Discrete I/O Control Programming
Example: PLC implementation of the electromechanical circuit.

You might also like