0% found this document useful (0 votes)
57 views33 pages

Assigment 2

The document discusses three examples of PLC programs for different applications. The first example is a pumping station that uses two sensors to control a pump based on the water level in a tank. The second example also involves a pumping station that automatically controls a pump based on high and low level switches. The third example is a heating system that uses thermostats and comparison instructions to maintain a temperature setpoint range by turning a heater on and off. For each example, the document discusses implementing the logic using ladder diagrams, statement listings, and functional diagrams in a PLC.

Uploaded by

Mostafa Elngar
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)
57 views33 pages

Assigment 2

The document discusses three examples of PLC programs for different applications. The first example is a pumping station that uses two sensors to control a pump based on the water level in a tank. The second example also involves a pumping station that automatically controls a pump based on high and low level switches. The third example is a heating system that uses thermostats and comparison instructions to maintain a temperature setpoint range by turning a heater on and off. For each example, the document discusses implementing the logic using ladder diagrams, statement listings, and functional diagrams in a PLC.

Uploaded by

Mostafa Elngar
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/ 33

Name: Mostafa Nasser Zaki

class: 301

subject: plc (assignment 2)


content:
Produce a report critically analysing how each example PLC
program makes use of PLC instructions. For each application
you should discuss the use of the following features in PLC,
annotating diagrams and structures where appropriate:

• Integrate Development Environments

• Ladder diagrams

• Statement listing

• Functional diagrams

• Graphical programming languages

• Mimic diagrams

• Sequential function charts (SFCs)

• Timers

• Counters

• Motion
• Integrate Development Environments:
Integrated development environments (IDE) are applications that
facilitates the development of other applications. Designed to
encompass all programming tasks in one application, one of the main
benefits of an IDE is that they offer a central interface with all the tools
a developer needs, An IDE, or Integrated Development Environment,
enables programmers to consolidate the different aspects of writing a
computer program.
IDEs increase programmer productivity by combining common
activities of writing software into a single application:
✓ Source code editor: Writing code is an important part of programming.
We start with a blank file, write a few lines of code, and a program is born!
IDEs facilitate this process with features like syntax highlighting and
autocomplete.
✓ Debugger: Debuggers are used during testing and can help
developers debug their application programs.
✓ Build tools: These can help automate developer tasks that are
more common to save time.
Example:
What Is Integrated Development
Environment (IDE)?
An integrated development environment (IDE) is a software suite that combines all
the development tools into a single graphical user interface (GUI). As a result, it
makes the development process more efficient and faster.
Some examples of popular integrated development environments
are NetBeans, Microsoft Visual Studio, Adobe Flex Builder, and Eclipse.
Now, let’s see the following features in an IDE that can improve overall productivity:

• Code editor – mainly used for writing and editing the source code. Many IDEs
also integrate with a text editor like an HTML editor that can highlight
keywords and syntax errors.
• Code completion – known as a code prompt, this feature is used to analyze
the entire code to identify and insert missing code components. Using it will
save time and minimize bugs or errors.
• Compiler – translates the plain text into a programming
language like JavaScript and Python so a computer can process it.
• Debugger – helps developers find and fix error codes in an application or a
website during the testing phase. For instance, debugging your
WordPress site will ensure its functionality and performance work well before
publishing it to users.
• Build automation tools – these are used to automate creation and software
development processes, such as compiling the source code into machine
code, packaging the binary code, and running automated tests.
• Programming language support – most IDEs are dedicated to a specific
programming language. For example, Xcode is used to develop macOS with
the Objective-C and Swift languages. However, some IDEs also offer multiple
languages like Eclipse and Komodo IDE.
• Version control – enables developers to track any changes they’ve made. It
also can help the IDE connect with the source repository they use.

• Ladder diagrams
Example (1) in pumping station
There may be three cases in this scenario.

1. Case-1
In the first case, there is no water present in the tank. So, both the sensor-1 and
sensor-2 are in their ideal status.
2. Case-2
In the second case, there is some amount of water in the tank or we can say that the
water tank is half filled up. So in this case sensor-1 detects that there is water inside the
tank, but sensor-2 is in its ideal status. There is no water at sensor-2. It means that the
tank is not filled fully with water.

