Jump to content

leikang

Staff group
  • Content Count

    97
  • Joined

  • Last visited

Everything posted by leikang

  1. Learn the PLC logic example on multiple switches and motors with the ladder diagram. This PLC logic example is prepared for the engineering students to learn and practice the ladder logic. The design of the same PLC program for industrial usage will be different. PLC Logic Example Problem Statement: Design a PLC ladder logic for the following application. There is a use of four toggle switches to control four motors. If Switch 1 is ON, then Motor I will be ON. If Switch 2 is ON, then Motor I and Motor II will be ON. If Switch 3 is ON, then Motor I, Motor II, and Motor III will be ON. If Switch 4 is ON, then Motor I, Motor II, Motor III, and Motor IV will be ON. Inputs of PLC The list of the digital inputs for this PLC logic is mentioned below. Switch 1: I0.0 Switch 2: I0.1 Switch 3: I0.2 Switch 4: I0.3 Outputs of PLC The required digital outputs are listed below. Motor 1: Q0.0 Motor 2: Q0.1 Motor 3: Q0.2 Motor 4: Q0.3 Multiple Switches and Motors Ladder Logic Here is the PLC logic for the given problem statement. Program Explained For this example, we used Schneider PLC software for programming. In the above PLC program, we have used Normal Open Contact for Switch 1 (I0.0), Switch 2 (I0.1), Switch 3 (I0.2) and Switch 4 (I0.3) Switch 1, Switch 2, Switch 3, and Switch 4 are connected in parallel for Motor 1, thus implementing OR logic gate. For Motor 2, inputs switch 2, switch 3, and switch 4 are connected in parallel, thus implementing OR logic gate. Switch 3 and switch 4 are implementing OR logic gate i.e., connected in parallel for Motor 3. Only Switch 4 is connected to Motor 4. For Motor 1 to be ON, either Switch 1 or Switch 2 or Switch 3 or Switch 4 should be ON. To turn ON Motor 2, either Switch 2 or Switch 3 or Switch 4 should be ON. When Switch 3 or Switch 4 is ON, then Motor 3 will turn ON. Motor 4 will turn ON when Switch 4 is turned ON. PLC Simulation Results Next, we will see the PLC simulation results with different input switch ON and OFF combinations. When Switch 1 is ON When the toggle switch 1 is turned ON, the current flows through it (here we are using the term “Current” in case of an electrical circuit, so here you can assume it as “Current” or simply call it as “Signal”). As a result, Motor 1 gets ON. Other motors will remain OFF because Switch 1 is not connected to them. When Switch 2 is ON The current will flow through switch 2 when it is turned ON that will turn ON Motor 1 and Motor 2. It is so because switch 2 is connected to Motor 1 and Motor 2 only. When Switch 3 is ON When Switch 3 is turned ON, the current flows through it that will turn ON three motors i.e., Motor 1, Motor 2 and Motor 3. The input switch 3 is connected to these outputs only. Motor 4 will remain OFF as Switch 3 is not connected to it. When Switch 4 is ON Switch 4 will turn ON all the motors when turned ON. Switch 4 is connected to all the motors, when turned ON, Motor 2, Motor 2, Motor 3 and Motor 4 will turn ON.
  2. This is the PLC Program to implement SR flip flop in PLC. Learn the PLC programming with this example logic. SR Flip Flop using PLC Ladder Logic Problem Description Implement a program for SR flip-flop logic in PLC using ladder language. Problem Diagram PLC Solution As we know, more complex systems cannot be controlled with combinational logic alone. The main reason is that we cannot, or choose not to add sensors to detect all conditions. In these cases we can use event to estimate the condition of the system. SR flip flop is used for Latch on or unlatch – to lock something ON or turn it OFF. Most PLC has special instruction for SR flip flop function. so no custom logic required for such types of PLCs. SR flip flop first executes SET function and then RESET function. Note :- Here we are considering simple function of SR flip flop instruction without using special instruction or using latch function. Here we are using simple latching circuit for SR flip flop function. Here as shown in figure two push buttons or two inputs are taken for program implementation. When user will press SET button or 1 is received at S input, Q output will be ON and if RESET button pressed or 1 received at R input, Q^ will be ON. List of inputs/outputs Digital Inputs Set Input :- I0.0 Reset input :- I0.1 Digital Outputs Q output :- Q0.0 Q^ output :- Q0.1 M memory Relay coil 1 :- M0.0 Relay coil 2 :- M0.1 PLC Ladder Diagram to implement SR flip-flop Program Explained For this PLC program we use S7-300 PLC and TIA portal software for programming. We can implement this logic by using other PLC also. Network 1: Here we used NC contact of relay coil 1(M0.0) so when reset button is pressed, Q output (Q0.0) is OFF. Network 2: Here we used NC contact of relay coil 2 (M0.1) so when set button is pressed, Q^ output (Q0.1) is OFF. Network 3: Here when we press RESET button (I0.0), relay coil 1(M0.0) will be latched. Network 4: Here when we press SET button (I0.1), relay coil 2(M0.1) will be latched. If both the inputs are low during power up, Q^ output (Q0.1) will go high because of its order. If both the inputs are Note :- Above application may be different from actual application. This example is only for explanation purpose only. We can implement this logic in other PLC also. This is the simple concept of implementing SR flip function without instruction. we can use this concept in other examples also. All parameters considered in example are for explanation purpose only, parameters may be different in actual applications. Result
  3. This is a PLC Program to read the temperature in PLC. Learn PLC programming using example problems and solutions. Read Temperature in PLC Problem Description Write a PLC program in which we can monitor the actual temperature. Here we are using an external temperature controller and its output is also connected to PLC for monitoring the temperature of material in the tank. Problem Diagram Problem Solution RTDs devices with resistance that changes with temperature changes in a linear way. This resistance value will change as temperature changes and by supplying a constant current, the measured voltage drop across the resistor can be used to determine the new resistance, and thus the temperature. RTDs come in a variety of types, with the most common type is a PT100. It’s made from platinum that has been calibrated to be 100 ohms at 0 degrees C. In above application, we want to measure material temperature of the tank, for that we use RTD sensor which will measure temperature of the tank and give signal to the temperature controller. Temperature controller will send signal in the form of voltage (0-10V DC).If RTD detect 0degree temperature, it will send 0V DC and if maximum temperature detected, it will send 10V DC to PLC. Temperature controller is directly connected to the PLC so PLC will read voltage. Note: – Here we consider simple application for explanation. We need to measure material temperature of the tank by using RTD sensor. And also consider other components for control purpose. Assume Scaling range of temperature controller is 0-100°C=0 to 10V DC and according to this signal PLC consider 0 to 27648. I/O List M memory Analog value from the temp controller :- MW100 Actual value from the temp controller :- MD104 Multiplication :- MD108 Actual temperature in °C :- MD112 PLC Ladder diagram to read the temperature PLC Logic Explanation For this application, we used S7-300 PLC and TIA portal software for programming. We can implement this logic by using other PLC’s also. Network 1: In this network, we implement logic for value conversion. It is necessary to convert value from INT to DINT for multiplication purpose or for calculation. So by using conversion instruction analog value from the RTD (MW100) is converted into actual analog value (MD104). Note:- Temperature controller provides 0-10V DC signal to PLC. ADC converter or analog input module will convert this analog signal into digital form, and the range of this digital signal is 0 to 27648. This digital range may change from one PLC to another. Network 2: we have the RTD temperature range which is 0 to 100 degc and the output voltage range is 0 to 10V DC. So we need to scale this voltage output in terms of temperature reading. Here multiply the value as per equation and final value will be stored in MD108. Note:-Here temperature controller and temperature measurement range is 0-100°C. Network 3: Now for final result multiplied value is divided by 27648, result will be stored in MD112 (Actual temperature in °C). Note:- Above application may be different from actual application. This example is only for explanation purpose only. We can implement this logic in other PLC also. This is the simple concept of temperature reading in S7-300 PLC, we can use this concept in other examples also. All parameters considered in example are for explanation purpose only, parameters may be different in actual applications.
  4. This is a PLC Program to implement analog scaling in S7-300 PLC. Control Valve Scaling Problem Description Implement PLC program in S7-300 for analog scaling. Problem Diagram Problem Solution Analog inputs come from different sensors or transmitters. Transmitters convert physical quantity into electrical signal. We can measure many physical quantity by using analog sensors such as temperature, pressure, level, distance, flow etc. Of course we can measure all physical quantity by using analog sensors, but for example and explanation purpose here we take one example of control valve. As shown in figure, here we consider one control valve and it has 4-20mA output (valve feedback) and 4-20mA input (valve command) for operation. Hence, when PLC will give 20mA to flow control valve, valve will be open 100% and for 4mA it will be 0% (close). In other way flow control valve is also providing output signal that can be used for close loop system/for valve percentage indication. If valve is 100% open, PLC will get 20mA signal and for 0% it will get 4mA. Note:- We consider here close loop system for simple explanation, so operator will set control valve open command parameter in range between 0% to 100% . Now as per close loop system, control valve will provide output signal (valve feedback) and by using SCALE instruction, operator can see actual valve open parameter on graphics. List of inputs/outputs M memory Enable command-Scaling :- M0.0 Bipolar selection-Scaling :- M0.1 Actual value from the sensor or transmitter :- MW10 Error word –Scaling :- MW12 Scaled output :- MD20 Enable command-Unscaling :- M1.0 Bipolar selection- Unscaling :- M0.2 Given value from the display :- MD24 Error word-Unscaling :- MW16 Unscaled output :- MW26 PLC Ladder Diagram for Valve Scaling Ladder Logic Explained For this application, we use S7-300 PLC and TIA portal software for programming. We can implement this logic by using other PLC also. Network 1: In this network, scaling logic is executed when Enable command (M0.0) is ON. The “Scale” instruction is to convert the integer (here 4-20mA signal from the control valve or MW10) at the IN parameter which can be scaled in physical units between a low limit (0% output) and a high limit (100% output). The result or scaled output (MD20) of the instruction is output at the OUT parameter. If bipolar selection (M0.1) is ON, it is assumed that the value at the IN parameter is bipolar (range between -27648 to +27648). If bipolar selection (M0.1) is OFF, it is assumed that the value at the IN parameter is unipolar (range between 0 to 27648). Network 2: The “Unscale” instruction is used to unscaled the floating-point number (given value from the display or MD24) on the IN parameter into physical units between a low limit and and a high limit. The result of the instruction is output (unscaled output MW26) at the OUT parameter. If bipolar selection (M0.2) is ON, it is assumed that the value at the IN parameter is bipolar (range between -27648 to +27648). If bipolar selection (M0.2) is OFF, it is assumed that the value at the IN parameter is unipolar (range between 0 to 27648). Error code table: Note: The above application may be different from actual application. This example is only for explanation purpose only. We can implement this logic in other PLC also. This is the simple concept of SCALE and UNSCALE instructions, we can use this concept in other examples also. All parameters considered in the example are for explanation purposes only, parameters may be different in actual applications. Result
  5. This is a PLC Program to control the level of parallel tanks. Learn the PLC programming using this example. Parallel Tanks Level Control Problem Description Two tanks are connected in parallel connection. We need to heat and cool the incoming material into the tanks and simultaneously control the level of the tanks. Implement the PLC program for this application. Problem Diagram Problem Solution Heating process is used to heat the material in the tank and cooling process is used to cool the material. Here consider both material are same as show in figure, inlet valve feeds material in both the tanks. Here we can use level switches for detecting the low levels and high levels for both the tanks. Use two temperature sensors for measuring the temperature of both the tanks. Outlet valves are used at the bottom of the tanks to drain the materials for further process. We will write PLC program for this application. List of Inputs & Outputs Digital Inputs Cycle START :- I0.0 Cycle STOP :- I0.1 Low level tank 1(LL1) :- I0.3 Low level tank 2(LL2) :- I0.4 High level tank 1(LH1) :- I0.5 High level tank 2(LH2) :- I0.6 Digital Outputs Inlet valve V2 for heating tank :- Q0.0 Inlet valve V3 for cooling tank :- Q0.1 Outlet valve V4 for heating tank :- Q0.2 Outlet valve V5 for cooling tank :- Q0.3 M memory Cycle ON bit :- M0.0 Register for temperature of heating tank :- MD10 Register for temperature of cooling tank :- MD14 Outlet valve V5 for cooling tank :- Q0.3 PLC Program for level control of parallel tanks Program Explanation For this application we used S7-300 PLC and TIA portal software for programming. We can implement this logic by using other PLC also. Network 1: This Network is for latching circuit. Whenever START button is pressed (I0.0), Cycle ON (M0.0) bit will be ON. Cycle can be STOP by pressing STOP PB (I0.1). Network 2: When heating tank level low (I0.3) is detected, inlet valve V2 (Q0.0) will be ON. If level high of tank 1(I0.5) is not detected and START (I0.0) button is pressed, inlet valve V2 (Q0.0) will be ON. Network 3: If level low of tank 2 (I0.4) is detected, inlet valve V3 (Q0.1) will be ON. If START button is pressed and high level of tank 2 (I0.6) is not detected, inlet valve V3 (Q0.1) will be ON. Network 4: If cycle is ON and actual temperature of heating tank (MD10) is greater or equal than set temperature (70°C), outlet valve V4 (Q0.2) will be ON Network 5: If cycle is ON and actual temperature of cooling tank (MD14) is less or equal than set temperature (20°C), outlet valve V5 (Q0.3) will be ON. Note :- This example is only for explanation purpose only. We can implement this logic in any PLC or using relay logic. Above application may be different from actual application or may be a part of the plant logic. Result
  6. leikang

    PLC Counter Instructions

    A counter is a PLC instruction that either increments (counts up) or decrements (counts down) an integer number value when prompted by the transition of a bit from 0 to 1 (“false” to “true”). Counter instructions come in three basic types: up counters, down counters, and up/down counters. Both “up” and “down” counter instructions have single inputs for triggering counts, whereas “up/down” counters have two trigger inputs: one to make the counter increment and one to make the counter decrement. PLC Counter Instructions To illustrate the use of a counter instruction, we will analyze a PLC-based system designed to count objects as they pass down a conveyor belt: In this system, a continuous (unbroken) light beam causes the light sensor to close its output contact, energizing discrete channel IN4. When an object on the conveyor belt interrupts the light beam from source to sensor, the sensor’s contact opens, interrupting power to input IN4. A push-button switch connected to activate discrete input IN5 when pressed will serve as a manual “reset” of the count value. An indicator lamp connected to one of the discrete output channels will serve as an indicator of when the object count value has exceeded some pre-set limit. We will now analyze a simple Ladder Diagram program designed to increment a counter instruction each time the light beam breaks: This particular counter instruction (CTU) is an incrementing counter, which means it counts “up” with each off-to-on transition input to its “CU” input. The normally-closed virtual contact (IN sensor object) is typically held in the “open” state when the light beam is continuous, by virtue of the fact the sensor holds that discrete input channel energized while the beam is continuous. When the beam is broken by a passing object on the conveyor belt, the input channel de-energizes, causing the virtual contact IN sensor object to “close” and send virtual power to the “CU” input of the counter instruction. This increments the counter just as the leading edge of the object breaks the beam. The second input of the counter instruction box (“R”) is the reset input, receiving virtual power from the contact IN switch reset whenever the reset pushbutton is pressed. If this input is activated, the counter immediately resets its current value (CV) to zero. Status indication is shown in this Ladder Diagram program, with the counter’s preset value (PV) of 25 and the counter’s current value (CV) of 0 shown highlighted in blue. The preset value is something programmed into the counter instruction before the system put into service, and it serves as a threshold for activating the counter’s output (Q), which in this case turns on the count indicator lamp (the OUT counts reached coil). According to the IEC 61131-3 programming standard, this counter output should activate whenever the current value is equal to or greater than the preset value (Q is active if CV ≥ PV). This is the status of the same program after thirty objects have passed by the sensor on the conveyor belt. As you can see, the current value of the counter has increased to 30, exceeding the preset value and activating the discrete output: If all we did not care about maintaining an accurate total count of objects past 25 – but merely wished the program to indicate when 25 objects had passed by. we could also use a down counter instruction preset to a value of 25, which turns on an output coil when the count reaches zero: Here, a “load” input causes the counter’s current value to equal the preset value (25) when activated. With each sensor pulse received, the counter instruction decrements. When it reaches zero, the Q output activates. A potential problem in either version of this object-counting system is that the PLC cannot discriminate between forward and reverse motion on the conveyor belt. If, for instance, the conveyor belt were ever reversed in direction, the sensor would continue to count objects that had already passed by before (in the forward direction) as those objects retreated on the belt. This would be a problem because the system would “think” more objects had passed along the belt (indicating greater production) than actually did. One solution to this problem is to use an up/down counter, capable of both incrementing (counting up) and decrementing (counting down), and equip this counter with two light-beam sensors capable of determining direction of travel. If two light beams are oriented parallel to each other, closer than the width of the narrowest object passing along the conveyor belt, we will have enough information to determine direction of object travel: This is called quadrature signal timing, because the two pulse waveforms are approximately 90 deg (one-quarter of a period) apart in phase. We can use these two phase-shifted signals to increment or decrement an up/down counter instruction, depending on which pulse leads and which pulse lags. A Ladder Diagram PLC program designed to interpret the quadrature pulse signals is shown here, making use of negative-transition contacts as well as standard contacts: The counter will increment (count up) when sensor B de-energizes only if sensor A is already in the de-energized state (i.e. light beam A breaks before B). Counter will decrement (count down) when sensor A de-energizes only if sensor B is already in the de-energized state (i.e. light beam B breaks before A). Note that the up/down counter has both a “reset” (R) input and a “load” input (“LD”) to force the current value. Activating the reset input forces the counter’s current value (CV) to zero, just as we saw with the “up” counter instruction. Then Activating the load input forces the counter’s current value to the preset value (PV), just as we saw with the “down” counter instruction. In the case of an up/down counter, there are two Q outputs: a QU (output up) to indicate when the current value is equal to or greater than the preset value, and a QD (output down) to indicate when the current value is equal to or less than zero. Note how the current value (CV) of each counter shown is associated with a tag name of its own, in this case parts counted. The integer number of a counter’s current value (CV) is a variable in the PLC’s memory just like boolean values such as IN sensor A and IN switch reset, and may be associated with a tag name or symbolic address just the same. This allows other instructions in a PLC program to read (and sometimes write!) values from and to that memory location.
  7. 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. 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. 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:
  8. Although it seems each model of PLC has its own idiosyncratic standard for programming, there does exist an international standard for controller programming that most PLC manufacturers at least attempt to conform to. This is the IEC 61131-3 standard, which will be the standard One should take solace in the fact that despite differences in the details of PLC programming from one manufacturer to another and from one model to another, the basic principles are largely the same. There exist much greater disparities between different general-purpose programming languages (e.g. C/C++, BASIC, FORTRAN, Pascal, Java, Ada, etc.) than between the programming languages supported by different PLCs, and this fact does not prevent computer programmers from being “multilingual.” I have personally written and/or analyzed programs for over a half-dozen different manufacturers of PLCs (Allen-Bradley, Siemens, Square D, Koyo, Fanuc, Moore Products APACS and QUADLOG, and Modicon), with multiple PLC models within most of those brands, and I can tell you the differences in programming conventions are largely insignificant. After learning how to program one model of PLC, it is quite easy to adapt to programming other makes and models of PLC. PLC Programming languages The IEC 61131-3 standard specifies five distinct forms of programming language for industrial controllers: Ladder Diagram (LD) Structured Text (ST) Instruction List (IL) Function Block Diagram (FBD) Sequential Function Chart (SFC) Not all programmable logic controllers support all five language types, but nearly all of them support Ladder Diagram (LD), which will be the primary focus of this book. Programming languages for many industrial devices are limited by design. One reason for this is simplicity: any programming language simple enough in structure for someone with no formal computer programming knowledge to understand is going to be limited in its capabilities. Another reason for programming limitations is safety: the more flexible and unbounded a programming language is, the more potential there will be to unintentionally create complicated “run-time” errors when programming. The ISA safety standard number 84 classifies industrial programming languages as either Fixed Programming Languages (FPL), Limited Variability Languages (LVL), or Full Variability Languages (FVL). Ladder Diagram and Function Block Diagram programming are both considered to be “limited variability” languages, whereas Instruction List (and traditional computer programming languages such as C/C++, FORTRAN, BASIC, etc.) are considered “full variability” languages with all the attendant potential for complex errors.
  9. leikang

    Two Hand Control Logic using PLC

    This article is about the programming of two-hand control used in the press industry. The purpose of this program is about safety to prevent fatal accidents. Below is an image of how the press machine looks and why we care about safety. As you can see there are pushbuttons used to control the press machine. The center plate is pushed against the surface of the workpiece when we press the push buttons. The two pushbuttons must be pressed at the same time to operate the press machine as shown in the below animation. When the operator uses his one hand to press the button and use his second hand when plate pushing against the surface, he can injure himself. The powerful force of pushing a plate can easily squeeze hands if the operator tries to maneuver things in a hurry. Below I have explained the program used to prevent such incidents with the help of Siemens TIA Portal. Here in the below figure press machine which has two inputs and one output is shown. Inputs are connected to the plc digital input (DI) module and single output which is connected to the digital output (DO) module. Below is a list of inputs and outputs used for the program. Inputs: Push Button (PB_1): I0.0 Push Button (PB_2): I0.2 Outputs: Press Machine Output: Q0.0 Two-Hand Control Logic Logic Description Network 1: Here two push-buttons PB_1 & PB_2 are connected in series. When both push-buttons are pressed at the same time, then the signal will pass through NC contact of timer T0 and energize the output. Network 2: Now if any single push button either PB_1 or PB_2 is pressed then timer T0 on-delay timer (S_ODT) is energized, here in our case after 5 seconds. Here NC contact of press machine’s output is also used after push button because if the output is ON then it won’t allow the timer to energize. So, the machine’s output will only energize when both buttons are pressed together.
  10. We most often come across a three-way traffic jam in our city. This PLC program gives the solution to control heavy traffic jams using programmable logic control. Traffic Light Control using PLC Problem Solution They are so many ways to write a program for traffic light control ex: sequencer output method but in this normal input, outputs and timers are used. Timers are used to give time delay for output to turn ON and OFF. Reset coil is used at the end to run the program continuously. Comparator blocks are used to reduce the number of timers used. Program done in AB RSLogix 500 Software. List of Inputs and Outputs for Traffic Control System PLC Program for 3-way Traffic control System Below tabular column gives the Steps or sequence of outputs to turn ON. PLC Logic Description for 3-way Traffic Control System RUNG000 : This is a Latching rung to operate the system through Master Start and Stop PB. RUNG001 and RUNG0002 : Starting the timer to turn ON first output West Green so east and west should be in red. Comparators in Parallel rung are used to turn OFF East red after 15 sec. Timer T4:2 timing bit in parallel contact used to turn ON East red again in 5th and 6Th Step. (Refer Above Tabular column for clarification) RUNG 0003 : Turning ON North Red up to 3rd step using T4:0 and T4:1’s timer timing bit and comparator blocks. Rung 0004 : Turn ON East yellow for 5 sec using comparator blocks. (Step 2nd) Rung 0005-0006-0007-0008-0009-0010 : The same procedures followed to turn ON further outputs. ( Refer Tabular column for a sequence of operation) RUNG 0011 : Reset coil is turned ON using T4:2 ‘s done bit to restart the cycle from beginning The program runs continuously until STOP PB is pressed Conclusion: The above-explained 3 ways traffic light control using PLC is for example only. It may vary from real-time. We can use this example program to understand the working of timers and comparator block function in AB PLC.
  11. leikang

    PLC Tag Naming Conventions

    When you design a PLC logic, you have to take care of the names that you provide to tags. It should be easily understood and interpreted by any programmer. It should neither be too long nor too short. The naming convention is important because improper tagging can cause troubleshooting issues for programmers. Also, giving lengthy names will consume the memory of PLC. So, every programmer has to follow proper naming conventions before writing a PLC program. In this post, we will see the concept of PLC tag naming conventions. PLC Tag Naming Conventions First of all, let us understand how tag naming convention plays a great role in PLC programming. You have a motor with its run command and run feedback as PLC IO’s. The motor is located in the blower room and it is used as an air compressor. The motor tag name in the P&ID is M-101. Now, for a PLC programmer, identifying a tag location is important. So, there are two types of mindsets that normally define a PLC programmer. The first will try to give as much information as possible in a tag name; so he can name the motor run command as M101_Compressor_Run_Command. The second one will try to give the name as Q_M101_Comp. The second mindset looks very clear, as he is giving short names and keeping the length as minimal as possible. This is the reason why naming a PLC tag is important, as it relieves the programmer from reading such lengthy tags in situations where urgent troubleshooting has arrived. (It is to be noted that PLC tag naming does not accept any special character apart from underscore (_) ). A PLC tag name should contain information that can help the programmer relate to the meaning of it. This generally implies the following information – data type (eg. boolean, integer), data flow (eg. input, output), scope (eg. local, global), instrument or device type (eg. motor, valve, sensor), process parameter (eg. pressure, flow, temperature) and location of the device. Tag Name Styles There are various styles according to IEC standards that must be followed for proper naming. Let us have a look at some of the most generally used: Camel Style, Pascal Style, Snake Style, Prefix with Data Type Style Camel Style In this style, there is no underscore in between. A full name is given to the whole word, but each word in it starts with a capital letter. For example, take the above-discussed example. M101_Compressor_Run_Command will be written as m101CompressorRunCommand. You can identify each word by a capital letter. The first letter will be a compulsory small letter. This style looks good if the word is small. It prevents the use of underscore and this makes memory consumption smaller. Pascal Style It is similar to the camel style; the only difference is that the first letter will be a compulsory capital letter. For example, our tag will be written as M101CompressorRunCommand. Snake Style The example that we discussed before is the snake style. Here, each word will be separated by an underscore. Prefix with Data Type Style Here, the tag will be prefixed by the data type of the tag name. In our case, the tag type was boolean. According to IEC standards, a boolean tag is usually given a prefix of ‘x’. So, our style will be written as xM101CompressorRunCommand. This helps the programmer to identify what type of data is used for that particular tag. Tips For Tag Naming in PLC Programming The first and foremost rule is that the length of a tag should be short, but not so short that no one can understand it. As discussed, the length should contain appropriate information in a proper length. Lengthy names should be strictly avoided. Follow the general tag naming styles that were discussed. These are according to IEC standards and make the logic look neat and clean. To reduce bugs during tag creation, use Excel files. Excel reduces workload in a very vast way as duplication and copying becomes very easy. Errors are hardly produced in Excel files. It is not always necessary to use a full name for a word. For example, the valve can be written as vlv and temperature can be written as temp. Avoid making the tag fully capitals. It looks cumbersome and inappropriate to read.
  12. A wise PLC programmer once told me that the first thing any aspiring programmer should learn about the PLC they intend to program is how the digital memory of that PLC is organized. This is sage advice for any programmer, especially on systems where memory is limited, and/or where I/O has a fixed association with certain locations in the system’s memory. Virtually every microprocessor-based control system comes with a published memory map showing the organization of its limited memory: how much is available for certain functions, which addresses are linked to which I/O points, how different locations in memory are to be referenced by the programmer. Discrete input and output channels on a PLC correspond to individual bits in the PLC’s memory array. Similarly, analog input and output channels on a PLC correspond to multi-bit words (contiguous blocks of bits) in the PLC’s memory. The association between I/O points and memory locations is by no means standardized between different PLC manufacturers, or even between different PLC models designed by the same manufacturer. This makes it difficult to write a general tutorial on PLC addressing, and so my ultimate advice is to consult the engineering references for the PLC system you intend to program. The most common brand of PLC in use is Allen-Bradley (Rockwell), which happens to use a unique form of I/O addressing (Note 1), students tend to find confusing. For these two reasons (popularity and confusion), I will focus on Allen-Bradley addressing conventions for the bulk of this section. Note 1 : The most modern Allen-Bradley PLCs have all but done away with fixed-location I/O addressing, opting instead for tag name based I/O addressing. However, enough legacy Allen-Bradley PLC systems still exist in industry to warrant coverage of these addressing conventions. PLC Memory Map The following table shows a partial memory map for an Allen-Bradley SLC 500 PLC Memory Map also called the data table, this map shows the addressing of memory areas reserved for programs entered by the user. Other areas of memory exist within the SLC 500 processor, but these other areas are inaccessible to the technician writing PLC programs. Note that Allen-Bradley’s use of the word “file” differs from personal computer parlance. In the SLC 500 controller, a “file” is a block of random-access memory used to store a particular type of data. By contrast, a “file” in a personal computer is a contiguous collection of data bits with collective meaning (e.g. a word processing file or a spreadsheet file), usually stored on the computer’s hard disk drive. Within each of the Allen-Bradley PLC’s “files” are multiple “elements,” each element consisting of a set of bits (8, 16, 24, or 32) representing data. Elements are addressed by number following the colon after the file designator, and individual bits within each element addressed by a number following a slash mark. For example, the first bit (bit 0) of the second element in file 3 (Binary) would be addressed as B3:2/0. In Allen-Bradley PLCs such as the SLC 500 and PLC-5 models, files 0, 1, and 2 are exclusively reserved for discrete outputs, discrete inputs, and status bits, respectively. Thus, the letter designators O, I, and S (file types) are redundant to the numbers 0, 1, and 2 (file numbers). Other file types such as B (binary), T (timers), C (counters), and others have their own default file numbers (3, 4, and 5, respectively), but may also be used in some of the user-defined file numbers (10 and above). For example, file 7 in an Allen-Bradley controller is reserved for data of the “integer” type (N), but integer data may also be stored in any file numbered 10 or greater at the user’s discretion. Thus, file numbers and file type letters for data types other than output (O), input (I), and status (S) always appear together. You would not typically see an integer word addressed as N:30 (integer word 30 in the PLC’s memory) for example, but rather as N7:30 (integer word 30 in file 7 of the PLC’s memory) to distinguish it from other integer word 30’s that may exist in other files of the PLC’s memory. This file-based addressing notation bears further explanation. When an address appears in a PLC program, special characters are used to separate (or “delimit”) different fields from each other. The general scheme for Allen-Bradley SLC 500 PLCs is shown here: Not all file types need to distinguish individual words and bits. Integer files (N), for example, consist of one 16-bit word for each element. For instance, N7:5 would be the 16-bit integer word number five held in file seven. A discrete input file type (I), though, needs to be addressed as individual bits because each separate I/O point refers to a single bit. Thus, I:3/7 would be bit number seven residing in input element three. The “slash” symbol is necessary when addressing discrete I/O bits because we do not wish to refer to all sixteen bits in a word when we just mean a single input or output point on the PLC. Integer numbers, by contrast, are collections of 16 bits each in the SLC 500 memory map, and so are usually addressed as entire words rather than bit-by-bit . Certain file types such as timers are more complex. Each timer “element ” consists of two different 16-bit words (one for the timer’s accumulated value, the other for the timer’s target value) in addition to no less than three bits declaring the status of the timer (an “Enabled” bit, a “Timing” bit, and a “Done” bit). Thus, we must make use of both the decimal-point and slash separator symbols when referring to data within a timer. Suppose we declared a timer in our PLC program with the address T4:2, which would be timer number two contained in timer file four. If we wished to address that timer’s current value, we would do so as T4:2.ACC (the “Accumulator” word of timer number two in file four). The “Done” bit of that same timer would be addressed as T4:2/DN (the “Done” bit of timer number two in file four) A hallmark of the SLC 500’s addressing scheme common to many legacy PLC systems is that the address labels for input and output bits explicitly reference the physical locations of the I/O channels. For instance, if an 8-channel discrete input card were plugged into slot 4 of an Allen Bradley SLC 500 PLC, and you wished to specify the second bit (bit 1 out of a 0 to 7 range), you would address it with the following label: I:4/1. Addressing the seventh bit (bit number 6) on a discrete output card plugged into slot 3 would require the label O:3/6. In either case, the numerical structure of that label tells you exactly where the real-world input signal connects to the PLC. PLC Memory Mapping Example To illustrate the relationship between physical I/O and bits in the PLC’s memory, consider this example of an Allen-Bradley SLC 500 PLC, showing one of its discrete input channels energized (the switch being used as a “Start” switch for an electric motor): If an input or output card possesses more than 16 bits – as in the case of the 32-bit discrete output card shown in slot 3 of the example SLC 500 rack – the addressing scheme further subdivides each element into words and bits (each “word” being 16 bits in length). Thus, the address for bit number 27 of a 32-bit input module plugged into slot 3 would be I:3.1/11 (since bit 27 is equivalent to bit 11 of word 1 – word 0 addressing bits 0 through 15 and word 1 addressing bits 16 through 31): A close-up photograph of a 32-bit DC input card for an Allen-Bradley SLC 500 PLC system shows this multi-word addressing: The first sixteen input points on this card (the left-hand LED group numbered 0 through 15) are addressed I:X.0/0 through I:X.0/15, with “X” referring to the slot number the card is plugged into. The next sixteen input points (the right-hand LED group numbered 16 through 31) are addressed I:X.1/0 through I:X.1/15. Legacy PLC systems typically reference each one of the I/O channels by labels such as “I:1/3” (or equivalent ) indicating the actual location of the input channel terminal on the PLC unit. The IEC 61131-3 programming standard refers to this channel-based addressing of I/O data points as direct addressing. A synonym for direct addressing is absolute addressing. Addressing I/O bits directly by their card, slot, and/or terminal labels may seem simple and elegant, but it becomes very cumbersome for large PLC systems and complex programs. Every time a technician or programmer views the program, they must “translate” each of these I/O labels to some real-world device (e.g. “Input I:1/3 is actually the Start push-button for the middle tank mixer motor”) in order to understand the function of that bit. A later effort to enhance the clarity of PLC programming was the concept of addressing variables in a PLC’s memory by arbitrary names rather than fixed codes. The IEC 61131-3 programming standard refers to this as symbolic addressing in contrast to “direct” (channel-based) addressing, allowing programmers arbitrarily name I/O channels in ways that are meaningful to the system as a whole. To use our simple motor “Start” switch example, it is now possible for the programmer to designate input I:1/3 (an example of a direct address) as “Motor start switch” (an example of a symbolic address) within the program, thus greatly enhancing the readability of the PLC program. Initial implementations of this concept maintained direct addresses for I/O data points, with symbolic names appearing as supplements to the absolute addresses. The modern trend in PLC addressing is to avoid the use of direct addresses such as I:1/3 altogether, so they do not appear anywhere in the programming code. The Allen-Bradley “Logix” series of programmable logic controllers is the most prominent example of this new convention at the time of this writing. Each I/O point, regardless of type or physical location, is assigned a tag name which is meaningful in a real-world sense, and these tag names (or symbols as they are alternatively called) are referenced to absolute I/O channel locations by a database file. An important requirement of tag names is that they contain no space characters between words (e.g. instead of “Motor start switch”, a tag name should use hyphens or underscore marks as spacing characters: “Motor start switch”), since spaces are generally assumed by computer programming languages to be delimiters (separators between different variables). Having introduced Allen-Bradley’s addressing notation for SLC 500 model PLCs, I will now abandon it in favor of the modern convention of symbolic addressing throughout the rest of the articles, so as to avoid making the programming examples brand- or model-specific. Each data point within my PLC programs will bear its own tag name rather than a direct (channel-based) address label.
  13. Ina process plant, on/off control is done through the PLC or DCS. The below Figure is an overview of one discrete/digital (on/off) circuit, showing the entire process from the power supply through the sensor and on to the PLC. PLC Digital Signals Wiring Techniques In Above Figure, a level switch is mounted to a vessel. The switch is monitored by a PLC digital input module. The circuit is powered through a circuit breaker (CB2) in an instrument power panel. The main power feed is brought to a marshalling panel, where the power is split, feeding multiple fused circuits. Fuse 03FU is the main disconnect fuse, while the remaining fuses are distribution fuses. Fuse 06FU feeds our circuit. Hot (electrically live) wire 06A is passed to the field junction box (FJB) as one wire in a multi-conductor cable. This cable, sometimes called a homerun or main cable, is broken out at the field junction box (FJB), where, in this example, two unshielded twisted pair cables are fed to the end device, LSH-47. This leaves one spare conductor. The hot wire 06A hits the + terminal of the form- A contact and jumpers to the H terminal to power up the electronics of the level switch. The wire number changes across the relay contact to 06B. This wire feeds the signal back to the FJB, where the signal is passed back to the termination cabinet via the multi-conductor homerun cable. There the signal and neutral are paired and passed to the PLC module. Note that the return neutral wire, labeled 02N (since it is the return wire for CB2), is split to the PLC and the level switch. NOTE: It is always advisable to use twisted-pair wire when connecting to a PLC system. Twisted-pair cables exhibit excellent noise immunity, which is particularly useful when connecting to high-impedance loads, such as those found on PLC/DCS I/O modules. A high-impedance load can be particularly sensitive to noise since the attendant current is so low, and the amount of actual work being done is minimal. That is it, in a nutshell. The following is a commentary on connectivity issues related to PLC/DCS signal wiring. a. Sinking and Sourcing The terms sinking and sourcing are used to describe the way a particular component in the circuit relates to power flow. These terms actually stem from the days of transistor logic. A transistor can be thought of as a simple switch for this discussion (Below Figure). DC (+) is DC Positive Terminal, DCC is DC common This type of transistor requires a small resistance on its collector (the upper side) for current limiting. In the Case 1 example, the resistor is in place, with the load shown in series with the transistor’s emitter. When the transistor conducts, current flows through the resistor, the transistor, and then through the load. This circuit was not used very much because the current divides across the internal circuitry, leaving less power available to drive the load and driving temperatures up in the I/O module. Case 2 This provides a more typical sourcing circuit, where the PLC output, by turning off, switches the full-load current to drive the load. When the output turns on, the transistor conducts, causing most of the current to be shunted through it, starving the load, and thereby de-energizing it. The downside of this configuration is that a small leakage current will continue to be present across the load, as a certain amount of current will continue to be directed across the load, though not enough, typically, to cause the load to stay energized. When troubleshooting, however, a small voltage will be detected across a de-energized load. In the Case 3 example, the load is the collector resistor. When the transistor conducts, the load energizes. From the standpoint of the board electronics, this is a better configuration because most of the heat is dissipated by the load. The downside of this configuration is that “switching the neutral” is counter-intuitive and can be unsafe, as full voltage is present at both the positive and negative terminals of the load when it is de-energized. For these reasons, Case 2 has evolved to become the most common output configuration. This sinking /sourcing concept can be extended to any circuit. b. Circuit Protection (Fusing) Most I/O modules are internally fused. However, that does not mean all that much to the user. While the internal fuse does limit damage to the module itself, in most cases the module still must be sent to the factory to be repaired. So the end result is the same to the user—a broken module. As a result, it is good practice to add external fuses to each I/O point, with a rating just below the fuse rating on the module circuit board. While this limits the size of the load that can be driven directly by the module, the internal fuse and module are protected. Caution: If internally fused discrete outputs are embedded in interlock chains, or if they are in circuits that depend on normally closed contacts to initiate safety actions, then another type of module that is unfused should be used. Or interposing relays could be deployed. It is possible to have the I/O point function normally (e.g., close its contacts, and report to the program that it has closed them) but still not pass power due to a blown internal fuse. c. Digital Input (DI) Circuits Digital input (DI) modules continually scan their input points for the presence or absence of voltage. If voltage is present, a 1 is written to a memory location. If voltage is absent, a 0 is written there. The required voltage type and magnitude are two of the factors that distinguish one DI module from another. Most DI points have high impedance, thus minimizing the amount of current absorbed, and so have a relatively minor effect on the power distribution system. Each digital input point can be thought of as a lamp, one that is either on or off. DI modules can be electrically isolated point to point, or they can be grouped by internally bussing the I/O common. Most modules today are grouped, as grouping allows for higher density. As we have seen, point densities of up to 32 points per module are common in the grouped configuration. The below Figure shows two different DI modules. The first module internally busses the DC(+) side of the circuit. The I/O point then passes power to the field device. This type of module is called a sourcing module. This configuration is unusual. Switching the common side in the field is typically not done. If the module internally busses the DC common side of the circuit, then the module is considered a sinking module. The I/O point completes the path to DC common. This configuration is used in the vast majority of cases because it allows each I/O point to be individually fused near the power supply before power is distributed to the field device. In either case, the current flows in the same direction through the field-mounted switch. d. Digital Output (DO) Circuits Relay contacts are considered output devices because they force other devices to react when they change state. PLC digital outputs can be thought of as relay contacts. In many cases, that is just what they are. In others, the switching element may be a solid-state device of some sort. Even in that case, the relay analogy works as long as the designer remembers to consider leakage current. DO modules switch voltage on and off to cause an external device to change state. These modules are either “isolated” or “non-isolated.” If a module is non-isolated, then it is either sinking or sourcing. 1. Isolated DO Circuits An isolated DO circuit is one in which the power source can be isolated between I/O points. The source is not internally bussed. The cost is two terminals per point, so it is expensive. There are three sources of wetted power, with points 1, 2, 4, 5, and 6 being isolated from point 3 and points 7 and 8. In this example, AC is being fed to Point 3, while DC signals are on the remaining points. Doing this demonstrates the possibilities. In practice, it is a good idea to separate AC and DC signals if at all possible. 2. Non-isolated DO Circuits As with the DI PLC module, point density is an important feature of DO modules. As can be seen in the isolated module in Figure, isolation comes with a price. A 16-terminal module has a point density of only eight since two terminals are needed per point. By internally bussing a common, the point density can be improved dramatically. However, the result is a non-isolated module that places limits on the designer. Power sources must be managed. In most cases this is not a problem since extending PLC I/O power to the field device is feasible. However, if a field device must source its own signal, then an interposing relay must be added to the circuit to provide isolation. The above Figure shows two different digital output modules. The first internally busses the DC(+) side of the circuit. The I/O point then provides a path to power, making it a sourcing module. If the module busses the DC common side of the circuit, as shown in Above Figure, Example 1, then the module is considered a sinking module. The I/O point completes the path to common. This type of module is rarely used today due to the common-side switching. Example 2 is far more common, as it puts the switching action ahead of the load in terms of current flow.
  14. Unlike the discrete/digital (on/off) circuit, analog signals vary across a range of voltage or current. Taking the same vessel described previously in Digital wiring example, how would the wiring change if we replaced the switch with a level transmitter? PLC Analog Signals Wiring Techniques The below Figure has the same circuit-breaker panel, but now it is feeding a DC power supply. The power supply could be in its own cabinet, or it could be in the marshalling panel. In any case, DC power is distributed in the marshalling panel. A single fuse could power several circuits, or each circuit could be fused. The transmitter is fed +24 VDC at its positive terminal. The 4–20 mA current signal is sourced from the (-) terminal of the transmitter to the PLC. Cabling is twisted pair and shielded. The signal cable is numbered with the transmitter number, and the wires inside are numbered to provide power source information. The shield is terminated in the marshalling panel, where all shields are gathered and terminated to a ground lug that is isolated from the cabinet. Note: Care should be used to ensure that the shield is only grounded at one spot. Shields that are grounded in more than one spot may inject large noise spikes onto the signal. This condition is called a ground loop and can be a very difficult problem to isolate, as the problem is intermittent. A “quiet” ground should be used to ground all the shields at one point. A quiet ground is one that is either tied to a dedicated ground triad, or one that is tied to the center-tap of an isolation transformer. Noisy ground would be one that is physically located far from the transformer, and one that services motors, lights, or other noisy items. That is the basic two-wire analog input circuit. The following is some specific information regarding the various analog possibilities: a. Circuit Protection (Fusing) Analog circuits are always low voltage, usually 24 VDC. As a result, fusing individual analog circuits is not required for personnel safety. Also, most analog I/O modules have current-limiting circuits onboard. So fusing is generally not required to protect the modules. If these two conditions are true—and the designer should confirm this with the manufacturer— then per-point fusing can be avoided if desired. If a designer wishes to save money by not fusing every point, then grouping the circuits into damage control zones should be considered. For example, if there is a pump pair, a primary and a backup, instruments for the two should be in separate fuse groups to prevent a single blown fuse from taking them both out. For more information, see I/O Partitioning in the index. b. Noise Immunity Analog circuits are susceptible to electronic noise. If, for example, an analog cable lies adjacent to a motor’s high-voltage cable, then the analog signal cable will act as an antenna, picking up the magnetically coupled noise generated by the motor. Other sources of noise exist, such as radio frequency (RF) radiation from a walkie-talkie. Noise on an analog signal cable can cause errors in reading the value of the signal, which in turn can cause a multitude of problems in the control system. Some ways to mitigate noise include: • Twisted-Pair Cables: Electronic noise may be greatly reduced by the use of twisted-pair cabling. Most instruments use two wires to transmit their signals. Current flows out to the device in one wire and back from the device in the other. If these wires are twisted, then the noise induced will be very nearly the same in each wire. The magnitude of induced current flow is identical in each conductor, but it travels in opposite directions, thus canceling out most of the noise. • Shielding: A further refinement in noise rejection is shielding, i.e., the use of a grounded braid or foil shield around the conductors. As previously mentioned, the shield should never be grounded in more than one place to avoid ground loops. Most instrument manufacturers recommend grounding the shield at the field instrument. However, a better place to do it is in the marshalling panel. It is easier to verify and manage the grounds if they are in one place. Also, it is possible to ensure a good ground at that point. • Conduit: A final refinement in noise rejection is grounded metallic conduit. This is rarely required, except for data communications cables and for particularly critical circuits. c. Resistance Temperature Detector (RTD) An RTD is made of a special piece of wire whose electrical resistance changes in a predictable way when the wire is exposed to varying temperatures. The material of choice today is 100 ohm platinum, though other types, such as 10 ohm copper, are sometimes used. For the platinum RTD, the rating is for 100 ohms at 0ºC. Resistance changes with temperature are very small, causing voltage variations in the millivolt range. RTDs are connected to a Wheatstone bridge circuit that is tuned to the RTD. But this tuning occurs on the bench. What about the field environment? We have already discussed the line attenuation difficulties inherent in millivolt signals (Chapter 4). This problem is overcome in the RTD circuit by the use of one or two sense inputs. These inputs help negate the effects of copper losses due to long lines and temperature variations along them and are additional wires that must be included in the RTD cable, hence the terms three-wire and four-wire RTDs. d. Thermocouple As we have discussed, a thermocouple exploits the electromotive force (EMF) that arises from changes in temperature affecting two dissimilar metals that have been laminated together. This EMF manifests itself as a millivolt (DC) signal. When certain combinations of these dissimilar metals are joined, a predictable curve of temperature to voltage results as temperature at the junction changes. The signal is measured at the open end of the two wires, and a millivolt-per-degree scale is used to convert the voltage to engineering units. Thermocouple is thus a two-wire device. It is susceptible to radiated and induced noise and so is usually housed in a shielded cable if extended for a very long distance. The thermocouple signal is also susceptible to degradation due to line loss, so minimizing the cable length is desirable. Also, it is important to use the proper extension wire. A thermocouple usually comes with a short pigtail connection to which extension wire must be attached. If a different wire material, such as copper, is used to extend the signal to the PLC, a spurious “cold junction” is created that causes a reverse EMF that partially cancels out the signal. Therefore, the proper extension wire should be used, or a device called a cold-junction compensator or ice-point reference needs to be installed between the copper wiring and the thermocouple wiring. Thermocouple I/O modules already have the cold-junction compensation onboard, so using the proper thermocouple extension wire is required. Specific types of thermocouples exhibit different temperature characteristics. A type J thermocouple is formed by joining an iron wire with a constantan wire. This configuration provides a curve relatively linear between 0 and 750ºC.8 A type K thermocouple has a nickel-chromium wire mated to a nickel-aluminum wire, sometimes called chromel/alumel. The type K thermocouple spans a useful temperature range of -200 to 1250ºC. Other combinations yield different response curves. e. 0–10 Millivolt (mV) Analog Analog signals were first generated by voltage modulation. In the old days, a transmitter would generate a weak signal that had to be captured and then filtered and amplified so it could be used to move a pen on a recorder, or a needle on a gauge. The Achilles’ heel of the millivolt signal is its susceptibility to electrical noise. This signal-to-noise ratio problem increases as a function of cable length. So the transmitter needed to be in close proximity to the indicator or recorder. Millivolt signals today are, by and large, fed to transducers that convert the small signal to a current or to other media (like digital data values) less susceptible to noise and decibel (dB) loss before leaving the vicinity of the sensing element. However, some recorders and data acquisition systems still operate on the millivolt signal. f. 4–20 Milliamp (mA) Analog The drive to overcome the line attenuation shortcomings of the millivolt signal resulted in the development of the 4–20 mA current loop. As a result of its greatly increased performance, this method of transmitting analog signals quickly became the industry standard. Most field instruments on the market have a sensing element (sensor) and a transmitting element. The transmitter is tuned to the sensor, which may provide any type of signal from frequency-modulated analog to millivolts DC. Whatever the form of the signal, the transmitter interprets it and converts it to an output current between 4 and 20 mA and within that span is proportional in magnitude to the input. The process of tuning the output to the input is called scaling. Thus, the transmitter becomes what is referred to as a variable-current source. Just as a battery, as a voltage source, tries to maintain a constant voltage, regardless of the amount of load applied to it, the current source tries to maintain a constant current (for a given input signal), regardless of load. Since current is common at all points of a series circuit, the problem of cable length—as noted as a problem with the millivolt signal—is nullified. Of course, the ability of the device to force a constant current through a circuit can be overcome if enough load is applied. Therefore, the designer must know how much energy the current source is capable of producing. Generally, today’s instruments are able to maintain 20 mA at a circuit resistance of 1000 ohms. Since a typical instrument has no more than 250 ohms of input resistance, it is possible to power several instruments from a single current source without needing an isolator. For example, a single transmitter should be able to feed its signal to a PLC, a chart recorder, and a totalizer at a cost of 750 ohms, plus the line resistance. This should still be within the comfort zone of a typical transmitter. Note: There are still instruments with 600 ohm ratings on the market, so the designer should always check whenever a complex circuit is contemplated. To determine the energy available to the circuit, the designer must be able to identify the provider of that energy. That task is sometimes not as straightforward as it might appear, and the answer to the question will greatly impact the wiring of the circuit. There are two primary types of analog circuit, as described from the point of view of the transmitter. Transmitters with two wires are considered to be passive devices that sink current, while transmitters with four wires are active devices that source current. The below Figure depicts three temperature transmitters, each connected to different I/O points on the same PLC module. One transmitter is directly powered (i.e., four-wire), while the others are indirectly powered (i.e., two-wire). Each transmitter is connected to a control device—in this case, a PLC input. From the PLC’s perspective, all 4–20 mA current inputs are really voltage inputs. Resistors, either user-provided external ones, as shown here, or internal ones, are used to convert the current to a voltage. The computer points themselves are actually high-resistance voltmeters, which give them excellent isolation from the field devices and minimize additional loading on the input circuit. The I/O points on the PLC are shown with internal power available for each point, so the module is capable of being the voltage source for the loop. The following is a detailed commentary on the differences between two-wire and four-wire devices: 1. Four-Wire Circuit As seen below, a four-wire transmitter is one that provides the energy to power the loop and generate the current-modulated signal. Most level transmitters, for example, are four-wire devices. Four-wire devices always have power connections in addition to the signal connections. Yet not all such powered transmitters are four-wire. If a powered transmitter’s output is noted as passive, then the device may be treated as a two-wire unit from the standpoint of the signal circuit. Most recording devices are externally powered, but are passive on the circuit. In these cases, the external power is for the internal electronics of the unit only. The signal circuit is isolated from this power source. Note that the recorder shown on the bottom circuit is a powered, passive device. 2. Two-Wire Circuit A two-wire device is said to be loop powered. This means the device functions by absorbing the energy it needs to generate the signal from the current loop. This is also referred to as “current sinking.” This nomenclature can be a bit confusing because a transmitter that is current sinking is still the signal source for the circuit. Power for the current loop is supplied elsewhere. A transmitter classified as two-wire must typically be the first device in the circuit with respect to current flow. In other words, the positive terminal of the transmitter must be directly connected to the positive terminal of the voltage source. The voltage source is usually a 24 VDC power supply. (a) Two-Wire Circuits with Stand-Alone Power Supply Referring to above Figure, PLC I/O point 2 depicts a two-wire circuit with an external DC power supply. Notice the wires must be rolled (polarity-wise) at the PLC for the proper polarity to be present across the I/O point. That is because current flow is now reversed with respect to the previous example because the transmitter must become the first load in the loop as opposed to being the energy source for the loop. (b) Two-Wire Circuits with PLC Internal Power Supply Most PLC systems today are able to source the loop current themselves by simply connecting the positive terminal of the transmitter to a different terminal at the PLC. The negative terminal of the transmitter is then tied to the positive side of the I/O point, and the negative side of the I/O point is jumpered to the PLC system’s DC common. That is depicted in the I/O point 3 example. In that example, a recorder has been added to the loop.
  15. For any unit conversion on any PLC, you can use four function math with the following for PLC Analog Input Conversion Formula, which assumes integer math, as follows : PLC Conversion Formula Formulas: EU = ((EUSpan x (DATA – DataOffset))/DataSpan) + EUOffset ProcessValue = EU / FACTOR DataOffset = Data in input register at 4 mA (or zero analog signal of whatever range – for example 0 VDC on a 0-10 VDC transmitter) DataSPan = Data at 20 mA – Data @ 4 mA FACTOR = arbitrary factor (multiple of 10) needed to get proper resolution and accuracy EU = Engineering Units x FACTOR EUOffset = Engineering Units @ 4 mA x FACTOR EUSpan = (Engineering Units @ 20 mA – Engineering Units @ 4 mA) x FACTOR DATA = Actual data reading in input register For Example, A Pressure transmitter of range 0 to 60 psig is connected to an PLC analog input card. The PLC Analog input card raw count starting from 6240 for 4mA and 31208 for 20mA. PLC reading 18975 raw counts and calculate equivalent pressure transmitter reading. Note: PLC raw counts may vary from system to system. 0-60 psig from 4-20 mA with resolution of 0.1 psig: FACTOR = 10 Data @ 4 mA = 6240 Data @ 20 mA = 31208 DataOffset = 6240 DataSpan = 31208 – 6240 = 24968 EUOffset = 0 x 10 = 0 EUSpan = (60 – 0) x 10 = 600 DATA = 18975 EU = ((EUSpan x (DATA – DataOffset))/DataSpan) + EUOffset EU = ((600 x (18975 – 6240)) / 24968) + 0 = 306 ProcessValue = EU / FACTOR Process Value = 306 / 10 = 30.6 psig
  16. leikang

    Multiple Pumps Control using PLC

    Write the PLC program to control multiple pumps using programmable logic controllers. We have two input pumps used to fill a tank. Make sure pumps operate in an equal amount of time over their lifetime. Multiple Pumps Control using PLC Program Logic: Develop ladder logic program according to the logic given below, The start/stop push button is provided for control of the two input pump motors P1 and P2. The Start/Stop pushbutton station is operated to control pump P1. When the tank is full drain pump motor P3 is started automatically and runs until the low-level sensor is actuated. After 3 fillings of the tank by pump P1 control automatically shifts to pump P2. The operation of the start/stop pushbutton now controls pump P2. After 3 fillings of the tank by pump P2, the sequence is repeated. PLC Program: Program Description: Rung 0000: Start/Stop PB latched with memory B3:0/0. Rung 0001: B3:0/0 enabled to turn on B3:0/1 which is to turn ON PUMP P1 (O:0/0) when low-level sensor(I:0/3) turn ON and High-level sensor (I:0/2) is in off condition.B3:0/1 is latched with low-level sensor because pump p1 should not go off once water started rising. Rung 0002: Memory contacts used to turn on PUMP P1 (O: 0/0) with counter (C5:0). Since we are going to shift pump operation from P1 to P2, two counters are used to shift between Pl and P2. Counter C5:1 is used to turn on PUMP P2(O:0/2). Rung 0003 & 0004: B3:0/0 enabled to turn on B3:0/2 which is to turn on PUMP P3(O:0/1) when high-level sensor(I:0/2) turn ON and low-level sensor (I:0/3) is in off condition.B3:0/2 is latched with high-level sensor because pump p3 should not go off once water started reducing. Rung 0005: When Pump 3 (O: 0/1) is running, the low-level sensor turns on will make Pump p3 off and pump P1(O:0/0) ON. Rung 0006: Both Counter reset is done once the second counter (C5:1) done bit turns ON. Conclusion: We can use this example to understand the programming logic in AB PLC.
  17. PLC programming took a history and reference from electrical drawings. As time passed and it became difficult to troubleshoot electrical systems involving automation, a need was required for some controller to execute a logic and do the needful. This gave birth to PLC systems. As you know, PLC programming has many types of languages and the original one is the ladder language. It should be known that electrical diagrams also help to convert it into ladder logic. In this post, we will see how to convert an electrical diagram into a PLC program. Understand Electrical Diagram First of all, you need to understand the electrical diagram. Refer to the below image. Every circuit has two ends – positive and negative. Current starts from the positive end and flows through the negative end. In between, electrical components and devices come. If you refer to the image below, there are four components – the start push button, the stop push button, the auxiliary contact of the lamp, and the lamp. The power supply starts from the positive end and goes to the input of the start push button (NO contact). The output of the start push button goes to the input of the stop push button (NC contact). The output of the stop push button goes to the input of the lamp. The output of the lamp is connected to the negative end supply. In parallel to the start push button, another wire goes down from the input of the button to an auxiliary contact of the lamp. The output of this contact is connected back to the output of the push button. When the power supply is given and if the start button is pressed, the lamp will turn on as it gets the path for current. Now, if the button is released, then the lamp will turn off as it does not get the path. So, to latch it, we therefore place the lamp contact in parallel which will hold the power supply path. When the stop button is pressed, the electrical supply path is cut off and the lamp goes off. Converting the wiring diagram to the PLC program Now, once you have understood the wiring diagram, start interpreting it in the same way for PLC programming. Refer to the below image. The ladder logic will have two power ends – left and right. Left is the equivalent to a positive power end and right is the equivalent to a negative power end. You will need four PLC programming components – start push button -> NO contact, stop push button -> NC contact, lamp -> output coil, and lamp NO contact. First, place the start push button NO contact. In parallel to it, place the lamp in NO contact. After this, place the stop push button NC contact. In the end, place the lamp in NO contact. The working will be the same as discussed for the wiring diagram. You saw that the same electrical drawing was interpreted and converted into ladder logic. The general tips to follow are: 1.Understand the wiring diagram from input power to the output power. In between, see which components are placed where and how they are wired. 2.In the wiring, identify the input parts and the output parts and mark them with separate colors. 3.Start programming by following the diagram and placing the components in the same way as wiring is done. 4.Run the program and see how it is working.
  18. We need to control the level of tanks which are connected in series. Implement program for Series Tanks Level Control using PLC Ladder Programming. Series Tanks Level Control Two tanks are connected in series connection. We need to control of both tanks which are connected in series. Implement the PLC program for this application. Problem Diagram Problem Solution In chemical companies, there are lots of materials which are used for process and also stored in storage tanks for different processes. Here we consider two tanks, 1. Storage Tank and 2. Feeder Tank. Storage tank has more capacity than feeder tank. Storage tank is for material storage and feeder tank is for material supply for other process. Two level switches are used for level detection and one inlet valve for material feeding control. Consider one manual outlet valve and it can be operated as per requirement by the operator. For this application we can use PLC, we will write PLC program for this application. List of Inputs and Outputs Digital Inputs Cycle START :- I0.0 Cycle STOP :- I0.1 Low level storage tank (LL1) :- I0.3 Low level feeder tank (LL2) :- I0.4 High level storage tank (LH1) :- I0.5 High level feeder tank (LH2) :- I0.6 Digital Output Inlet valve :- Q0.0 M memory Cycle ON bit :- M0.0 Inlet valve close condition :- M0.1 PLC Ladder Diagram for Level control of Series Tanks Program Description For this application we used S7-300 PLC and TIA portal software for programming. We can implement this logic by using other PLC also. Network 1: Network 1 is for latching circuit. Whenever START button is pressed (I0.0), Cycle ON (M0.0) bit will be ON. Cycle can be STOP by pressing STOP PB (I0.1). Network 2: If low level of storage tank (I0.3) or low level of feeder tank (I0.4) is detected, inlet valve (Q0.0) will be ON. (Inlet valve close condition should not present). Network 3: High levels (I0.5 &I0.6) of both tanks are detected, inlet valve close condition will be activated and it will close the inlet valve (Q0.0). Here outlet valve is manual valve, it can be operated by operator as per requirement. Note :- Above application may be different from actual application. This example is only for explanation purpose only. We can implement this logic in other PLC also. Result
  19. Study the PLC programming example on LED control using the ladder logic diagram and learn the program description. This PLC example is for engineering students who are interested in learning and practicing the PLC exercises. The real-time industrial PLC programs will be provided with more safety features. PLC Programming LED Control Design a PLC ladder logic for the following application. We are using three toggle Switches to control three LED’s If Toggle Switch 1 and Toggle Switch 2 are ON, then LED 1 and LED 2 will be ON. If Toggle Switch 2 and Toggle Switch 3 are ON, then LED 2 will be OFF, and LED 3 will be ON. Digital Inputs The required inputs are listed below. Toggle Switch 1: I0.0 Toggle Switch 2: I0.1 Toggle Switch 2: I0.1 Here we call these toogle switches as simple “Switch” in our next discussions, But remember these are toggle-type switches. Digital Inputs The required outputs are listed below. LED 1: Q0.0 LED 2: Q0.1 LED 3: Q0.2 Ladder Diagram for LED Control PLC Program Description For this application, we used EcoStruxure Machine Expert Basic v1.2 software for programming. In the above program, we have used Normally Open Contacts for Switch 1 (I0.0), Switch 2(I0.1), and Switch 3 (I0.2). We have also used Normally Closed Contact for Switch 3 (I0.2). Switch 1 and Switch 2, present in Rung0 are connected in series for LED 1 and LED 2, thus implementing AND logic gate. With Switch 1 and Switch 2, Switch 3 is connected to LED 3 as Normally Closed Contact. For LED 3, Switch 2 and Switch 3 present in Rung1 are connected in series, thus implementing the AND logic gate. For LED 1 to be ON, Switch 1 and Switch 2 should be ON. When Switch 1 and Switch 2 are turned ON and Switch 3 is OFF, then LED 2 will be ON. When Switch 2 and Switch 3 are ON, LED 3 will be ON. Turning ON Switch 3 will turn OFF LED 2. When Switch 1 and Switch 2 are ON In Rung0, the signal through Switch 1 and Switch 2 when turned ON. As a result, LED 1 and LED 3 will turn ON. Switch 3 is used as a Normally Closed Contact for Switch 3 when in a false state, it will allow the signal to turn ON LED 2. When Switch 2 and Switch 3 are ON The signal through Switch 2 and Switch 3 in Rung1, that turns ON LED 3. In Rung0, switch 3 is taken as Normally Closed Contact, when in the true state, it will not allow signal to pass through it. As a result, LED 2 will turn OFF. Switch 3 is connected to LED 1 and therefore, it will remain ON.
  20. PLC Temperature Control: In a vessel there are Three Heaters which are used to control the temperature of the vessel. PLC Temperature Control Programming We are using Three Thermostats to measure the temperature at each heater. also another thermostat for safety shutoff in case of malfunction or emergency or to avoid over temperatures. All these heaters have different setpoints or different temperature ranges where heaters can be turned ON accordingly (below table shows the temperature ranges). A temperature control system consists of four thermostats. The system operates three heating units. The thermostats (TS1/TS2/TS3/TS4 are set at 55°C, 60°C, 65°C and 70°C. Below 55°C temperature, three heaters (H1,H2,H3) are to be in ON state Between 55°C – 60°C two heaters (H2,H3) are to be in ON state. Between 60°C – 65°C one heater (H3) is to be in ON state. Above 70°C all heaters are to be in OFF state, there is a safety shutoff (Relay CR1) in case any heater is operating by mistake. A master switch turns the system ON and OFF. PLC Solution There are four thermostats; assume them be in NC state when the set point is not reached. Let there be a control relay (CR1) to work as a safety shutoff. Master Switch : The Start switch is NO and Stop switch NC type. The below table shows the temperature ranges where Thermostats (TS1,TS2,TS3,TS4) status will be indicated as per the temperature value. Also the Heaters (H1,H2,H3) status in which either those Heaters will be ON or OFF as per the temperature value. PLC Ladder Logic Ladder Logic Operation First Rung: It has START button (default NO contact) and STOP button (default NC contact). A Relay CR1 is used to control the heaters depending on the thermostats status. A Thermostat TS4 is connected in between STOP & Relay, if TS4 activated (means TS4 contact changes from NC to NO) then all heaters will be OFF. An NO contact of Relay CR1 is used across the START button in order to latch or hold the START command. Second Rung: An NO contact of Relay CR1 is used to control the Heaters (H1,H2,H3) with the thermostats (TS1,TS2,TS3) status. After giving START command, This NO contact becomes NC contact. if temperature below 55 Deg C, TS1, TS2 & TS3 will be in Close Status so all heaters will be ON. if Temperature is in between 55 to 60 Deg C, Then TS1 will be Open, so Heater H1 will be OFF. then, if temperature in between 60 to 65 Deg C then TS2 also be Open, so Heater H2 will be OFF if temperature in between 65 to 70 Deg C then TS3 also be Open, so Heater H3 will be OFF There is a safety Shutoff which is used to avoid any malfunctions of Thermostats or to avoid over temperatures. if temperature reaches above 70 Deg C then TS4 will activates and de-energizes the Relay, thus all Heaters will be turned OFF. Note : Here Heaters H1, H2, H3 are either Relays or Contactors we energizing. so an NO contact of these relays are connected to Electrical Heater feeder circuits (MCC).These Electrical Feeder circuits will be controlled as per these signals and accordingly the heaters will be either ON or OFF.
  21. PLC program for an artificial fishpond water level monitoring system explained with the ladder logic concept for beginners. Water Level Monitoring System Problem Description Implement a PLC program for an artificial fishpond water level monitoring system. Feed or drain the water of the artificial fishpond when the water level is below the normal level and activate the alarm when the water level is above or below the level. Problem Diagram Problem Solution This problem can be solved by using simple automation. Here we considered one artificial fishpond, four level sensors and three pumps for system monitor & control. Here we will write program that will control whole system. System will maintain normal level and it does not allow water level to go up or down to maintain the normal level. If water level goes down from the normal level then system will feed water in the fishpond and if water level goes up from the normal level then system will drain water from the fishpond. List of Inputs/Outputs Inputs List Level Sensor, L0 : I0.0 (L0=1 when the water level is above the alarm level). Level Sensor, L1 : I0.1 (L1=1 when the water level is above the normal level) Level Sensor, L2 : I0.2 (L2=1 when the water is above the normal level) Level Sensor, L3 : I0.3 (L3=1 when the water is above the alarm level) Outputs List Feeding pump :- Q0.0 Drainage pump 1 :- Q0.1 Drainage pump 2 :- Q0.2 Alarm lamp :- Q0.3 PLC Ladder Logic for artificial fishpond water level monitoring Logic Explained In this problem we will consider S7-300 PLC and TIA portal software for programming. Network 1: In this network, we have written logic for drainage pump 1 (Q0.1). When water level is above the highest level of alarm level (L3 = I0.3), at that time drainage pump 1 (Q0.1) will be ON. Network 2: If water level is below the alarm level then feeding pump (Q0.0) should be start. So here we have taken NC contact of L1 (I0.1), when level is below the normal level then feeding pump (Q0.0) will ON and fill the water in the fishpond. Network 3: If water level is above the normal level then the drainage pump 2 (Q0.2) will be ON. Here water level is above than the normal level, not alarm level, so only drainage pump2 (Q0.1) will work. Network 4: Here we have used two conditions in OR gate so either level is below normal level (L1 = I0.1) or above normal level (L1 = I0.1) then flashing circuit will be activated and alarm lamp (Q0.3) will be ON. Network 5: Timer 2 for flashing circuit. Network 6: Here we have used two conditions in OR gate so either level is below normal level (L1=01) or above normal level then alarm lamp (Q0.3) will flash automatically on 5 second interval. Level is above alarm level (L0=1, L1=1, L2=1, L3=1) or below alarm level (L0=0, L1=0, L2=0, L3=0) THEN alarm lamp will flash automatically on 5 seconds interval. Level is above alarm level (L0=0, L1=0, L2=0, L3=0) then drainage pump 1&2 will start and if water level is above normal then only drainage pump 2 will start. Note:- Above example is for explanation purpose only, not all parameters or interlocks are considered. It is not necessary to use S7-300 PLC for this simple logic, we have used this PLC for our discussion purpose. Result
  22. Modbus communication of delta PLC (DVP 14SS2) with delta VFD (VFD-L series). The motor is to be run directly from HMI (DOP-107CV) using Modbus communication. Delta PLC and VFD Modbus Communication The induction motor is to be run directly from HMI along with its speed control. Speed control is such that there should be two buttons in HMI that increase and decreases the speed of the motor by steps of one hertz (assume). There is a VFD-L series delta AC drive which will run the motor based on the commands received from PLC. Firstly, communication and other parameters need to be set in the drive matching all its configurations with the PLC such as baud rate, parity, communication mode, etc; except the slave ID (station address) which must be different from the PLC station address. By default, the PLC station address is equal to one (1). This means the station address of the drive must be anything in its defined range other than one (1). The detailed parameters to be set for the communication mode are as follows: 2-00 = 4 2-01 = 4 Communication Parameters We have to set the communication parameters as per the above table. (taken from manual). 9-00 = 2 (can be set to anything except 1) 9-01 = 1 9-04 = 7 (RTU mode, stop bits equal to 1 & parity to even) DVP 14SS2 has two communication ports namely RS232 and RS485 separately. Now, the communication port 2 settings need to be done according to the set parameters of VFD which are as follows. Open the WPL soft. (Delta PLC Software) Click on the Communication Program icon on the programming page. Select COM2 and press next. Set the parameters according to the VFD drive communication parameters and click Next. Here, they are fed according to the parameters set in the VFD-L dive. The station address of PLC is 1 (see left bottom corner) Check the highlighted and press next. One can check the boxes below and write the conditions. Here, we are skipping this window, and instead, we will write the logic directly on ladder diagram mode. Click Finish. Now, the following ladder logic is generated as a result of the above set conditions. The ladder in rung 2 executes each time a sent request is received. The ladder in rung 3 executes each time after any data is read from or written to the drive. Now, before moving further, the logic for starting and stopping the motor and its speed control is written, we need to find out the Modbus addresses of the drive through which the said will be executed. For the VFD-L series, 2000H is the Modbus address for starting & stopping the drive and 2001H is for the frequency change. Here, H denotes hexadecimal. In this topic, we are here to use the decimal format for the particular address. So hexadecimal must be changed to decimal format. Through the 8421 code, we would convert as follows: 2000 (Hex) = 8192 (Dec) 2001(Hex) = 8193 (Dec) So, instead of 200H & 2001H, 8192K & 8193K will be used. Make sure that 8192 & 8193 are only the Modbus addresses. If 8192K has a value equal to 10 then the motor will start. If 8192K has a value equal to 1 then the motor will stop. If 8193K has a value equal to 5000 then the motor will run on 50 Hz, which means if the speed of the motor needs to be increased by 1 Hz, 100 must be added to the existing value and vice versa. PLC Program Explanation Now, going to the details of the PLC program. Sending request bit M1122 is set each time any command is given to VFD in rung 5. MODRW K2 K6 K8192 D70 K1 MODRW represents Mod read write K2 represents the station address of the VFD. K6/K3 represents the function code whether to write or read. Here k6 represents write. K8192 represents the Modbus address to which data is written Data in D70 is written to k8192 K1 is the data length 10 (dec) and 1 (dec) are moved to D70 when start and stop commands are given in rungs 6 and 7. At the same time, the transmission of data takes place i.e data in D70 is written to the 8192k address of VFD in rung 8 to start and stop the motor. 100 (dec) is added to D100’s value in rung 10 to increase the speed by 1 Hz when the speed increase pulse (M4) is received. 100 (dec) is subtracted from D100’s value in rung 9 to decrease the speed by 1 Hz when the speed decrease pulse (M5) is received. At the same time, the transmission of data takes place i.e data in D100 is written to the 8193k address of VFD in rung 11 to start and stop the motor. HMI Now, coming to the HMI configuration. After selecting the HMI model, set the below configuration as here, PLC to HMI configuration is on RS232. (You have to configure it as per the HMI model) Take four momentary buttons, assign the addresses, and design the HMI screen as follows: Start = M0 Stop = M1 Increase speed = M4 Decrease speed = M5 Test the process The HMI design is not covered in this article.
  23. Когда вы работаете в системе промышленной автоматизации для программирования ПЛК, у вас есть требования, при которых вам необходимо контролировать процесс постепенно или поэтапно. Алгоритмы управления Вы не можете напрямую включить или отключить логику выполнения своей работы. Это может оказать неблагоприятное воздействие на фактический выходной сигнал ПЛК. По этой причине в программе ПЛК доступны различные типы методов управления для соответствующих действий. В этом посте мы увидим различные методы алгоритмов управления, которые используются в программе ПЛК. ПИД-регулятор Это, безусловно, самый известный метод контроля. ПИД-регулятор использует механизм замкнутого контура управления. Это означает, что сначала он получит обратную связь и в зависимости от вашего желания будет соответствующим образом изменять выходные данные. Для этого ПИД-регулятор использует внутренние математические вычисления с тремя параметрами – пропорцией, интегралом и производной. Итак, если вы хотите управлять чиллером с компрессором, то ПЛК будет управлять выходной мощностью компрессора, сначала измеряя фактическую температуру и сверяя ее с тем, сколько требуется пользователю. В зависимости от этой разницы каждый раз мощность компрессора будет либо регулироваться постепенно, либо включаться-выключаться для поддержания температуры. Для этого в программе ПЛК для выполнения этой задачи будет использоваться блок ПИД. Генератор функций Это очень простой тип метода управления. В генераторе функций вам необходимо определить входную таблицу из n значений. Аналогичным образом определите выходную таблицу из n значений. Так, например, если мы определим 10 таблиц значений как на входной, так и на выходной стороне, у нас будет элемент размером 10. Теперь эти 10 элементов будут иметь разные значения. Если вы установили 0-100 на входной стороне, то мы установили 0-50 на выходной стороне. Эти 10 элементов представляют собой 10 диапазонов, то есть 0–10, 10–20, 20–30 и так далее. Соответственно, выходная сторона будет распределена на 10 элементов от 0 до 5, 5–10, 10–15 и так далее до 50. Когда ввод в реальном времени находится между любым значением на входной стороне, соответствующий масштабированный выход будет прошедший. Здесь у вас есть полная гибкость в установке значений входных и выходных таблиц. Нечеткое логическое управление Нечеткая логика — относительно очень хороший метод управления выходными данными. Обычно у вас есть два двоичных состояния – 0 и 1. Итак, давайте рассмотрим, может ли клапан быть открыт или закрыт. Но что, если клапан застрял между ними? Мы не знаем, находится ли клапан в открытом или закрытом состоянии. В этом случае помогает, если существует состояние между 0 и 1. Это помогает хотя бы приблизиться к возможности. Это называется суетливая логика. Здесь вы можете определить значения около 0 и 1. Это может быть 0,9 или 0,2. Соответственно, вы можете контролировать выходы, когда они приближаются к этим значениям. И когда он достигнет крайнего предела, то есть 0 или 1, можно полностью открыть или закрыть клапан. До этого можно постепенно управлять клапанами. Это обеспечивает более точный контроль процесса. Итак, этот блок управления позволяет собирать значения, которые могут быть полезны в непредсказуемых ситуациях. Требуется много знаний и опыта, чтобы правильно установить значения и наборы, чтобы логика работала правильно. Позиция пропорциональная Эта логика будет открывать или закрывать устройство, импульсно открывая или закрывая контакты в определенный заранее заданный таймер, установленный пользователем. Это делается для ширины импульса, пропорциональной отклонению между требуемым положением и текущим положением. Вам необходимо установить параметры управления, такие как минимальное и максимальное значение ограничения выхода, продолжительность, в течение которой выход будет оставаться включенным, скорость, с которой устройство должно открываться или закрываться в %/секунду и т. д. Функциональный блок принимает фактическую обратную связь, оценивает внутренние таймеры и проверяет, происходит ли открытие или закрытие с желаемой скоростью или нет. Если нет, то будет подан соответствующий импульс открытия или закрытия. Таким образом, мы увидели различные методы алгоритмов управления, используемые в программировании ПЛК.
  24. Документация ПЛК представляет собой очень важную инженерную документацию этапов управления процессом, и, как и все технические описания, необходимы точные подробные инженерные записи. Без точных чертежей изменения и модификации, необходимые для модернизации и диагностики, крайне затруднены или невозможны. Документация по системе ПЛК Каждый провод от ПЛК к оборудованию мониторинга и управления должен быть четко промаркирован и пронумерован на обоих концах и записан на электрической схеме. ПЛК должен иметь полные и актуальные лестничные схемы (или на другом утвержденном языке), и каждая ступенька должна быть помечена полным описанием ее функции. Основными документами в системе ПЛК являются: Обзор системы и полное описание работы управления; Структурная схема блоков системы; Полный список всех входов и выходов, пунктов назначения и номеров; Схема подключения модулей ввода-вывода, обозначение адреса для каждой точки ввода-вывода и расположение стоек; Лестничная диаграмма с описанием, номером и функцией ступени. Также необходимо иметь возможность моделировать лестничную программу в автономном режиме на персональном компьютере или в фоновом режиме в ПЛК, чтобы можно было выполнять изменения, обновления и моделирование неисправностей, не прерывая нормальную работу ПЛК. , а эффект от изменений и обновлений можно оценить до их внедрения.
  25. Инструкции сравнения в ПЛК используются для проверки пар значений, чтобы обеспечить логическую непрерывность цепочки. Таким образом, инструкции сравнения редко, если вообще когда-либо, будут последней инструкцией в цепочке. Типы инструкций сравнения В качестве примера предположим, что инструкция LES представлена двумя значениями. Если первое значение меньше второго, то инструкция сравнения верна. Команда равенства (EQU) Используйте инструкцию EQU, чтобы проверить, равны ли два значения. Если источники A и источники B равны, инструкция логически верна. Если эти значения не равны, инструкция логически ложна. Источник A должен быть адресом. Источник B может быть либо программной константой, либо адресом. Значения хранятся в дополняющей друг друга форме. Инструкция «Не равно» (NEQ) Используйте инструкцию NEQ, чтобы проверить, не равны ли два значения. Если источники A и источники B не равны, инструкция логически верна. Источник A должен быть адресом. Источник B может быть либо программной константой, либо адресом. Значения хранятся в дополняющей друг друга форме. Инструкция «Меньше чем» (LES) Используйте инструкцию LES, чтобы проверить, меньше ли одно значение (источник A) другого (источник B). Если значение источника A меньше значения источника B, инструкция логически верна. Источник A должен быть адресом. Источник B может быть либо программной константой, либо адресом. Значения хранятся в дополняющей друг друга форме. Инструкция «Меньше или равно» (LEQ) Используйте инструкцию LEQ, чтобы проверить, меньше ли одно значение (источник A) другого (источник B) или равно ему. Если значение в источнике A меньше или равно значению в источнике B, инструкция логически верна. Источник A должен быть адресом. Источник B может быть либо программной константой, либо адресом. Значения хранятся в дополняющей друг друга форме. Инструкция «Больше, чем (GRT)» Используйте инструкцию GRT, чтобы проверить, больше ли одно значение (источник A) другого (источник B). Если значение в источнике A больше, чем значение в источнике B, инструкция логически верна. Инструкция «Больше или равно» (GEQ) Используйте команду GEQ, чтобы проверить, больше ли одно значение (источник A) другого (источник B) или равно ему. Если значение в источнике A больше или равно значению в источнике B, инструкция логически верна. Маскированное сравнение равных (MEQ) Используйте инструкцию MEQ для сравнения данных по адресу источника с данными по адресу сравнения. Использование этой инструкции позволяет маскировать части данных отдельным словом. Источник — это адрес значения, которое вы хотите сравнить. Маска — это адрес маски, через которую инструкция перемещает данные. Маска может быть шестнадцатеричным значением. Сравнение — это целое число или адрес ссылки. Если 16 бит данных по адресу источника равны 16 битам данных по адресу сравнения (без маскированных битов), инструкция верна. Инструкция становится ложной, как только обнаруживается несоответствие. Инструкция по предельному тесту (LIM) M) Используйте инструкцию LIM для проверки значений в пределах или за пределами указанного диапазона, в зависимости от того, как вы установили пределы. Значения нижнего предела, теста и верхнего предела могут быть адресами слов или константами, ограниченными следующими комбинациями: Если параметр Test является программной константой, параметры Low Limit и High Limit должны быть адресами слов. Если параметр «Тест» представляет собой адрес слова, параметры «Нижний предел» и «Верхний предел» могут быть либо программной константой, либо адресом слова. Статус true/false инструкции LIM Если значение нижнего предела равно или меньше верхнего предела, инструкция верна, когда тестовое значение находится между пределами или равно любому из пределов. Если нижний предел имеет значение, превышающее верхний предел, инструкция является ложной, если тестовое значение находится между пределами.
×
×
  • Create New...