Jump to content
  • PLC programming technology and HMI interface design English database

    PLC, DCS, HMI and SCADA product application technical articles

    leizuofa
    Here we discuss about PLC Pneumatic Circuit Control with different examples. PLC ladder diagram for single-acting and double-acting pneumatic cylinders.
    PLC Pneumatic Circuit Examples
    Example 1 :
    A double-acting cylinder is used to perform machinng operation. Pneumatic cylinder is advanced by pressing two push buttons simultaneously. If any one of the push button is released, cylinder comes back to start position. Draw the pneumatic circuit, PLC wiring diagram and ladder diagram to implement this task.
    Solution :

    As shown in the PLC wiring diaram, The push buttons PB1 and PB2 are connected at memory address I1 and I2.
    I1 and I2 are connected in series in ladder diagram to realize this AND logic function.
    When the push buttons PB1 and PB2 are pressed simultaneously, the addresses I1 and I 2 turn to state 1 from state 0 , as a result power flows through the coil and there will be output at coil 01. Output at the coil 01 operated the solenoid coil and cylinder moves forward to do the required operation.
    If any one of PB1 and PB2 is pressed, then corresponding bit addresses turns to 0, since I1 and I2 are in series , if any of them turns to 0 state , there will not be any output at 01 and thus solenoid is de-energised and returns back.
    Example 2 :
    Double acting cylinder is used to perform forward and return motion. Pneumatic cylinder is advanced by pressing push buttons PB1. Cylinder is returned by pressing push button PB2. Draw the pneumatic circuit, PLC wiring diagram and ladder diagram to implement this task.

    Solution

    PLC Wiring diagram and Ladder diagrams are shown in above Figure. when the push button PB1 is pressed state of the address I1 turns to 1 and thus there will be output 01. The output of 01 operates the solenoid Y1 and cylinder moves forward,
    When the cylinder reaches the extreme forward position, and Push button PB2 is operated , the state of address I2 turns to 1 and thus there will be output 02. The output of 02 operates the solenoid Y2 and cylinder return back to initial position.
    Example 3 :
    Double acting cylinder is used to perform forward and return automatically after reaching the extreme forward position. Pneumatic cylinder is advanced by pressing push buttons PB1. Draw the pneumatic circuit, PLC wiring diagram and ladder diagram to implement this task.
    Solution

    PLC Wiring diagram and Ladder diagrams are shown in above Figure. when the pushbutton PB1 is pressed state of the address I1 turns to 1 and thus there will be output 01. The output of 01 operates the solenoid Y1 and cylinder moves forward.
    When the cylinder reaches the extreme forward position, and Limit switch S2 is operated , the state of address I3 turns to 1 and thus there will be output 02. The output of 02 operates the solenoid Y2 and cylinder return back to initial position.
    Example 4 :
    Double acting cylinder is used to perform pressing operation. Cylinder has to move forward when PB1 button is pressed and return for set time of 20 seconds before it automatically returns to intial position. Limit switch S2 is used for end sensing of the forward motion of the cylinder. Draw the pneumatic circuit, PLC wiring diagram and ladder diagram to implement this task.
    Solution

    When PB1 is pressed, address I1 input state goes to 1 and there is an output at O1. Due to output at O1, the solenoid coil Y1 is operated and cylinder moves forward.
    When cylinder reaches end position, limit switch S2 is operated and as a result address I3 changes to 1 and consequently starts the timer T1.
    The signal state of timer T1 changes to 1 after 20 seconds is reached. At the end of 20 seconds there will be output from Timer T1 set output O2. Coil Y2 is energised thus causing the return motion of the cylinder.
    Example 5 :
    Double acting cylinder is used to perform continuous to and fro motion. Cylinder has to move forward when PB1 button is pressed and once to and fro reciprocation starts it should continue till stop button PB2 is pressed. Limit swithces are used for end position sensing. Draw the pneumatic circuit, PLC wiring diagram and ladder diagram to implement this task.
    Solution :

    The start and stop operations can be implemented using memory flag with address M1 that is set by PB1 and reset by PB2.
    The state of the memory element M1 is scanned through an NO contact, is combined in series with the state of sensor S1 to get start and stop controls.
    Example 6 :
    Double acting cylinder is used to perform to and fro operation. Cylinder has to move forward when PB1 button is pressed and continue to and fro motion till 10 cycles of operations is performed. Draw the pneumatic circuit, PLC wiring diagram and ladder diagram to implement this task.
    Solution

    The fully automatic operation of cylinder can be obtained as earlier using limit switch S1 and S2.
    Start and stop operation can be implemented using memory flag with address M1 that is set by PB1 at I1 and reset by NC contact of a down counter.
    The state of memory flag M1 scanned through an NO contact (rung 2) is combined in series with the state sensor S1 to get start and stop controls.
    Example 7 :
    Draw the pneumatic circuit, PLC wiring diagram and ladder diagram to implement A+B+B-A- sequence.
    Solution

    In this sequence circuit, PB2 is used to initiate the program. Pressing PB2 causes the last memory state M4 to set and all other memory flags M1, M2 and M3 to reset. Initially S1 and S3 are actuated and generate outputs.
    Condition 1:
    Pressing PB1 sets Memory flag M1 and resets Memory flag M4. Solenoid Y1 is energised. Cylinder A extends (A+). Sensor S1 is deactivated once A travels and S2 is activated when end position is reached.
    Condition 2:
    When S2 is actuated, memory M2 is set and Memory flag M1 is reset. Solenoid Y3 is energised. Cylinder B extends (B+). Sensor S3 is deactivated once B travels and S4 is activated when end position is reached.
    Condition 3:
    When S4 is actuated, memory M3 is set and Memory flag M2 is reset. Solenoid Y4 is energised. Cylinder B retracts (B-). Sensor S4 is deactivated once B travels and S3 is activated when initial position is reached.
    Condition 4:
    When S3 is actuated, memory M4 is set and Memory flag M3 is reset. Solenoid Y2 is energised. Cylinder A retracts (A-). Sensor S2 is deactivated once B travels and S1 is activated when initial position is reached.


    leizuofa
    I am always surprised how an automation system like PLC or DCS does the scaling for a sensor ? or even sometimes thinking about a simple field transmitter scaling techniques for converting any type of sensor output into standard 4-20mA.
    For example, consider a Temperature Transmitter and we all know by using a simple formula we can calculate the equivalent temperature from the RTD sensor output resistance And in the case of a thermocouple, a complex algorithm is required for converting its output millivolt into equivalent temperature.
    So now the Question is How a PLC or DCS or Transmitter does the Scaling?
    Let us discuss in detail about scaling.

    How a PLC do the Scaling for a Sensor ?
    Scaling is the process of taking a signal such as a process variable, voltage or current output from a sensor and applying calculations to present this signal in a more usable form in terms of engineering units, such as PSI, °F or %RH to the operator in the control room.
    There are three common techniques used in the data acquisition world including linear scaling, mapped scaling and formula scaling.
    All three methods have their place and time for use and will be described in this article.
    Scaling Techniques
    There are three techniques for scaling that we are going to cover here in this article: linear, mapping and formula.
    These three techniques overlap a little bit as we will explain, but they are the primary methods used in the world of data acquisition.
    Just to give a quick overview of these three methods and what they are best utilized for, we’ve put together a table below.

    In certain instances where formula-based scaling is not available, mapping can sometimes be used to predefine a table based on the formula needed and vice versa.
    It is also worth noting that when working with a sensor that has an analog output, the units specified for that sensor are not set in stone.
    For example
    if your sensor has a 4 to 20mA output for a range of -40 to 100°C, it would be just as easy to scale the output into Fahrenheit by saying that the unit has a range of -40 to 212°F.  We’ll touch more on this in the next section.
    Linear Scaling
    The technique of linear scaling should remind you a few your days back in basic algebra.  It uses the old slope-intercept form ‘y = mx + b’ where
    y is your output (also known as engineering units value), x is your input (whether it be voltages, milliamps, etc.), m is your slope (also known as scale factor), and b is your y-intercept (also known as offset). As previously stated, linear scaling works best with linear voltage or current outputs in which the minimum and maximum outputs represent specific values along with the sensors range.
    If you’re a bit rusty, have no fear, we’ll give you a couple of examples to freshen things up.
    Example 1
    Let’s consider the level Transmitter with a 0 to 100 ft WC range and 0 to 10V DC output.  These specifications tell us two things:
    An output of 0V represents a measurement of 0ftWC and An output of 10V represents a measurement of 100ftWC. It’s best to start with your scale factor, or m in the equation.  The factor m can be solved by using the slope formula
    m = (y2-y1) / (x2-x1)’ and choosing two points along the linear scale.
    After the scale factor has been determined, we simply plug the value m back into the slope-intercept formula and use one of our points to calculate our offset.

    We will use the two points (0, 0) and (10, 100) to calculate the scale factor or m.             m  = (y2-y1) / (x2-x1) = (100 – 0) / (10 – 0) = 100 / 10
                Therefore m = 10
    Now we will use the slope-intercept formula and the point (0, 0) to calculate the offset or b.             y = mx + b, where y = 0, x = 0, m = 10, and b is unknown.
                0 = 10(0) + b = 0 + b
                Therefore b = 0
    It’s always a good idea to verify that your scale factor and offset are right by plugging our second point into our completed equation, which in this case is (10, 100).             y = mx + b, where y = 100, x = 10, m = 10, and b = 0.
                100 = 10(10) + 0 = 100
                Given that this arithmetical operation is valid, we have verified that our scale factor and offset are correct.
    Example 2
    Considering that the 0 to 10V example is fairly simple, let’s move on to something more challenging like a 4 to 20mA output.
    We will still use the level Transmitter with a 0 to 100ftWC range, but this time we’ll use a 4 to 20mA output.  These specifications again tell us two things:
    An output of 4mA represents a measurement of 0ftWC and An output of 20mA represents a measurement of 100ftWC. We will go about this example, in the same manner, we did the last one by first finding the scale factor and then plugging in a few numbers to calculate the offset.

    We will use the two points (4, 0) and (20, 100) to calculate the scale factor or m.             m = (y2-y1) / (x2-x1) = (100 – 0) / (20 – 4) = 100 / 16
                Therefore m = 6.25
    Now we will use the slope-intercept formula and the point (4, 0) to calculate the offset or b.             y = mx + b, where y = 0, x = 4, m = 6.25, and b is unknown.
                0 = 6.25(4) + b = 25 + b
                Therefore b = -25
    It’s always a good idea to verify that your scale factor and offset are right by plugging our second point into our completed equation, which in this case is (20, 100).             y = mx + b, where y = 100, x = 20, m = 6.25, and b = -25.
                100 = 6.25(20) + (-25) = 100
                Given that this arithmetical operation is valid, we have verified that our scale factor and offset are correct.
    Mapped Scaling
    The technique of mapped scaling often built-in and preprogrammed for inputs like thermocouples, Pt100/1000’s, and other resistive temperature sensors.
    For example, when you configure your data acquisition system to measure a type K thermocouple, the system already knows what thermocouple millivolt output corresponds to what temperature.
    This example does not apply only to type K thermocouples, but any type of commonly used resistive temperature sensor or other related sensors.
    However, there are some instances in which we would need to create our own mapping table.
    One of these instances would be when we are working with a data acquisition system that is not preconfigured for use with resistive temperature sensors.  This is not a very common situation that we run into, but it is worth mentioning. The other instance would be when we have a non-linear function and formula-based scaling is not available or is a piecewise function.  A good example of this would be when we are using a level sensor to calculate tank volume in a non-linear tank. Typically when we want to know what the volume of a fluid in a tank is we measure the depth or level of the tank.
    By knowing this, we can calculate the volume of the fluid.  If the tank had a flat bottom and was the same diameter along with its height then this calculation would be simple, and we could use linear scaling like above.
    However, typically these tanks are rounded and the level of the fluid does not directly correlate to the volume of fluid. In this situation, we must use mapped scaling and a little bit of math to attain our desired result.

    For our example we will use a horizontal cylinder tank with a diameter of 5 ft. and a length of 10 ft.
    There are a number of complicated trigonometric formulas used to determine the filled volume of a tank like this that we’re going to skip over as they are too complex for the scope of this article.  Instead, we will do the calculations and show you the value mapping table.
    Also, for this example, we will be using the level Transmitter again, but this time a 0 to 10V DC output and 0 to 5 ft WC range.

    If this is the mapping table programmed into your data acquisition system then the volume will be calculated rather than simply measuring the depth.
    Typically the more points in your table the more accurate the calculations will turn out to be.  To demonstrate this concept, let’s use an 1V output signal as an example.
    An output of 1V would tell us that there is a 0.5 ft. depth in the tank.  This calculates out to be approximately 76 gallons. 1V falls between 0V and 2V on our table, so the data acquisition system will set up a linear scale between those two points and will say that a 1V output is 104.5 gallons, which is nearly 30 gallons off! Formula Scaling
    This technique has the potential to be one of the most powerful scaling methods, however, it is often a resource hog and most data acquisition systems storing data at high rates cannot keep up with this process.
    For data acquisition systems that cannot perform formula scaling there are two alternatives:
    Storing raw values and applying the required formulas to the data after the data has been saved from the data acquisition system.  This can typically be done in a piece of software such as Microsoft Excel. Using a programmable signal calculator.  This type of device can be configured to process multiple inputs via a user-defined formula and provide a linear output. There are numerous potential uses for formula scaling.  We will cover two possible scenarios for this technique: vertical cylinder tank volume and differential pressure.
    Example 1
    For a vertical cylinder tank, the fill volume can be calculated by the formula ‘V = π r2 f ‘ where
    V is the volume filled, r is the radius of the tank, and f is the fill height. Let’s say that our tank has a diameter of 5 ft. and a height of 10 ft.  Again, let’s use the level Transmitter for our example with a 0 to 10 ft WC range and 0 to 5V DC output.
    The level Transmitter is giving us our fill height or f.  From this fill height, we can directly calculate the fill volume or V.  We will be using some of the same methods for linear scaling to get our f and applying the calculations on top of that.

    We will first calculate the linear scaling for the fill height or f.  I’m going to skip a few steps since we covered this in the first section.             y = f = 2x, where x is the voltage output of the sensor.
    Now we can replace the f in the vertical cylinder tank formula with 2x.             V = π r2 f = π (2.5)2 (2x) = π 12.5x
    Example 2
    The second scenario that we are going to use to explain the technique of formula scaling is differential pressure.
    There are obviously a number of differential pressure sensors out there that give a linear output, but from experience, I can tell you that there is are a lot of uses for this method of calculating differential pressure.
    In this example, we will use two of the transmitters with a 0 to 100 PSI range and 0 to 10 V DC output.
    One will be placed inside a pressurized vessel submerged below water and the other will be placed outside of this vessel.  The differential pressure will determine the amount of force that is being exerted on the walls of the vessel.
    The calculations here are very simple.  Simply subtract one from the other.
    Pdifferential = Pexternal – Pinternal
    Conclusion
    There three most commonly used techniques for scaling sensor outputs are
    Linear scaling, Mapped scaling and Formula scaling. PLC Shift Register As you can see, there are many instances in which more than one of these techniques can work and the best choice usually depends on the hardware/software that you’re working with.
    Linear scaling is the easiest to work with, however, sensors with linear outputs tend to be more expensive as additional hardware is required to linearize the raw output from the transducer.
    Mapped scaling is used more often than we tend to even notice.  Any time a resistive temperature sensor is giving you a temperature reading, mapped scaling is at work somewhere along the line.
    Formula scaling is very powerful but requires hardware/software configurations.

    leizuofa
    Objective : To understand the basic concept of PLC Valve Control Ladder Logic.
    Target Users : Students, Technicians, Freshers, Trainee engineers.

    Note : Barrier or Relay not shown in above figure.
    Lets list out the required PLC digital inputs and digital output signals :
    PLC Digital Inputs :
    Valve Open Feedback Valve Close Feedback PLC Digital output :
    Valve Energize command PLC Valve Control Ladder Logic Programming
    Any pneumatic valve requires instrument air supply for its operation. A air filter regulator is used to remove any liquid or particulate matter present in the instrument air supply and to set the required air supply to the valve.
    The output of air filter regulator is connected to valve actuator via a Solenoid valve. This solenoid valve is used to control i.e. ON/OFF the instrument air supply to the valve actuator.

    Consider solenoid valve (SOV) is Normally Close (NC) type. In normal position, the SOV is in off position or de-energized state, so the instrument air supply will be blocked as SOV is Normally closed. if SOV is energized i.e. PLC sends the signal then SOV energizes and becomes normally open (NO), so allows instrument air supply through its. 
    Some people often confuses about Solenoid valve and Valve actuator. These both are different, SOV controls (ON/OFF) the instrument air supply and Valve actuator controls the position of the valve either fully open or fully close.
    ON/OFF valve are equipped with either proximity switches or limit switches to sense the valve position either fully open or fully close. so these are connected to the PLC digital inputs. So PLC can know the valve status in the field either fully open or fully close and displays to the operator via graphics.
    Consider our ON/OFF valve is Normally Open type i.e. valve is in Open position. so by default Open Feedback will be sent to the PLC or we can say Open feedback limit switch or proximity switch will be energized and close feedback switch is in de-energize state.
    Lets say PLC sends an Digital output command to the ON/OFF valve (via a barrier or a relay). Say we have 24V DC powered solenoid valve mounted on the ON/OFF valve.
    Generally either a barrier or a relay is placed after the PLC digital output module. consider we have a barrier, first barrier receives the PLC digital output module command (PLC command is Barrier input) then the barrier energizes its output (Barrier output) and barrier sends the 24V DC power to the respective ON/OFF valve.
    The purpose of barrier or relay is used to isolate the PLC & Field signals or for safety purpose or to amplify the power/voltage signals.
    Now ON/OFF valve receives the PLC command i.e. it received the 24V DC power to the solenoid valve from the barrier. so now solenoid valve will be energized and changes to Normally Open (NC) state. Now solenoid valve passes the instrument air supply to the valve actuator as it becomes Normally open.
    The valve actuator receives the instrument air supply and moves the valve stem accordingly and the valve position will change from fully open state to full close state. When the ON/OFF valve starts the stem movement then immediately Open Feedback will be gone (proximity switch will not detect any object mounted on the stem).
    After starts valve stem movement and before reaching close position, both open & close feedbacks will not be available to the PLC and we call this as transition state. After the ON/OFF valve fully closed then close feedback switch (proximity or limit) will be energized and close feedback signal will be sent to the PLC and displayed to the operator.
    Note : Sometimes ON/OFF valve may stuck in between, so operator will not receive any feedback on the graphics, as both open & close feedback switches will only detect either fully open or fully close states of the valve. Its not possible to detect any Intermediate state of the valve.
    Say now PLC withdraws the Output command to the ON/OFF valve i.e. barrier input will be turned off, so barrier will de-energized or barrier output will be OFF, 24V DC power will be disconnected/removed to the Solenoid valve.
    As solenoid valve power removed, SOV changes its state from NO to NC. Solenoid valve becomes Normally Closed i.e. Instrument air supply to the valve actuator will be stopped or disconnected. So ON/OFF valve also comes into its original state i.e. Open state.
    PLC can send output command signal based on some logics or real time input signals. for example : if level of a drum reaches high alarm then drum feed ON/OFF valve has to be closed.
    Details of ON/OFF Valve :
    In our example we considered a pneumatic on/off valve. First we see the list of components in the valve & its purpose.
    a. Air Filter Regulator :
    Air Filters are used to remove liquid water and particulate matter from compressed air sources. These are ‘mechanical filters’ and do not remove oil vapors or chemical contaminants in vapor form. Click here for Principle & Animation.
    b. Solenoid Valve :
    A solenoid valve is an electro-mechanical controlled valve. The valve features a solenoid, which is an electric coil with a movable ferromagnetic core in its center. This core is called the plunger.
    In rest position, the plunger closes off a small orifice. An electric current through the coil creates a magnetic field. The magnetic field exerts a force on the plunger. As a result, the plunger is pulled toward the center of the coil so that the orifice opens. This is the basic principle that is used to open and close solenoid valves.
    Solenoid Valve Animation
    Solenoid valve Types & Principles
    c. Open Feedback & Close Feedback :
    A proximity switch is one detecting the proximity (closeness) of some object.
    By definition, these switches are non-contact sensors, using capacitive, inductive, magnetic, electric, or optical means to sense the proximity of the valve position either open or close.
    d. Valve Actuator :
    A valve actuator is a device that produces force to open or close the valve utilizing a power source. This source of power can be manual (hand, gear, chain-wheel, lever, etc.) or can be electric, hydraulic or pneumatic.
    e. Instrument Air Supply :
    Compressed & Dried air supply for the valve.

    leizuofa
    Here, we will emulate the exact same high-pressure alarm circuit using an Allen-Bradley MicroLogix 1000 PLC instead of a relay coil:
    PLC Logic Example

    Ladder-logic Program

    Suppose a fluid pressure of 36 PSI is applied to the pressure switch. This is less than the switch’s trip setting of 50 PSI, leaving the switch in its “normal” (closed) state. This sends power to input I:0/2 of the PLC.
    The contact labeled I:0/2 drawn in the ladder-logic program of the PLC acts like a relay contact driven by a coil energized by input terminal I:0/2.
    Thus, the closed pressure switch contact energizes input terminal I:0/2, which in turn “closes” the normally-open contact symbol I:0/2 drawn in the ladder-logic program.
    This “virtual” contact sends virtual power to a virtual coil labeled B3:0/0, which is nothing more than a single bit of data in the PLC’s microprocessor memory.
    “Energizing” this virtual coil has the effect of “actuating” any contact drawn in the program bearing the same label.
    This means the normally-closed contact B3:0/0 will now be “actuated” and thus in the open state, not sending virtual power to the output coil O:0/1.
    With virtual coil O:0/1 “unpowered,” the real-life output O:0/1 on the PLC will be electrically open, and the alarm lamp will be unpowered (off).
    If we suppose a fluid pressure of 61 PSI be applied to the pressure switch, the normally-closed pressure switch contact will be actuated (forced) into the open state.
    This will have the effect of de-energizing PLC input I:0/2, thus “opening” the normally-open virtual contact in the PLC program bearing the same label. This “open” virtual contact interrupts virtual power to the virtual coil B3:0/0, causing the normally-closed virtual contact B3:0/0 to “close,” sending virtual power to virtual coil O:0/1.
    When this virtual output coil “energizes,” the real-life output channel of the PLC activates, sending real power to the alarm light to turn it on, signaling a high-pressure alarm condition.
    We may simplify this PLC program further by eliminating the virtual control relay B3:0/0 and simply having input I:0/2 activate output O:0/1 through a “normally-closed” virtual contact:

    The effect is the same: the PLC output O:0/1 will activate whenever input I:0/2 de-energizes (whenever the pressure switch is opened by a high pressure), turning on the alarm lamp in a high-pressure condition.
    In a low-pressure condition, the energized input I:0/2 forces the virtual normally-closed contact I:0/2 to open, thus de-energizing the PLC’s output O:0/1 and turning the alarm lamp off.
    Programmable Logic Controllers have not only greatly simplified the wiring of industrial logic controls by replacing multitudes of electromechanical relays with a microprocessor, but they have also added advanced capabilities such as counters, timers, sequencers, mathematical functions, communications, and of course the ability to easily modify the control logic through programming rather than by re-wiring relays.
    The beauty of ladder-logic programming is that it translates the technician’s understanding of traditional relay control circuits into a virtual form where contacts and coils interact to perform practical control functions.
    A key concept to master, however, is the association of real-life conditions to switch status based on the “normal” representation of those switch contacts, whether the switches be real (relay) or virtual (PLC). Once this vital concept is mastered, both hard-wired relay control circuits and PLC programs become possible to understand. Without mastering this vital concept, neither relay control circuits nor PLC programs may be understood.

    leizuofa
    The IEC 61131-3 standard specifies several dedicated ladder instructions for performing arithmetic calculations. Some of them are shown here:
    PLC Math instructions

    As with the data comparison instructions, each of these math instructions must be enabled by an “energized” signal to the enable (EN) input. Input and output values are linked to each math instruction by tag name.
    An example showing the use of such instructions is shown here, converting a temperature measurement in units of degrees Fahrenheit to units of degrees Celsius.
    In this particular case, the program inputs a temperature measurement of 138 deg F and calculates the equivalent temperature of 58.89 deg 😄

    well as a dedicated variable (X) used to store the intermediate calculation between the subtraction and the division “boxes.”
    Although not specified in the IEC 61131-3 standard, many programmable logic controllers support Ladder Diagram math instructions allowing the direct entry of arbitrary equations.
    Rockwell (Allen-Bradley) Logix5000 programming, for example, has the “Compute” (CPT) function, which allows any typed expression to be computed in a single instruction as opposed to using several dedicated math instructions such as “Add,” “Subtract,” etc.
    General-purpose math instructions dramatically shorten the length of a ladder program compared to the use of dedicated math instructions for any applications requiring non-trivial calculations.
    For example, the same Fahrenheit-to-Celsius temperature conversion program implemented in Logix5000 programming only requires a single math instruction and no declarations of intermediate variables:


    leikang
    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:


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

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

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

    leikang
    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

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

    leikang
    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


    caixiaofeng
    The PLC documentation is a very important engineering record of the process control steps, and, as with all technical descriptions, accurate detailed engineering records are essential.
    Without accurate drawings, changes and modifications needed for upgrading and diagnostics are extremely difficult or impossible.

    Every wire from the PLC to the monitoring and control equipment must be clearly marked and numbered at both ends, and recorded on the wiring diagram.
    The PLC must have complete up-to-date ladder diagrams (or other approved language), and every rung must be labeled with a complete description of its function.
    The essential documents in a PLC System are:
    1. System overview and complete description of control operation;
    2. Block diagram of the units in the system;
    3. Complete list of every input and output, destination, and number;
    4. Wiring diagram of I/O modules, address identification for each I/O point, and rack locations;
    5. Ladder diagram with rung description, number, and function.
    It is also necessary to have the ability to simulate the ladder program off-line on a personal computer, or in a background mode in the PLC, so that changes, upgrades, and fault simulations can be performed without interrupting the normal operation of the PLC, and the effects of changes and upgrades can be evaluated before they are incorporated.

    caixiaofeng
    Every programmable logic controller must have some means of receiving and interpreting signals from real-world sensors such as switches, and encoders, and also be able to effect control over real-world control elements such as solenoids, valves, and motors.
    This is generally known as input/output, or I/O, capability. Monolithic (“brick”) PLCs have a fixed amount of I/O capability built into the unit, while modular (“rack”) PLCs use individual circuit board “cards” to provide customized I/O capability.
    PLC Input Output Modules

    The advantages of using replaceable I/O cards instead of a monolithic PLC design are numerous.
    First, and most obvious, is the fact that individual I/O cards may be easily replaced in the event of failure without having to replace the entire PLC.
    Specific I/O cards may be chosen for custom applications, biasing toward discrete cards for applications using many on/off inputs and outputs, or biasing toward analog cards for applications using many 4-20 mA and similar signals.
    Some PLCs even offer the feature of hot-swappable cards, meaning each card may be removed and a new one inserted without de-energizing power to the PLC processor and rack.
    Please note that one should not assume any system has hot-swappable cards, because if you attempt to change out a card “live” in a system without this feature, you run the risk of damaging the card and/or the rest of the unit it is plugged in to!

    Some PLCs have the ability to connect to processor-less remote racks filled with additional I/O cards or modules, thus providing a way to increase the number of I/O channels beyond the capacity of the base unit.
    The connection from host PLC to remote I/O racks usually takes the form of a special digital network, which may span a great physical distance:

    An alternative scheme for system expansion is to network multiple PLCs together, where each PLC has its own dedicated rack and processor.
    Through the use of communication instructions, one PLC may be programmed to read data from and/or write data to another PLC, effectively using the other PLC as an extension of its own I/O.
    Although this method is more expensive than remote I/O (where the remote racks lack their own dedicated processors), it provides the capability of stand-alone control in the event the network connection between PLC processors becomes severed.
    Input/output capability for programmable logic controllers comes in three basic varieties: discrete, analog, and network.

Apply for friendship links:WhatsApp or E-mail: admin@plchmis.com
×
×
  • Create New...