3. Case-3
The third case represents that the tank is filled fully with water. There is water at both
sensor-1 and sensor-2.

In both the first and second cases, we have to give the motor to remains ON because
the tank is only partially filled with water. But in the third case, we have to stop the
motor because in this case tank is filled fully with water.

PLC Ladder Logic Conversion


To implement this logic in PLC programming, let’s consider sensor1 as I0.0 and
sensor2 as I0.1 inputs and the motor will be as Q0.0 output.
Let’s implement this logic in the ladder language.

Efficiency in this step: the program is worked successfully


Example (2) in pumping station
➢ Auto: if Auto Mode selected in Local Control Panel, then pump will be
logically controlled based on Low Level Switch and High-Level Switch
➢ When the water level reaches low level then pump will be stopped.
➢ if the level of the water reaches high point, the pump will start so that
the water can be drained and thus lowering the level.
➢ Indication Panel: This panel contains LEDs to show the status of the
water level control. It has Pump Running, Low Level & High-Level
Signals
➢ If pump is running then the Pump Running status lamp will be ON.
➢ then, if Low Level Switch activated then Low-Level Status lamp will be
ON.
➢ if High Level Switch activated then High-Level Status lamp will be ON.

Efficiency in this step: the program is worked successfully


Example (3) in heating system
ON/OFF Control system is a commonly used method to control temperature.
Comparison instructions, that are Less than or equal and Greater than or
equal are set to control the temperature range.

A Less than or equal logic energize when the input value is less than or equal
to the setpoint.

A Greater than or equal logic energize when the input value is greater than or
equal to the setpoint.

Ladder Diagram for ON/OFF temperature control

S1 connected in the first line and the last line of the above ladder diagram is
programmed to the heater output circuit to control the circuit.

MOV instruction carries and displays the output values of the temperature
measuring device, MOV instruction addresses a thermocouple here.

All the MOV, LEQ, GEQ are addressed to the same integer file.

Source A in both LEQ and GEQ are the thermocouple current output, which is
compared with the setpoint value at the source B.

Setpoint for LEQ will be the lower range value and for GEQ it is the upper
range value.

Now, look at the ladder diagram above.

• If source A < source B of the LEQ logic, then the low temp and heater
output becomes TRUE. The heater remains to ON as long as these
two conditions satisfies - Low temp output is TRUE and High temp
output is FALSE.
• Even if the Low temp output turns FALSE the heating continues until
the High temp turns TRUE. Look at the latch in the last line of the
ladder diagram.
• The heater continues to be ON until the temperature reaches the upper
range value.
• When the temperature reaches higher range value, the source A will
be equal to source B of the GEQ logic. Then the High temp becomes
TRUE.
• The heater turns OFF when the High temp becomes TRUE.
• The heater remains OFF until the temperature reaches the lower range
value. And starts again.
The cycle is repeated to maintain an average setpoint temperature.

Efficiency in this step: the program is worked successfully


• Statement listing:
Example (1) in pumping station:
There may be three cases in this scenario.

1. Case-1
In the first case, there is no water present in the tank. So, both the sensor-1 and
sensor-2 are in their ideal status.
2. Case-2
In the second case, there is some amount of water in the tank or we can say
that the water tank is half filled up. So in this case sensor-1 detects that there is
water inside the tank, but sensor-2 is in its ideal status. There is no water at
sensor-2. It means that the tank is not filled fully with water.
3. Case-3
The third case represents that the tank is filled fully with water. There is water
at both sensor-1 and sensor-2.
In both the first and second cases, we have to give the motor to remains ON
because the tank is only partially filled with water. But in the third case, we have
to stop the motor because in this case tank is filled fully with water.

Efficiency in this step: the program is worked successfully


