Perhaps the most important yet elusive concept to grasp when learning to program PLCs is the relationship between the electrical status of the PLC’s I/O points and the status of variables and other “elements” in its programming.
This is especially true for Ladder Diagram (LD) programming, where the program itself resembles an electrical diagram.
Making the mental connection between the “real” world of the switches, contactors, and other electrical devices connected to the PLC and the “imaginary” world of the PLC’s program consisting of virtual contacts and relay “coils” is most fundamental.
The first fundamental rule one should keep in mind when examining a Ladder Diagram PLC program is that each virtual contact shown in the program actuates whenever it reads a “1” state in its respective bit and will be at rest whenever it reads a “0” state in its respective bit (in the PLC’s memory).
If the contact is a normally-open (NO) type, it will open when its bit is 0 and close when its bit is 1. If the contact is a normally-closed (NC) type, it will close when its bit is 0 and open when its bit is 1.
A 0 bit state causes the contact to be in its “normal” (resting) condition, while a 1 bit state actuates the contact, forcing it into its non-normal (actuated) state.
Another rule to remember when examining a Ladder Diagram PLC program is that the programming software offers color highlighting ( Note 1 ) to display the virtual status of each program element: a colored contact is closed, while an un-colored contact is open.
While the presence or absence of a “slash” symbol marks the normal status of a contact, its live color highlighting shown by PLC programming software reveals the “conductive” status of the elements in real time.
Also Read : History of PLC’s
Note 1 : It should be noted that in some situations the programming software will fail to color the contacts properly, especially if their status changes too quickly for the software communication link to keep up, and/or if the bit(s) change state multiple times within one scan of the program. However, for simple programs and situations, this rule holds true and is a great help to beginning programmers as they learn the relationship between real-world conditions and conditions within the PLC’s “virtual” world.
Mis-conceptions of PLC Ladder Logic
The following table shows how the two types of contacts in a PLC’s Ladder Diagram program respond to bit states, using red coloring to signify each contact’s virtual conductivity:
Just as a pressure switch’s contacts are actuated by a high pressure condition, and a level switch’s contacts are actuated by a high level condition, and a temperature switch’s contacts are actuated by a high temperature condition, so a PLC’s virtual contact is actuated by a high bit condition (1). In the context of any switch, an actuated condition is the opposite of its normal (resting) condition.
The following simplified illustration (The electrical wiring shown in this diagram is incomplete, with the “Common” terminal shown unconnected for simplicity’s sake.) shows a small PLC with two of its discrete input channels electrically energized, causing those two bits to have “1” statuses.
The color-highlighted contacts in the programming editor software’s display shows a collection of contacts addressed to those input bits in various states (colored = closed ; un-colored = open).
As you can see, every contact addressed to a “set” bit (1) is in its actuated state, while every contact addressed to a “cleared” bit (0) is in its normal state:
Remember that a colored contact is a closed contact. The contacts appearing as colored are either normally-closed contacts with “0” bit states, or normally-open contacts with “1” bit states.
It is the combination of bit state and contact type (NO vs. NC) that determines whether the virtual contact will be open (un-colored) or closed (colored) at any given time.
Correspondingly, it is a combination of colored highlighting and virtual contact type that indicates the real-world energization status of a particular PLC input at any given time.
The main problem of students/engineers have comprehending PLC Ladder Diagram programs is that they over-simplify and try to directly associate real-world switches connected to the PLC with their respective contact instructions inside the PLC program.
Students/Engineers mistakenly think the real-world switch connecting to the PLC and the respective virtual switch contact inside the PLC program are one and the same, when this is not the case at all.
Rather, the real-world switch sends power to the PLC input, which in turn controls the state of the virtual contact(s) programmed into the PLC.
Specifically, I see students/engineers routinely fall into the following mis-conceptions:
- Mistakenly think the contact instruction type (NO vs. NC) needs to match that of its associated real-world switch
- Mistakenly think color highlighting of a contact instruction is equivalent to the electrical status of its associated real-world PLC input
- Mistakenly think a closed real-world switch must result in a closed contact instruction in the live PLC program
To clarify, here are the fundamental rules one should keep in mind when interpreting contact instructions in Ladder Diagram PLC programs:
- Each input bit in the PLC’s memory will be a “1” when its input channel is powered, and will be a “0” when its input channel is unpowered
- Each virtual contact shown in the program actuates whenever it reads a “1” state in its respective bit, and will be at rest whenever it reads a “0” state in its respective bit
- A colored contact is closed (passes virtual power in the PLC program), while an un-colored contact is open (blocks virtual power in the PLC program)
In trying to understand PLC Ladder Diagram programs, the importance of these rules cannot be overemphasized.
The truth of the matter is a causal chain – rather than a direct equivalence – between the real-world switch and the contact instruction status.
The real-world switch controls whether or not electrical power reaches the PLC input channel, which in turn controls whether the input register bit will be a “1” or a “0”, which in turn controls whether the contact instruction will actuated or at rest.
Virtual contacts inside the PLC program are thus controlled by their corresponding real-world switches, rather than simply being identical to their real-world counterparts as novices tend to assume.
Following these rules, we see that normally-open (NO) contact instructions will mimic what their real-world switches are doing, while normally-closed (NC) contact instructions will act opposite of their real-world counterparts.
The color highlighting of coil instructions in a Ladder Diagram PLC program follows similar rules. A coil will be “on” (colored) when all contact instructions prior to it are closed (colored).
A colored coil writes a “1” to its respective bit in memory, while an un-colored coil instruction writes a “0” to its respective bit in memory. If these bits are associated with real-world discrete output channels on the PLC, their states will control the real-world energization of devices electrically connected to those channels.
To further illuminate these fundamental concepts, we will examine the operation of a simple PLC system designed to energize a warning lamp in the event that a process vessel experiences a high fluid pressure.
The PLC’s task is to energize a warning lamp if the process vessel pressure ever exceeds 270 PSI, and keep that warning lamp energized even if the pressure falls below the trip point of 270 PSI. This way, operators will be alerted to both past and present process vessel over-pressure events.
120 volt AC “line” power (L1 and L2) provides electrical energy for the PLC to operate, as well as signal potential for the input switches and power for the warning lamp.
Two switches connect to the input of this PLC: one normally-open pushbutton switch acting as the alarm reset (pressing this switch “unlatches” the alarm lamp) and one normally-open pressure switch acting as the sensing element for high process vessel pressure:
The reset pushbutton connects to discrete input X1 of the PLC, while the pressure switch connects to discrete input X4. The warning lamp connects to discrete output Y5.
Red indicator LEDs next to each I/O terminal visually indicate the electrical status of the I/O points, while red-shaded highlighting shows the virtual power (Note 2 ) status of the “contacts” and “coils” in the PLC’s program, displayed on the screen of a personal computer connected to the PLC through a programming cable.
With no one pressing the reset pushbutton, that switch will be in its normal status, which for a “normally-open” switch is open.
Also Read : How PLC Controls a Motor
Likewise with the pressure switch: with process pressure less than the trip point of 270 PSI, the pressure switch will also be in its normal status, which for a “normally-open” switch is open.
Since neither switch is conducting electricity right now, neither discrete input X1 nor X4 will be energized. This means the “virtual” contacts inside the PLC program will likewise be in their own normal states.
Thus, any virtual contact drawn as a normally-open will be open (not passing virtual power), and any virtual contact drawn as a normally-closed (a diagonal slash mark through the contact symbol) will be closed.
This is why the two normally-open virtual contacts X4 and Y5 have no highlighting, but the normally-closed virtual contact X1 does – the colored highlighting representing the ability to pass virtual power.
Note 2 : For a PLC program contact, the shading represents virtual “conductivity.” For a PLC program coil, the shading represents a set (1) bit.
If the process vessel experiences a high pressure (> 270 PSI), the pressure switch will actuate, closing its normally-open contact. This will energize input X4 on the PLC, which will “close” the virtual contact X4 in the ladder program.
This sends virtual power to the virtual “coil” Y5, which in turn latches itself on through virtual contact Y5 (Note 3 ) and also energizes the real discrete output Y5 to energize the warning lamp:
Note 3 : It is worth noting the legitimacy of referencing virtual contacts to output bits (e.g. contact Y5), and not just to input bits.
A “virtual contact” inside a PLC program is nothing more than an instruction to the PLC’s processor to read the status of a bit in memory. It matters not whether that bit is associated with a physical input channel, a physical output channel, or some abstract bit in the PLC’s memory.
It would, however, be wrong to associate a virtual coil with an input bit, as coil instructions write bit values to memory, and input bits are supposed to be controlled solely by the energization states of their physical input channels.
If now the process pressure falls below 270 PSI, the pressure switch will return to its normal state (open), thus de-energizing discrete input X4 on the PLC.
Because of the latching contact Y5 in the PLC’s program, however, output Y5 remains on to keep the warning lamp in its energized state:
Thus, the Y5 contact performs a seal-in function to keep the Y5 bit set (1) even after the high pressure condition clears.
This is precisely the same concept as the “seal-in” auxiliary contact on a hard-wired motor starter circuit, where the electro-mechanical contactor keeps itself energized after the “Start” pushbutton switch has been released.
The only way for a human operator to re-set the warning lamp is to press the pushbutton.
This will have the effect of energizing input X1 on the PLC, thus opening virtual contact X1 (normally closed) in the program, thus interrupting virtual power to the virtual coil Y5, thus powering down the warning lamp and un-latching virtual power in the program:
Credits : by Tony R. Kuphaldt – Creative Commons Attribution 4.0 License
PLC Tutorials :
- PLC Ladder Logic Example
- What is Ladder Diagram Programming ?
- PLC Programming Questions & Answers – 1
- PLC Pump Permissive Interlocks
- PLC Electric Motor Interlocks
- PLC Programming Questions & Answers – 5
- Logic Gates in PLC Ladder Logic
- PLC Program Examples
- PLC Programming Questions & Answers – 4
- PLC Programming Questions & Answers – 7