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

    PLC, DCS, HMI and SCADA product application technical articles

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

    leikang
    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


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

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

    caixiaofeng
    This is a complete tutorial about PLC ladder logic to control variable frequency drive (VFD) for motor speed control with speed selection from Field Local Panel or SCADA graphics.
    Execution Steps :
    Prepare a Control and Power drawing Commissioning and Parameters Programming in VFD Prepare a PLC program Prepare a SCADA design How to Control VFD with PLC ?

    Control and Power Diagram

    Commissioning and Parameters Programming in VFD
    Commissioning is needed for the proper function of VFD. Necessary parameter like Motor Nameplate details, Input Voltage, Motor Type, Frequency should be entered in VFD during quick commissioning. After successful quick commissioning, now it’s a time to install the advanced commissioning. This commissioning is needed to give the details of all the digital and analog inputs and outputs, like  
    Information about Digital inputs of Start command and Speed Selection command Information about Digital Outputs like Status of Drive Running and Drive in Fault etc. Information about Analog Inputs like Speed Input 1 and Speed Input 2 Information about Analog Outputs like Current and Frequency of Motor PLC Program
    Network 1 :

    In this Network 1, we are checking whether the VFD is ready to start. This signal will come when all the conditions are healthy as well as safety and power feedbacks are active.
    Network 2 :

    In the Network 2, When start button is pressed, VFD Drive_DO bit will be set, if Ready_to_Start and No Error will be there.
    Network 3 :

    This is the stop logic, When stop button is pressed it will reset the Drive_DO bit.
    Network 4 :

    In this Network 4, this logic is required for safety as soon as Drive_DO bit will set and if any case VFD will not operate due to any fault then after predefined wait time, here we considered it as Run_FB_Time, it will reset the Drive_DO bit and generate Error.
    This Error you can acknowledge from the SCADA after resolving the error from the field side.
    Network 5 :

    In this Network 5, If the VFD is taking more current and gives overload error, then it will reset Drive_DO bit and generate Error.
    This Error you can acknowledge from the SCADA after resolving the error from the field side.
    Network 6 :

    This is the speed selection Digital output, if you select speed input as a local then it will not activate Speed Selection bit resulting Speed_DO absent and if you select speed input as a remote then it will activate Speed Selection bit resulting Speed_DO present.
    SCADA Design
    Normal State

    This is the normal state of motor. There is no error as well as Ready bit is also in normal state.
    Also the speed selection is in LOCAL mode.
    Running State

    This state shows that Ready bit is high and motor is running without any error.
    Error State

    There is an error bit is high and motor also showing error condition.
    Note :
    In some industries, Yellow color also used to indicate the error condition. Red color is used to indicate motor stop condition.

    caixiaofeng
    Ladder Diagram (LD) Programming
    The most common language used to program PLCs is Ladder Diagram (LD), also known as Relay Ladder Logic (RLL).
    This is a graphical language showing the logical relationships between inputs and outputs as though they were contacts and coils in a hard-wired electromechanical relay circuit.
    This language was invented for the express purpose of making PLC programming feel “natural” to electricians familiar with relay-based logic and control circuits. While Ladder Diagram programming has many shortcomings, it remains extremely popular in industries automation.
    Every Ladder Diagram program is arranged to resemble an electrical diagram, making this a graphical (rather than text-based) programming language.
    Ladder diagrams are to be thought of as virtual circuits, where virtual “power” flows through virtual “contacts” (when closed) to energize virtual “relay coils” to perform logical functions.
    None of the contacts or coils seen in a Ladder Diagram PLC program are real; rather, they act on bits in the PLC’s memory, the logical interrelationships between those bits expressed in the form of a diagram resembling a circuit. being edited on a personal computer:
    Ladder Diagram Programming
    The following computer screenshot shows a typical Ladder Diagram program.

    Contacts appear just as they would in an electrical relay logic diagram – as short vertical line segments separated by a horizontal space.
    Normally-open contacts are empty within the space between the line segments, while normally-closed contacts have a diagonal line crossing through that space.
    Coils are somewhat different, appearing as either circles or pairs of parentheses. Other instructions appear as rectangular boxes.
    Each horizontal line is referred to as a rung, just as each horizontal step on a stepladder is called a “rung.”
    A common feature among Ladder Diagram program editors, as seen on this screenshot, is the ability to color-highlight those virtual “components” in the virtual “circuit” ready to “conduct” virtual “power.”
    In this particular editor, the color used to indicate “conduction” is light blue.
    Another form of status indication seen in this PLC program is the values of certain variables in the PLC’s memory, shown in red text.
    For example, you can see coil T2 energized at the upper-right corner of the screen (filled with light blue coloring), while coil T3 is not.
    Correspondingly, each normally-open T2 contact appears colored, indicating its “closed” status, while each normally-closed T2 contact is uncolored.
    By contrast, each normally-open T3 contact is uncolored (since coil T3 is unpowered) while each normally-closed T3 contact is shown colored to indicate its conductive status.
    Likewise, the current count values of timers T2 and T3 are shown as 193 and 0, respectively. The output value of the math instruction box happens to be 2400, also shown in red text.
    Color-highlighting of Ladder Diagram components only works, of course, when the computer running the program editing software is connected to the PLC and the PLC is in the “run” mode (and the “show status” feature of the editing software is enabled).
    Otherwise, the Ladder Diagram is nothing more than black symbols on a white background.
    Not only is status highlighting very useful in de-bugging PLC programs, but it also serves an invaluable diagnostic purpose when a technician analyzes a PLC program to check the status of real-world input and output devices connected to the PLC.
    This is especially true when the program’s status is viewed remotely over a computer network, allowing maintenance staff to investigate system problems without even being near the PLC!

    caixiaofeng
    Programmable logic controllers are built to input various signal types (discrete, analog), execute control algorithms on those signals, and then output signals in response to control processes. By itself, a PLC generally lacks the capability of displaying those signal values and algorithm variables to human operators.
    A technician or engineer with access to a personal computer and the requisite software for editing the PLC’s program may connect to the PLC and view the program’s status “online” to monitor signal values and variable states, but this is not a practical way for operations personnel to monitor what the PLC is doing on a regular basis.
    In order for operators to monitor and adjust parameters inside the PLC’s memory, we need a different sort of interface allowing certain variables to be read and written without compromising the integrity of the PLC by exposing too much information or allowing any unqualified person to alter the program itself.
    One solution to this problem is a dedicated computer display programmed to provide selective access to certain variable’s in the PLC’s memory, generally referred to as Human-Machine Interface, or HMI.
    HMIs may take the form of general-purpose (“personal”) computers running special graphic software to interface with a PLC, or as special-purpose computers designed to be mounted in sheet metal panel fronts to perform no task but the operator-PLC interface.
    This first photograph shows an example of an ordinary personal computer (PC) with HMI software running on it:

    The display shown here happens to be for monitoring an example, a vacuum swing adsorption (VSA) process for purifying oxygen extracted from ambient air. Somewhere, a PLC (or collection of PLCs) is monitoring and controlling this VSA process, with the HMI software acting as a “window” into the PLC’s memory to display pertinent variables in an easy-to-interpret form for operations personnel. The personal computer running this HMI software connects to the PLC(s) via digital network cables such as Ethernet.
    Note : An older term for an operator interface panel was the “Man-Machine Interface” or “MMI.”
    This next photograph shows an example of a special-purpose HMI panel designed and built expressly to be used in industrial operating environments:

    These HMI panels are really nothing more than “hardened” personal computers built ruggedly and in a compact format to facilitate their use in industrial environments.
    Most industrial HMI panels come equipped with touch-sensitive screens, allowing operators to press their fingertips on displayed objects to change screens, view details on portions of the process, etc.

    Technicians and/or engineers program HMI displays to read and write data via a digital network to one or more PLCs.
    Graphical objects arrayed on the display screen of an HMI often mimic real-world indicators and switches, in order to provide a familiar interface for operations personnel.
    A “pushbutton” object on the face of an HMI panel, for example, would be configured to write one bit of data to the PLC, in a manner similar to a real-world switch writing one bit of data to the PLC’s input register.
    Modern HMI panels and software are almost exclusively tag-based, with each graphic object on the screen associated with at least one data tag name, which in turn is associated to data points (bits, or words) in the PLC by way of a tag name database file resident in the HMI.
    Graphic objects on the HMI screen either accept (read) data from the PLC to present useful information to the operator, send (write) data to the PLC from operator input, or both.
    The task of programming an HMI unit consists of building a tag name database and then drawing screens to illustrate the process to as good a level of detail as operators will need to run it.
    An example screenshot of a tag name database table for a modern HMI is shown here:

    The tag name database is accessed and edited using the same software to create graphic images in the HMI.
    As per this example you can see several tag names (e.g. START PUSHBUTTON, MOTOR RUN TIMER, ERROR MESSAGE, MOTOR SPEED) associated with data points within the PLC’s memory (in this example, the PLC addresses are shown in Modbus register format).
    In many cases the tag name editor will be able to display corresponding PLC memory points in the same manner as they appear in the PLC programming editor software (e.g. I:5/10, SM0.4, C11, etc.).
    An important detail to note in this tag name database display is the read/write attributes of each tag.
    Note in particular how four of the tags shown are read-only: this means the HMI only has permission to read the values of those four tags from the PLC’s memory, and not to write (alter) those values.
    The reason for this in the case of these four tags is that those tags refer to PLC input data points. The START PUSHBUTTON tag, for instance, refers to a discrete input in the PLC energized by a real pushbutton switch.
    As such, this data point gets its state from the energization of the discrete input terminal. If the HMI were to be given write permission for this data point, there would likely be a conflict.
    Suppose input terminal on the PLC were energized (setting the START PUSHBUTTON bit to a “1” state) and the HMI simultaneously attempted to write a “0” state to the same tag.
    One of these two data sources would win, and other would lose, possibly resulting in unexpected behavior from the PLC program.
    For this reason, data points in the PLC linked to real-world inputs should always be limited as “read-only” permission in the HMI’s database, so the HMI cannot possibly generate a conflict.
    The potential for data conflict also exists for some of the other points in the database, however.
    A good example of this is the MOTOR RUN bit, which is the bit within the PLC program telling the real-world motor to run.
    Presumably, this bit gets its data from a coil in the PLC’s Ladder Diagram program. However, since it also appears in the HMI database with read/write permission, the potential exists for the HMI to over-write (i.e. conflict) that same bit in the PLC’s memory.
    Suppose someone programmed a toggling “pushbutton” screen object in the HMI linked to this tag: pushing this virtual “button” on the HMI screen would attempt to set the bit (1), and pushing it again would attempt to reset the bit (0).
    If this same bit is being written to by a coil in the PLC’s program, however, there exists the distinct possibility that the HMI’s “pushbutton” object and the PLC’s coil will conflict, one trying to tell the bit to be a “0” while the other tries to tell that bit to be a “1”.
    This situation is quite similar to the problem experienced when multiple coils in a Ladder Diagram program are addressed to the same bit.
    The general rule to follow here is never allow more than one element to write to any data point. In my experience teaching PLC and HMI programming, this is one of the more common errors students make when first learning to program HMIs: they will try to have both the HMI and the PLC writing to the same memory locations, with weird results.
    One of the lessons you will learn when programming large, complex systems is that it is very beneficial to define all the necessary tag names before beginning to lay out graphics in an HMI.
    The same goes for PLC programming: it makes the whole project go faster with less confusion if you take the time to define all the necessary I/O points (and tag names, if the PLC programming software supports tag names in the programming environment) before you begin to create any code specifying how those inputs and outputs will relate to each other.
    Maintaining a consistent convention for tag names is important, too. For example, you may wish to begin the tag name of every hard-wired I/O point as either INPUT or OUTPUT (e.g. INPUT PRESSURE SWITCH HIGH, OUTPUT SHAKER MOTOR RUN, etc.).
    The reason for maintaining a strict naming convention is not obvious at first, since the whole point of tag names is to give the programmer the freedom to assign arbitrary names to data points in the system.
    However, you will find that most tag name editors list the tags in alphabetical order, which means a naming convention organized in this way will present all the input tags contiguously (adjacent) in the list, all the output tags contiguously in the list, and so on.
    Another way to leverage the alphabetical listing of tag names to your advantage is to begin each tag name with a word describing its association to a major piece of equipment.
    Take for instance this example of a process with several data points defined in a PLC control system and displayed in an HMI:

    If we list all these tags in alphabetical order, the association is immediately obvious:
    Exchanger effluent pump Exchanger effluent temp out Exchanger preheat pump Exchanger preheat temp in Exchanger preheat valve Reactor bed temp Reactor feed flow Reactor feed temp Reactor jacket valve As you can see from this tag name list, all the tags directly associated with the heat exchanger are located in one contiguous group, and all the tags directly associated with the reactor are located in the next contiguous group.
    In this way, judicious naming of tags serves to group them in hierarchical fashion, making them easy for the programmer to locate at any future time in the tag name database.
    You will note that all the tag names shown here lack space characters between words (e.g. instead of “Reactor bed temp”, a tag name should use hyphens or underscore marks as spacing characters: “Reactor bed temp”), since spaces are generally assumed by computer programming languages to be delimiters (separators between different variable names).
    Like programmable logic controllers themselves, the capabilities of HMIs have been steadily increasing while their price decreases.
    Modern HMIs support graphic trending, data archival, advanced alarming, and even web server ability allowing other computers to easily access certain data over wide-area networks.
    The ability of HMIs to log data over long periods of time relieves the PLC of having to do this task, which is very memory-intensive.
    This way, the PLC merely “serves” current data to the HMI, and the HMI is able to keep a record of current and past data using its vastly larger memory reserves.
    If the HMI is based on a personal computer platform (e.g. Rockwell RSView, Wonderware, FIX/Intellution software), it may even be equipped with a hard disk drive for enormous amounts of historical data storage.
    Some modern HMI panels even have a PLC built inside the unit, providing control and monitoring in the same device.
    Such panels provide terminal strip connection points for discrete and even analog I/O, allowing all control and interface functions to be located in a single panel-mount unit.

    caixiaofeng
    Develop PLC Programming Examples on Industrial Automation according to the logic given below,
    A Saw, Fan and oil pump all go ON when a start button is pressed. If the saw has operated less than 20s, the oil pump should go off when the saw is turned off and the fan is to run for an additional 5s after the shutdown of the saw. If the saw has operated for more than 20s, the fan should remain on until reset by a separate fan reset button and the oil pump should remain on for an additional 10 s after the saw is turned off. Write a PLC program that will implement this process. PLC Programming Examples

    Program Description:
    Rung 0000:
    Start/Emergency Stop PB latched with memory B3:0/0.
    Rung 0001:
    B3:0/0 enabled to turn on Saw (O: 0/0), Fan (O: 0/1 ) and Oil pump (O:0/2).
    Normally closed contact of Stop switch is in series Saw output to turn off.
    Fan reset switch and Timer T4:0 is connected to turn off Fan when condition meets.
    Timer T4:2 done a bit and memory bit is to turn off the oil pump.
    Rung 0002:
    When the stop is pressed, according to the logic mentioned in point 2, Fan output (O: 0/2) needs to turn off after 5s.
    Comparator block restricts the timer T4:0 to run after the 20s of Saw operation.
    Rung 0003:
    Timer T4:1 runs when the start is pressed. When the stop is pressed at any point after the 20s, Saw output will go off.
    After 10s, the oil pump will go off. This operation is done by Timer T4:2. Timer T4:0 done bit is used to restrict the Timer T4:1 operation when T4:0 is ON.
    Rung 0004:
    Less than a comparator block is used to perform the logic mentioned in point 2, to turn off Fan when saw output operation was less than 20s.
    Program Output:
    Now we see the simulation of above ladder logic for different conditions as mentioned below.
    When Start PB is pressed

    When Stop switch pressed before the 20s

    When Stop switch pressed after the 20s

    When Fan reset switch is pressed

    Conclusion:
    We can use this example to understand the programming logic in Allen Bradley PLC.

    caixiaofeng
    PLC Programming Example on multi-motor control for beginners using Schneider Electric EcoStruxure Machine Expert Basic PLC software.
    Please note, that 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 designed with more safety and protection features.
    PLC Programming Example on Multi-Motor
    Design a PLC ladder logic for the following application.
    We are using three toggle switches to control three motors.
    If Switch 1 is ON, then Motor I, Motor II, and Motor III 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 Off. Digital Inputs
    The following digital inputs (DI) are required in this example program. The assigned PLC DI addresses are also mentioned.
    Switch 1: I0.0
    Switch 2: I0.1
    Switch 3: I0.2
    Digital Outputs
    The following digital outputs (DO) are required in this example program. The assigned PLC DO addresses are also mentioned.
    Motor 1: Q0.0
    Motor 2: Q0.1
    Motor 3: Q0.2
    Ladder Diagram for Multi-Motor Control

    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 Contact for Switch 1 (I0.0), Normally Closed Contacts for Switch 2 (I0.1) and Switch 3 (I0.2) Switch 1 and switch 3 are connected in series for Motor 1 and Motor 2, thus implementing AND logic gate. For Motor 3, switch 1, switch 2 and switch 3 are connected in series, thus implementing AND logic gate. For Motor 1 and Motor 2 to be ON, switch 1 should be ON and switch 3 should be OFF. When switch 1 is ON, switch 2 and switch 3 are OFF, Motor 3 will be ON. Turning ON Switch 3 will turn OFF all the Motors i.e., Motor 1, Motor 2 and Motor 3 will be OFF. Motor 3 will turn OFF, when Switch 2 is turned ON. When switch 1 is turned ON, all the motors will turn ON because the current will also pass through switch 2 and switch 3 as these are Normally Closed Contacts. Without turning OFF switch 1, motor 1 and motor 2 will still remain ON but motor 3 will turn OFF, when switch 2 is turned ON. On turning Switch 2 ON, it will not pass current to motor 3. All the motors will turn OFF when switch 3 is turned ON, even if other switches are ON. When Switch 1 is ON
    The current flows through switch 1 as it is in true state. In false state, switch 3 and switch 4 also pass current to the outputs.

    When Switch 2 is ON
    The current does not flow through switch 2 when it is turned ON. In true state Normally Closed contact breaks the circuit.

    When Switch 3 is ON
    Switch 3 is a Normally closed contact. When turned On, it will not allow current to pass through it. As a result, none of the output will be ON.


    caixiaofeng
    This is a PLC Program for Entry/Exit control of the basement or underground car parking.
    PLC Car Parking
    Problem Description
    Due to crowded area we face lots of problems of vehicle parking at basement or underground at shopping mall, hotels, complex etc.This is happening due to contradiction between the rapidly growing number of vehicles and limited parking spaces in malls, shop and complex in cities results in the phenomenon of “difficult parking and disorderly parking”.Current parking problem has serious impacts on people’s quality of life and the running of roads.
    Problem Diagram

    Problem Solution
    By simple automation we can reduce the car parking problem at basement or underground in shopping mall, hotels, complex etc. The Entry/Exit at basement is a single lane passage and it needs traffic lights to control cars.Here we consider two lights indication for cars control. Red lights prohibit cars entering or leaving while green lights allow cars entering and leaving.When car enters at the passage from the entry of the ground floor, both red lights (ground floor and basement) will be ON.Other car entering and leaving is prohibited during the process till the car passes through the single passage.When passage is clear both green lights (ground floor and basement) will be ON and allow other cars entering from the ground floor or basement.
    Initially we will keep green lights ON and red light OFF
    List of Inputs and Outputs
    Inputs List
    Main SWITCH : I0.0 Sensor S1 for ground floor Entry/Exit : I0.1 Sensor S2 for basement Entry/Exit : I0.2 Outputs List
    Green light (Entry/Exit ground floor) : Q0.0 Green light (Entry/Exit basement) : Q0.1 Red light (Entry/Exit ground floor) : Q0.2 Red light (Entry/Exit basement) : Q0.3 M memory coil List
    M10.0 : Will be ON when car passes sensor S1 M10.3 : Will be ON when car Passes sensor S2 M0.0 : Positive edge of system ON M0.1 & M11.0 : Positive edge of sensor S1 M0.3 & M11.1 : Positive edge of sensor S2 M11.2 : Negative edge of sensor S2 M11.3 : Negative edge of sensor S1 PLC Ladder Diagram for Entry/Exit control of car parking








    Program Description
    In this application we have used Siemens S7-300 PLC and TIA Portal Software for programming.
    Network 1:
    As per above explanation in first network when system is ON (I0.0), initially both green lights (ground floor (Q0.0) and basement (Q0.1)) will be ON. SET instruction is executed and it will set both output Q0.0 and Q0.1.
    Network 2:
    As per above explanation in second network when system is ON (I0.0), initially both red lights (ground floor (Q0.2) and basement (Q0.3)) will be OFF.)RESET instruction is executed and it will reset both output Q0.2 and Q0.3.
    Network 3:
    When car enters in the empty passage from the ground floor, sensor S1 (I0.1) will be triggered and with this trigger, memory coil M10.0 will be SET.
    Network 4:
    When car enters in the empty passage from the basement, sensor S2 (I0.2) will be triggered and with this trigger, memory coil M10.3 will be SET.
    Network 5:
    Both red lights will be set by either positive trigger of sensor S1 or sensor S2.Because when car enters in empty passage then both red lights (Q0.2 & Q0.3) will prohibit car entry/exit from both side.
    Network 6:
    Here we have taken negative trigger of both sensor S1 (I0.1) and S2 (I0.2). so when they triggered red lights (Q0.2 & Q0.3) will be OFF.When car completely passes empty passage then red lights (Q0.2 & Q0.3) should be OFF.
    Network 7:
    In this network green lights (Q0.0 & Q0.1) will be ON when red lights are OFF.Green lights (Q0.0 & Q0.1) allow other car for entry or exit.
    Network 8:
    If red lights (Q0.2 & Q0.3) are ON at that time green lights (Q0.0 & Q0.1) should be OFF.So in this network when red lights (Q0.2 & Q0.3) ON at that time reset instruction will be executed and green lights (Q0.0 & Q0.1) will be OFF
    Network 9:
    If system ON (I0.0) SWITCH is OFF then all memories should be 0.Here we have taken MOVE instruction for moving zero in all memories (MB0, QB0, and MB10).
    This Example is for concept explanation only, not all parameters are considered in this example (such as door open/close system, alarms etc.)
    Result

    Note : The above PLC Logic provided for basic idea about application of PLC in Car Parking Control of Entry/Exit Gates. The Logic is limited and not complete application.

    caixiaofeng
    This is a PLC Program to implement a program for counting objects on the moving conveyor.
    Counting Moving Objects on Conveyor
    Objects are moving on the conveyor. We need to count the total number of objects collected at the end of conveyor and display it on the local control panel.
    Write a PLC program for this application.
    Problem Diagram

    Problem Solution
    Here we use PLC ladder program to implement this logic.
    Mostly proximity sensors are used to detect the objects. Here we mount proximity sensor to detect the parts or objects moving on the conveyor.
    Inductive sensor are mostly used to detect metal objects. For other type of objects, we use Capacitive proximity sensor for detecting the objects moving on the conveyor. We connect this sensor to the PLC and by using counter  logic,we will count the number of objects and display the total number on the local control panel display.
    Here we use UP counter for counting the collected Objects at the end of conveyor.
    Note:- Here we considered simple application for counting objects. We considered proximity sensor for detecting the objects. Proximity sensor will sense the object and PLC UP counter will count the collected objects.
    List of Inputs and Outputs
    Digital Inputs
    Start :- I0.0 Stop :- I0.1 Proximity :- I0.2 (Objects detection) Counter Reset PB :- I0.3 Digital Output
    Cycle ON :- Q0.0 M memory
    Counter Reset :- M0.1 Total Objects collected :- MW10 PLC Ladder Logic for counting Objects on the conveyor


    Ladder Logic Explanation
    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 first network we used latching circuit for cycle ON. Here we used START PB (I0.0 ) to start the cycle and STOP PB (I0.1) to stop the cycle.
    Network 2:
    PLC Counter instruction is used to count the number of objects. Proximity sensors are mounted near to the conveyor.
    When an object comes near to the proximity sensor (I0.2), it will detect the object and output of the sensor becomes energize or changes to ON state.
    When there will be no object near to the proximity sensor then output of sensor becomes de-energize or changes to OFF state.
    PLC counter counts in the incremental way. Total counted Objects number will be stored in the memory word or register (MW10).
    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 UP counter. By using this concept we can count objects moving on the conveyor or any other counting application. This logic is only part or for specific application logic only.
    All parameters considered in example are for explanation purpose only, parameters may be different in actual applications.
    Result


    caixiaofeng
    There are many control situations requiring actions to be initiated when a certain combination of logic functions conditions is realized in a PLC.
    PLC Logic Functions
    Say, for an automatic drilling machine, there might be the condition that the drill motor is to be activated when the limit switches are activated that indicate the presence of the workpiece and the drill position as being at the surface of the workpiece.
    Such a situation involves the AND logic function, condition A  AND  condition B having both to be realized for an output to occur. This section is a consideration of such logic functions.
    PLC AND LOGIC
    Figure 1.7a shows a situation where an output is not energized unless two, normally open, switches are both closed. Switch A and switch B have both to be closed, which thus gives an AND logic situation.
    We can think of this as representing a control system with two inputs A and B (Figure 1.7b). Only when A and  B are both on is there an output. Thus if we use 1 to indicate an on signal and 0 to represent an off signal, then for there to be a 1 output we must have A and B both 1.
    Such an operation is said to be controlled by a logic gate and the relationship between the inputs to a logic gate and the outputs is tabulated in a form known as a truth table. Thus for the AND gate we have:

    An example of an AND gate is an interlock control system for a machine tool so that it can only be operated when the safety guard is in position and the power switched on.
    Figure 1.8a shows an AND gate system on a ladder diagram. The ladder diagram starts with j j, a normally open set of contacts labeled input A, to represent switch A and in series with it j j, another normally open set of contacts labeled input B, to represent switch B.
    The line then terminates with O to represent the output. For there to be an output, both input A and input B have to occur, i.e., input A and input B contacts have to be closed (Figure 1.8b). In general:
    On a ladder diagram contacts in a horizontal rung, i.e., contacts in series, represent the logical AND operations.

    PLC OR LOGIC
    Figure 1.9a shows an electrical circuit where an output is energized when switch A or B, both normally open, are closed.
    This describes an OR logic gate (Figure 1.9b) in that input A or input B must be on for there to be an output.
    The truth table is:

    Figure 1.10a shows an OR logic gate system on a ladder diagram, Figure 1.10b showing an equivalent alternative way of drawing the same diagram.
    The ladder diagram starts with j j, normally open contacts labeled input A, to represent switch A and in parallel with it j j, normally open contacts labeled input B, to represent switch B.
    Either input A or input B have to be closed for the output to be energized
    (Figure 1.10c). The line then terminates with O to represent the output. In general:
    Alternative paths provided by vertical paths from the main rung of a ladder diagram, i.e., paths in parallel represent logical OR operations.
    An example of an OR gate control system is a conveyor belt transporting bottled products to packaging where a deflector plate is activated to deflect bottles into a reject bin if either the weight is not within certain tolerances or there is no cap on the bottle.

    PLC NOT LOGIC
    Figure 1.11a shows an electrical circuit controlled by a switch that is normally closed. When there is an input to the switch, it opens and there is then no current in the circuit.
    This illustrates a NOT gate in that there is an output when there is no input and no output when there is an input (Figure 1.11c). The gate is sometimes referred to as an inverter.
    The truth table is:

    Figure 11.11b shows a NOT gate system on a ladder diagram. The input A contacts are shown as being normally closed.
    This is in series with the output ( ). With no input to input A, the contacts are closed and so there is an output. When there is an input to input A, it opens and there is then no output.
    An example of a NOT gate control system is a light that comes on when it becomes dark, i.e., when there is no light input to the light sensor there is an output.

    PLC NAND LOGIC
    Suppose we follow an AND gate with a NOT gate (Figure 1.12a). The consequence of having the NOT gate is to invert all the outputs from the AND gate.
    An alternative, which gives exactly the same results, is to put a NOT gate on each input and then follow that with OR (Figure 1.12b).
    The same truth table occurs, namely:

    Both the inputs A and B have to be 0 for there to be a 1 output.
    There is an output when input A and input B are not 1.
    The combination of these gates is termed a NAND gate (Figure 1.13).

    An example of a NAND gate control system is a warning light that comes on if, with a machine tool, the safety guard switch has not been activated and the limit switch signaling the presence of the workpiece has not been activated.
    PLC NOR LOGIC
    Suppose we follow an OR gate by a NOT gate (Figure 1.14a).
    The consequence of having the NOT gate is to invert the outputs of the OR gate.
    An alternative, which gives exactly the same results, is to put a NOT gate on each input and then an AND gate for the resulting inverted inputs (Figure 1.14b).
    The following is the resulting truth table:

    The combination of OR and NOT gates is termed a NOR gate. There is an output when neither input A or input B is 1.
    Figure 1.15 shows a ladder diagram of a NOR system.
    When input A and input B are both not activated, there is a 1 output. When either X400 or X401 are 1 there is a 0 output.

    PLC Exclusive OR (XOR) LOGIC
    The OR gate gives an output when either or both of the inputs are 1.
    Sometimes there is, however, a need for a gate that gives an output when either of the inputs is 1 but not when both are 1, i.e., has the truth table:

    Such a gate is called an Exclusive OR or XOR gate.
    One way of obtaining such a gate is by using NOT, AND and OR gates as shown in Figure 1.16.

    Figure 1.17 shows a ladder diagram for an XOR gate system. When input A and input B are not activated then there is 0 output.
    When just input A is activated, then the upper branch results in the output being 1. When just input B is activated, then the lower branch results in the output being 1.
    When both input A and input B are activated, there is no output.
    In this example of a logic gate, input A and input B have two sets of contacts in the circuits, one set being normally open and the other normally closed.
    With PLC programming, each input may have as many sets of contacts as necessary.

    PLC Exclusive NOR (XNOR) LOGIC


    xiangjinjiao
    In the late 1960’s an American company named Bedford Associates released a computing device they called the MODICON. As an acronym, it meant Modular Digital Controller, and later became the name of a company division devoted to the design, manufacture, and sale of these special-purpose control computers.
    Other engineering firms developed their own versions of this device, and it eventually came to be known in non-proprietary terms as a PLC, or Programmable Logic Controller.
    PLC
    The purpose of a PLC was to directly replace electromechanical relays as logic elements, substituting instead a solid-state digital computer with a stored program, able to emulate the interconnection of many relays to perform certain logical tasks.
    A PLC has many “input” terminals, through which it interprets “high” and “low” logical states & Analog values from switches and sensors.
    It also has many output terminals, through which it outputs “high” and “low” signals to power lights, solenoids, contactors, small motors, and other devices lending themselves to on/off control and also analog output for controlling control valves, motor speed control etc.
    In an effort to make PLCs easy to program, their programming language was designed to resemble ladder logic diagrams. Thus, an engineer accustomed to reading ladder logic schematics would feel comfortable programming a PLC to perform the same control functions.
    PLC Programming
    The following illustration shows a simple PLC, as it might appear from a front view.
    Two screw terminals provide connection to power supply for powering the PLC’s internal circuitry, labeled L1 and L2.
    Six screw terminals on the left-hand side provide connection to input devices, each terminal representing a different input “channel” with its own “X” label.
    The lower-left screw terminal is a “Common” connection, which is generally connected to L2 (neutral) of the 120 VAC power source.

    Inside the PLC housing, connected between each input terminal and the Common terminal, is an opto-isolator device (Light-Emitting Diode) that provides an electrically isolated “high” logic signal to the computer’s circuitry (a photo-transistor interprets the LED’s light) when there is 120 VAC power applied between the respective input terminal and the Common terminal.
    An indicating LED on the front panel of the PLC gives visual indication of an “energized” input:

    Output signals are generated by the PLC’s computer circuitry activating a switching device (transistor, TRIAC, or even an electromechanical relay), connecting the “Source” terminal to any of the “Y-” labeled output terminals.
    The “Source” terminal, correspondingly, is usually connected to the L1 side of the 120 VAC power source.
    As with each input, an indicating LED on the front panel of the PLC gives visual indication of an “energized” output:

    In this way, the PLC is able to interface with real-world devices such as switches and solenoids.
    The actual logic of the control system is established inside the PLC by means of a computer program.
    This program dictates which output gets energized under which input conditions.
    Although the program itself appears to be a ladder logic diagram, with switch and relay symbols, there are no actual switch contacts or relay coils operating inside the PLC to create the logical relationships between input and output.
    These are imaginary contacts and coils, if you will. The program is entered and viewed via a personal computer connected to the PLC’s programming port.
    Consider the following circuit and PLC program:

    When the pushbutton switch is unactuated (unpressed), no power is sent to the X1 input of the PLC.
    Following the program, which shows a normally-open X1 contact in series with a Y1 coil, no “power” will be sent to the Y1 coil. Thus, the PLC’s Y1 output remains de-energized, and the indicator lamp connected to it remains dark.
    If the pushbutton switch is pressed, however, power will be sent to the PLC’s X1 input.
    Any and all X1 contacts appearing in the program will assume the actuated (non-normal) state, as though they were relay contacts actuated by the energizing of a relay coil named “X1”.
    In this case, energizing the X1 input will cause the normally-open X1 contact will “close,” sending “power” to the Y1 coil.
    When the Y1 coil of the program “energizes,” the real Y1 output will become energized, lighting up the lamp connected to it:

    It must be understood that the X1 contact, Y1 coil, connecting wires, and “power” appearing in the computer’s (engineering system where PLC software loaded) display are all virtual.
    They do not exist as real electrical components. They exist as commands in a computer program — a piece of software only — that just happens to resemble a real relay schematic diagram.
    Equally important to understand is that the computer used to display and edit the PLC’s program is not necessary for the PLC’s continued operation.
    Once a program has been loaded to the PLC from the computer, the computer may be unplugged from the PLC, and the PLC will continue to follow the programmed commands.
    I include the computer display in these illustrations for your sake only, in aiding to understand the relationship between real-life conditions (switch closure and lamp status) and the program’s status (“power” through virtual contacts and virtual coils).
    The true power and versatility of a PLC is revealed when we want to alter the behavior of a control system. Since the PLC is a programmable device, we can alter its behavior by changing the commands we give it, without having to reconfigure the electrical components connected to it.
    For example, suppose we wanted to make this switch-and-lamp circuit function in an inverted fashion: push the button to make the lamp turn off, and release it to make it turn on.
    The “hardware” solution would require that a normally-closed pushbutton switch be substituted for the normally-open switch currently in place.
    The “software” solution is much easier: just alter the program so that contact X1 is normally-closed rather than normally-open.
    In the following illustration, we have the altered system shown in the state where the pushbutton is unactuated (not being pressed):

    In this next illustration, the switch is shown actuated (pressed):

    One of the advantages of implementing logical control in software rather than in hardware is that input signals can be re-used as many times in the program as is necessary.
    For example, take the following circuit and program, designed to energize the lamp if at least two of the three pushbutton switches are simultaneously actuated:

    To build an equivalent circuit using electromechanical relays, three relays with two normally-open contacts each would have to be used, to provide two contacts per input switch.
    Using a PLC, however, we can program as many contacts as we wish for each “X” input without adding additional hardware, since each input and each output is nothing more than a single bit in the PLC’s digital memory (either 0 or 1), and can be recalled as many times as necessary.
    Furthermore, since each output in the PLC is nothing more than a bit in its memory as well, we can assign contacts in a PLC program “actuated” by an output (Y) status.
    Take for instance this next system, a motor start-stop control circuit:

    The pushbutton switch connected to input X1 serves as the “Start” switch, while the switch connected to input X2 serves as the “Stop.”
    Another contact in the program, named Y1, uses the output coil status as a seal-in contact, directly, so that the motor contactor will continue to be energized after the “Start” pushbutton switch is released.
    You can see the normally-closed contact X2 appear in a colored block, showing that it is in a closed (“electrically conducting”) state.
    If we were to press the “Start” button, input X1 would energize, thus “closing” the X1 contact in the program, sending “power” to the Y1 “coil,” energizing the Y1 output and applying 120 volt AC power to the real motor contactor coil.
    The parallel Y1 contact will also “close,” thus latching the “circuit” in an energized state:

    Now, if we release the “Start” pushbutton, the normally-open X1 “contact” will return to its “open” state, but the motor will continue to run because the Y1 seal-in “contact” continues to provide “continuity” to “power” coil Y1, thus keeping the Y1 output energized:

    To stop the motor, we must momentarily press the “Stop” pushbutton, which will energize the X2 input and “open” the normally-closed “contact,” breaking continuity to the Y1 “coil:”

    When the “Stop” pushbutton is released, input X2 will de-energize, returning “contact” X2 to its normal, “closed” state.
    The motor, however, will not start again until the “Start” pushbutton is actuated, because the “seal-in” of Y1 has been lost:

    An important point to make here is that fail-safe design is just as important in PLC-controlled systems as it is in electromechanical relay-controlled systems.
    One should always consider the effects of failed (open) wiring on the device or devices being controlled.
    In this motor control circuit example, we have a problem: if the input wiring for X2 (the “Stop” switch) were to fail open, there would be no way to stop the motor!
    The solution to this problem is a reversal of logic between the X2 “contact” inside the PLC program and the actual “Stop” pushbutton switch:

    When the normally-closed “Stop” pushbutton switch is unactuated (not pressed), the PLC’s X2 input will be energized, thus “closing” the X2 “contact” inside the program.
    This allows the motor to be started when input X1 is energized, and allows it to continue to run when the “Start” pushbutton is no longer pressed.
    When the “Stop” pushbutton is actuated, input X2 will de-energize, thus “opening” the X2 “contact” inside the PLC program and shutting off the motor.
    So, we see there is no operational difference between this new design and the previous design.
    However, if the input wiring on input X2 were to fail open, X2 input would de-energize in the same manner as when the “Stop” pushbutton is pressed.
    The result, then, for a wiring failure on the X2 input is that the motor will immediately shut off.
    This is a safer design than the one previously shown, where a “Stop” switch wiring failure would have resulted in an inability to turn off the motor.
    In addition to input (X) and output (Y) program elements, PLCs provide “internal” coils and contacts with no intrinsic connection to the outside world.
    These are used much the same as “control relays” (CR1, CR2, etc.) are used in standard relay circuits: to provide logic signal inversion when necessary.
    To demonstrate how one of these “internal” relays might be used, consider the following example circuit and program, designed to emulate the function of a three-input NAND gate.
    Since PLC program elements are typically designed by single letters, I will call the internal control relay “C1” rather than “CR1” as would be customary in a relay control circuit:

    In this circuit, the lamp will remain lit so long as any of the pushbuttons remain unactuated (unpressed).
    To make the lamp turn off, we will have to actuate (press) all three switches, like this:


    xiangjinjiao
    Basics of Ladder Diagram in PLC Programming
    Ladder logic was originally a written method to document the design and construction of relay racks as used in manufacturing and process control.Each device in the relay rack would be represented by a symbol on the ladder diagram with connections between those devices shown. In addition, other items external to the relay rack such as pumps, heaters, and so forth would also be shown on the ladder diagram.
    Ladder logic has evolved into a programming language that represents a program by a graphical diagram based on the circuit diagrams of relay logic hardware. Ladder logic is used to develop software for programmable logic controllers (PLCs) used in industrial control applications. The name is based on the observation that programs in this language resemble ladders, with two vertical rails and a series of horizontal rungs between them. While ladder diagrams were once the only available notation for recording programmable controller programs, today other forms are standardized in IEC 61131-3.
    Ladder logic is widely used to program PLCs, where sequential control of a process or manufacturing operation is required. Ladder logic is useful for simple but critical control systems. As programmable logic controllers became more sophisticated it has also been used in very complex automation systems. Often the ladder logic program is used in conjunction with an HMI program operating on a computer workstation.
    Example of a simple ladder logic program
    The language itself can be seen as a set of connections between logical checkers (contacts) and actuators (coils). If a path can be traced between the left side of the rung and the output, through asserted (true or “closed”) contacts, the rung is true and the output coil storage bit is asserted  or true. If no path can be traced, then the output is false (0) and the “coil” by analogy to electromechanical relays is considered “de-energized”.
    Ladder logic has contacts that make or break circuits to control coils. Each coil or contact corresponds to the status of a single bit in the programmable controller’s memory. Unlike electromechanical relays, a ladder program can refer any number of times to the status of a single bit, equivalent to a relay with an indefinitely large number of contacts.
    So-called “contacts” may refer to physical (“hard”) inputs to the programmable controller from physical devices such as pushbuttons and limit switches via an integrated or external input module, or may represent the status of internal storage bits which may be generated elsewhere in the program.
    Each rung of ladder language typically has one coil at the far right. Some manufacturers may allow more than one output coil on a rung.
    —( )— A regular coil, energized whenever its rung is closed. —()— A “not” coil, energized whenever its rung is open. —[ ]— A regular contact, closed whenever its corresponding coil or an input which controls it is energized. —[]— A “not” contact, closed whenever its corresponding coil or an input which controls it is not energized. The “coil” (output of a rung) may represent a physical output which operates some device connected to the programmable controller, or may represent an internal storage bit for use elsewhere in the program.
    Logical AND
     ------[ ]--------------[ ]----------------( )
       Key Switch 1      Key Switch 2       Door Motor
    The above realizes the function: Door Motor = Key Switch 1 AND Key Switch 2
    This circuit shows two key switches that security guards might use to activate an electric motor on a bank vault door. When the normally open contacts of both switches close, electricity is able to flow to the motor which opens the door.
    Logical AND with NOT
     ------[ ]--------------[]----------------( )
       Close Door      Obstruction         Door Motor
    The above realizes the function: Door Motor = Close door AND NOT(Obstruction).
    This circuit shows a pushbutton that closes a door, and an obstruction detector that senses if something is in the way of the closing door. When the normally open push button contact closes and the normally closed obstruction detector is closed (no obstruction detected), electricity is able to flow to the motor which closes the door.
    Logical OR
     --+-------[ ]-------+-----------------( )
       | Exterior Unlock |                 Unlock
       |                 |
       +-------[ ]-------+
         Interior Unlock
    The above realizes the function: Unlock = Interior Unlock OR Exterior Unlock
    This circuit shows the two things that can trigger a car’s power door locks. The remote receiver is always powered. The lock solenoid gets power when either set of contacts is closed.
    Industrial STOP/START
    In common industrial latching start/stop logic we have a “start” button to turn on a motor contactor, and a “stop” button to turn off the contactor.
    When the “start” button is pushed the input goes true, via the “stop” button NC contact. When the “run” input becomes true the seal-in “run” NO contact in parallel with the “start” NO contact will close maintaining the input logic true (latched or sealed-in). After the circuit is latched the “stop” button may be pushed causing its NC contact to open and consequently the input to go false. The “run” NO contact then opens and the circuit logic returns to its quiescent state.
     --+----[ ]--+----[]----( )
       |   start |   stop    run
       |         |
       +----[ ]--+
            run
     -------[ ]--------------( )
            run             motor
    The above realizes the function: run = ( start OR run ) AND ( NOT stop )
    Note the use of parenthesis to group the logical OR function before evaluating the logical AND function (which has a higher order of operation priority). Also note the use of NOT to represent the “stop” NC contact logic.
    This latch configuration is a common idiom in ladder logic. In ladder logic it is referred to as seal-in logic. The key to understanding the latch is in recognizing that “start” switch is a momentary switch (once the user releases the button, the switch is open again). As soon as the “run” solenoid engages, it closes the “run” NO contact, which latches the solenoid on. The “start” switch opening up then has no effect.
    For safety reasons, an Emergency-Stop and/or Stop should be hardwired in series with the Start switch, and the relay logic should reflect this.
     --[]----[]----+--[ ]--+---------( )
       ES    Stop    | Start |        Motor
                     |       |
                     +--[ ]--+
                        Run
    Complex logic
    Here is an example of what two rungs in a ladder logic program might look like. In real world applications, there may be hundreds or thousands of rungs.
    Typically, complex ladder logic is ‘read’ left to right and top to bottom. As each of the lines (or rungs) are evaluated the output coil of a rung may feed into the next stage of the ladder as an input. In a complex system there will be many “rungs” on a ladder, which are numbered in order of evaluation.
     1. ----[ ]---------+----[ ]-----+----( )
          Switch        |   HiTemp   |    A/C
                        |            |
                        +----[ ]-----+
                            Humid
     2. ----[ ]----[]--------------------( )
            A/C    Heat                 Cooling
    Line 1 realizes the function: A/C = Switch AND ( HiTemp OR Humid )
    Line 2 realizes the function: Cooling = A/C AND ( NOT Heat )
    This represents a slightly more complex system for rung 2. After the first line has been evaluated, the output coil “A/C” is fed into rung 2, which is then evaluated and the output coil “Cooling” could be fed into an output device “Compressor” or into rung 3 on the ladder. This system allows very complex logic designs to be broken down and evaluated.
    Additional functionality
    Additional functionality can be added to a ladder logic implementation by the PLC manufacturer as a special block. When the special block is powered, it executes code on predetermined arguments. These arguments may be displayed within the special block.
                                  +-------+
      -----[ ]--------------------+  A    +----
       Remote Unlock              +-------+
                               Remote Counter
                                  +-------+
      -----[ ]--------------------+  B    +----
       Interior Unlock            +-------+
                              Interior Counter
                          +--------+
      --------------------+ A + B  +-----------
                          | into C |
                          +--------+
                             Adder
    In this example, the system will count the number of times that the interior and remote unlock buttons are pressed. This information will be stored in memory locations A and B. Memory location C will hold the total number of times that the door has been unlocked electronically.
    PLCs have many types of special blocks. They include timers, arithmetic operators and comparisons, table lookups, text processing, PID control, and filtering functions. More powerful PLCs can operate on a group of internal memory locations and execute an operation on a range of addresses, for example, to simulate a physical sequential drum controller or a finite state machine. In some cases, users can define their own special blocks, which effectively are subroutines or macros. The large library of special blocks along with high speed execution has allowed use of PLCs to implement very complex automation systems.

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