Example (2) in pumping station
A water tank controlled by a plc device consisting of 2 water sensors
at the top and bottom of the tank that switches to delivery mode
when immersed in water, a water pump and a valve to empty the
tank, knowing that the emptying valve works automatically after
filling the tank.
Efficiency in this step: the program is worked successfully
Example (3) in heating system
temperature control system consists of four thermostats controlling three
heating units. The thermostat contacts are set to close at 50°, 60°, 70°, and 80°F,
respectively. The PLC ladder logic program is to be designed so that at a
temperature below 50°F, three heaters are to be ON. Between 50°F to 60°F, two
heaters are to be ON. For 60°F to 70°F, one heater is to be ON. Above 80°F,
there is a safety shutoff for all three heaters in case one stays on because of a
malfunction. A master switch is to be used to turn the system ON and OFF.
Identify a typical PLC program for this control process
Efficiency in this step: the program is worked successfully
• Functional diagrams
Example (1) in pumping station
A water tank controlled by a plc device consisting of 2 water
sensors at the top and bottom of the tank that switches to
delivery mode when immersed in water, a water pump and a
valve to empty the tank, knowing that the emptying valve works
automatically after filling the tank.
Efficiency in this step: the program is worked successfully
Example (2) in pumping station:
There may be three cases in this scenario.
1. Case-1
In the first case, there is no water present in the tank. So, both the sensor-1 and
sensor-2 are in their ideal status.
2. Case-2
In the second case, there is some amount of water in the tank or we can say
that the water tank is half filled up. So in this case sensor-1 detects that there is
water inside the tank, but sensor-2 is in its ideal status. There is no water at
sensor-2. It means that the tank is not filled fully with water.
3. Case-3
The third case represents that the tank is filled fully with water. There is water
at both sensor-1 and sensor-2.
In both the first and second cases, we have to give the motor to remains ON
because the tank is only partially filled with water. But in the third case, we have
to stop the motor because in this case tank is filled fully with water.

Efficiency in this step: the program is worked successfully


Example (3) in heating system
temperature control system consists of four thermostats controlling three
heating units. The thermostat contacts are set to close at 50°, 60°, 70°, and 80°F,
respectively. The PLC ladder logic program is to be designed so that at a
temperature below 50°F, three heaters are to be ON. Between 50°F to 60°F, two
heaters are to be ON. For 60°F to 70°F, one heater is to be ON. Above 80°F,
there is a safety shutoff for all three heaters in case one stays on because of a
malfunction. A master switch is to be used to turn the system ON and OFF.
Identify a typical PLC program for this control process

Efficiency in this step: the program is worked successfully


• Graphical programming languages:
graphical programming languages for PLCs are programming languages that
use graphical symbols and diagrams to represent the logical structure and
operation of a control system. Some of the most common graphical
programming languages for PLCs include:
Ladder Diagrams (LD): As I mentioned earlier, ladder diagrams are based on
the electrical circuit diagrams used in relay logic systems. They use a set of
vertical lines to represent power rails and horizontal lines to represent the
inputs, outputs, and intermediate steps of the program.
Function Block Diagrams (FBD): This graphical programming language
represents the logic of a control system as a collection of interconnected
function blocks. The function blocks are connected by input and output lines,
which carry signals between them.
Sequential Function Charts (SFC): SFCs use a series of interconnected steps
and transitions to describe the flow of control through a system. They are
used to represent the sequential operation of a process or system.
Overall, graphical programming languages for PLCs provide a visual
representation of the logical structure and operation of a control system,
making it easier for programmers to design and debug their programs.
• Mimic diagrams
Example (1) in pumping station

As shown in the below image, we have two sensors, Sensor1 will detect whether the
water is present in the tank and the Sensor2 will detect the tank is full of water
Example (2) in pumping station
PLC Program for Water Level Control

Logic Description:
• Auto : if Auto Mode selected in Local Control Panel, then pump will be
logically controlled based on Low Level Switch and High Level Switch
• Manual: if Manual Mode Selected in Local Control Panel, then irrespective
of Low-Level Switch & High-Level Switch Status, Pump will be controlled
manually using ON/OFF button in Local Control Panel.
• When the water level reaches low level then pump will be stopped.
• if the level of the water reaches high point, the pump will start so that the
water can be drained and thus lowering the level.
• Indication Panel: This panel contains LED’s to show the status of the
water level control. It has Pump Running, Low Level & High Level Signals
• If pump is running then the Pump Running status lamp will be ON.
• then, if Low Level Switch activated then Low-Level Status lamp will be ON.
• if High Level Switch activated then High Level Status lamp will be ON
Example (3) in heating system:
Example (1) example (2)

Example (3)

• Sequential function charts (SFCs)


