

leizuofa
Staff group-
Content Count
198 -
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 leizuofa
-
PLC Energize or De-energize the Outputs based on Events
leizuofa posted A plc and hmi english article in PLC programming learning
Write the following PLC Program to Energize or De-energize the Outputs based on Events. A certain switch (I:1/0) is to start a process. The process is to run for 30 seconds, stop for 10 seconds and then repeat as long switch I:1/0 remains closed. Opening I:1/0 at any time is to reset all timers and de-energize all outputs. Output O:2/0 is to be energized during the 30s run period and output O:2/1 is to be energized during the 10s stop period. During the run period, a single output O:2/2 is controlled by input I:1/1. If I:1/1 is open (at the beginning of the run period) O:2/2 is to be off for the first 5 seconds then on for 10 seconds. If I:1/1 is closed (at the beginning of the run period) O:2/2 is to be off for the first 10 seconds then on for 15 seconds. Changing I:1/1 after the run period has begun should not change the above sequence. Output O:2/2 is always to be off during the stop period. PLC Energize or De-energize Outputs -
Write a PLC Counters Program for the below example. PLC Counters A certain process is to count the number of true-to-false transitions on input I:0.0/0 for a 10 second period. Counting is to occur if input word I:0.1 has a value less than 10000 or greater than 20000. The 10 second counting period is to begin 15 seconds after the process starts. I:0.0/1 is a process start input and input I:0.0/2 is a process stop input. The count display is to be output to word O:0.0 only at the end of the count period. All outputs are to be de-energized 5 seconds after the count period. The process should repeat only after another distinct press of the process start input. Write an efficient ladder logic program for this process. PLC Logic
-
Write a PLC Logic GATE Program for the below plc example. Logic GATE Program Write a program that ANDs B3:0 with B3:1 when I:0.0/0 is energized, ORs B3:0 with B3:1 when I:0.0/1 is energized, XORs B3:0 with B3:1 when I:0.0/2 is energized and COMPLEMENTS B3:0 when I:0.0/3 is energized. B3:1 is to hold the result in each case. If more than one input I:0.0/0-I:0.0/3 is energized, only one of the operations will be performed. The precedence order for operations should be from AND (highest precedence) to COMPLEMENT (lowest precedence). PLC Ladder Logic
-
ALLEN BRADLEY Allen Bradley PLC Subroutines
leizuofa posted A plc and hmi english article in PLC programming learning
JSR, SBR, and RET instructions are used to direct the controller to execute a separate subroutine file within the ladder program and return to the instruction following the JSR instruction. Allen Bradley PLC Subroutines The SBR instruction must be the first instruction on the first rung in the program file that contains the subroutine. Use a subroutine to store recurring sections of program logic that must be executed from several points within your application program A subroutine saves memory because you program it only once. Update critical I/O within subroutines using immediate input and/or output instructions (IIM, IOM), especially if your application calls for nested or relatively long subroutines Otherwise, the controller does not update I/O until it reaches the end of the main program (after executing all subroutines) Outputs controlled within a subroutine remain in their last state until the subroutine is executed again. When the JSR instruction is executed, the controller jumps to the subroutine instruction (SBR) at the beginning of the target subroutine file and resumes execution at that point. You cannot jump into any part of a subroutine except the first instruction in that file. The target subroutine is identified by the file number that you entered in the JSR instruction. The SBR instruction serves as a label or identifier for a program file as a regular subroutine file. The instruction must be programmed as the first instruction of the first rung of a subroutine. The RET instruction marks the end of subroutine execution or the end of the subroutine file. The rung containing the RET instruction may be conditional if this rung precedes the end of the subroutine. In this way, the controller omits the balance of a subroutine only if its rung condition is true. -
Write a PLC Timers Program for the following plc example. PLC Timers Construct a PLC timing circuit that will output (using output O:2/0) a 0.5 second pulse every two seconds (i.e. on for 0.5s then off for 2s). If a switch (using I:1/0) is closed and a 1 second pulse every two seconds if the switch is open. Ladder Logic
-
Motor Star Delta Starter for PLC Program
leizuofa posted A plc and hmi english article in PLC programming learning
When electric motor is started, it draws a high current typical 5-6 times greater than normal current. In DC motors there is no back emf at starting therefore initial current is very high as compared to the normal current. To protect the motor from these high starting currents we use a star and delta starter. Simply in Star connection, supply voltage to motor will be less. so we use star connection during starting of the motor, after motor running we will change the connection form star to delta to gain full speed of the motor. Star Delta Motor Starter The following figure shows the winding connections in star and delta configuration one by one. It can be seen that in star connection, one end of all three windings are shorted to make star point while other end of each winding is connected to power supply. In delta configuration, the windings are connected such that to make a close loop. The connection of each winding is shown in above figure. In actual motor the three phase connections are provided in the following order as shown So in order to make winding connection in star and delta style in practical motor, the connection is shown above. Main contractor is used to supply power to the windings. It must be turned on all the time. Initially the star contactor is closed while delta contactor is open It makes the motor windings in star configuration. When the motor gains speed, the star contactor is opened while delta contactor is closed turning the motor windings into delta configuration. The contactors are controlled by using PLC. The following section of PLC tutorial will explain the ladder programming for star delta motor starter. PLC program for star delta motor starter : PLC Ladder Logic Rung 1 Main contactor : The main contactor depends upon the normally open input start push button (I1), normally closed stop button (I2) and normally closed overload relay. It means that Main contactor will only be energized if start button is pressed, while stop is not pressed and overload relay is not activated. A normally open input named (Q1) is added in parallel to the start button I1. By doing so, a push button is created which means that once motor is started, it will be kept started even if start button is released Rung 2 Star contactor: Star contactor depends upon main contactor, normally close contacts of timer (T1), and normally close contacts of output delta contactor (Q3). So star contactor will only be energized if main contactor is ON, time output is not activated and delta contactor is not energized. Timer T1: Timer T1 measures the time after which the winding connection of star delta starter is to be changed. It will start counting time after main contactor is energized. Rung 3 Delta contactor: Delta contactor will be energized when main contactor (Q1) is energized, timer T1 is activated and star contactor (Q3) is de-energized. Also see Programing of push button and other requirements for simple motor starter is explained in PLC Tutorial: Motor starter Note : This post for educational or reference purpose only. For a live circuit, there will be some additions to the above circuit like safety related, as per application, some interlocks etc. -
PLC Program for Motor Starter
leizuofa posted A plc and hmi english article in PLC programming learning
PLC tutorial explaining step by step procedure to program PLC for motor starter. Motor starters are of many types however the scope of this PLC tutorial is confined to simple motor starter. It should have the following provisions. Push button to start the motor : The motor should continue to rotate even when the push button is released. Stop Push button to halt the motor after it started. Over current protection : In case of over load, the motor should stop automatically by the signal coming from contactors of overload relay. Limit switch : It should prevent the motor from starting and can also stop the running motor. The motor starter should also have indicator (Lights) to show ON or OFF status of motor. Motor Electrical Schematic : The above figure shows the physical layout of motor starter however this would be designed through ladder logic in this PLC tutorial. Above figure does not show limit switch because it depends on external interlock like say level switch, flow switch, pressure switch etc… depending on application. if interlock not required then simply remove the symbol from the diagram and connect with simple wire. Ladder diagram for Motor starter : Following figure shows the ladder diagram for motor starter. Start Button I1 : Normally open contact (Make contact) is used because the motor should only start when the button is pressed. Stop Button I2 : Normally close (break contact) contact is used because the button should normally be closed or high so that the motor keeps on running. It should open when the button is pressed. It is opposite to start push button. Overload relay I3 : In normal condition, this relay should allow the motor to rotate so normally close contact is selected for it. In case of overload it will stop the motor by opening its contact. Limit switch I4 : The motor should only rotate when the limit switch is closed therefore normally open contact is used. Output Q1, Q2, Q3 : Relay coil Q1, Q2 and Q3 represent motor output, motor indication ON and indication OFF respectively. ON indicator gets input from normally open input which depends upon output Q1. OFF indicator is fed by normally close input which depends upon output Q2. Input Q1 ( for continuous rotation): Since it is required that once push button is pressed, motor should run continuously even if the push button is released. To achieve this part, an input Q1 (normally open) is used and connected in parallel with I1. This input depends upon output Q1. When output is high, input Q1 is also high. Since input Q1 provides parallel path with I1, so if any of them is to be high, motor will run (if other conditions are also satisfied). Start button (Normally open), stop button (Normally close), overload relay (Normally close) and limit switch (Normally open) are connected in series. So motor will run if start button is pushed, stop button is not pressed, overload relay is not picked and limit switch is closed. Note : This post for educational or reference purpose only. For a live circuit, there will be some additions to the above circuit like safety related, as per application, some interlocks etc. -
PLC Program for Mixing Tank
leizuofa posted A plc and hmi english article in PLC programming learning
Create a ladder diagram for controlling a batch mixing process. Implement a PLC program for the mixing tank or Mixing Process using PLC Ladder Logic. PLC Program for Mixing Tank Fig : Mixing tank A tank is used to mix two liquids. The required control circuit operates as follows: A. When the START button is pressed, solenoids A and B energize. This permits the two liquids to begin filling the tank. B. When the tank is filled, the float switch trips. This de-energizes solenoids A and B and starts the motor used to mix the liquids together. C. The motor is permitted to run for 1 minute. After 1 minute has elapsed, the motor turns off and solenoid C energizes to drain the tank. D. When the tank is empty, the float switch de- energizes solenoid C. E. A STOP button can be used to stop the process at any point. F. If the motor becomes overloaded, the action of the entire circuit will stop. G. Once the circuit has been energized, it will continue to operate until it is manually stopped. PLC Logic Solution A relay schematic that will perform the logic of this circuit is shown in Below Figure. The logic of this circuit is as follows: Fig : Relay Schematic A. When the START button is pushed, relay coil CR is energized. This causes all CR contacts to close. Contact CR-1 is a holding contact used to maintain the circuit to coil CR when the START button is released. B. When contact CR-2 closes, a circuit is completed to solenoid coils A and B. This permits the two liquids that are to be mixed together to begin filling the tank. C. As the tank fills, the float rises until the float switch is tripped. This causes the normally closed float switch contact to open and the normally open con- tact to close. D. When the normally closed float switch opens, solenoid coils A and B de-energize and stop the flow of the two liquids into the tank. E. When the normally open contact closes, a circuit is completed to the coil of a motor starter and the coil of an on-delay timer. The motor is used to mix the two liquids together. F. At the end of the one minute time period, all of the TR contacts change position. The normally closed TR-2 contact connected in series with the motor starter coil opens and stops the operation of the motor. Normally open TR-3 contact closes and energizes solenoid coil C which permits liquid to begin draining from the tank. The normally closed TR-1 contact is used to assure that valves A and B cannot be re-energized until solenoid C de-energizes. G. As liquid drains from the tank, the float drops. When the float drops far enough, the float switch trips and its contacts return to their normal positions. When the normally open float switch contact reopens and de-energizes coil TR, all TR contacts return to their normal positions. H. When the normally open TR-3 contact reopens, solenoid C de-energizes and closes the drain valve. Contact TR-2 recloses, but the motor cannot restart because of the normally open float switch contact. When contact TR-1 re-closes, a circuit is completed to solenoids A and B. This permits the tank to begin refilling, and the process starts over again. I. If the STOP button or overload contact opens, coil CR de-energizes and all CR contacts open. This de- energizes the entire circuit. Note : The PLC Program also will be very much similar to the above relay schematic. Assignment For You Analyse the below animation and share the circuit operation through comments. -
PLC controls pneumatic circuit
leizuofa posted A plc and hmi english article in PLC programming learning
Here we discuss about PLC Pneumatic Circuit Control with different examples. PLC ladder diagram for single-acting and double-acting pneumatic cylinders. PLC Pneumatic Circuit Examples Example 1 : A double-acting cylinder is used to perform machinng operation. Pneumatic cylinder is advanced by pressing two push buttons simultaneously. If any one of the push button is released, cylinder comes back to start position. Draw the pneumatic circuit, PLC wiring diagram and ladder diagram to implement this task. Solution : As shown in the PLC wiring diaram, The push buttons PB1 and PB2 are connected at memory address I1 and I2. I1 and I2 are connected in series in ladder diagram to realize this AND logic function. When the push buttons PB1 and PB2 are pressed simultaneously, the addresses I1 and I 2 turn to state 1 from state 0 , as a result power flows through the coil and there will be output at coil 01. Output at the coil 01 operated the solenoid coil and cylinder moves forward to do the required operation. If any one of PB1 and PB2 is pressed, then corresponding bit addresses turns to 0, since I1 and I2 are in series , if any of them turns to 0 state , there will not be any output at 01 and thus solenoid is de-energised and returns back. Example 2 : Double acting cylinder is used to perform forward and return motion. Pneumatic cylinder is advanced by pressing push buttons PB1. Cylinder is returned by pressing push button PB2. Draw the pneumatic circuit, PLC wiring diagram and ladder diagram to implement this task. Solution PLC Wiring diagram and Ladder diagrams are shown in above Figure. when the push button PB1 is pressed state of the address I1 turns to 1 and thus there will be output 01. The output of 01 operates the solenoid Y1 and cylinder moves forward, When the cylinder reaches the extreme forward position, and Push button PB2 is operated , the state of address I2 turns to 1 and thus there will be output 02. The output of 02 operates the solenoid Y2 and cylinder return back to initial position. Example 3 : Double acting cylinder is used to perform forward and return automatically after reaching the extreme forward position. Pneumatic cylinder is advanced by pressing push buttons PB1. Draw the pneumatic circuit, PLC wiring diagram and ladder diagram to implement this task. Solution PLC Wiring diagram and Ladder diagrams are shown in above Figure. when the pushbutton PB1 is pressed state of the address I1 turns to 1 and thus there will be output 01. The output of 01 operates the solenoid Y1 and cylinder moves forward. When the cylinder reaches the extreme forward position, and Limit switch S2 is operated , the state of address I3 turns to 1 and thus there will be output 02. The output of 02 operates the solenoid Y2 and cylinder return back to initial position. Example 4 : Double acting cylinder is used to perform pressing operation. Cylinder has to move forward when PB1 button is pressed and return for set time of 20 seconds before it automatically returns to intial position. Limit switch S2 is used for end sensing of the forward motion of the cylinder. Draw the pneumatic circuit, PLC wiring diagram and ladder diagram to implement this task. Solution When PB1 is pressed, address I1 input state goes to 1 and there is an output at O1. Due to output at O1, the solenoid coil Y1 is operated and cylinder moves forward. When cylinder reaches end position, limit switch S2 is operated and as a result address I3 changes to 1 and consequently starts the timer T1. The signal state of timer T1 changes to 1 after 20 seconds is reached. At the end of 20 seconds there will be output from Timer T1 set output O2. Coil Y2 is energised thus causing the return motion of the cylinder. Example 5 : Double acting cylinder is used to perform continuous to and fro motion. Cylinder has to move forward when PB1 button is pressed and once to and fro reciprocation starts it should continue till stop button PB2 is pressed. Limit swithces are used for end position sensing. Draw the pneumatic circuit, PLC wiring diagram and ladder diagram to implement this task. Solution : The start and stop operations can be implemented using memory flag with address M1 that is set by PB1 and reset by PB2. The state of the memory element M1 is scanned through an NO contact, is combined in series with the state of sensor S1 to get start and stop controls. Example 6 : Double acting cylinder is used to perform to and fro operation. Cylinder has to move forward when PB1 button is pressed and continue to and fro motion till 10 cycles of operations is performed. Draw the pneumatic circuit, PLC wiring diagram and ladder diagram to implement this task. Solution The fully automatic operation of cylinder can be obtained as earlier using limit switch S1 and S2. Start and stop operation can be implemented using memory flag with address M1 that is set by PB1 at I1 and reset by NC contact of a down counter. The state of memory flag M1 scanned through an NO contact (rung 2) is combined in series with the state sensor S1 to get start and stop controls. Example 7 : Draw the pneumatic circuit, PLC wiring diagram and ladder diagram to implement A+B+B-A- sequence. Solution In this sequence circuit, PB2 is used to initiate the program. Pressing PB2 causes the last memory state M4 to set and all other memory flags M1, M2 and M3 to reset. Initially S1 and S3 are actuated and generate outputs. Condition 1: Pressing PB1 sets Memory flag M1 and resets Memory flag M4. Solenoid Y1 is energised. Cylinder A extends (A+). Sensor S1 is deactivated once A travels and S2 is activated when end position is reached. Condition 2: When S2 is actuated, memory M2 is set and Memory flag M1 is reset. Solenoid Y3 is energised. Cylinder B extends (B+). Sensor S3 is deactivated once B travels and S4 is activated when end position is reached. Condition 3: When S4 is actuated, memory M3 is set and Memory flag M2 is reset. Solenoid Y4 is energised. Cylinder B retracts (B-). Sensor S4 is deactivated once B travels and S3 is activated when initial position is reached. Condition 4: When S3 is actuated, memory M4 is set and Memory flag M3 is reset. Solenoid Y2 is energised. Cylinder A retracts (A-). Sensor S2 is deactivated once B travels and S1 is activated when initial position is reached. -
An Allen-Bradley SLC500 programmable logic controller (PLC) uses a 16-bit analog-to-digital converter ( in its model 1746-NI4 ) in analog input card to convert 4-20 mA signals into digital number values ranging from 3277 (at 4 mA) to 16384 (at 20 mA). However, these raw numbers from the PLC’s analog card must be mathematically scaled inside the PLC to represent real-world units of measurement, in this case 0 to 700 GPM of flow. PLC Analog Input Scaling Formulate a scaling equation to program into the PLC so that 4 mA of current registers as 0 GPM, and 20 mA of current registers as 700 GPM. We are already given the raw number values from the analog card’s analog-to-digital converter (ADC) circuit for 4 mA and 20 mA: 3277 and 16384, respectively. These values define the domain of our linear graph: Calculating and substituting the slope (m) value for this equation, using the full rise-over-run of the linear function: This type of scaling calculation is so common in PLC applications that Allen-Bradley has provided a special SCL (“scale”) instruction just for this purpose. Instead of “slope” (m) and “intercept” (b), the instruction prompts the human programmer to enter “rate” and “offset” values, respectively. Furthermore, the rate in Allen-Bradley’s SCL instruction is expressed as the numerator of a fraction where the denominator is fixed at 10000, allowing fractional (less than one) slope values to be specified using integer numbers. Aside from these details, the concept is exactly the same. Expressing our slope of 700/13107 as a fraction with 10000 as the denominator is a simple matter of solving for the numerator using cross-multiplication and division: Thus, the SCL instruction would be configured as follows
-
How a PLC do the Scaling for a Sensor ?
leizuofa posted A plc and hmi english article in PLC programming learning
I am always surprised how an automation system like PLC or DCS does the scaling for a sensor ? or even sometimes thinking about a simple field transmitter scaling techniques for converting any type of sensor output into standard 4-20mA. For example, consider a Temperature Transmitter and we all know by using a simple formula we can calculate the equivalent temperature from the RTD sensor output resistance And in the case of a thermocouple, a complex algorithm is required for converting its output millivolt into equivalent temperature. So now the Question is How a PLC or DCS or Transmitter does the Scaling? Let us discuss in detail about scaling. How a PLC do the Scaling for a Sensor ? Scaling is the process of taking a signal such as a process variable, voltage or current output from a sensor and applying calculations to present this signal in a more usable form in terms of engineering units, such as PSI, °F or %RH to the operator in the control room. There are three common techniques used in the data acquisition world including linear scaling, mapped scaling and formula scaling. All three methods have their place and time for use and will be described in this article. Scaling Techniques There are three techniques for scaling that we are going to cover here in this article: linear, mapping and formula. These three techniques overlap a little bit as we will explain, but they are the primary methods used in the world of data acquisition. Just to give a quick overview of these three methods and what they are best utilized for, we’ve put together a table below. In certain instances where formula-based scaling is not available, mapping can sometimes be used to predefine a table based on the formula needed and vice versa. It is also worth noting that when working with a sensor that has an analog output, the units specified for that sensor are not set in stone. For example if your sensor has a 4 to 20mA output for a range of -40 to 100°C, it would be just as easy to scale the output into Fahrenheit by saying that the unit has a range of -40 to 212°F. We’ll touch more on this in the next section. Linear Scaling The technique of linear scaling should remind you a few your days back in basic algebra. It uses the old slope-intercept form ‘y = mx + b’ where y is your output (also known as engineering units value), x is your input (whether it be voltages, milliamps, etc.), m is your slope (also known as scale factor), and b is your y-intercept (also known as offset). As previously stated, linear scaling works best with linear voltage or current outputs in which the minimum and maximum outputs represent specific values along with the sensors range. If you’re a bit rusty, have no fear, we’ll give you a couple of examples to freshen things up. Example 1 Let’s consider the level Transmitter with a 0 to 100 ft WC range and 0 to 10V DC output. These specifications tell us two things: An output of 0V represents a measurement of 0ftWC and An output of 10V represents a measurement of 100ftWC. It’s best to start with your scale factor, or m in the equation. The factor m can be solved by using the slope formula m = (y2-y1) / (x2-x1)’ and choosing two points along the linear scale. After the scale factor has been determined, we simply plug the value m back into the slope-intercept formula and use one of our points to calculate our offset. We will use the two points (0, 0) and (10, 100) to calculate the scale factor or m. m = (y2-y1) / (x2-x1) = (100 – 0) / (10 – 0) = 100 / 10 Therefore m = 10 Now we will use the slope-intercept formula and the point (0, 0) to calculate the offset or b. y = mx + b, where y = 0, x = 0, m = 10, and b is unknown. 0 = 10(0) + b = 0 + b Therefore b = 0 It’s always a good idea to verify that your scale factor and offset are right by plugging our second point into our completed equation, which in this case is (10, 100). y = mx + b, where y = 100, x = 10, m = 10, and b = 0. 100 = 10(10) + 0 = 100 Given that this arithmetical operation is valid, we have verified that our scale factor and offset are correct. Example 2 Considering that the 0 to 10V example is fairly simple, let’s move on to something more challenging like a 4 to 20mA output. We will still use the level Transmitter with a 0 to 100ftWC range, but this time we’ll use a 4 to 20mA output. These specifications again tell us two things: An output of 4mA represents a measurement of 0ftWC and An output of 20mA represents a measurement of 100ftWC. We will go about this example, in the same manner, we did the last one by first finding the scale factor and then plugging in a few numbers to calculate the offset. We will use the two points (4, 0) and (20, 100) to calculate the scale factor or m. m = (y2-y1) / (x2-x1) = (100 – 0) / (20 – 4) = 100 / 16 Therefore m = 6.25 Now we will use the slope-intercept formula and the point (4, 0) to calculate the offset or b. y = mx + b, where y = 0, x = 4, m = 6.25, and b is unknown. 0 = 6.25(4) + b = 25 + b Therefore b = -25 It’s always a good idea to verify that your scale factor and offset are right by plugging our second point into our completed equation, which in this case is (20, 100). y = mx + b, where y = 100, x = 20, m = 6.25, and b = -25. 100 = 6.25(20) + (-25) = 100 Given that this arithmetical operation is valid, we have verified that our scale factor and offset are correct. Mapped Scaling The technique of mapped scaling often built-in and preprogrammed for inputs like thermocouples, Pt100/1000’s, and other resistive temperature sensors. For example, when you configure your data acquisition system to measure a type K thermocouple, the system already knows what thermocouple millivolt output corresponds to what temperature. This example does not apply only to type K thermocouples, but any type of commonly used resistive temperature sensor or other related sensors. However, there are some instances in which we would need to create our own mapping table. One of these instances would be when we are working with a data acquisition system that is not preconfigured for use with resistive temperature sensors. This is not a very common situation that we run into, but it is worth mentioning. The other instance would be when we have a non-linear function and formula-based scaling is not available or is a piecewise function. A good example of this would be when we are using a level sensor to calculate tank volume in a non-linear tank. Typically when we want to know what the volume of a fluid in a tank is we measure the depth or level of the tank. By knowing this, we can calculate the volume of the fluid. If the tank had a flat bottom and was the same diameter along with its height then this calculation would be simple, and we could use linear scaling like above. However, typically these tanks are rounded and the level of the fluid does not directly correlate to the volume of fluid. In this situation, we must use mapped scaling and a little bit of math to attain our desired result. For our example we will use a horizontal cylinder tank with a diameter of 5 ft. and a length of 10 ft. There are a number of complicated trigonometric formulas used to determine the filled volume of a tank like this that we’re going to skip over as they are too complex for the scope of this article. Instead, we will do the calculations and show you the value mapping table. Also, for this example, we will be using the level Transmitter again, but this time a 0 to 10V DC output and 0 to 5 ft WC range. If this is the mapping table programmed into your data acquisition system then the volume will be calculated rather than simply measuring the depth. Typically the more points in your table the more accurate the calculations will turn out to be. To demonstrate this concept, let’s use an 1V output signal as an example. An output of 1V would tell us that there is a 0.5 ft. depth in the tank. This calculates out to be approximately 76 gallons. 1V falls between 0V and 2V on our table, so the data acquisition system will set up a linear scale between those two points and will say that a 1V output is 104.5 gallons, which is nearly 30 gallons off! Formula Scaling This technique has the potential to be one of the most powerful scaling methods, however, it is often a resource hog and most data acquisition systems storing data at high rates cannot keep up with this process. For data acquisition systems that cannot perform formula scaling there are two alternatives: Storing raw values and applying the required formulas to the data after the data has been saved from the data acquisition system. This can typically be done in a piece of software such as Microsoft Excel. Using a programmable signal calculator. This type of device can be configured to process multiple inputs via a user-defined formula and provide a linear output. There are numerous potential uses for formula scaling. We will cover two possible scenarios for this technique: vertical cylinder tank volume and differential pressure. Example 1 For a vertical cylinder tank, the fill volume can be calculated by the formula ‘V = π r2 f ‘ where V is the volume filled, r is the radius of the tank, and f is the fill height. Let’s say that our tank has a diameter of 5 ft. and a height of 10 ft. Again, let’s use the level Transmitter for our example with a 0 to 10 ft WC range and 0 to 5V DC output. The level Transmitter is giving us our fill height or f. From this fill height, we can directly calculate the fill volume or V. We will be using some of the same methods for linear scaling to get our f and applying the calculations on top of that. We will first calculate the linear scaling for the fill height or f. I’m going to skip a few steps since we covered this in the first section. y = f = 2x, where x is the voltage output of the sensor. Now we can replace the f in the vertical cylinder tank formula with 2x. V = π r2 f = π (2.5)2 (2x) = π 12.5x Example 2 The second scenario that we are going to use to explain the technique of formula scaling is differential pressure. There are obviously a number of differential pressure sensors out there that give a linear output, but from experience, I can tell you that there is are a lot of uses for this method of calculating differential pressure. In this example, we will use two of the transmitters with a 0 to 100 PSI range and 0 to 10 V DC output. One will be placed inside a pressurized vessel submerged below water and the other will be placed outside of this vessel. The differential pressure will determine the amount of force that is being exerted on the walls of the vessel. The calculations here are very simple. Simply subtract one from the other. Pdifferential = Pexternal – Pinternal Conclusion There three most commonly used techniques for scaling sensor outputs are Linear scaling, Mapped scaling and Formula scaling. PLC Shift Register As you can see, there are many instances in which more than one of these techniques can work and the best choice usually depends on the hardware/software that you’re working with. Linear scaling is the easiest to work with, however, sensors with linear outputs tend to be more expensive as additional hardware is required to linearize the raw output from the transducer. Mapped scaling is used more often than we tend to even notice. Any time a resistive temperature sensor is giving you a temperature reading, mapped scaling is at work somewhere along the line. Formula scaling is very powerful but requires hardware/software configurations. -
PLC control motor ladder logic programming
leizuofa posted A plc and hmi english article in PLC programming learning
Now we are discussing about How a PLC Motor Control ?. Before going into the article, let us assume some conditions here. A PLC has to start a Motor when the Start button is pressed. It has three interlocks which are Motor Vibration High, Overload & Motor Temperature High. if any of the interlock activated then PLC has to stop the motor immediately. PLC has to stop the motor if the stop button is pressed. PLC trip logic or interlock has to be enable only when motor is in Remote mode. PLC Motor Control In above figure : Red LED indicator lights on the input and output cards of the PLC indicate if those respective I/O channels are energized. Note : In above figure, Local Control Panel signals are not shown. Local control panel is connected to motor feeder directly. 24v DC power directly connected ( in general fuses or barriers will be used, power will be distributed through bus bar) PLC Inputs Start push button Stop push button Vibration High Temperature High Overload Trip Run feedback Local/Remote status PLC Outputs Start Command (Remote Start) Stop Command (Remote Stop) Start Permissive ( Optional) The motor is a three phase, 415V AC powered device. So by default high voltage equipment will be powered from substations or motor control centers (MCC) which are maintained by electrical. So we consider this motor is connected to a simple motor feeder in the substation. Generally the motor feeder have inputs from field (local control panel) & PLC also. Which are shown in below figure. Note : the motor feeder may have start, stop, some other trips indications like overload etc… in the motor feeder panel which are not shown in the fig. These are mounted on the motor feeder panel (in addition to LCP). If motor feeder receives start & stop command inputs from PLC then we call them as Remote Start & Remote Stop signals. Similarly if motor feeder receives start & stop command inputs from local control panel (LCP) which is installed in field (near to motor) then we call them as Local Start & Local Stop signals. In common practice, this LCP has emergency stop & Local/Remote selection switch also. The motor feeder also sends a Local/Remote status to PLC. If Local/Remote selection switch is in Local mode then motor feeder will only consider signals from LCP and ignore the commands from PLC. Similarly if Local/Remote Selection switch in Remote Mode then motor feeder will consider signals from Remote i.e. PLC and ignore the signals from LCP. For example : if Local/Remote selection Switch in Remote Mode. If field operator pressed the start push button from the field LCP then motor will not be started as the selection is in remote mode. Depends on the Local/Remote selection switch status the motor feeder will decides which signals to be consider i.e. either PLC or LCP signals. Note : Local/Remote Selection will not be applied for Emergency Stop or Stop Commands either from PLC or LCP. Whatever mode it is, the Stop commands will be accepted by motor feeder and stops the motor immediately. This is a safety concern. Lets see how a PLC controls a motor. Now Local/Remote selection switch is in Remote mode. Here we are sending an Permissive signal ( Start Permissive) to the motor feeder. For starting the motor, the permissive must be healthy otherwise motor feeder will be de-energized or will not start the motor. In PLC, Start permissive will be used as a extra safety & for checking the interlock status. if all the interlocks are healthy then only permissive signal will be sent to motor feeder. Generally we call this as “Start Permissive”, as name implies it is only required for starting the motor, after motor started the status of this permissive signal will not be considered by motor feeder (Only required for starting the motor). This is an optional signal. For High capacity motors, start permissive signals will be used. For normal or low capacity motors these are very rarely used, again depends on our applications, industry, requirements etc. Lets say all interlocks are healthy, so PLC sends the permissive signal to motor feeder. Now start push button is pressed. First PLC checks the Local/Remote status, if it is in Remote then proceeds further. Again it checks for any active trips/interlocks. If there is no interlock or all working normal, then PLC sends a start command to substation where motor feeder is installed. In this example we have three interlocks: Motor Vibration High, Motor Temperature High & Overload trip. In generally High capacity motors are equipped with Vibration sensors & temperature sensors. In our example we consider vibration signals as fail safe, so default status is normally closed, if high vibration appears then the contact become Normally Open & PLC trips/stops the motor. We have another interlock which is Overload trip, this input is taken from the motor feeder. The temperature sensors signal is normally open and when temperature high then it becomes normally close and PLC trips/Stops the motor. Note: Fail safe or default contact status either NC or NO are depends on our application or logic requirements. Here we are only discussing an example for understanding the concept. After receiving the start command from the PLC, motor feeder will be energized and power up the motor. After motor started, the motor feeder will send the Run feedback to the PLC. The run feedback will be displayed on the graphics. In some PLC’s or in safety PLC’s if the Run feedback is not received in specified time frame ( say within 5 seconds) then PLC automatically sends an Stop signals to the motor feeder. This is a optional feature in normal PLC applications( must in safety PLC’s). Say now Vibration High came, then PLC sends a stop command to motor feeder and it immediately stops the motor. The run feedback status also updates accordingly. Motor will be started when Level Transmitter will be High & again it will stopped at Level Transmitter Low Abbreviations : MCC : Motor Control Center or Substation where motor will be powered. PLC/DCS : Control System, where Motor can be controlled as per logic (Auto) or as per operator action (Manual). LCP : Local Control Panel which is installed in the field, near motor in which start, stop push buttons are available -
PLC ladder logic programming to control valves
leizuofa posted A plc and hmi english article in PLC programming learning
Objective : To understand the basic concept of PLC Valve Control Ladder Logic. Target Users : Students, Technicians, Freshers, Trainee engineers. Note : Barrier or Relay not shown in above figure. Lets list out the required PLC digital inputs and digital output signals : PLC Digital Inputs : Valve Open Feedback Valve Close Feedback PLC Digital output : Valve Energize command PLC Valve Control Ladder Logic Programming Any pneumatic valve requires instrument air supply for its operation. A air filter regulator is used to remove any liquid or particulate matter present in the instrument air supply and to set the required air supply to the valve. The output of air filter regulator is connected to valve actuator via a Solenoid valve. This solenoid valve is used to control i.e. ON/OFF the instrument air supply to the valve actuator. Consider solenoid valve (SOV) is Normally Close (NC) type. In normal position, the SOV is in off position or de-energized state, so the instrument air supply will be blocked as SOV is Normally closed. if SOV is energized i.e. PLC sends the signal then SOV energizes and becomes normally open (NO), so allows instrument air supply through its. Some people often confuses about Solenoid valve and Valve actuator. These both are different, SOV controls (ON/OFF) the instrument air supply and Valve actuator controls the position of the valve either fully open or fully close. ON/OFF valve are equipped with either proximity switches or limit switches to sense the valve position either fully open or fully close. so these are connected to the PLC digital inputs. So PLC can know the valve status in the field either fully open or fully close and displays to the operator via graphics. Consider our ON/OFF valve is Normally Open type i.e. valve is in Open position. so by default Open Feedback will be sent to the PLC or we can say Open feedback limit switch or proximity switch will be energized and close feedback switch is in de-energize state. Lets say PLC sends an Digital output command to the ON/OFF valve (via a barrier or a relay). Say we have 24V DC powered solenoid valve mounted on the ON/OFF valve. Generally either a barrier or a relay is placed after the PLC digital output module. consider we have a barrier, first barrier receives the PLC digital output module command (PLC command is Barrier input) then the barrier energizes its output (Barrier output) and barrier sends the 24V DC power to the respective ON/OFF valve. The purpose of barrier or relay is used to isolate the PLC & Field signals or for safety purpose or to amplify the power/voltage signals. Now ON/OFF valve receives the PLC command i.e. it received the 24V DC power to the solenoid valve from the barrier. so now solenoid valve will be energized and changes to Normally Open (NC) state. Now solenoid valve passes the instrument air supply to the valve actuator as it becomes Normally open. The valve actuator receives the instrument air supply and moves the valve stem accordingly and the valve position will change from fully open state to full close state. When the ON/OFF valve starts the stem movement then immediately Open Feedback will be gone (proximity switch will not detect any object mounted on the stem). After starts valve stem movement and before reaching close position, both open & close feedbacks will not be available to the PLC and we call this as transition state. After the ON/OFF valve fully closed then close feedback switch (proximity or limit) will be energized and close feedback signal will be sent to the PLC and displayed to the operator. Note : Sometimes ON/OFF valve may stuck in between, so operator will not receive any feedback on the graphics, as both open & close feedback switches will only detect either fully open or fully close states of the valve. Its not possible to detect any Intermediate state of the valve. Say now PLC withdraws the Output command to the ON/OFF valve i.e. barrier input will be turned off, so barrier will de-energized or barrier output will be OFF, 24V DC power will be disconnected/removed to the Solenoid valve. As solenoid valve power removed, SOV changes its state from NO to NC. Solenoid valve becomes Normally Closed i.e. Instrument air supply to the valve actuator will be stopped or disconnected. So ON/OFF valve also comes into its original state i.e. Open state. PLC can send output command signal based on some logics or real time input signals. for example : if level of a drum reaches high alarm then drum feed ON/OFF valve has to be closed. Details of ON/OFF Valve : In our example we considered a pneumatic on/off valve. First we see the list of components in the valve & its purpose. a. Air Filter Regulator : Air Filters are used to remove liquid water and particulate matter from compressed air sources. These are ‘mechanical filters’ and do not remove oil vapors or chemical contaminants in vapor form. Click here for Principle & Animation. b. Solenoid Valve : A solenoid valve is an electro-mechanical controlled valve. The valve features a solenoid, which is an electric coil with a movable ferromagnetic core in its center. This core is called the plunger. In rest position, the plunger closes off a small orifice. An electric current through the coil creates a magnetic field. The magnetic field exerts a force on the plunger. As a result, the plunger is pulled toward the center of the coil so that the orifice opens. This is the basic principle that is used to open and close solenoid valves. Solenoid Valve Animation Solenoid valve Types & Principles c. Open Feedback & Close Feedback : A proximity switch is one detecting the proximity (closeness) of some object. By definition, these switches are non-contact sensors, using capacitive, inductive, magnetic, electric, or optical means to sense the proximity of the valve position either open or close. d. Valve Actuator : A valve actuator is a device that produces force to open or close the valve utilizing a power source. This source of power can be manual (hand, gear, chain-wheel, lever, etc.) or can be electric, hydraulic or pneumatic. e. Instrument Air Supply : Compressed & Dried air supply for the valve. -
How PLC Reads the Data from Field Transmitters
leizuofa posted A plc and hmi english article in PLC programming learning
Instrumentation and control rely on converting physical or process variables into a more useful format for the operator display. Pressure in a pipe is converted to mechanical deflection of a diaphragm, which is converted to electrical energy by a strain gauge (the diaphragm and strain gauge constitute a transducer), then to a numeric integer value by an I/O module, and then to a floating point engineering unit value by the PLC or HMI for display. This information is also used to help generate output commands, which are converted into electrical signals and then to mechanical action. The trick is to understand the I/O relationships of the various converters. How PLC Reads the Data from Field Transmitters For example, a flow orifice will cause a predictable pressure drop as fluids flow across it. A pressure transmitter can measure this pressure drop by comparing the upstream pressure to the downstream pressure. Though this pressure differential is not linear with flow rate, it has a repeatable relationship to it. This relationship is best approximated as a square-root function. Taking the square root of the differential pressure signal effectively linearizes it with the flow rate. After a linear relationship has been established, the entire conversion sequence from transmitter to computer display can be deduced from one measurement. The below Figure depicts two typical temperature measurement circuits as follows: The top configuration uses the external power supply of the transmitter to power the signal loop. This configuration is referred to as a four-wire loop. The bottom configuration uses an internal power supply (AI card Power) to power the loop. This configuration is referred to as a two-wire loop. The following discussion about unit conversions applies to both circuit types. Focus on the top circuit. A thermocouple is the sensing element. Thermocouples are devices that use the principle of bimetallic contact to generate a small millivolt signal. Note that the temperature-voltage curve presented in the chart is relatively linear throughout the temperature interval. Outside of that temperature interval, the signal can become less linear (a characteristic of a thermocouple), but that is of no importance here. Instrument scaling must always begin at the process measurement. The designer consults the heat and material balance (HMB) sheet for our imaginary system and finds the expected temperature at the measurement point is approximately 105°C. The upstream heater is capable of heating the system to approximately 130°C before it shuts down due to its over-temperature interlock. The design engineer knows a properly calibrated span would place the normal operating point at about the middle of the curve. The upper end would need to be above 130°C. After some thought, the engineer decides on a calibrated span of 15 to 150°C and chooses a type K thermocouple, which provides an output of 0.597 to 6.138 mV over that temperature interval. The temperature transmitter, then, must be bench calibrated to provide a 4 -20 mA output signal that is proportional to the 0.597 to 6.138 mV input signal expected from the thermocouple. The transmitter, being a current source (as opposed to a voltage source), varies its power output as necessary to maintain a steady milliamp output that is proportional to the millivolts on its input i.e. measured temperature reading. (Note: A voltage source, such as a battery, tries to maintain a constant voltage regardless of load, while a current source tries to maintain a constant current regardless of load). The temperature transmitter then converts this signal into a 4–-20 mA signal that has been scaled, in this case for a span of 15 to –150°C. The PLC has an analog input module that detects the output of the temperature transmitter. Virtually all analog input modules are voltmeters, even though they are listed as milliamp inputs. Sometimes the resistor is external on the terminal strip, and sometimes it is internal on the PLC I/O module (shown in Figure). In either case, the 4-–20 mA signal will be converted to a voltage. Typically, this voltage is 1-–5 VDC because the resistor used is 250 ohms. This analog value must then be converted to a binary value. In our example, the PLC specification lists this particular PLC I/O module as having 12-bit resolution. To find the resolution of the module in terms of the process variable, perform a binary conversion: 212 = 4095. So, for an input span of 1-–5 VDC, the PLC I/O module provides an integer value to the PLC program that ranges from 0 to 4095. The PLC program may fetch this data to use as needed. One of the possible actions of the PLC program is to move this data value into a network interface buffer (a series of contiguous locations in PLC memory) for transmittal upstream to the HMI. The raw-count integer value is then made available for data transmittal across the network. The HMI receives this transmitted data stream, which is then stored in an input data buffer. The HMI computer has a tag-file database, which contains instructions about how to manipulate each data item for presentation to the operator. Many of the tags in the tag file are linked to data items in the input data buffer. One such tag is linked to this particular location. The 0 to 4095 raw value is extracted and converted to engineering units by use of the formula embedded in either the tag-file database or the graphic screen software that uses the information. The formula in our sample case is shown in Below Figure. The value produced (85.88) would be the value displayed to the operator in oC as follows in Below Figures: -
Here, we will emulate the exact same high-pressure alarm circuit using an Allen-Bradley MicroLogix 1000 PLC instead of a relay coil: PLC Logic Example Ladder-logic Program Suppose a fluid pressure of 36 PSI is applied to the pressure switch. This is less than the switch’s trip setting of 50 PSI, leaving the switch in its “normal” (closed) state. This sends power to input I:0/2 of the PLC. The contact labeled I:0/2 drawn in the ladder-logic program of the PLC acts like a relay contact driven by a coil energized by input terminal I:0/2. Thus, the closed pressure switch contact energizes input terminal I:0/2, which in turn “closes” the normally-open contact symbol I:0/2 drawn in the ladder-logic program. This “virtual” contact sends virtual power to a virtual coil labeled B3:0/0, which is nothing more than a single bit of data in the PLC’s microprocessor memory. “Energizing” this virtual coil has the effect of “actuating” any contact drawn in the program bearing the same label. This means the normally-closed contact B3:0/0 will now be “actuated” and thus in the open state, not sending virtual power to the output coil O:0/1. With virtual coil O:0/1 “unpowered,” the real-life output O:0/1 on the PLC will be electrically open, and the alarm lamp will be unpowered (off). If we suppose a fluid pressure of 61 PSI be applied to the pressure switch, the normally-closed pressure switch contact will be actuated (forced) into the open state. This will have the effect of de-energizing PLC input I:0/2, thus “opening” the normally-open virtual contact in the PLC program bearing the same label. This “open” virtual contact interrupts virtual power to the virtual coil B3:0/0, causing the normally-closed virtual contact B3:0/0 to “close,” sending virtual power to virtual coil O:0/1. When this virtual output coil “energizes,” the real-life output channel of the PLC activates, sending real power to the alarm light to turn it on, signaling a high-pressure alarm condition. We may simplify this PLC program further by eliminating the virtual control relay B3:0/0 and simply having input I:0/2 activate output O:0/1 through a “normally-closed” virtual contact: The effect is the same: the PLC output O:0/1 will activate whenever input I:0/2 de-energizes (whenever the pressure switch is opened by a high pressure), turning on the alarm lamp in a high-pressure condition. In a low-pressure condition, the energized input I:0/2 forces the virtual normally-closed contact I:0/2 to open, thus de-energizing the PLC’s output O:0/1 and turning the alarm lamp off. Programmable Logic Controllers have not only greatly simplified the wiring of industrial logic controls by replacing multitudes of electromechanical relays with a microprocessor, but they have also added advanced capabilities such as counters, timers, sequencers, mathematical functions, communications, and of course the ability to easily modify the control logic through programming rather than by re-wiring relays. The beauty of ladder-logic programming is that it translates the technician’s understanding of traditional relay control circuits into a virtual form where contacts and coils interact to perform practical control functions. A key concept to master, however, is the association of real-life conditions to switch status based on the “normal” representation of those switch contacts, whether the switches be real (relay) or virtual (PLC). Once this vital concept is mastered, both hard-wired relay control circuits and PLC programs become possible to understand. Without mastering this vital concept, neither relay control circuits nor PLC programs may be understood.
-
A timer is a PLC instruction measuring the amount of time elapsed following an event. Timer instructions come in two basic types: on-delay timers and off-delay timers. Both “on-delay” and “off-delay” timer instructions have single inputs triggering the timed function. An “on-delay” timer activates an output only when the input has been active for a minimum amount of time. PLC Timer Instructions Take for instance this PLC program, designed to sound an audio alarm siren prior to starting a conveyor belt. To start the conveyor belt motor, the operator must press and hold the “Start” push-button for 10 seconds, during which time the siren sounds, warning people to clear away from the conveyor belt that is about to start. Only after this 10-second start delay does the motor actually start (and latch “on”): Similar to an “up” counter, the on-delay timer’s elapsed time (ET) value increments once per second until the preset time (PT) is reached, at which time its output (Q) activates. In this program, the preset time value is 10 seconds, which means the Q output will not activate until the “Start” switch has been depressed for 10 seconds. The alarm siren output, which is not activated by the timer, energizes immediately when the “Start” push-button is pressed. An important detail regarding this particular timer’s operation is that it be non-retentive. This means the timer instruction should not retain its elapsed time value when the input is de-activated. Instead, the elapsed time value should reset back to zero every time the input de-activates. This ensures the timer resets itself when the operator releases the “Start” push-button. A retentive ondelay timer, by contrast, maintains its elapsed time value even when the input is de-activated. This makes it useful for keeping “running total” times for some event. Most PLCs provide retentive and non-retentive versions of on-delay timer instructions, such that the programmer may choose the proper form of on-delay timer for any particular application. The IEC 61131-3 programming standard, however, addresses the issue of retentive versus non-retentive timers a bit differently. According to the IEC 61131-3 standard, a timer instruction may be specified with an additional enable input (EN) that causes the timer instruction to behave non-retentively when activated, and retentively when de-activated. The general concept of the enable (EN) input is that the instruction behaves “normally” so long as the enable input is active (in this case, non-retentive timing action is considered “normal” according to the IEC 61131-3 standard), but the instruction “freezes” all execution whenever the enable input de-activates. This “freezing” of operation has the effect of retaining the current time (CT) value even if the input signal de-activates. For example, if we wished to add a retentive timer to our conveyor control system to record total run time for the conveyor motor, we could do so using an “enabled” IEC 61131-3 timer instruction like this: When the motor’s contactor bit (OUT contactor) is active, the timer is enabled and allowed to time. However, when that bit de-activates (becomes “false”), the timer instruction as a whole is disabled, causing it to “freeze” and retain its current time (CT) value ( Note 1 ). This allows the motor to be started and stopped, with the timer maintaining a tally of total motor run time. Note 1 : The “enable out” (ENO) signal on the timer instruction serves to indicate the instruction’s status: it activates when the enable input (EN) activates and de-activates when either the enable input de-activates or the instruction generates an error condition (as determined by the PLC manufacturer’s internal programming). The ENO output signal serves no useful purpose in this particular program, but it is available if there were any need for other rungs of the program to be “aware” of the run-time timer’s status. If we wished to give the operator the ability to manually reset the total run time value to zero, we could hard-wire an additional switch to the PLC’s discrete input card and add “reset” contacts to the program like this: Whenever the “Reset” switch is pressed, the timer is enabled (EN) but the timing input (IN) is disabled, forcing the timer to (non-retentively) reset its current time (CT) value to zero. The other major type of PLC timer instruction is the off-delay timer. This timer instruction differs from the on-delay type in that the timing function begins as soon as the instruction is deactivated, not when it is activated. An application for an off-delay timer is a cooling fan motor control for a large industrial engine. In this system, the PLC starts an electric cooling fan as soon as the engine is detected as rotating, and keeps that fan running for two minutes following the engine’s shut-down to dissipate residual heat: When the input (IN) to this timer instruction is activated, the output (Q) immediately activates (with no time delay at all) to turn on the cooling fan motor contactor. This provides the engine with cooling as soon as it begins to rotate (as detected by the speed switch connected to the PLC’s discrete input). When the engine stops rotating, the speed switch returns to its normally-open position, de-activating the timer’s input signal which starts the timing sequence. The Q output remains active while the timer counts from 0 seconds to 120 seconds. As soon as it reaches 120 seconds, the output de-activates (shutting off the cooling fan motor) and the elapsed time value remains at 120 seconds until the input re-activates, at which time it resets back to zero. The following timing diagrams compare and contrast on-delay with off-delay timers: While it is common to find on-delay PLC instructions offered in both retentive and non-retentive forms within the instruction sets of nearly every PLC manufacturer and model, it is almost unheard of to find retentive off-delay timer instructions. Typically, off-delay timers are non-retentive only (Note 2 ). Note 2 : The enable (EN) input signals specified in the IEC 61131-3 programming standard make retentive off-delay timers possible (by de-activating the enable input while maintaining the “IN” input in an inactive state), but bear in mind that most PLC implementations of timers do not have separate EN and IN inputs. This means (for most PLC timer instructions) the only input available to activate the timer is the “IN” input, in which case it is impossible to create a retentive off-delay timer (since such a timer’s elapsed time value would be immediately re-set to zero each time the input re-activates).
-
The IEC 61131-3 standard specifies several dedicated ladder instructions for performing arithmetic calculations. Some of them are shown here: PLC Math instructions As with the data comparison instructions, each of these math instructions must be enabled by an “energized” signal to the enable (EN) input. Input and output values are linked to each math instruction by tag name. An example showing the use of such instructions is shown here, converting a temperature measurement in units of degrees Fahrenheit to units of degrees Celsius. In this particular case, the program inputs a temperature measurement of 138 deg F and calculates the equivalent temperature of 58.89 deg 😄 well as a dedicated variable (X) used to store the intermediate calculation between the subtraction and the division “boxes.” Although not specified in the IEC 61131-3 standard, many programmable logic controllers support Ladder Diagram math instructions allowing the direct entry of arbitrary equations. Rockwell (Allen-Bradley) Logix5000 programming, for example, has the “Compute” (CPT) function, which allows any typed expression to be computed in a single instruction as opposed to using several dedicated math instructions such as “Add,” “Subtract,” etc. General-purpose math instructions dramatically shorten the length of a ladder program compared to the use of dedicated math instructions for any applications requiring non-trivial calculations. For example, the same Fahrenheit-to-Celsius temperature conversion program implemented in Logix5000 programming only requires a single math instruction and no declarations of intermediate variables:
-
PLC Data Comparison Instructions
leizuofa posted A plc and hmi english article in PLC programming learning
As we have seen with counter and timers, some PLC instructions generate digital values other than simple Boolean (on/off) signals. Counters have current value (CV) registers and timers have elapsed time (ET) registers, both of which are typically integer number values. Many other PLC instructions are designed to receive and manipulate non-Boolean values such as these to perform useful control functions. The IEC 61131-3 standard specifies a variety of data comparison instructions for comparing two non-Boolean values, and generating Boolean outputs. PLC Data Comparison Instructions The basic comparative operations of “less than” (<), “greater than” (>), “less than or equal to” (≤), “greater than or equal to” (≥), “equal to” (=), and “not equal to” (6=) may be found as a series of “box” instructions in the IEC standard: The Q output for each instruction “box” activates whenever the evaluated comparison function is “true” and the enable input (EN) is active. If the enable input remains active but the comparison function is false, the Q output de-activates. If the enable input de-de-activates, the Q output retains its last state. A practical application for a comparative function is something called alternating motor control, where the run-times of two redundant electric motors are monitored, with the PLC determining which motor to turn on next based on which motor has run the least: .In this program, two retentive on-delay timers keep track of each electric motor’s total run time, storing the run time values in two registers in the PLC’s memory: Motor A runtime and Motor B runtime. These two integer values are input to the “greater than” instruction box for comparison. If motor A has run longer than motor B, motor B will be the one enabled to start up next time the “start” switch is pressed. If motor A has run less time or the same amount of time as motor B (the scenario shown by the blue-highlighted status indications), motor A will be the one enabled to start. The two series-connected virtual contacts OUT motor A and OUT motor B ensure the comparison between motor run times is not made until both motors are stopped. If the comparison were continually made, a situation might arise where both motors would start if someone happened to press the Start pushbutton with one motor is already running. -
T 字路口交通控制系统 PLC 编程
leizuofa posted A PLC and HMI Simplified Chinese article in PLC programming learning
本文介绍的是在 PLC 梯形逻辑的帮助下使用比较器进行信号灯操作的 T 字路口交通控制系统。 T 字路口交通控制系统 T字路口交通控制系统的功能由三组段组成。通过比较器操作的逻辑,我们控制交通灯系统。 第一段: 第一段中,车道1允许通行,车道2和车道3停止通行。在此段中,车道 1 的绿灯(绿 1)亮起,车道 2 的红灯(红 2)和车道 3 的红灯(红 3)亮。此期间持续十五秒。 第二段: 在第二段中,车道 2 允许通行,车道 1 和车道 3 停止通行。在该段中,车道 2 的绿灯(绿 2)亮起,车道 1 的红灯(红 1)和车道 3 的红灯(红 3)亮。此期间持续十五秒。 第三段: 第三段,车道3允许通行,车道1和车道2停止通行。在该段中,车道 3 的绿灯(绿 3)亮起,车道 1 的红灯(红 1)和车道 2 的红灯(红 2)亮。此期间持续十五秒。 执行完所有三个段后,操作序列再次开始并不断重复。 输入和输出说明 在这个 PLC 项目中,我们使用了 2 个输入、6 个输出、2 个内存和 1 个接通延迟定时器。 序号 符号 说明 1 I 0.0 开始 2 I 0.1 停止 3 M 0.0 内存 4 M 0.1 内存 1 5 Q 0.0 绿色 1 6 Q 0.1 红色 1 7 Q 0.2 绿色 2 8 Q 0.3 红色 2 9 Q 0.4 绿色 3 10 Q 0.5 红色 3 11 DB1 延时定时器 PLC 编程及其讲解 1. 当按下 START (I 0.0) 按钮时,MEMORY (M 0.0) 通电。这个 M 0.0 是用于执行程序中所有进程的主存储器。由于它被锁存,因此它仅处于通电状态。如果按下停止(I 0.1),整个过程将随时停止。 2. 一旦 MEMORY 通电,它将打开 TIMER DB1,控制交通路口的计时。在此计时器中,我们将预设时间设置为 45 秒。一旦定时器达到预设时间,存储器 1 (M 0.1) 就会通电,并且该 M 0.1 还会根据逻辑重置定时器并连续运行循环。 3. 其次,比较器在控制交通路口方面发挥着主要作用。首先,输出 GREEN 1 (Q 0.0) 按照逻辑打开。这里我们使用小于或等于比较器。在此逻辑中,Q0.0 将在 0 秒到 15 秒内处于 ON 状态。之后,它将进入OFF 状态 4. 接下来,对于输出 RED 1 (Q0.1),我们使用大于或等于函数。Q0.1 将在 15 秒至 45 秒内处于 ON 状态。当 Q0.0 处于 ON 状态时,它处于 OFF 状态。 5. 然后,对于输出 GREEN 2 (Q0.2),我们对此输出使用小于或等于和大于或等于。两个比较器功能均与输出串联逻辑连接。在此情况下,Q0.2 将根据条件处于 ON 状态 16 秒至 30 秒。 6. 接下来,对于输出 RED 2 (Q0.3),我们还使用小于或等于和大于或等于函数来执行操作。比较器与输出并联连接。该输出将在 0 秒至 15 秒以及 30 秒至 45 秒期间处于 ON 状态。在 15 秒之间,它只会处于 OFF 状态,因为此时 Q0.2 处于 ON 状态。 7. 然后对于最后一个 GREEN 3 输出 (Q0.4),我们使用大于或等于函数。根据条件逻辑,它将在 30 秒到 45 秒内处于 ON 状态。在此时间之前,它将处于关闭状态。 8. 最后,RED 3 输出(Q0.5)。这里我们使用小于或等于函数来执行 PLC 逻辑。0 秒到 30 秒内它将处于 ON 状态,之后将处于 OFF 状态。 结论 因此,通过这种方式,给定的丁字路口交通控制由比较器功能与 PLC 逻辑来执行。我们可以通过多种方式借助 PLC 逻辑来控制交通逻辑,这也是方式之一。 -
当你使用 PLC 时,你需要知道它一般有哪些类型的电压;以便您可以进行相应的接线。不仅仅是电源,还必须与所需的输入输出电压有关。 每个 PLC 制造商根据他们提供的模块和 CPU 都有自己的一组电压和电流范围。在本文中,我们将了解随处可见的 PLC 工作电压。 PLC 电源 标准情况下,PLC 可在四种电压下运行:24V DC、24V AC、110V AC 和 240V AC。在有些 PLC 中,只有 CPU 需要电源,IO 模块由 CPU 背板供电,而在有些 PLC 中,包括 CPU、输入和输出在内的所有模块都需要电源。 无论如何,您都需要在 PLC 面板中安装 SMPS 或变压器来转换原始电源电压。在交流电源电压中,一些 PLC 提供 110-240V AC 的电压范围。 PLC 中的每个电源点都有一个接地点,以在出现浪涌或短路时保证 PLC 的安全。当使用交流电源时,内部大多装有保护熔断器。 直流电源内部也有保险丝,但对于交流电源,由于涉及高电压,因此必须使用保险丝。当 CPU 给出额定电压时,就意味着你提供的电压已经得到了很好的稳定和控制。 但是,电压保持恒定在 24V 或 240V 是不切实际的。因此,PLC 有一个额定电压范围,如 20-28V DC 或 220V-245V AC。每个 PLC 中都预定义了该范围,以便您获得一个电源区域,以便高效地使用它们,而不会出现任何问题。 IO 模块电源 现在,让我们进入下一个主题:IO 模块所需的电源。如前所述,有两种类型的电源可用,一种是模块由 CPU 背板本身供电,另一种是模块需要外部电源。 使用背板时,每个 CPU 都有一个 mA 额定值,它将作为所连接模块的负载提供。 例如,如果 CPU 的额定值为 24VDC – 450mA,那么它还将指定 CPU 背板可以为 IO 模块提供这么多电流,并且您只能将该数量的模块连接到 CPU 机架。 此外,每个模块都会指定连接到背板总线上时需要多少电流。这可以帮助您为特定应用选择适当的模块和 CPU。 说到第二种供电方式,有一些模块需要外接电源。因此,在这种情况下,您必须相应地选择具有更高电流和额定负载的 SMPS 或变压器。反过来,这可以正确地为 CPU 和模块供电,也可以为需要相同电源的面板上的其他组件供电。 现场仪表电源 PLC 的现场接线也大多需要仪器仪表的直流电压和大功率设备的交流电压。因此,上述四种电压对于 IO 模块公共电源接线来说是相同的。 另外,请记住,除了标准电源外,PLC 内部大多还有备用电池。这样可以确保 PLC 内存中的程序在断电时保持完整。 PLC 电源选择 因此,在选择电源时,一般需要考虑以下参数:额定电压、额定电流、额定功率、纹波和噪声、电压可调范围、电压容差、线路调整率和负载调整率。 选择正确的电源后,您就可以连接 CPU 和模块以正确供电。 这样,我们就了解了 PLC 工作电压的概念。
-
PLC 与 PAC 主要差异和相似之处
leizuofa posted A PLC and HMI Simplified Chinese article in PLC programming learning
可编程逻辑控制器 (PLC) 和可编程自动化控制器 (PAC) 是两种类型的工业控制器,用于自动化制造、加工和其他工业应用中的流程和机器。两种类型的控制器具有相似的功能,但它们之间也存在显着的差异。 在本文中,我们将介绍 PLC 和 PAC 的区别、相似之处和示例。 内容: 什么是 PLC? 什么是 PAC? PLC 和 PAC 之间的相似之处。 PLC 和 PAC 之间的差异。 来自不同供应商的 PLC 模型示例。 来自不同供应商的 PAC 模型示例。 PLC 什么时候最适合?什么时候用 PAC? 结论 什么是 PLC? PLC 是 Programmable Logic Controller 的缩写,是一种用于自动化控制系统的专用工业计算机。PLC 设计用于在恶劣环境下运行,用于控制制造工厂、装配线和其他工业环境中的机械。 PLC 可以使用梯形图、功能块图、结构文本、指令表和时序图等5种不同的语言进行编程。这 5 种语言根据 IEC 61131-3 标准获得批准和应用。 什么是 PAC? PAC 代表可编程自动化控制器,它类似于 PLC,但具有更高级的功能。PAC 将传统 PLC 的功能与执行更复杂的任务以及与其他设备和系统通信的能力相结合,使其比 PLC 更加灵活和强大。 PAC 通常用于汽车、航空航天和发电等行业中更复杂的自动化和控制应用。PAC 可以使用与 PLC 相同的 5 种语言进行编程,但也可以使用 C 和 C++ 进行编程,使它们能够处理更复杂的算法编码。 PLC 和 PAC 之间的相似之处 PLC 和 PAC 之间的相似之处太多,有时甚至很难判断它们是否不同。虽然他们之间还是有一些区别的。 他们的相似之处甚至更多。以下是 PLC 和 PAC 之间的一些共同点: 核心功能 PLC 和 PAC 均旨在为工业自动化系统提供可靠且准确的控制。 它们用于监控传感器和其他设备的输入,处理信息,然后向执行器和其他设备输出控制信号。 编程 PLC 和 PAC 都使用编程语言来创建决定自动化系统行为的控制逻辑。它们共享 IEC 61131-3 标准中定义的 5 种编程语言,但 PAC 提供更多编程语言选项,包括 C 和 C++。 耐用性 PLC 和 PAC 均可承受恶劣的工业环境,例如极端温度、湿度和振动。它们的设计坚固可靠,使用寿命长,维护要求低。 模块化设计 PLC 和 PAC 均采用模块化设计,易于扩展和定制。可以添加或删除模块以满足特定要求。 行业标准 PLC 和 PAC 的构建都是为了满足自动化和控制系统的行业标准,例如 IEC 61131。这些标准确保不同制造商的设备和系统之间的互操作性。 PLC 与 PAC 的区别 PAC 和 PLC 之间的区别可能有些模糊。虽然 PAC 的构成没有定义,但 PAC 与 PLC 有一些共同特征: 功能性 虽然 PLC 和 PAC 都用于自动化和控制应用,但 PAC 具有更高级的功能,例如运动控制、过程控制和数据采集。PAC 通常还比 PLC 拥有更多的处理能力和内存。 连接性 PAC 拥有比 PLC 更先进的连接选项,包括以太网、USB 和无线。这使得将它们集成到更大的自动化系统以及与其他设备和系统通信变得更容易。 成本 由于其更先进的功能和灵活性,PAC 通常比 PLC 更昂贵。 更多高级功能 PAC 通常具有比 PLC 更先进的软件功能,例如集成运动控制、数据记录和高级诊断工具。这些功能使工程师和技术人员能够更轻松地对控制系统进行监控和故障排除。 不同供应商的 PLC 模型示例 西门子 S7-1500 PLC: 这是来自领先自动化供应商之一西门子的高性能 PLC。它专为要求苛刻的应用而设计,并提供运动控制、安全和安保等高级功能。见图1。 图 1 – 西门子 S7-1500 PLC Allen-Bradley CompactLogix 5370 PLC: 这是罗克韦尔自动化的一款多功能 PLC,提供广泛的 I/O 选项和通信协议。它适用于各种应用,包括机器控制和过程自动化。见图2。 图 2 – Allen-Bradley CompactLogix 5370 PLC 三菱电机 Q 系列 PLC: 这是三菱电机可靠的 PLC,提供高速处理、灵活的 I/O 选项和高级编程功能。它适用于多种应用,包括汽车、食品和饮料以及制药。见图3。 图 3 — 三菱电机 Q 系列 PLC 欧姆龙 NJ 系列 PLC: 这是 Omron 的高速、高性能 PLC,提供先进的运动控制和网络功能。它适用于多种应用,包括包装、印刷和半导体制造。见图4。 图 4——欧姆龙 NJ 系列 PLC Beckhoff TwinCAT PLC: 这是 Beckhoff 的一款基于软件的 PLC,在基于 PC 的平台上运行。它提供运动控制、CNC 和机器人等先进功能,适用于各种应用,包括机器控制和过程自动化。见图5。 图 5 – Beckhoff TwinCAT CX9240 基于 PC 的 PLC 来自不同供应商的 PAC 模型示例 艾默生 DeltaV DCS PAC: 这是艾默生的分布式控制系统 (DCS) PAC。它专为复杂的连续控制应用而设计,提供过程建模、批量管理和高级控制等高级功能。见图6。 图 6 – 艾默生 DeltaV DCS PAC 施耐德电气 Modicon M340 PAC: 这是施耐德电气的高性能 PAC,提供运动控制、安全和网络安全等高级功能。它适用于多种应用,包括能源、水处理和采矿。见图7。 图 7 – Modicon M340 PAC PAC 的其他一些示例如下: ABB AC 800M PAC 横河 ProSafe-RS PAC 菲尼克斯电气 PLCnext 技术 PAC 博世力士乐 IndraMotion MLC PAC PLC 何时最适合?什么时候是 PAC? PLC 和 PAC 用于不同类型的自动化应用,具体取决于该应用的具体要求。以下是有关 PLC 最适合的情况和 PAC 最适合的情况的一些一般准则: PLC 最适合: 离散控制应用: PLC 最适合涉及离散控制的应用,例如控制输送机、分拣设备或包装机械的操作。 简单的控制系统: PLC 非常适合具有相对简单的控制系统的应用,可以使用梯形逻辑或其他类似的编程语言进行编程。 成本敏感型应用: PLC 通常比 PAC 便宜,这使得它们成为成本为重要因素的应用的不错选择。 中小型系统: PLC 适用于输入和输出数量相对较少的中小型控制系统。 制造工厂中的输送系统是自动化系统的一个很好的例子,其中 PLC 最适合。在此应用中,PLC 负责控制输送机的速度和方向,并监控输送线上传感器和其他设备的状态。PLC 还可以编程来处理特定的生产任务,例如分类、计数或包装。 输送机系统通常具有固定的结构和需要以顺序方式执行的一组明确定义的操作。PLC 非常适合此类应用,因为它们设计用于处理离散控制任务并且运行非常可靠。PLC 可以轻松编程和配置,以处理不同类型的传感器、执行器和通信协议。 PAC 最适合: 过程控制应用: PAC 最适合涉及过程控制的应用,例如控制化工厂、水处理厂或发电厂的运行。 复杂的控制系统: PAC 非常适合具有需要高级算法和优化功能的复杂控制系统的应用。 大型系统: PAC 适用于输入和输出数量较多且系统分布面积较大的大型控制系统。 高性能应用: PAC 能够处理需要快速数据处理、实时控制和高可靠性的高性能应用。 发电厂控制系统是自动化系统的一个很好的例子,其中 PAC 最适合。在此应用中,PAC 负责控制和监视大量复杂的过程和设备,例如涡轮机、发电机、锅炉和泵。PAC 还负责收集和分析来自各种传感器和其他来源的数据,并根据这些数据做出决策,以优化工厂的绩效。 发电厂控制系统是一个非常复杂和动态的环境,许多不同的过程和设备同时运行。PAC 非常适合此类应用,因为它们提供分布式控制、冗余和容错等高级功能,这对于确保工厂的可靠性和安全性至关重要。PAC 可以处理大量数据,并且可以编程来执行复杂的算法和优化任务。 结论 PLC 和 PAC 都用于工业自动化应用。 它们具有不同的功能,并且最适合不同类型的应用程序。 在 PLC 和 PAC 之间进行选择时,必须考虑应用的具体要求。 PLC 通常用于控制系统相对简单的离散控制应用。 PAC 用于具有复杂控制系统并需要先进算法和优化功能的过程控制应用。 -
微控制器和 PLC 之间的区别
leizuofa posted A PLC and HMI Simplified Chinese article in PLC programming learning
控制任何机器或系统中的过程一直是工程师的梦想。由于技术的出现,已经开发了许多控制器来灵活可靠地控制过程。 控制器有两种通用类型,广泛应用于从小规模到大规模的许多过程中。它们是微控制器和 PLC。它们可以完成各种操作,从小型计算到复杂的算法、逻辑性能和数据处理。通过自动化流程,使任务变得更加容易。 在这篇文章中,我们将了解微控制器和 PLC 之间的区别。 什么是微控制器? 让我们先了解基础知识。您有一个按钮和一盏灯。按下按钮 5 秒后,系统会要求您打开灯。从这些来看,我们需要什么来执行这个任务? 您将需要一个输入(按钮)、一个输出(灯)、一个用于执行此任务的控制器(处理器类型)、一个为电路供电的电源以及一个用于存储该逻辑以及输入和输出状态的存储器。当将其组合在单个封装中时,就形成了微控制器。 简而言之,微控制器是一种小型计算机,它接受物理输入,根据它们处理逻辑,并打开或关闭物理输出。它是一个小型的芯片式器件,将所有这些电路嵌入其中,就像一个小封装一样,并完成所有的处理和控制工作。 微控制器将处理少量的输入和输出。例如,考虑安装在手持设备上的小型显示电路,如 LED 或 LCD。如果按下其上的按钮,显示屏上就会显示相应的数字。 当您按下另一个按钮时,它将显示根据处理器内部逻辑写入的其他数字。这意味着它首先被编程为显示一个数字,然后按下第二个按钮,就会显示计算出的数字。所有这些计算、变量的存储处理和 IO 处理都是在这个微控制器芯片内部完成的。 什么是 PLC? 让我们继续进行更高级别的处理。您有 50 个传感器,4-20 mA 或热电偶类型。您有 20 种不同类型的输出,0-10V DC 执行器或继电器输出。您已被分配相同的任务来根据其中写入的逻辑接受输入和控制输出。 需要所有相同的 IO 组件、电源、处理器和内存。但是,您可以看到所有这些具有内存和处理器的 IO 板/引脚无法嵌入在小型单芯片上。这就是 PLC 发挥作用的时候。PLC 基本上是微控制器的扩展。它是一个柜箱式设备,有 IO 板、内存和处理器;所有这些都在不同的芯片上相互连接。所有这些芯片组成一个 PLC 机柜。 IO 可以有不同的类型,从简单的数字信号到复杂的模拟信号。它们有特殊的通信板,可以与以太网、Modbus、CAN Open、Profibus、Profinet 等现实协议进行通信。 微控制器也有通信板,但它们的接口很小,连接性有限。 IO 模块要么嵌入在主 PLC 中,要么通过通信连接到远程模块。这很容易实现 IO 的扩展。各种高级工业传感器和执行器可以轻松与 PLC 连接。 单片机和 PLC 的区别 现在我们已经了解了它们的含义,让我们看看它们的区别: 仅在定义中,我们就知道 PLC 可以处理大量进程和循环。这就是为什么它最适合工业应用。微控制器无法满足大量具有复杂接线和通信要求的 IO。它最适合小规模应用。 与微控制器相比,PLC 中的信号处理更加灵活。这意味着,模数转换、高速计数器输入和输出在 PLC 中比在微控制器中更容易配置。 由于微控制器提供的功能有限,因此其价格比 PLC 便宜。 PLC 的主要优点是其坚固性和稳定性。具有非常高的温度和环境顽固性,是关键、危险和恶劣环境的最佳产品。 与微控制器相比,PLC 更容易受到电磁噪声和其他类型的噪声的影响。 PLC 中的编程比微控制器中的编程要容易得多。微控制器使用 C 和 C++ 等复杂软件进行编程,这在 PLC 中要容易得多,因为它具有易于与电气绘图理解相关的语言。 微控制器需要嵌入式系统、VLSI 和软件方面的知识来设计,而 PLC 程序员则需要工业自动化、仪器仪表和网络方面的知识来设计。 -
PLC 中的先进先出(FIFO)和后进先出(LIFO)顺序是什么?
leizuofa posted A PLC and HMI Simplified Chinese article in PLC programming learning
顺序逻辑在 PLC 编程中非常有用。它有助于轻松整理事情。使用 PLC 的各种应用程序都写入了一些或其他顺序逻辑。 两种最广泛使用的序列是 LIFO 和 FIFO。您一定听说过电子学中用于堆叠和排序的名称。这些类型的顺序逻辑在 PLC 中也可用。 在本文中,我们将学习 PLC 编程中的 LIFO 和 FIFO 顺序概念。 PLC 中的 FIFO 顺序 FIFO 代表先进先出。从它的名字就可以很容易地理解这个序列的含义。先来的东西就会先出去。您输入一个元素;当您请求一个元素时,输入的第一个元素将提供给您。同样的逻辑也适用于 FIFO 序列的 PLC 编程。 在编程中,分配一个逻辑块,称为 FIFO。它最多可以存储 16 个字或更多,具体取决于 PLC。它包含三种类型的输入——重置、存储和检索。 在复位输入的上升沿,序列被复位并清空。在存储输入的上升沿,输入处存在的字被存储在块中。该模块将记住收到的单词序列。 在检索输入的上升沿,首先输入的字将在 PLC 程序员配置的目标字中给出。它有两个输出——空的和满的。如果空位为真,则表示存储器为空,如果满输入为真,则表示存储器已满。 PLC 中的 LIFO 顺序 LIFO 代表后进先出。从它的名字就可以很容易地理解这个序列的含义。最后出现的东西将首先消失。您输入一个元素;当您请求一个元素时,最后输入的元素将提供给您。同样的逻辑也适用于 LIFO 序列的 PLC 编程。 在编程中,逻辑块被指定为后进先出(LIFO)。它最多可以存储 16 个字或更多,具体取决于 PLC。它包含三种类型的输入——重置、存储和检索。在复位输入的上升沿,序列被复位并清空。 在存储输入的上升沿,输入处存在的字被存储在块中。该模块将记住收到的单词序列。 在检索输入的上升沿,最后输入的字将在程序员配置的目标字中给出。它有两个输出——空的和满的。如果空位为真,则表示存储器为空,如果满输入为真,则表示存储器已满。 这些序列非常容易操作。程序员必须注意不要同时向存储块提供任何输入。在这种情况下,该块将不会执行任何操作。一次只需给出一个输入。还需要注意的是,不同的 PLC 在热启动或冷启动时的功能不同。 一般来说,例如在 PLC 冷启动时,寄存器将被重置,而在热启动的情况下,寄存器将保持原样。这取决于制造商。 -
PLC 中有许多指令有助于以简化的方式执行逻辑。指令有多种类别,如算术、比较、逻辑、控制器等。例如,用于添加两个变量的简单加法指令就属于算术类别。因此,类似地,PLC 逻辑中可以使用多种类型的指令。 PLC 编程中广泛使用的一种这样的指令是移位指令。它属于数值处理的范畴。 在这篇文章中,我们将学习 PLC 编程中移位寄存器指令的概念。 PLC 中的移位寄存器 顾名思义,移位指令是将字的位移动某个预定义位置的命令。 例如,您有一个 16 位的字。您想要将位号 3 从当前的第四位置移动到第七位置。因此,每当给出移位命令脉冲时,该位就会在每个触发器中从第四位置移位到第七位置。 在这种连续性中,第五个位置的位将移动到第八个位置;第三位置的位将移动到第六位置。因此,在这里,您将按您定义的位置数移动组中的位。 移位指令 移位指令有两种类型——移位和循环。让我们看一下旋转指令。考虑语法 – %MW10:= SHL (%MW12, 4)。%MW10 是目标存储器字,%MW12 是源存储器字。 请参阅下图。在 %MW10 中,当给出第一个左移触发时,位 0 移至位 1,依此类推。该结果存储在 %MW12 中。当这样的触发被给出四次时,最终,位0将最终转移到位4,依此类推。 最终结果无论如何都存储在 %MW12 中,并且您会得到从源字移位四个位置的位的最终答案。但是,要记住的一件事是,每次移位时,前面的位都会填充值 0。您可以在图像中清楚地看到这一点。 第一次移位后,%MW12 中的第一位为 0。因此,经过四次移位后,最终结果将为 – 0000 1101 1100 0000。因此,该移位可以是右移或左移。 PLC 中还有另一种类型的转换;较早的类型从前一个位置添加了零,但第二种类型保持第一位的值(右侧的 MSB 和左侧的 LSB)不变。这称为算术移位。 因此,如果移位前第一位(右端的 MSB 和左端的 LSB)的值最初为 1,则最后一位将仅保持为 1,并且将从前第二位开始添加零,最多添加多少次 给出了移位命令。需要注意的是,最后移位的位总是存储在进位位中。 轮换指令 第二种是循环指令。考虑语法 – %MW10:= ROL (%MW12, 4)。%MW10 是目标存储器字,%MW12 是源存储器字。我们将使用上面相同的图像作为参考。旋转指令,顾名思义,只是将位旋转您定义的位置。 与移位指令相比,移位指令在每个前面的位后添加零;这里,位只是按照与左方向相同的顺序移位。因此,假设您的源词为 – 1100 1010 1100 0101;那么,触发 4 个位置后,最终结果将是 – 1010 1100 0101 1100。相同的逻辑在正确的方向上工作。最后移位的位也存储在进位位中。 另一种类型属于旋转类别。这里,不是只移位 16 位,而是翻转进位位。这意味着,最后一位被移至进位位,然后进位位将被移至第一位,依此类推。在早期类型中,最后一位仅存储在进位位中。
-
西门子 西门子 S7-1200 PLC 硬件配置
leizuofa posted A PLC and HMI Simplified Chinese article in PLC programming learning
S7-1200 PLC 是一种紧凑、模块化且经济高效的解决方案,为中小型自动化应用提供广泛的功能和灵活性。这些功能包括通信选项、内存、CPU 性能和 IO 配置。当您有需要控制的过程时,您应该选择 PLC 并对其进行配置,以最适合您的过程要求。 在本文中,我们将讨论 S7-1200 PLC 的硬件配置,并举例说明如何在西门子 Tia portal 中对其进行配置。 内容: PLC 的硬件配置是怎样的? 硬件配置的重要性。 简单的项目示例。 如何使用给定的示例配置我们的 PLC? CPU 的硬件配置。 IO 硬件配置。 人机界面配置。 结论。 PLC 的硬件配置是怎样的? 硬件配置是指 PLC 的特定组件,例如 CPU、内存、输入/输出 (I/O) 模块、通信端口、电源以及系统可能需要并添加的任何附加模块或附件 。 PLC 的硬件配置还包括启用或禁用某些 CPU 功能,具体取决于设备、其功能以及过程的要求。 PLC 的硬件配置步骤通常涉及以下内容: 根据应用需求选择合适的 PLC 型号。 确定系统的输入/输出要求,包括传感器、执行器以及将连接到 PLC 的其他设备的类型和数量。 选择将用于将 PLC 连接到其他设备和系统的通信协议和网络拓扑。 确定 PLC 及其外围设备的电源要求。 将 PLC 安装在适当的位置并连接所有必要的电缆和电线。 配置 PLC 软件以与硬件组件进行通信并设置适当的逻辑和控制功能。 硬件配置的具体步骤可能会根据 PLC 型号和应用要求而有所不同,但这些是该过程中通常涉及的基本步骤。 在本文中,我们将讨论在 TIA Portal 平台中完成的硬件配置。这意味着我们将假设您了解您的应用程序,并且您已经选择了 PLC 型号和为其供电的电源。您可以参考之前的文章,其中我们讨论了如何选择最适合您的应用的 PLC 和电源。 PLC 中硬件配置的重要性 正确的硬件配置可确保系统可靠且稳健。如果硬件组件配置不正确,它们可能无法按预期工作,从而导致系统故障或错误 硬件配置影响系统的性能。通过选择正确的硬件组件并进行适当的配置,系统可以以最高的效率和速度运行,并可以处理大量的输入和输出。 硬件配置影响系统的可扩展性和灵活性。硬件组件及其配置的选择应考虑到系统未来的扩展或修改,以确保系统能够轻松适应更改或升级。 硬件配置影响系统的成本。通过选择合适的硬件组件和配置,可以避免不必要的成本,并使系统的总体成本最小化。 S7-1200 硬件配置 我们将假设一个简单的 PLC 项目,并在开始编写代码之前了解如何将 PLC 配置到我们的项目中。 使用 PLC 的反应器温度控制系统 该项目涉及使用 PLC 控制反应器的温度。该系统应测量反应器的温度并通过控制冷却液的流量来调节温度。 该项目使用四个热电偶来测量温度,两个电磁阀来控制冷却液的流量,以及一个电机来驱动反应器的叶轮。 输入/输出配置 输入: 热电偶 1 – 4:这些是 4 个模拟输入,用于测量反应器内不同位置的温度。 紧急停止按钮:这是一个数字输入,用于在紧急情况下停止系统。 温度设定点电位计:这是一个模拟输入,允许操作员设置所需的温度设定点。 输出: 电磁阀 1 和 2:这是 2 个数字输出,用于控制冷却液通过反应器管道的流量。 电机控制:这是一个数字输出,用于控制驱动叶轮的电机的速度和方向。 加热器控制:这是控制反应器加热系统的数字输出。 系统操作: 系统等待操作员使用电位计设置温度设定点。 PLC 读取温度设定值并将其与反应器的当前温度(由四个热电偶测量)进行比较。 如果反应器温度低于设定点,PLC 会激活加热器控制输出以升高温度。 如果反应器温度高于设定点,PLC 会激活电磁阀输出之一,以增加冷却液的流量并降低温度。 PLC 持续监控温度并调整加热器和冷却系统以维持所需的设定值。 PLC 还控制驱动叶轮的电机以混合反应器中的内容物。 如果按下紧急停止按钮,PLC 将禁用所有输出并停止系统。 PLC 项目可以进一步扩展和修改,以包含附加功能,例如报警、数据记录或远程监控,具体取决于项目的具体要求。但是,我们不会关心该系统的 PLC 逻辑编码,而是使用此示例来解释如何对 PLC 进行硬件配置以适合我们的项目。 这包括: 选择 PLC CPU。 选择 IO 模块。 将输入和输出标签分配给硬件模块。 为 PLC 分配 IP 以进行通信。 分配保护密码。 配置 PLC 的本地时间。 配置 HMI 并设置与 PLC 的连接。 如何根据给定的示例配置 PLC? 下面我们将讨论使用所需硬件创建基本的 PLC 项目。 CPU 的硬件配置: 选择 CPU: 在 TIA Portal 中启动新项目时,应配置新设备并将其添加到项目中。见图1。 图 1. 为您的项目配置设备 从上图中可以看出,TIA Portal 已经向您显示第一步应该是配置新设备。 在上一篇文章中,我们讨论了如何选择适合您工艺的 PLC,所以这里不再提及,对于我们的项目,因为它是一个简单的项目,我们将选择 CPU 1214C AC/DC/RLY。见图2。 图 2. 将新控制器添加到项目中 中央处理器特性: 根据您为项目选择的 CPU,将提供不同的 CPU 功能和属性。 您可以根据需要启用或禁用这些功能。某些功能需要进行额外的配置。见图3。 图 3 – CPU 特性 正如您在上图中看到的,您可以在项目中为 CPU 设置许多属性。 我们将提到您需要在创建的每个项目中配置的一些属性,其他一些属性仅在特殊情况下使用。 沟通: 这对于任何 PLC 项目来说都是非常重要的配置;您的项目很可能有不同的模块和设备需要相互通信。设置 PLC 和这些设备之间的通信对于您的项目非常重要。 通过选择 CPU,您已经定义了通信方式。有些 CPU 仅适用于 Profinet,有些仅适用于 Profibus,有些则能够同时使用两者。本例中所选的 PLC 仅适用于 Profinet。 从 Profinet 界面,您将为 PLC 设置 IP 地址,该 IP 在项目中应该是唯一的;您不能为两个不同的模块使用相同的 IP。见图4。 图 4 – Profinet 接口 周期: 如您所知,这是 PLC 的另一个重要属性;程序的循环时间取决于您编写了多少代码以及 PLC 执行该代码需要多长时间。 在循环时间属性中,可以设置循环监控时间,如果 PLC 执行程序的时间超过这个设置的时间,那么PLC 就会报错。见图5。 通过此属性,您还可以确定 CPU 的最小循环时间,如果触发了 “启用循环 OB 的最小循环时间”,则可以执行此操作。 然后,您可以写入所需的最小循环时间,PLC 将调整其性能以匹配该时间。当然这个时间受到 CPU 性能的限制,所以你不能把这个时间降低到一定的限制以下。 图 5 – 周期时间属性 系统和时钟存储器位: 系统内存位和时钟内存位是 CPU 内部的内置位,操作系统用于指示 PLC 中的某些事件。 例如,有一个内存位仅在第一次扫描时变为 TRUE,或者如果诊断状态发生变化,则内存位将变为 TRUE,还有一些专用时钟内存位,例如代表 10Hz 时钟的位或代表 10Hz 时钟的位。2Hz的时钟。 这些位在某些应用中非常有用,并且可以节省大量编程代码以获得相同的功能。见图6。 图 6 – 启用系统和时钟存储器位 您可以启用一个或两个内存字节的使用;您还可以确定这些字节的地址,如图所示。 一天中的时间: PLC 的另一个非常重要的属性是设置 PLC 内部的时间。在您制作的几乎所有项目中,您都需要了解实时情况,以便能够分配不同日期的某些操作。 在上一篇文章中,我们讨论了 PLC 内部的本地时间和系统时间以及如何使用它们。CPU 的此属性允许您将本地时间设置为所需的时区。见图7。 图 7 – 当地时间属性 保护和安全: 通过该属性,您可以确定 PLC 的访问级别和密码保护。见图8。 图 8——保护和安全财产 前面提到的属性是您要做的几乎所有 PLC 项目中最常配置的属性。还有一些其他属性不太可能与简单程序(例如 Web 服务器和 OPC UA)一起使用。 项目硬件配置的下一步是配置 IO。 IO 硬件配置: 项目的另一个重要步骤是 IO 的配置,这意味着确定您需要多少个 IO 模块以及需要什么类型的 IO 模块。 在决定 IO 时,您应该考虑一些关键点,例如拥有一些备用 IO 点以及选择适合项目内输入传感器和输出执行器的 IO 模块。见图9。 图 9 – 添加模拟输入模块 正如我们在示例项目中提到的,我们有 4 个热电偶用作 PLC 的模拟输入,因此我需要添加一个至少具有 4 个输入通道的模拟输入模块,因为所选的 PLC 只有 2 个模拟输入通道。 另外,热电偶是一种特殊类型的模拟输入,需要专用的输入模块。这就是为什么我们选择 AI 8xTC 模块,它有 8 个输入通道,专用于与热电偶一起使用;我们选择 8 通道模块,4 通道模块有备用通道供将来需要扩展项目时使用。 如果您转到 AI 8xTC 模块的属性,您将看到您可以单独配置每个输入通道,您可以选择热电偶类型、测量范围和其他属性。见图10。 图 10 – 配置输入模块 接下来,您需要定义 IO 标签,并将每个输入或输出分配给 PLC 或 IO 模块中的正确 IO 点。见图11。 图 11 – 分配输入标签 然后继续分配其余的输入和输出标签,见图 12 和 13。 图 12 – 为 PLC 分配输入标签 图 13 – 将输出标签分配给您的项目 人机界面配置 您的 PLC 项目可能需要 HMI,选择 HMI 后,您可以进行不同的配置。 本文仅介绍如何配置 HMI 与 PLC 之间的通讯。从上图可以看出,您通过添加新设备来选择 HMI,然后选择 HMI。见图 14。 图 14 – 选择 HMI 设置 HMI 和 PLC 之间的通讯有多种方法,但最简单的方法是通过网络视图页面。见图 15。 图 15 – 设置 HMI 连接 在网络视图页面中,您只需从 HMI 上单击代表 Profinet 的绿色小方块并将其拖至 PLC 即可设置 HMI 和 PLC 之间的连接。 然后,TIA Portal 将在两个模块之间绘制一条绿线,并自动为 HMI 提供 IP 地址以设置它们之间的通信。 结论 硬件配置是任何 PLC 项目中非常关键的一步。 PLC 的正确硬件配置将确保满足项目所需的功能。 硬件配置包括选择 IO 模块、启用或禁用某些 CPU 属性以及使用 PLC 配置不同的设备(例如 HMI)。