

xiangjinjiao
Staff group-
Content Count
110 -
Joined
-
Last visited
Content Type
Profiles
Forums
PLC programming technology and HMI interface design Simplified Chinese database
- PLC AND HMI SIMPLIFIED CHINESE ARTICLES
- PLC AND HMI SIMPLIFIED CHINESE ARTICLE Comments
- PLC AND HMI SIMPLIFIED CHINESE ARTICLE Reviews
PLC and HMI Brand Database
- PLC AND HMI BRANDS INTRODUCTIONS
- PLC AND HMI BRAND INTRODUCTION Comments
- PLC AND HMI BRAND INTRODUCTION Reviews
PLC programming technology and HMI interface design English database
- PLC AND HMI ENGLISH ARTICLES
- PLC AND HMI ENGLISH ARTICLE Comments
- PLC AND HMI ENGLISH ARTICLE Reviews
PLC programming technology and HMI interface design Russian database
- PLC AND HMI RUSSIAN ARTICLES
- PLC AND HMI RUSSIAN ARTICLE Comments
- PLC AND HMI RUSSIAN ARTICLE Reviews
Spanish database on PLC programming techniques and HMI interface design
- PLC AND HMI SPANISH ARTICLES
- PLC AND HMI SPANISH ARTICLE Comments
- PLC AND HMI SPANISH ARTICLE Reviews
German database on PLC programming technology and HMI interface design
- PLC AND HMI ARTICLES IN GERMAN
- PLC AND HMI ARTICLE IN GERMAN Comments
- PLC AND HMI ARTICLE IN GERMAN Reviews
Downloads
Store
Gallery
Blogs
Calendar
Videos
Everything posted by xiangjinjiao
-
PLC Program for Automatic Parameter Initialization When Power UP
xiangjinjiao posted A plc and hmi english article in PLC programming learning
This is a PLC Program for Automatic Parameter initialization when power up. Parameter Initialization When Power UP Problem Description In many applications, it is necessary to initialize some data when the machine is powered up. Sometimes due to power failure, the value in some parameters becomes zero. Due to this problem, the operator has to feed all data again or every time during power failure. When the machine gets powered up, at that time necessary parameters should be initialized automatically. Here we discuss this issue with some basic ladder logic. Problem Diagram Problem Solution In this case, we need to write the logic in the PLC program so all parameters will be initialized automatically. We can also set a manual initialization button so the operator can initialize data while the machine operation is running. Here we will consider the machine set speed as data and it will be initialized automatically when the machine turns on. If the operator wants to reinitialize the set speed during the running cycle then he needs to do it through the initialization button. PLC Ladder diagram Here is the PLC program Automatic Parameter initialization when powered up. List of PLC inputs/outputs Inputs List Parameter Initialization Button : I0.0 MW10 : Set Speed form Display Outputs List Mw12 : Speed for drive Program Description For this application we use S7-1200 PLC and TIA portal software for programming. This logic is used for parameter initialization. For first scan, we used here S7-1200 facilities of system Memory. Every PLC have its own system memory. Always ON bit, always OFF bit, first scan bit, and diagnostic status changed are the system memory for S7-1200 PLC. We can configure any memory address “M” for system memory. Here we configured M1.0 for first scan bit which is used for parameter initialization. We write for parameter initialization in Network 1. Here we use NO contact of First scan bit (M1.0) for moving initial 5 RPM in MW12(Speed for drive).By using MOVE instruction 5 RPM will be moved in MW12 . Add NO contact of Parameter Initialization Button (I0.0) for moving Initial 5RPM in MW12 (Speed for drive) manually. For editing data manually in running cycle we write logic in Network 2. Here operator can enter data in MW10 (SET SPEED) from the display and it will go in MW12(Speed for drive). For Example, Say we need to enter 100 RPM speed from display it will be written in word MW10 (Set Speed from display) and as per logic it will be moved in MW12 (Speed for drive), so motor will run on 100 RPM. Runtime Test Cases Note: The above PLC Logic provided for basic idea about application of PLC Program for Automatic Parameter Initialization when Power UP. The Logic is limited and not complete application. -
PLC Program for Latching and unlatching Circuit
xiangjinjiao posted A plc and hmi english article in PLC programming learning
This is a PLC Program for Latching and an unlatched circuit for output. PLC Latching and unlatching Circuit Problem Description In some conveying systems, the operator fills the tank manually by operating the water pump manually. In this situation operator waits when the tank is being filled because when the tank reaches to high level, the water pump should be stopped. Also water pump should remain in ON condition until the tank reaches a high level. For example, we consider a manual water conveying system in this article. Problem Diagram Problem Solution In this example, we consider one storage tank for water and use one water pump for tank filling. We also use one level sensor for high level and control panel for operator. Here START PB for enabling the motor so we can feed the water in the tank, for stop motor we use STOP PB. Level sensor for detection of High level so when tank becomes full, high level sensor will be activated and stops the water pump. For this sequence we will use SET and RESET instruction for latching and unlatching the water pump. We can make this circuit by sing relays. In application there one manual discharge valve only for discharging the tank manual. We will not consider in or logic. PLC Inputs List START PB : I0.0 STOP PB : I0.1 HIGH LEVEL SENSOR : I0.2 LOW LEVEL SENSOR : I0.3 PLC Outputs List WATER PUMP : I0.0 PLC Ladder diagram for Latching and unlatched circuit Program Description For this application we use S7-1200 PLC and TIA portal software for programming. We can make this circuit or logic with relay also. This circuit or logic known as latching and unlatching circuit or logic. We will write logic for water pump in Network 1. Here we use NO contact of START PB (I0.0) for enabling the water pump (Q0.0). By using SET instruction water pump output coil (Q0.0) will be latched. Add NO contact of LEVEL LOW SENSOR (I0.3) in series with the water pump output (Q0.0). Water pump should not start if tank is full. so for safety purpose use one NO contact of LOW LEVEL SENSOR (I0.3) in series after START PB (I0.0) in Network 1. Now HIGH LEVEL SENSOR (I0.2) will be detected after some time of pump running and in this case water pump (Q0.0) should be stopped automatically. For that purpose we need to unlatch the circuit. We will write logic for unlatching circuit in Network 2. In this case, we take No contact of HIGH LEVEL SENSOR (I0.3) for unlatching the circuit by using RESET instruction. Add one NO contact of STOP PB (I0.1) in parallel connection, so operator can unlatch the circuit by pressing STOP PB (I0.1). Here we latch circuit by SET instruction and unlatch with RESET instruction. Runtime Test Cases Note: The above PLC Logic provided for basic idea about application of PLC Program for Latching and unlatching Circuit. The Logic is limited and not complete application. -
3 Phase Motor Control using PLC Ladder Logic
xiangjinjiao posted A plc and hmi english article in PLC programming learning
This is a PLC Program for Forward and Reverse control for 3 Phase Asynchronous Motor. 3 Phase Motor Control using PLC Problem Description There are lots of motors and conveyors used in industries for different purposes. In some cases, motors or conveyors need forward and reverse operation for some control purpose. For example overhead crane, in crane every time operators moves it forward and reverse for material handling. So we can use PLC systems for programming the motor for forward/reverse operation. Problem Diagram Problem Solution In this case, we need to operate motor in both direction, that can be possible only by forward/Reverse Control Relay Circuit or through Logic. Here we solve this problem by using simple Forward/Reverse Control Logic in the PLC. So here we will consider one 3 phase motor for Forward and Reverse Operation. And we will take two contactors or relays for motor control because we need two different directions here i.e. Forward/Reverse. First contactor for Forward Direction control and Second contactor for Reverse Direction control of Motor. Also we should consider three push buttons i.e. for forward, reverse and stop functions of motor. So here operator will use FWD PB for forward operation, REV PB for reverse operation and STOP PB for stop function. PLC Inputs List FWD PB : I0.0 REV : I0.1 STOP PB : I0.2 Motor Trip : I0.3 PLC Outputs List Motor forward : Q0.0 Motor reverse : Q0.1 PLC Ladder diagram for Forward/Reverse control of Motor Ladder Logic Description In this application, we will use Siemens S7-1200 PLC and TIA Portal Software for programming. We can also design this logic with relay circuit. This circuit is also known as Forward/Reverse control for 3 Phase Induction Motor. We will write logic for forward condition in Network 1. Here we use the NO contact of FWD PB (I0.0) for forward operation of the motor, we are using push button so we need to use one NO contact of motor forward output coil (Q0.0) for latching purpose. (Push button only provides momentary contact and we need to latch the action so motor forward coil contact will be used) Put NC contact of motor reverse output (Q0.1) in series for unlatching the circuit because both forward and reverse should not run at the same time. Now write the logic for reverse condition in network 2. Here we will take NO contact of REV PB (I0.2) for motor reverse function and also take one more NO contact of the motor reverse output coil(Q0.1) for latching the motor reverse output (QO.1). (Push button only provides momentary contact and we need to latch the action so motor forward coil contact will be used) Here also put NC contact of motor forward output coil (Q0.0) in series for unlatching the circuit because both forward and reverse should not run at the same time. For interlocking purpose put NC contact of FWD PB (I0.0) in series with REV PB (I0.2) and put NC contact of REV PB (I0.2) in series with FWD PB (I0.0). Put NC Contact in series in both network so operator can stop forward or reverse rotation by pressing STOP PB Here we have used OLR for Protection of motor so add NC contact of Motor trip (I0.3) in series in both the network for motor protection Runtime Test Cases Note: The above PLC Logic provided for basic idea about application of PLC Logic for 3 Phase Asynchronous Motor Control. The Logic is limited and not complete application. -
PLC Program for Conditional Control Logic
xiangjinjiao posted A plc and hmi english article in PLC programming learning
This is the PLC Program for Conditional Logic Circuit. The below example is based on the ladder logic using a programmable logic controller. PLC Conditional Control Logic In Industry or plants, there are lots of gearbox systems used for different machines/motors. For smooth operation of gearbox motors, they need to be lubricated every time because good maintenance work can extend gearbox life. But the problem is that operators often make mistakes during machine operation because in every gearbox motor mechanism, we need to start lubrication first and then the main gearbox mechanism should start. So we have to implement a logic to make sure things are properly controlled from a PLC system. Problem Diagram Note: For easy discussions, Local/Remote, or any other permissive interlocks are not considered in this example. Problem Solution Here we solve this problem by using a simple conditional logic example, in this example, there is one gearbox motor and we need to provide lubrication before starting it. So for lubrication, we have a lubrication motor (also called as Oil Pump or Auxiliary Lube Oil Pump) and it will provide lubrication oil to the main motor or gearbox motor. Also, we will provide an interlock system, so the operator cannot start/operate the Main motor directly without using proper lubrication otherwise the main motor may overheat and it may be damaged after some runs without proper care. The operator has to switch ON oil pump first and then only he can able to operate the main motor. By using this logic, we can take care of the gearbox motor for a long time run with proper lubrication. Operators start/stop oil pump by using START and STOP push buttons of oil pump. Both Oil Pump and Main Motor have separate individual START & STOP push buttons as shown in above diagram. PLC Inputs List Oil Pump StART PB : I0.0 Oil Pump STOP PB : I0.1 Main Motor START PB : I0.2 Main Motor STOP PB : I0.3 PLC Outputs List Oil Pump Motor : Q0.0 Main Motor : Q0.1 PLC Ladder diagram for conditional Control Circuit Ladder Logic Description In this application, we used Siemens S7-1200 PLC and TIA Portal Software for programming. We can also design this logic with relay circuit. This circuit is also known as conditional control circuit because second sequence is depended on first condition. We will write logic for oil pump in Network 1. Here we will take NO contact of oil pump START PB (I0.0) and also we have to consider one NO contact of oil pump (Q.0) coil for latching START command. Put NC contact of oil pump stop PB (I0.1) in series for unlatching the circuit by pressing oil pump STOP PB (I0.1), so operator can stop the oil pump (Q0.0). Now write the logic for main motor in Network 2. Here we will take NO contact of main motor START PB (I0.2) and also take one more NO contact of the main motor coil for latching the main motor (Q0.1). Put NC contact of main motor stop PB(I0.3) in series for unlatching the circuit by pressing the main motor STOP PB(I0.3), so operator can stop the main motor(Q0.1). Put NO contact of oil pump (Q0.0) in series after the main motor START PB(I0.2) for interlocking. So that operator has to start oil pump (Q0.0) and then only he can START the main motor (Q0.1). Runtime Test Cases Note: The above PLC Logic provided for basic idea about application of PLC Program for Conditional Control Logic. The Logic is limited and not complete application. -
SIEMENS How to Troubleshoot Siemens PLC Programs?
xiangjinjiao posted A plc and hmi english article in PLC programming learning
This article is about the PLC programming troubleshooting method. In industrial PLCs where thousands of inputs and outputs are used, and we know how lengthy PLC programs are, depends on the application or plant usage. Troubleshoot Siemens PLC Programs Some times, People may change the logic parameters unknowingly and it may lead to a fault. Even some faults are created during the logic design stage due to the complexity of the design. The siemens plc software has different handy tools available in it to troubleshoot the faults generated in the programs. Faults can be like overlapping of addressing, multiple same output instances, memory bit address overlapping, many times a single program is used to work over and over, etc. To find out such problems, there are four types of windows available in the siemens software which will help us to troubleshoot the issues. They are: Cross Reference Call Structure Assignment List Dependency Structure Let discuss how to use them in our program for troubleshooting and where to find them in the software. Cross Reference Cross-reference is used to find all the digital & analog inputs and outputs used in the logics. It will help us to know about the number of times the I/O’s are used in the program and also take users directly to the specific location of the I/O’s in the logic pages. Here is an example of one of the programs, in which you can see how the cross-reference table looks like. It contains all the information like addressing, the language of the program, used inputs and outputs, etc. Call Structure When you want to know which block is used in programming then call structure is used. This is a reversal of cross-reference function in which we get to know that how many times SFC, FB block are used in OB (Organization Block) and here we get to know that how many times OB used in SFC and FBs. Assignment List The assignment list is a very useful feature when it comes to knowing that how many inputs, outputs, timers and counters used in our application and how many of them are still remaining, so we can use them in future logics. Dependency Structure Dependency structure is used to show where each and every block used within the programming. But in step 7 it won’t take you directly on location however in TIA PORTAL it will take you to the location where the program is written. NOTE: To open these windows in step 7, use the info as shown in Drawing. After clicking on display you have the options. In TIA PORTAL, follow the below step shown in the drawing. -
How to Troubleshoot a PLC System?
xiangjinjiao posted A plc and hmi english article in PLC programming learning
At this post i will give some basic instructions which are from my personal experience in order to give you a guide for how troubleshooting in automation systems (PLC/DCS) is : Automation systems troubleshooting has in general the same tactic in order to find the solution of system’s fault. Nevertheless, depends the complexity and the size of application and the specific automation system, the troubleshooting steps would be a little different or more complicated. The best knowledge is obtained through practice and actual troubleshooting conditions. Practice again and again is the solution in my opinion. Any supplement and comments are welcome!! Troubleshoot a PLC System Before we proceed, we agree that modern automation systems have PLCs for controlling the application. If we have a small application then the system possibly has a microPLC (or nanoPLC) or another type of compact controller (many times this depends of the application). I said modern automation systems because in the past (before PLCs/other compact controllers be well known and used by automation development companies), the control of an automation system was going on only with relays. Investigate the Controller’s program The first thing we should do, is to find out if we have the right conditions fulfilled for the operation that is faulty. To do this we should find the “mind” of our system. This “mind” is the controller (either this is a kind of PLC or another type of compact controller). If we don’t have the right conditions fulfilled, then we should investigate the controller’s programme for finding out the origin of the problem (ALWAYS check messages appear at SCADA.This will guide faster to the solution because at SCADA appear important information such as fault/alarm description or a specific address in PLC). The thing that we will find out is... either a faulty signal from hardware (eg a digital signal from a button or a digital signal from a mechanical switch or a digital signal from a relay’s contact that “does not come” to controller’s input or an analog signal which has wrong values) or a faulty signal from another software system (eg SCADA). Investigate the conditions that came from hardware When we conclude for the origin of the problem, then we leave for a while controller’s programme and go out to check our conclusions. We should already have find the drawings of automation system in order to see the connections for the components we want to check. For example, if we find out that we have a digital signal from a button which “does not come” to controller’s input, then we take our multimeter and go to check the button. If the button is OK, then we investigate if there is any fuse between button and controller’s input. If there is, then we check it. If the fuse is OK, then we investigate the route of the cable. Maybe we have a cut cable.If the cable is OK, then maybe we have hardware problem to the controller’s input and maybe we should change this input module with a new one or otherwise fix it (the repairs should be done by qualified staff). Investigate the hardware after the outputs of our controller If we conclude that we have the right conditions, then we should check the components that we have between controller and the faulty equipment (we mean the equipment that doesn’t work as it should). For example, if we have an industrial furnace that does not close its door (even though we have the conditions for closing the door from programme), maybe we have a faulty relay that energizes from PLC (or other controller) for closing the door. If the relay is OK, then maybe we have problem with the motor that is responsible for closing the door. We should check motor for its status (motor coils, mechanical parts) If the motor is OK, we should check the voltage values come to motor’s input (with our multimeter) and also check the cable for its status if multimeter’s measurements are not right. If the voltage and cable are OK, then maybe we have a jam somewhere at the door-furnace construction. Power units are a “plus”! Generally, when we have power units (drives) in our automation system in order to drive a motor, then we should have together the manual of the specific power unit. That’s because power units have a digital display or 7-segment led displays or simple LEd’s for informing us about the fault that exists inside them or at the driven motor. This is very useful for engineers and technicians. Also, modern power units have special algorithms for checking motor status, voltage and current values etc. For example, if a motor is overheated, the drive will inform us about it because it checks continuously the temperature sensor (eg thermistor) which is located inside motor’s enclosure. Then we should check the motor if it is overheated actually or we have a faulty temperature sensor that we should replace it. Check controllers status Some times, when the CPU of our PLC detects an unacceptable condition at the programme’s flow, then it goes to “STOP” mode and possibly a led flashes and indicates this malfunction. Also, if any other malfunction is going on to the system, some led’s indicate the kind of fault (refer to controller’s manual for more information). Same behavior have in general any kind of controller is established in an automation system. Safety systems Many automation systems (often production machines) have in their design some “safety systems” like “Pilz” or “Siemens Sirius”. These are smart compact controllers for monitoring situations like protective door opening or Emergency-Stop. When something of these occurs, the safety system stops the operation of the automation system for human and machine protection. In order to reset the automation system to the functional state, there are special instructions in safety systems manuals. The conclusion for all the above is to have a step by step tactic in troubleshooting. Passing time and getting more experience, maybe we will bypass some steps, specifically if we are the staff responsible for the maintenance of a system which we come across every day. However, a good tactic is to be organised and patient. Good luck to your efforts! -
How to filter analog and digital inputs in a PLC?
xiangjinjiao posted A plc and hmi english article in PLC programming learning
In this post, we will understand how to filter digital and analog inputs in a PLC. As the topic says, filtering is a means to remove unwanted spikes in the signals received in PLC. Its role is to eliminate the fluctuations and pass only proper signal changes at a particular time to the PLC. Inside a PLC, the filter circuitry comes first and then comes the PLC input processing circuitry, which accepts the final filtered input and uses it for its logic. PLC Digital Input Filters Let us first consider the digital input. The role of input with a filter is to accept a digital field input and pass it to a processing circuit through the filter. If you see the below image, there are two parts. First of all, the green circle indicates that the input change will be passed and the red circle shows that the input change will not be passed. In the first (above) part, there are two changes where there are many fluctuations and that input changes will be bypassed. There are two changes where there are no fluctuations and that input change will be passed to the processing circuit. The same is the theory with the second (below) part. This is possible by filtering. Filtering is defined by a factor or time. Suppose you set a time of 3 ms. The role of the filter is to accept only that input change that stays higher than 3 ms. If the input changes before 3 ms, then that input will not be considered and will be ignored. This means that short and high-frequency interference pulses will be neglected. This logic is the same as a debounce timer that we write in the PLC logic. In the below image, the lamp will turn on only when the start button input remains high for 3 seconds. This is the same logic used in a digital pass filter. It will pass on the input change to the processing part only when that input maintains a state (high or low) for the set time. Apart from time, as discussed, some PLCs have the option of setting a factor instead of time. The factor calculates the internal time and decides the level of filtering. Higher the factor value, the higher the filtering power. PLC Analog Input Filters Now, let us see the filtering in analog inputs. As analog inputs are variable in nature, the filter logic for them cannot be implemented the same as for digital inputs. So, in analog inputs, averaging logic is used. The filter will average the values attained in a particular set time and give an average final value for that time. Refer to the below image for the study. The first one – the blue color has a factor of 1. The second one – the green color has a factor of 2. The third one – the orange color has a factor of 3. The fourth one – the brown color has a factor of 4. As the value of the filter factor increases, you can see that the shape of the signal improves by filtering the signal at a sharper value. In a set time, the filter will average the values that it gets from the input; and based on formulas used inside it, it will give the final average output per time. So, as the filter factor or weightage is increased, we get a finer value of an analog signal with less interference. Normally, a first-pass filter is used for this purpose. In this way, we conclude that filtering is of great use in reducing unwanted noise from the field input and passing proper values, which will also protect the PLC input circuit from damage; if any high or unwanted spikes occur. -
DCS versus PLC Architecture
xiangjinjiao posted A plc and hmi english article in PLC programming learning
The main difference between DCS and PLC is the business model which we discussed with comparison of DCS Versus PLC Architecture. DCS versus PLC Architecture The DCS business model can be said to be based on a monolithic integrated system by a single manufacturer. DCS Architecture For a DCS the controller, I/O-subsystem, database server software, engineering software, and operator software are all a single monolithic unit designed together and only work with each other. It is not possible to use components from a third-party. It is not possible to use any of these components on some other system. A DCS uses I/O-subsystem network and control network based on standard Ethernet, but with a proprietary application protocol, and typically only with a particular approved model of Ethernet switches. Figure 1 In a DCS all components come from the same single manufacturer Only a specific version of Windows is permitted and only on one type of approved computer shipped from the DCS manufacturer. These restrictions enable the DCS manufacturer to test everything together very thoroughly, on a very large scale, heavily loaded, with many controllers and work stations. Applications like batch control, advanced control, and auto-tuning etc. are also tested together. This ensures there are no compatibility conflicts and unforeseen dependencies. Thorough large-scale testing is possible because there is essentially only one type of each component so only one or very few combinations. Third-party software is only permitted on separate “application stations” where it cannot conflict the native DCS applications and must be tested and approved by the DCS manufacturer; white-listed. A DCS is monolithic using the same brand I/O subsystem, controller, and software, and single computer and operating system platform. This has been thoroughly tested on very large scale. DCS Long Term Support Systems typically remain operational for 15 years or more. During this time there will be several Windows versions, service packs, hot fixes, lots of virus definition updates, and computer hardware will need to be replaced too. Typically DCS only support a single type of anti-virus software and whenever there is a new virus definition or when there is a Windows operating system service pack or hot fix, the entire monolithic suite of all hardware and software are tested together again by the system vendor prior to release ensuring the virus definition and service pack can be deployed without any compatibility conflicts. DCS Upgrade DCS versions are also upgraded as a single monolithic unit of all hardware and software such as I/O card firmware, controller firmware, server software, engineering station software, operator station software, as well as any other software are all upgraded together. Any time there is a new system version all these components have been thoroughly tested together on a large scale by the system manufacturer in advance ensuring they are all compatible with each other. Moreover, the online hotcutover process from earlier version to the new version has been thoroughly tested on a large scale ensuring smooth deployment at site. It is this reassurance that thorough and large-scale testing provides which makes DCS very popular with large installations like petrochemical complexes. Such testing is made practical by the few combinations in a monolithic system. PLC Architecture / Business Model The PLC business model can be said to be based on flexible architecture by a system integrator (SI). PLC Architecture The PLC architecture is very flexible where each component can be freely selected from any of many suppliers. The PLC is the CPU with configuration software and IO-subsystem. Sometimes the I/O-subsystem may come from a third-party. Even I/O cards that plug into the backplane may come from third-parties. The HMI software is typically from a third-party. A native OPC server from the PLC manufacturer is typically best, but third-party OPC servers are sometimes used. Figure 2 For a PLC components from different manufacturers are integrated Basically any PLC works with any I/O-subsystem, OPC server, and HMI software because standard protocols like PROFIBUS-DP, PROFINET, Modbus/RTU, Modbus/TCP, DeviceNet, and EtherNet/IP as well as OPC etc. are used. Networking gear, computers, and Windows version can be selected freely. Some components found not working are blacklisted. Figure 3 DCS uses a single supplier while PLC solutions combines multiple suppliers resulting in a large number of combinations Note: Now-a-days single PLC package supplier also available This flexibility enables hundreds of combinations of hardware and software making it impossible for these manufacturers to get together to test every possible combination of their hardware and software on each version of Windows before a plant decides to purchase. Some combinations may be tested by the manufacturers involved, but it may or may not be on large scale with heavy loading. A PLC permits any combination of I/O subsystem, CPU, and HMI/SCADA software, on a wide verity of computer and operating system platforms. Every combination cannot be tested. The PLC manufacturer may supply all hardware and software components, all from the same manufacturer as many PLC manufacturers have acquired HMI companies. If so, this particular combination may have been tested more thoroughly than the other combinations tested. Auxiliary third-party applications like batch control, advanced control, and auto-tuning etc. are generally not tested together as it results in an even greater number of combinations. PLC uses proprietary configuration software just like DCS. That is, you cannot use third-party configuration software for your PLC, just like a DCS. A native OPC server for the PLC is better than a third-party OPC server because the PLC configuration software generally automatically configures the address space for the OPC server. PLC Long Term Support During the 15 years or more of typical system operation there will be several Windows versions, service packs, hot fixes, lots of virus definition updates, and computer hardware will need to be replaced too. Typically PLC has no restriction on anti-virus software or Windows operating system version so again the number of combinations of virus definitions, service packs, and hot fixes becomes too vast and impractical for these manufacturers to get together to test every possible new combination before a deployment in plants to ensure there will be no compatibility conflicts when deployed on the large number of combinations of hardware and software. The PLC manufacturer may limit to a single anti-virus software and Windows version. If so, this particular combination may have been tested more thoroughly than the other combinations they test. PLC Upgrade For a PLC, hardware and software components are upgraded individually. That is, I/O-subsystem firmware, CPU firmware and configuration software, OPC server, HMI software, as well as any other software are all upgraded independent of each other. Taking different versions for each option of components into account, the number of combinations becomes orders of magnitude larger. This flexibility makes it impractical for these manufacturers to get together to test every possible combination of new versions before deployment in plants. Testing the hot-cutover of one combination of versions to another combination of versions becomes nearly impossible. The PLC manufacturer may supply all hardware and software components, limit to a single antivirus software and Windows version which are tested before deployment, and limit to single I/O-Subsystem Database Server Controller/PLC Operator Station / HMI, DCS, PLC system-wide version upgrades, and test hot-cutover before deployment. This way the flexibility of the PLC would be abandoned to achieve the robustness of a DCS. -
Control Algorithms in PLC Programming
xiangjinjiao posted A plc and hmi english article in PLC programming learning
When you are working in an industrial automation system for PLC programming, you have requirements where you need to control a process gradually or in a step-by-step way. Control Algorithms You cannot directly just on or off a logic for getting your work done. It can have adverse effects on your actual PLC output. For this reason, there are various types of control methods available in a PLC program for appropriate actions. In this post, we will see the various control algorithm methods that are used in a PLC program. PID control This is by far the most famous method for control. PID uses a closed-loop mechanism for control. This means it will first get the feedback and based on what you desire, it will accordingly vary the output. For this, PID controller uses internal mathematical calculations with three parameters – proportion, integral, and derivative. So, if you want to control a chiller with a compressor, then the PLC will control the compressor output by first measuring the actual temperature and checking it with how much the user requires. Based on that difference every time, the compressor output will either be controlled gradually or turned on-off to maintain the temperature. For this, a PID block will be used in the PLC program for doing this task. Function generator This is a very simple type of control method. In the function generator, you have to define an input table of n values. Similarly, define an output table of n values. So, for example, if we define 10 value tables in both the input and output sides, we have a 10-size element. Now, these 10 elements will have different values. If you set 0-100 on the input side, then we have set 0-50 on the output side. These 10 elements are 10 ranges, meaning 0-10, 10-20, 20-30, and so on. Accordingly, the output side will be distributed into 10 elements from 0-5, 5-10, 10-15 and so on till 50. When a real-time input is between any value at the input side, the corresponding scaled output will be passed. Here, you have full flexibility to set the input and output table values. Fuzzy logic control Fuzzy logic is a relatively very good method for controlling an output. Normally, you have two binary states – 0 and 1. So, let us consider whether a valve can be opened or closed. But what if the valve is stuck in between? We do not know whether the valve is near to open state or closed state. In that case, it helps if there exists a state between 0 and 1. This helps to at least come closer to a possibility. This is called fussy logic. Here, you get to define values near 0 and 1. It can be like 0.9 or 0.2. Accordingly, you can control the outputs when it comes close to these values. And when it reaches the extreme limit, that is 0 or 1, you can fully open or close the valve. Before that, you can gradually operate the valves. This brings more precise control to the process. So, this control block allows for a collection of values that can be useful in unpredictable situations. It requires a lot of knowledge and expertise to correctly set the values and sets so that the logic works properly. Position proportional This logic will open or close a device by pulsing open or close contacts at some predefined timer set by the user. It is done for a pulse width proportional to the deviation between the required position and the current position. You have to set control parameters like how much minimum and maximum to limit the output, what the duration for which output will remain on, the rate at which the device should open or close in %/second, etc. The function block takes actual feedback, evaluates internal timers, and checks whether the opening or closing is happening within that desired rate or not. If not, then the corresponding open or closed pulse will be given. In this way, we saw the various control algorithm methods used in PLC programming. -
Contacts and Coils in PLC Ladder Logic
xiangjinjiao posted A plc and hmi english article in PLC programming learning
The most elementary objects in Ladder Diagram programming are contacts and coils, intended to mimic the contacts and coils of electromechanical relays. Contacts and coils are discrete programming elements, dealing with Boolean (1 and 0; on and off; true and false) variable states. Each contact in a Ladder Diagram PLC program represents the reading of a single bit in memory, while each coil represents the writing of a single bit in memory. Discrete input signals to the PLC from real-world switches are read by a Ladder Diagram program by contacts referenced to those input channels. In legacy PLC systems, each discrete input channel has a specific address which must be applied to the contact(s) within that program. In modern PLC systems, each discrete input channel has a tag name created by the programmer which is applied to the contact(s) within the program. Similarly, discrete output channels – referenced by coil symbols in the Ladder Diagram – must also bear some form of address or tag name label. To illustrate, we will imagine the construction and programming of a redundant flame-sensing system to monitor the status of a burner flame using three sensors. The purpose of this system will be to indicate a “lit” burner if at least two out of the three sensors indicate flame. If only one sensor indicates flame (or if no sensors indicate flame), the system will declare the burner to be un-lit. The burner’s status will be visibly indicated by a lamp that human operators can readily see inside the control room area. Our system’s wiring is shown in the following diagram: Each flame sensor outputs a DC voltage signal indicating the detection of flame at the burner, either on (24 volts DC) or off (0 volts DC). These three discrete DC voltage signals are sensed by the first three channels of the PLC’s discrete input card. The indicator lamp is a 120 volt light bulb, and so must be powered by an AC discrete output card, shown here in the PLC’s last slot. To make the ladder program more readable, we will assign tag names (symbolic addresses) to each input and output bit in the PLC, describing its real-world device in an easily-interpreted format. We will tag the first three discrete input channels as IN sensor A, IN sensor B, and IN sensor C, and the output as OUT burner lit. A ladder program to determine if at least two out of the three sensors detect flame is shown here, with the tag names referencing each contact and coil: Series-connected contacts in a Ladder Diagram perform the logical AND function, while parallel contacts perform the logical OR function. Thus, this two-out-of-three flame-sensing program could be verbally described as: “Burner is lit if either A and B, or either B and C, or either A and C” An alternate way to express this is to use the notation of Boolean algebra, where multiplication represents the AND function and addition represents the OR function: Burner_lit = AB + BC + AC Yet another way to represent this logical relationship is to use logic gate symbols: To illustrate how this program would work, we will consider a case where flame sensors B and C detect flame, but sensor A does not (Note1). This represents a two-out-of-three-good condition, and so we would expect the PLC to turn on the “Burner lit” indicator light as programmed. From the perspective of the PLC’s rack, we would see the indicator LEDs for sensors B and C lit up on the discrete input card, as well as the indicator LED for the lamp’s output channel: Note 1 : The most likely reason why one out of two flame sensors might not detect the presence of a flame is some form of misalignment or fouling of the flame sensor. In fact, this is a good reason for using a 2-out-of-3 flame detection system rather than a simplex (1-out-of-1) detector scheme: to make the system more tolerant of occasional sensor problems without compromising burner safety. Those two energized input channels “set” bits (1 status) in the PLC’s memory representing the status of flame sensors B and C. Flame sensor A’s bit will be “clear” (0 status) because its corresponding input channel is de-energized. The fact that the output channel LED is energized (and the “Burner lit” indicator lamp is energized) tells us the PLC program has “set” that corresponding bit in the PLC’s output memory register to a “1” state. A display of input and output register bits shows the “set” and “reset” states for the PLC at this moment in time: Examining the Ladder Diagram program with status indication enabled, we see how only the middle contact pair is passing “virtual power” to the output coil: Recall that the purpose of a contact in a PLC program is to read the status of a bit in the PLC’s memory. These six “virtual contacts” read the three input bits corresponding to the three flame sensors. Each normally-open “contact” will “close” when its corresponding bit has a value of 1, and will “open” (go to its normal state) when its corresponding bit has a value of 0. Thus, we see here that the two contacts corresponding to sensor A appear without highlighting (representing no “conductivity” in the virtual relay circuit) because the bit for that input is reset (0). The two contacts corresponding to sensor B and the two contacts corresponding to sensor C all appear highlighted (representing “conductivity” in the virtual circuit) because their bits are both set (1). Recall also that the purpose of a coil in a PLC program is to write the status of a bit in the PLC’s memory. Here, the “energized” coil sets the bit for the PLC output 0 to a “1” state, thus activating the real-world output and sending electrical power to the “Burner lit” lamp. Note that the color highlighting does not indicate a virtual contact is conducting virtual power, but merely that it is able to conduct power. Color highlighting around a virtual coil, however, does indicate the presence of virtual “power” at that coil. Contacts and relays are not just useful for implementing simple logic functions, but they may also perform latching functions as well. A very common application of this in industrial PLC systems is a latching start/stop program for controlling electric motors by means of momentary-contact push-button switches. As before, this functionality will be illustrated by means of an hypothetical example circuit and program: In this system, two push-button switches are connected to discrete inputs on a PLC, and the PLC in turn energizes the coil of a motor contactor relay by means of one of its discrete outputs. An overload contact is wired directly in series with the contactor coil to provide motor over-current protection, even in the event of a PLC failure where the discrete output channel remains energized ( note 2 ). The ladder program for this motor control system would look like this: Note 2 : While it is possible to wire the overload contact to one of the PLC’s discrete input channels and then program a virtual overload contact in series with the output coil to stop the motor in the event of a thermal overload, this strategy would rely on the PLC to perform a safety function which is probably better performed by hard-wired circuitry. Pressing the “Start” pushbutton energizes discrete input channel 6 on the PLC, which “closes” the virtual contact in the PLC program labeled IN switch Start. The normally-closed virtual contact for input channel 7 (the “Stop” pushbutton) is already closed by default when the “Stop” button is not being pressed, and so the virtual coil will receive “power” when the “Start” pushbutton is pressed and the “Stop” pushbutton is not. Note the seal-in contact bearing the exact same label as the coil: OUT contactor. At first it may seem strange to have both a contact and a coil in a PLC program labeled identically (Note 3 ), since contacts are most commonly associated with inputs and coils with outputs, but this makes perfect sense if you realize the true meaning of contacts and coils in a PLC program: as read and write operations on bits in the PLC’s memory. The coil labeled OUT contactor writes the status of that bit, while the contact labeled OUT contactor reads the status of that same bit. The purpose of this contact, of course, is to latch the motor in the “on” state after a human operator has released his or her finger from the “Start” pushbutton. Note 3 : A very common misconception among students first learning PLC Ladder Diagram programming is to always associate contacts with PLC inputs and coils with PLC outputs, thus it seems weird to have a contact bear the same label as an output. However, this is a false association. In reality, contacts and coils are read and write instructions, and thus it is possible to have the PLC read one of its own output bits as a part of some logic function. What would be truly strange is to label a coil with an input bit address or tag name, since the PLC is not electrically capable of setting the real-world energization status of any input channels. This programming technique is known as feedback, where an output variable of a function (in this case, the feedback variable is OUT contactor) is also an input to that same function. The path of feedback is implicit rather than explicit in Ladder Diagram programming, with the only indication of feedback being the common name shared by coil and contact. Other graphical programming languages (such as Function Block) have the ability to show feedback paths as connecting lines between function outputs and inputs, but this capacity does not exist in Ladder Diagram. A step-by-step sequence showing the operation and status of this simple program illustrates how the seal-in contact functions, through a start-up and shut-down cycle of the motor: This sequence helps illustrate the order of evaluation or scan order of a Ladder Diagram program. The PLC reads a Ladder Diagram from left to right, top to bottom, in the same general order as a human being reads sentences and paragraphs written in English. However, according to the IEC 61131-3 standard, a PLC program must evaluate (read) all inputs (contacts) to a function before determining the status of a function’s output (coil or coils). In other words, the PLC does not make any decision on how to set the state of a coil until all contacts providing power to that coil have been read. Once a coil’s status has been written to memory, any contacts bearing the same tag name will update with that status on subsequent rungs in the program. Step 5 in the previous sequence is particularly illustrative. When the human operator presses the “Stop” pushbutton, the input channel for IN switch Stop becomes activated, which “opens” the normally-closed virtual contact IN switch Stop. Upon the next scan of this program rung, the PLC evaluates all input contacts (IN switch Start, IN switch Stop, and OUT contactor) to check their status before deciding what status to write to the OUT contactor coil. Seeing that the IN switch Stop contact has been forced open by the activation of its respective discrete input channel, the PLC writes a “0” (or “False”) state to the OUT contactor coil. However, the OUT contactor feedback contact does not update until the next scan, which is why you still see it color-highlighted during step 5. A potential problem with this system as it is designed is that the human operator loses control of the motor in the event of an “open” wiring failure in either pushbutton switch circuit. For instance, if a wire fell off a screw contact for the “Start” pushbutton switch circuit, the motor could not be started if it was already stopped. Similarly, if a wire fell off a screw contact for the “Stop” pushbutton switch circuit, the motor could not be stopped if it was already running. In either case, a broken wire connection acts the same as the pushbutton switch’s “normal” status, which is to keep the motor in its present state. Some applications, this failure mode would not be a severe problem. Many applications, though, it is quite dangerous to have a running motor that cannot be stopped. For this reason, it is customary to design motor start/stop systems a bit differently from what has been shown here. In order to build a “fail-stop” motor control system with our PLC, we must first re-wire the pushbutton switch to use its normally-closed (NC) contact: This keeps discrete input channel 7 activated when the pushbutton is unpressed. When the operator presses the “Stop” pushbutton, the switch’s contact will be forced open, and input channel 7 will de-energize. If a wire happens to fall off a screw terminal in the “Stop” switch circuit, input channel 7 will de-energize just the same as if someone pressed the “Stop” pushbutton, which will automatically shut off the motor. In order for the PLC program to work properly with this new switch wiring, the virtual contact for IN switch Stop must be changed from a normally-closed (NC) to a normally-open (NO): As before, the IN switch Stop virtual contact is in the “closed” state when no one presses the “Stop” switch, enabling the motor to start any time the “Start” switch is pressed. Similarly, the IN switch Stop virtual contact will open any time someone presses the “Stop” switch, thus stopping virtual “power” from flowing to the OUT contactor coil. Although this is a very common way to build PLC-controlled motor start/stop systems – with an NC pushbutton switch and an NO “Stop” virtual contact – students new to PLC programming often find this logical reversal confusing. Perhaps the most common reason for this confusion is a mis-understanding of the “normal” concept for switch contacts, be they real or virtual. The IN switch Stop virtual contact is programmed to be normally-open (NO), but yet it is typically found in the closed state. Recall that the “normal” status of any switch is its status while in a resting condition of no stimulation, not necessarily its status while the process is in a “normal” operating mode. The “normally-open” virtual contact IN switch Stop is typically found in the closed state because its corresponding input channel is typically found energized, owing to the normally-closed pushbutton switch contact, which passes real electrical power to the input channel while no one presses the switch. Just because a switch is configured as normally-open does not necessarily mean it will be typically found in the open state! The status of any switch contact, whether real or virtual, is a function of its configuration (NO versus NC) and the stimulus applied to it. Another concern surrounding real-world wiring problems is what this system will do if the motor contactor coil circuit opens for any reason. An open circuit may develop as a result of a wire falling off a screw terminal, or it may occur because the thermal overload contact tripped open due to an over-temperature event. The problem with our motor start/stop system as designed is that it is not “aware” of the contactor’s real status. In other words, the PLC “thinks” the contactor will be energized any time discrete output channel 2 is energized, but that may not actually be the case if there is an open fault in the contactor’s coil circuit. This may lead to a dangerous condition if the open fault in the contactor’s coil circuit is later cleared. Imagine an operator pressing the “Start” switch but noticing the motor does not actually start. Wondering why this may be, he or she goes to look at the overload relay to see if it is tripped. If it is tripped, and the operator presses the “Reset” button on the overload assembly, the motor will immediately start because the PLC’s discrete output has remained energized all the time following the pressing of the “Start” switch. Having the motor start up as soon as the thermal overload is reset may come as a surprise to operations personnel, and this could be quite dangerous if anyone happens to be near the motor-powered machinery when it starts. What would be safer is a motor control system that refuses to “latch” on unless the contactor actually energizes when the “Start” switch is pressed. For this to be possible, the PLC must have some way of sensing the contactor’s status. In order to make the PLC “aware” of the contactor’s real status, we may connect the auxiliary switch contact to one of the unused discrete input channels on the PLC, like this: Now, the PLC is able to sense the real-time status of the contactor via input channel 5. We may modify the PLC program to recognize this status by assigning a new tag name to this input (IN contactor aux) and using a normally-open virtual contact of this name as the seal-in contact instead of the OUT contactor bit: Now, if the contactor fails to energize for any reason when the operator presses the “Start” switch, the PLC’s output will fail to latch when the “Start” switch is released. When the open fault in the contactor’s coil circuit is cleared, the motor will not immediately start up, but rather wait until the operator presses the “Start” switch again, which is a much safer operating characteristic than before. A special class of virtual “coil” used in PLC ladder programming that bears mentioning is the “latching” coil. These usually come in two forms: a set coil and a reset coil. Unlike a regular “output” coil that positively writes to a bit in the PLC’s memory with every scan of the program, “set” and “reset” coils only write to a bit in memory when energized by virtual power. Otherwise, the bit is allowed to retain its last value. A very simple motor start/stop program could be written with just two input contacts and two of these latching coils (both bearing the same tag name, writing to the same bit in memory): Note the use of a normally-open (NO) pushbutton switch contact (again!), with no auxiliary contact providing status indication of the contactor to the PLC. This is a very minimal program, shown for the strict purpose of illustrating the use of “set” and “reset” latching coils in Ladder Diagram PLC programming. “Set” and “Reset” coils ( Referred to as “Latch” and “Unlatch” coils ) are examples of what is known in the world of PLC programming as retentive instructions. A “retentive” instruction retains its value after being virtually “de-energized” in the Ladder Diagram “circuit.” A standard output coil is non-retentive, which means it does not “latch” when de-energized. The concept of retentive and non-retentive instructions will appear again as we explore PLC programming, especially in the area of timers. Ordinarily, we try to avoid multiple coils bearing the same label in a PLC Ladder Diagram program. With each coil representing a “write” instruction, multiple coils bearing the same name represents multiple “write” operations to the same bit in the PLC’s memory. Here, with latching coils, there is no conflict because each of the coils only writes to the OUT contactor bit when its respective contact is energized. So long as only one of the pushbutton switches is actuated at a time, there is no conflict between the identically-named coils. This raises the question: what would happen if both pushbutton switches were simultaneously pressed? What would happen if both “Set” and “Reset” coils were “energized” at the same time? The result is that the OUT contactor bit would first be “set” (written to a value of 1) then “reset” (written to a value of 0) in that order as the two rungs of the program were scanned from top to bottom. PLCs typically do not typically update their discrete I/O registers while scanning the Ladder Diagram program (this operation takes place either before or after each program scan), so the real discrete output channel status will be whatever the last write operation told it to be, in this case “reset” (0, or off). Even if the discrete output is not “confused” due to the conflicting write operations of the “Set” and “Reset” coils, other rungs of the program written between the “Set” and “Reset” rungs might be. Consider for example a case where there were other program rungs following the “Set” and “Reset” rungs reading the status of the OUT contactor bit for some purpose. Those other rungs would indeed become “confused” because they would see the OUT contactor bit in the “set” state while the actual discrete output of the PLC (and any rungs following the “Reset” rung) would see the OUT contactor bit in the “reset” state: Multiple (non-retentive) output coils with the same memory address are almost always a programming faux pax for this reason, but even retentive coils which are designed to be used in matched pairs can cause trouble if the implications of simultaneous energization are not anticipated. Multiple contacts with identical addresses are no problem whatsoever, because multiple “read” operations to the same bit in memory will never cause a conflict. The IEC 61131-3 PLC programming standard specifies transition-sensing contacts as well as the more customary “static” contacts. A transition-sensing contact will “actuate” only for a duration of one program scan, even if its corresponding bit remains active. Two types of transition-sensing Ladder Diagram contacts are defined in the IEC standard: one for positive transitions and another for negative transitions. The following example shows a wiring diagram, Ladder Diagram program, and a timing diagram demonstrating how each type of transition-sensing contact functions when stimulated by a real (electrical) input signal to a discrete channel: When the pushbutton switch is pressed and the discrete input energized, the first test lamp will blink “on” for exactly one scan of the PLC’s program, then return to its off state. The positive transition contact (with the letter “P” inside) activates the coil OUT test1 only during the scan it sees the status of IN test transition from “false” to “true,” even though the input remains energized for many scans after that transition. Conversely, when the pushbutton switch is released and the discrete input de-energizes, the second test lamp will blink “on” for exactly one scan of the PLC’s program then return to its off state. The negative-transition contact (with the letter “N” inside) activates the coil OUT test2 only during the scan it sees the status of IN test transition from “true” to “false,” even though the input remains de-energized for many scans after that transition: It should be noted that the duration of a single PLC program scan is typically very short: measured in milliseconds. If this program were actually tested in a real PLC, you would probably not be able to see either test lamp light up, since each pulse is so short-lived. Transitional contacts are typically used any time it is desired to execute an instruction just one time following a “triggering” event, as opposed to executing that instruction over and over again so long as the event status is maintained “true.” Contacts and coils represent only the most basic of instructions in the Ladder Diagram PLC programming language. -
Comparison Instructions in PLC Programming
xiangjinjiao posted A plc and hmi english article in PLC programming learning
Comparison instructions in PLC are used to test pairs of values to condition the logical continuity of a rung. Thus, comparison instructions would seldom, if ever, be the last instruction on a rung. Types of Comparison Instructions As an example, suppose a LES instruction is presented with two values. If the first value is less than the second, then the comparison instruction is true. Equal (EQU) Instruction Use the EQU instruction to test whether two values are equal. If source A and source B are equal, the instruction is logically true. If these values are not equal, the instruction is logically false. Source A must be an address. Source B can be either a program constant or an address. Values are stored in two’s complementary form. Not Equal (NEQ) Instruction Use the NEQ instruction to test whether two values are not equal. If source A and source B are not equal, the instruction is logically true. Source A must be an address. Source B can be either a program constant or an address. Values are stored in two’s complementary form. Less Than (LES) Instruction Use the LES instruction to test whether one value (source A) is less than another (source B). If source A is less than the value at source B, the instruction is logically true. Source A must be an address. Source B can be either a program constant or an address. Values are stored in two’s complementary form. Less Than or Equal (LEQ) Instruction Use the LEQ instruction to test whether one value (source A) is less than or equal to another (source B). If the value at source A is less than or equal to the value at source B, the instruction is logically true. Source A must be an address. Source B can be either a program constant or an address. Values are stored in two’s complementary form. Greater Than (GRT) Instruction Use the GRT instruction to test whether one value (source A) is greater than another (source B). If the value at source A is greater than the value at source B, the instruction is logically true. Greater Than Or Equal (GEQ) Instruction Use the GEQ instruction to test whether one value (source A) is greater than or equal to another (source B). If the value at source A is greater than or equal to the value at source B, the instruction is logically true. Masked Comparison for Equal (MEQ) Use the MEQ instruction to compare data at a source address with data at a compare address. The Use of this instruction allows portions of the data to be masked by a separate word. Source is the address of the value you want to compare. Mask is the address of the mask through which the instruction moves data. The mask can be a hexadecimal value. Compare is an integer value or the address of the reference. If the 16 bits of data at the source address are equal to the 16 bits of data at the compare address (less masked bits), the instruction is true. The instruction becomes false as soon as it detects a mismatch. Limit Test (LIM) Instruction Use the LIM instruction to test for values within or outside a specified range, depending on how you set the limits. The Low Limit, Test, and High Limit values can be word addresses or constants, restricted to the following combinations: If the Test parameter is a program constant, both the Low Limit and High Limit parameters must be word addresses. If the Test parameter is a word address, the Low Limit and High Limit parameters can be either a program constant or a word address. True/False Status of the LIM Instruction If the Low Limit has a value equal to or less than the High Limit, the instruction is true when the Test value is between the limits or is equal to either limit. If the Low Limit has a value greater than the High Limit, the instruction is false when the Test value is between the limits. -
Basics of PLC Programming
xiangjinjiao posted A plc and hmi english article in PLC programming learning
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: -
PLC Programming Learning - Ladder Diagram Basics
xiangjinjiao posted A plc and hmi english article in PLC programming learning
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. -
PLC programming for defective part classification
xiangjinjiao posted A plc and hmi english article in PLC programming learning
Advanced PLC programming for defective parts sorting to distinguish between good and bad parts and then transport them via conveyors. Advanced PLC Programming for Defective Parts Sorting The below simulation shows the good and bad products identification and sorting the products based on their quality using PLC ladder logic. The conveyors are used to move the products. The conveyors are started and stopped when the products are delivered on the conveyor and during the drilling operation. The drill machine is used for drilling the products as per the design. Sometimes the drilling operation may damage the products. A sensor detects the quality of the products and a pusher is used to push the bad products into another storage bin. PLC Inputs and Outputs The below table lists the required inputs and outputs of the PLC system. Type Device No. Device name Operation Input X0 Drilling ON while drilling. Input X1 Part under drill One part is supplied when Y0 is ON: A large metal cube. Input X2 Drilled correctly ON when the part is drilled correctly. The previous result is cleared when drilling starts. Input X3 Drilled wrong ON when the part is detected at the left end. Input X4 Sensor ON when the part is detected at the right end. Input X5 Sensor ON when the part is detected in front of the pusher. Input X10 Sensor ON when the part is not drilled correctly. The previous result is cleared when drilling starts. Output Y0 Supply command The conveyor moves forward when Y1 is ON. Output Y1 Conveyor forward The conveyor moves forward when Y3 is ON. Output Y2 Start drilling Starts drilling when Y2 is ON (A process cycle that cannot be stopped partway). Output Y3 Conveyor forward Extends when Y5 is ON and retracts when Y5 is OFF. The pusher cannot be stopped in the mid-stroke. Output Y5 Pusher Extends when Y5 is ON and retracts when Y5 is OFF. The pusher cannot be stopped in the mid stroke. Program Description This project aims to differentiate between good and defective parts using sensors and sorting them accordingly. The project consists of two key areas: overall control and drill control. Overall Control There is a pushbutton named PB1 (X20) on the control panel. When you press PB1, it triggers the Supply command (Y0) for the hopper, causing it to supply parts. Releasing PB1 deactivates the Supply command, stopping the hopper. There is a switch, SW1 (X24), on the control panel. When you turn SW1 ON, the conveyors start to move forward. Turning SW1 OFF halts the conveyors. Drill Control Now let’s discuss the control of the drill: When the Part under the drill sensor (X1) within the drill is activated, the conveyor halts. The drilling process commences when the Start drilling command (Y2) is activated. It stops when the Drilling sensor (X0) is activated. After one complete cycle of drill operation, if Start drilling (Y2) is activated, either the Drilled correctly (X2) or Drilled wrong (X3) sensor is triggered. Note that the drill can’t be stopped mid-operation. In this PLC simulation, every third part is considered defective (A part with multiple holes also falls into the defective category). When the Detect part sensor (X10) in the pusher identifies a defective part, the conveyor stops, and the pusher moves the part onto the ‘Defective’ tray. Remember that when the actuating command for the pusher is ON, it fully extends. When the command is OFF, the pusher fully retracts. A part that passes inspection continues along the conveyor to the ‘OK’ tray located at the right end. PLC Programming -
使用 PLC 梯形逻辑进行交通灯控制
xiangjinjiao posted A PLC and HMI Simplified Chinese article in PLC programming learning
我们在城市中最常遇到三路交通拥堵。该 PLC 程序提供了使用可编程逻辑控制来控制严重交通拥堵的解决方案。 使用 PLC 进行交通灯控制 问题方案 编写交通灯控制程序的方法有很多种,例如:序列发生器输出方法,但在这种正常输入、输出和计时器中使用。 定时器用于为输出打开和关闭提供时间延迟。 最后使用复位线圈来连续运行程序。 比较器块用于减少所用定时器的数量。 程序在 AB RSLogix 500 软件中完成。 交通控制系统的输入和输出列表 三路交通控制系统 PLC 程序 下面的表格列给出了打开输出的步骤或顺序。 三路交通控制系统的 PLC 逻辑描述 梯级000: 这是一个锁存梯级,用于通过主启动和停止 PB 操作系统。 梯级001 和 梯级0002 : 启动计时器打开第一个输出西绿色,因此东和西应该为红色。 并行梯级中的比较器用于在 15 秒后关闭东红。定时器 T4:并联触点中的 2 个定时位用于在第 5步 和第 6步中再次打开东红灯 。(请参阅上面的表格列以进行说明) 梯级 0003: 使用 T4:0 和 T4:1 的定时器定时位和比较器块将北红打开至第 3步。 梯级 0004: 使用比较器模块将东黄灯打开 5 秒。(第二步) 梯级 0005-0006-0007-0008-0009-0010 : 按照相同的步骤打开更多输出。(操作顺序请参见表格列) 梯级 0011: 使用 T4:2 的完成位将复位线圈打开,以从头开始重新启动循环 程序连续运行,直到按下 STOP PB 结论: 上述使用 PLC 的 3 种交通灯控制方式仅作为示例。它可能与实时有所不同。我们可以使用这个示例程序来了解AB PLC中定时器和比较器块功能的工作。 -
使用 PLC 控制多泵
xiangjinjiao posted A PLC and HMI Simplified Chinese article in PLC programming learning
使用可编程逻辑控制器编写 PLC 程序来控制多台泵。我们有两个输入泵用于填充水箱。确保泵在其使用寿命内运行相同的时间。 使用 PLC 控制多泵 程序逻辑: 根据下面给出的逻辑开发梯形图逻辑程序, 启动/停止按钮用于控制两个输入泵电机 P1 和 P2。 启动/停止按钮站用于控制泵 P1。 当水箱已满时,排水泵电机 P3 自动启动并运行,直到低液位传感器启动。 泵 P1 向水箱注水 3 次后,控制自动切换至泵 P2。 启动/停止按钮的操作现在控制泵 P2。 通过泵 P2 对水箱进行 3 次填充后,重复该顺序。 PLC程序: 程序说明: 梯级 0000: 启动/停止 PB 由存储器 B3:0/0 锁存。 梯级 0001: B3:0/0 使能打开 B3:0/1,即当低电平传感器(I:0/3)打开且高电平传感器(I: 0/2) 处于关闭状态。B3:0/1 被低水位传感器锁定,因为一旦水开始上升,泵 p1 就不会关闭。 梯级 0002: 用于通过计数器 (C5:0) 打开泵 P1 (O: 0/0) 的内存触点。 由于我们要将泵操作从 P1 切换到 P2,因此使用两个计数器在 P1 和 P2 之间切换。 计数器 C5:1 用于打开泵 P2(O:0/2)。 梯级 0003 和 0004: B3:0/0 使能打开 B3:0/2,即当高电平传感器(I:0/2)打开且低电平传感器(I: 0/3) 处于关闭状态。B3:0/2 由高液位传感器锁定,因为一旦水开始减少,泵 p3 不应关闭。 梯级 0005: 当泵 3 (O:0/1) 运行时,低液位传感器打开将使泵 p3 关闭,泵 P1(O:0/0) 打开。 梯级 0006: 一旦第二个计数器(C5:1) 完成位转为 ON,两个计数器都会复位。 结论: 我们可以通过这个例子来理解 AB PLC 中的编程逻辑。 -
当您设计 PLC 逻辑时,您必须注意为标签提供的名称。它应该很容易被任何程序员理解和解释。它既不应该太长也不应该太短。 命名约定很重要,因为不正确的标记可能会导致程序员出现故障排除问题。另外,给出冗长的名称会消耗 PLC 的内存。因此,每个程序员在编写 PLC 程序之前都必须遵循正确的命名约定。在这篇文章中,我们将了解 PLC 标签命名约定的概念。 PLC 命名约定 首先,让我们了解一下标签命名约定在 PLC 编程中如何发挥重要作用。您有一个电机,其运行命令和运行反馈作为 PLC IO。 电机位于鼓风机室内,用作空气压缩机。P&ID 中的电机标签名称为 M-101。现在,对于 PLC 程序员来说,识别标签位置非常重要。因此,PLC 程序员通常有两种心态。 第一个将尝试在标签名称中提供尽可能多的信息;因此他可以将电机运行命令命名为 M101_压缩机_运行_命令。第二个将尝试将名称命名为 Q_M101_Comp。 第二种心态看起来非常清晰,因为他给出了简短的名称并保持尽可能短的长度。这就是为什么命名 PLC 标签很重要的原因,因为它可以使程序员在紧急故障排除的情况下不必读取如此冗长的标签。(需要注意的是,PLC 变量命名不接受除下划线(_)之外的任何特殊字符)。 PLC 标签名称应包含可帮助程序员理解其含义的信息。这通常意味着以下信息 – 数据类型(例如布尔值、整数)、 数据流(例如输入、输出), 范围(例如本地、全球), 仪器或设备类型(例如电机、阀门、传感器), 过程参数(例如压力、流量、温度)和 设备的位置。 标签名称样式 根据 IEC 标准,有多种样式,必须遵循这些样式才能正确命名。 让我们看一下一些最常用的: 骆驼风格, 帕斯卡风格, 蛇的风格, 带有数据类型样式的前缀 骆驼风格 在这种风格中,中间没有下划线。整个单词有一个全名,但其中的每个单词都以大写字母开头。例如,以上面讨论的例子为例。 M101_压缩机_运行_命令将被写为m101压缩机运行命令。您可以通过大写字母来识别每个单词。 第一个字母必须是小写字母。如果字很小,这种样式看起来不错。它可以防止使用下划线,从而减少内存消耗。 帕斯卡风格 类似骆驼风格;唯一的区别是第一个字母必须是大写字母。 例如,我们的标签将写为 M101CompressorRunCommand。 蛇型 我们之前讨论的例子是蛇风格。在这里,每个单词将用下划线分隔。 带有数据类型样式的前缀 这里,标签将以标签名称的数据类型为前缀。在我们的例子中,标签类型是布尔值。根据 IEC 标准,布尔标签通常带有前缀“x”。 因此,我们的样式将写为 xM101CompressorRunCommand。这有助于程序员识别该特定标签使用什么类型的数据。 PLC 编程中标签命名的技巧 第一个也是最重要的规则是标签的长度应该短,但不能短到没人能理解。如所讨论的,长度应该以适当的长度包含适当的信息。应严格避免使用过长的名称。 遵循所讨论的一般标签命名样式。这些符合 IEC 标准,使逻辑看起来整洁干净。 要减少标签创建过程中的错误,请使用 Excel 文件。Excel 极大地减少了工作量,因为重复和复制变得非常容易。Excel 文件中几乎不会产生错误。 并不总是需要使用单词的全名。 例如,阀门可写为 vlv,温度可写为 temp。 避免将标签完全大写。 看起来很麻烦,不适合阅读。
-
如何将电气图转换成 PLC 程序?
xiangjinjiao posted A PLC and HMI Simplified Chinese article in PLC programming learning
PLC 编程借鉴了电气图纸的历史和参考。随着时间的推移,对涉及自动化的电气系统进行故障排除变得越来越困难,需要一些控制器来执行逻辑并执行所需的操作。这催生了 PLC 系统。 大家知道,PLC 编程有很多种语言,最早的一种是梯形图语言。应该知道,电气图也有助于将其转换为梯形逻辑。在这篇文章中,我们将了解如何将电气图转换为 PLC 程序。 了解电气图 首先,您需要了解电气图。请参阅下图。每个电路都有两端——正极和负极。电流从正极开始流经负极。 电气元件和设备介于两者之间。如果您参考下图,有四个组件:启动按钮、停止按钮、灯的辅助触点和灯。 电源从正极开始,连接到启动按钮的输入端(常开触点)。启动按钮的输出连接到停止按钮的输入(常闭触点)。停止按钮的输出连接到灯的输入。 灯的输出连接到负端电源。与启动按钮并行,另一根电线从按钮的输入端延伸到灯的辅助触点。该触点的输出连接回按钮的输出。 当提供电源并且按下启动按钮时,灯将在获得电流路径时点亮。现在,如果释放按钮,则灯将关闭,因为它没有获取路径。 因此,为了锁定它,我们将灯触点并联放置,这将保持电源路径。当按下停止按钮时,供电路径被切断并且灯熄灭。 将接线图转换为PLC程序 现在,一旦您理解了接线图,就开始以与PLC 编程相同的方式解释它。请参阅下图。 梯形逻辑有两个电源端——左和右。左相当于正电源端,右相当于负电源端。 您将需要四个 PLC 编程组件 - 启动按钮 -> 常开触点、停止按钮 -> 常闭触点、灯 -> 输出线圈和灯常开触点。 首先,将启动按钮置于常开触点。与它平行,将灯置于常开触点。此后,放置停止按钮常闭触点。最后,将灯置于常开状态。 工作原理与接线图所讨论的相同。您看到相同的电气图被解释并转换为梯形图逻辑。 需要遵循的一般提示是: 1、了解从输入电源到输出电源的接线图。在两者之间,查看哪些组件放置在何处以及它们是如何接线的。 2、接线时,区分输入部分和输出部分,并用不同的颜色进行标记。 3、按照图表开始编程,并按照与接线相同的方式放置组件。 4、运行该程序并查看它是如何工作的。 -
PLC 模拟量输入转换公式
xiangjinjiao posted A PLC and HMI Simplified Chinese article in PLC programming learning
对于任何 PLC 上的任何单位转换,您可以使用四个函数数学来表示 PLC 模拟输入转换公式,该公式假定整数数学,如下所示: PLC换算公式 公式: EU = ((EUSpan x (DATA – DataOffset))/DataSpan) + EUOffset 过程价值 = EU / 因子 DataOffset = 4 mA 时输入寄存器中的数据(或任何范围的零模拟信号 - 例如 0-10 VDC 变送器上的 0 VDC) DataSPan = 20 mA 时的数据 – 4 mA 时的数据 FACTOR = 获得正确分辨率和准确度所需的任意因子(10 的倍数) EU = 工程单位 x 系数 EUOffset = 工程单位 @ 4 mA x 系数 EUSpan =(20 mA 时的工程单位 – 4 mA 时的工程单位)x 系数 DATA = 输入寄存器中实际读取的数据 例如, 范围 0 至 60 psig 的压力变送器连接到 PLC 模拟输入卡。 PLC 模拟输入卡原始计数从 6240(4mA)和 31208(20mA)开始。 PLC读取18975原始计数并计算等效压力变送器读数。 注意:PLC 原始计数可能因系统而异。 4-20 mA 为 0-60 psig,分辨率为 0.1 psig: 系数 = 10 数据 @ 4 mA = 6240 20 mA 时的数据 = 31208 数据偏移 = 6240 数据跨度 = 31208 – 6240 = 24968 EU 偏移 = 0 x 10 = 0 EUSpan = (60 – 0) x 10 = 600 数据 = 18975 EU = ((EUSpan x (DATA – DataOffset))/DataSpan) + EUOffset 欧盟 = ((600 x (18975 – 6240)) / 24968) + 0 = 306 过程价值 = EU / 因子 过程值 = 306 / 10 = 30.6 psig -
使用 PLC 的双手控制逻辑
xiangjinjiao posted A PLC and HMI Simplified Chinese article in PLC programming learning
本文介绍的是冲压行业中使用的双手控制的编程。 该计划的目的是为了防止致命事故的安全。下图展示了压力机的外观以及我们为何关心安全。正如您所看到的,有用于控制压力机的按钮。当我们按下按钮时,中心板被推到工件的表面上。 必须同时按下两个按钮才能操作压力机,如下图所示。 当操作者用一只手按下按钮并用另一只手将板推向表面时,他可能会受伤。如果操作员试图匆忙操纵物品,推板的强大力量很容易挤伤手。 下面我解释了在西门子 TIA Portal 的帮助下用于防止此类事件的程序。 下图中显示了具有两个输入和一个输出的压力机。输入连接到 plc 数字输入 (DI) 模块,单输出连接到数字输出 (DO) 模块。 以下是该程序使用的输入和输出的列表。 输入: 按钮 (PB_1):I0.0 按钮 (PB_2):I0.2 输出: 压力机产量:Q0.0 双手控制逻辑 逻辑描述 网络1: 这里两个按钮PB_1 和 PB_2 串联。当两个按钮同时按下时,信号将通过定时器 T0 的常闭触点并激励输出。 网络2: 现在,如果按下 PB_1 或 PB_2 中的任何一个按钮,则定时器 T0接通延迟定时器(S_ODT) 就会通电,在我们的例子中是 5 秒后。 这里,压力机输出的 NC 触点也用在按钮之后,因为如果输出为 ON,则不允许定时器通电。 因此,只有同时按下两个按钮时,机器的输出才会通电。