Sequential Function Chart
Sequential Function Chart (SFC) can be used to structure the internal
organization of a program consisting of sub-programs and are also written in
other languages of the standard. It can also be used in its pure form of
specifying the logical control algorithms.
The SFC programming structure consists of three main elements that organize
the control program.

A program in SFC consists of

• Steps (Stages)
• Transitions
• Actions.
Stages

Each stage indicates the state of the process. A step can be active or inactive.

As shown in the figure below, a transition not only can have one input step
and one output step but also can have more input steps and more output
steps, connected by the directed links.

These sequential flow chart diagrams show the stages in sequential order
and are widely used to present algorithms, workflow, or process flow.

Typically, a sequential flow chart displays the steps as charts of various kinds.
Their order is established by connecting them with lines.

The stages involve associated actions.


Only some of the stages can be found active in each cycle of the process.

Each stage is identified with a number that must be unique and not it must
necessarily keep an order consistent with the sequence of the process.

Transitions
In between two steps, a transition is a step represented by a horizontal line
across a vertical line. It is containing the logic condition allowing the transfer
from one step to another.

Transitions are associated with a condition, these can be a logical function of


variables of input and internal system.

Actions
The actions associated with the stages are represented by a rectangle sidebox
where the type of action to be carried out is indicated (only the active ones). A
stage can have one or more actions associated with it.

The process is broken down into stages, which will be activated sequentially.

One or more actions are associated with each stage. These actions will only be
active when the stage is active.

The activation of a transition condition indicates the activation of the next


stage and the deactivation of the preceding stage.

Program operation
Sequential Flow Chart (SFC) steps are connected with each other same as
the flow chart. SFC is conducive to Boolean operation AND or OR decisions.
AND decisions are simply placed in series and OR decisions are placed in
parallel.

There are two ways to indicate conditions

• Symbolic and
• Literal

Between stage and stage, there must be a transition. The Transition conditions
are written to the right of the line that joins them. There may be a jump or step
backward seen same as flow charts.

A condition is associated with every transition. If all the input steps of a


transition are active, and the transition condition is satisfied then the transition
is fired, which means deactivation of all its inputs steps and activation of all its
output steps.
Timer: -
PLC timer is an element in ladder logic programming taken from
electrical systems. Timers are devices that count time increments. The
timer creates a delay in both PLC programming and in relay boards on
connection or instantaneous disconnection
Types of timer: -
The three main types of PLC timers:
• On-delay,
• Off-delay,
• Retentive on-delay.
• On-delay,
An ON-delay timer is a type of time delay relay used to control the
activation of a circuit by delaying the initiation of current flow. ON-
delay timers are typically used in applications where it is important to
ensure that a circuit is not activated until after a certain amount of
time has elapsed
What is an off-delay timer?
OFF-delay timers are a type of time delay relay that opens or closes the
circuit as soon as power is removed. The contacts will not return to
their normal position until the pre-set time delay has elapsed, at which
point the load is de-energized. OFF-delay timers are often referred to
as “delay on break” timers

•Off-delay

A off-delay (TOF) timer is a PLC programming instruction which use to switch off the
output or system after a certain amount of time. See here, a basic structure of AB PLC
Off delay timer programming instruction. In PLC programming, when the off-delay timer
is energized (True), it immediately turns ‘on’ its output.

•Retentive on-delay

Retentive ON delay timer is to delaying the ON time, if input goes off in


between, it will resumes the accumulator value and input turns ON, it
will start running for the resumed value. Example-VLC video player
plays video from the resumed placed if we closed and open the player
again
Example in pumping station:

Motion diagram of timers

In delay timer

It is the most used type

Explanation of the time chart for the timer with delay


From the attached photo

When the restart signal is interrupted, the timer returns to its value,
catches it, and the output state returns to its state

Off delay timer

When the timer starts, the image is opened. When RLO is turned on, the
timer takes its points at their origin and stops output Q.

If the signal is played on R, the timer will take its points to their origin and
stop running directly at the same moment
stored in the delay timer

And also lawsuits are held on the delay timer

This type of timer is similar to the regular On Delay

That is, when the signal is turned on at S, he puts it on the screen and
then turns on the Q output, and if the signal is turned off at S, the timer
does not stop counting

Any run on R is played

The type requires the use of Reset

pulse timer
When the output starts, the time starts, the schedule, with the help of, it
shuts it down at the right moment, it turns it off, it prints it stops the
output x

If the signal is separated from S at any moment or a signal is given on R:


the timer returns its points and stops output Q directly at that moment

Extended pulse timer

It is kind of similar to the pulse type timer with a difference

It studies the time it starts at the right time, at the right time, at the right
time, and sets it up and plugs in to stop the output Q

PLC Counter | What is a counter in PLC?


A PLC Counter is a function in PLC programming that is used to measure things like
how many times an event has happened in a process or how many times a product has
been produced.
In this blog, we are going to see how plc counters work? and how can we use counters
in the PLC program?
• counter
• Up Counter
• Down Counter
• Up and Down Counter

These are the blocks that are used as a counter in PLC ladder logic. All counter blocks
have some inputs and some outputs.

Inputs,
• CU – Count Up Input
• CD – Count Down Input
• S – Set Input for presetting counter
• PV – Value for presetting counter
• R – Reset Input
Outputs,
• Q – Status of Counter
• CV – Current counter value
• CV_BCD – Current counter value in BCD coded

Up Counter(S_CU)
For each pulse at Count Up(CU) bit, the current Counter Value(CV) will be increased by
1. When there is a pulse at Set input(S), it will set Presetting Value(PV) at the current
Counter Value(CV).

When there is a pulse at Reset input(R), the counter block will get reset and the current
counter value is set at 0 again.

Example,
There is an indicating alarm when the production limit reaches 100.

Down Counter(S_CD)
For each pulse at Count Down (CD) bit, the current Counter Value (CV) will be
decreased by 1. When there is a pulse at Set input(S), it will set Presetting Value (PV)
at the current Counter Value(CV).

When there is a pulse at Reset input(R), the counter block will get reset and the current
counter value is set at 0 again.

Example,
There is an alarm showing that the production limit has reached below 10.

Up Down Counter(S_CUD)

This block has both the count up and count down functions.

At each pulse at Count Up(CU) bit, it will increase the current Counter Value(CV), and
each pulse at Count Down(CD) bit, will decrease the current Counter Value(CV).
When there is a pulse at the Set input(S), it will set Presetting Value(PV) at the current
Counter Value(CV).

When there is a pulse at Reset input(R), the counter block will get reset and the current
Counter value is set at 0 again.

Example,
Suppose there is a limit of 50 vehicles in a parking lot. So it will show the vacant
positions and parking full indicator.
Subroutine instructions
There are two main instructions used for calling a subroutine and returning to the
calling routine. Figure 4 shows the network rung that calls a subroutine called
“Auto Mode”. It is going to call the subroutine at any time when the “System OK”
memory contact MB180 is true. So I hope you can feel now how your program is
more organized and readable when you go through the main program and easily
can catch what the program does by reading the names of the called subroutines.
Exactly, having a meaningful name for subroutines is very important to give the
advantage of the readability of your program. So, my friends please make sure
you chose a purposeful name for your subroutines.

Subroutine calling instruction


Also fig. 5 shows the network rung that represents the returning command to the
calling routine. It shows when the alarm is true represented by memory contact
MB32 and pump status “Stop Pump” represented by memory bit64, the return
command will be enabled for returning the execution point to the network just
next to the calling network in the calling program. For example, if the calling
network is at rung number 3, then the return command in the subroutine will
return the execution at rung number 4 in the calling routine. By the way, in most
cases of ladder logic programming, you might not find a return instruction
because it is inherently performed by completing the called subroutine but we
just include it here as in fig. 5 to show up how the process of calling a subroutine
and returning to the calling routine.
Return instruction in the called subroutine
Figure 6 depicts the whole image of the scenario of calling one subroutine. In rung 3, a
subroutine called “Auto mode” is being called by having the memory contact MB18
true. Then after that subroutine, “Auto mode” is completed it returns to the calling
routine at the next rung to the calling rung which is in this case example rung number
4. As we stated earlier, you can notice that there are now returning instructions but
automatically, the called subroutine returns to the calling routine at the instruction just
next to the calling instruction.

Fig. 6: the whole scenario of calling subroutine

You might also like