Simple motion control implementation with Omron PLC SCOPE In todays challenging economical environment and highly competitive global market, manufacturers need to get the most of their automation equipment and use the most optimized solution. Good programming practices and well organized software implementations are among the important measures and this white paper explains in detail one of the examples with all the resources which you can quickly implement and develop. CONTENT Summary... 2 Introduction...3 Main challenges...3 Applying motion control principle in the PLC...5 Easy Positioning Function Block Library... 7 Connect...7 Movelink...8 Profile generation...9 Benefits...10 WHITEPAPER Direct Power Control 1
Executive Summary Packaging is everywhere and virtually any industry needs packaging. That means, the requirements of users from packaging machines are extremely diverse and complexity of the machines differs greatly. This means, getting the most out of the automation system is more important than ever. Introducing new machine functionality often requires a more capable automation system and this may results with a higher cost. While this is a must in some cases, good programming practices and well organized software implementations are very helpful to cope with this challenge, to keep the manufacturing cost at a minimum with no compromise from market trends. Through the life cycle of the machine, motion/position control requirements can change and when the machine movements are not complex and few millimeters of accuracy is enough, it is possible to implement a simple motion control algorithm in the PLC using conventional (pulse/analog) interfaces. This is especially important as end users put more demands for improved throughput, shorter product changeover time and higher packaging quality and this often increases the number of servo motors on the machine. Mechanisms like high speed rotary knife or flying shear needs to be controlled with advanced controllers and digital real time networks to achieve sub-micron precision. But servo motors used for slower or non-continuous processes (e.g. automated product changeover mechanism, intermittent transparent film wrapper unit) can be controlled with a simpler hardware and software architecture. This whitepaper explains in detail one of the examples with all the resources which you can quickly develop and implement in your machine. Simple motion control implementation 2
Introduction Packaging machines has a very wide range of industries and applications to cover; therefore there are a lot different types of machines from only mechanically controlled machines to high-end automated complex machines with robots, multiple servo axes etc. There are many packaging machines where OEM s needs simple motion control implementation with only basic instructions. For machines with intermittent movements or slow machines which are packing big size products and similar, usually it is not needed to have micrometer precision. Whatever the reason is, when the movements of the machine is slightly more complicated than just point to point, motion control implementation in the PLC becomes more difficult and can take a lot of time because complex programming is needed to reach control requirements. To overcome this situation, machine manufacturers are often scaling up their control system or using separate controllers for sequential control and motion control which introduce higher costs and complication. Real time motion control is the best solution for high performance applications where highly accurate synchronization, interpolation, CAM etc. functions are needed. Simpler, less accurate and slower applications can be still automated with a PLC even if there is no dedicated motion control function. But this approach can cost a lot of programming time and complexity and in contrast with real time motion control the performance depends much more to the programmer, because program code optimization and programming structure is very important parameters that affects the performance of the control system. Omron PLC s are providing a competent base to solve this problem and this paper intends to explain a programming approach which greatly simplifies this challenge. The result is a function block library named as Easy Positioning which explained in more detail further in this document. This function block library is an example of how above mentioned functions can be integrated into Omron PLC s to provide a simple solution. The Easy Positioning function block library can be used for simple electronic gearing, linked movements, electronic CAM and similar movements with supported Omron PLC s. These function blocks can be used with all models of CJ series (modular) and CP1 series (compact) PLC s except few models of CP1. It is free to download, use and distribute from Omron support site, myomron.com. Main challenges Easy positioning L is an example of how users can get most out of their PLC s but in order to judge what kind of solution is the best for a certain application; one should understand all aspects, possibilities, difficulties and limitations. Traditional PLC architecture or program execution sequence in other words, makes programming of this kind of movements a time consuming job and the accuracy can get dramatically worse just by PLC settings. Besides this, pulse interface is often the bottleneck of the system by the means of resolution. Simple motion control implementation 3
Easy positioning function blocks aims to mimic some basic principles of motion controllers in the PLC using a combination of various functions and settings. But to understand the difficulty, it is crucial to have an understanding of fundamentals of motion control. A typical example, electronic gearing (i.e. synchronization of a slave servo motor with a master encoder/ servo feedback, called as master-follower as well therefore) requires the controller to capture the encoder information, apply the virtual gear ratio and calculate the next speed and position command for the servo on the fly. Ratio 1/2 Slave axis Master axis Virtual link Cycle Fig. 3 - Electronic gearbox functional diagram Fig. 4 Profile generation, heartbeat of the system In order to achieve an acceptable performance, this needs to be done cyclically (called heartbeat also), based on a constant interval. So the motion controller gets feedback from the master and slave every cycle, executes the calculation -also using the data from previous cycle- to generate the target movement parameters (position, speed, acceleration etc.) for the next cycle. So the motion controller actually divides the movement path into the points with the resolution of the cycle time. This requires processing power. Additionally, the cycle of this calculation needs to be constant and short enough to have a smooth movement of the slave. As motion controllers are designed for this duty, the architecture is optimized in accordance. They are executing motion control as a high priority system task which has a fixed running interval and guarantees the performance without relying on user program. PLC s however, are executing the tasks with a sequential, top-down approach. So the program starts from the first line, executed until the end and jumps back to the top. This means, depending on the amount of program code it is running, the cycle time varies (as seen in Fig. 5); even cycle by cycle due to background services and non-cyclic operations like external communications etc. For this reason implementing a motion control application is not as straight as it is with motion controller even while mathematical functions are already programmed. Simple motion control implementation 4
Present Scan (ms) 250 200 150 100 50 0 1 3 5 7 9 11121517192212325272931333537394143454749515355575961636567697173757777981 Fig. 5 - PLC cycle time trace from a real machine Another issue is resolution of the control. Modern motion control systems are taking the advantage of high speed communication for data exchange with the field devices. This allows the use of very high resolution encoders (e.g. 1,048,576 ppr *1 of Omron G5 servo). This is very difficult to transmit with pulse interface in industrial environments without specific hardware. For example with a PLC with 100 khz pulse input/output frequency (typical in the market), in order to rotate the same motor at 3000 rpm *2 (rev. per minute) maximum command resolution can be just 2000 ppr instead of 1,048,576. Depending on the system design this could mean a big loss of accuracy. In other words, even if a servo motor with high resolution encoder is used, this resolution cannot be used due to this limitation. Applying motion control principle in the PLC In order to apply such strategy as mentioned above there are three main steps: 1. Ensuring encoder feedback with a constant pace 2. Implementation of related calculations in to the programming 3. Scaling, conversion and delivery of the result Easy positioning function blocks are using scheduled interrupt tasks in order to maintain a constant feedback interval (fig. 6). Scheduled interrupt tasks are running at every time when predefined interval time is passed, so its cycle is not effected by the main program. This way a constant rate of the encoder feedback can achieved. A very long interval time can decrease the accuracy as and cause the control to react with delays while a very short interval can increase the total cycle time of the PLC and affect other machine operations controlled in the main program as it suspends during the execution of scheduled interrupt program. *1 ppr: pulse per revolution *2 rpm: revolution per minute Simple motion control implementation 5
Main task cycle Interrupt task New feedback New feedback New feedback New feedback New feedback Int 1 Int 1 Int 1 Int 1 Int 1 Interrupt interval Fig. 6 - PLC cycle time trace from a real machine Inside this interrupt program, using one of the Delta function blocks, position difference between current cycle and previous cycle needs to be calculated. This information later on will be used as input by another function block (for instance OL_Connect) to calculate slave command for the next cycle. As the last step, this output of calculation needs to be send to the servo driver either analogue or pulse signal. There are conversion and scaling options available as well. Start Cyclic in the interrupt task Read feedback E;ectronic gear, synchronization etc. Make calculation Scaling, analogue or pulse output Convert & Output Fig. 7 - Flowchart of principle of operation Simple motion control implementation 6
Easy Positioning Function Block Library There are several types of movements already supported by easy positioning library which are explained further in the document. 1. Connect 2. Movelink 3. Smooth profile generation (polynomial 5) 4. Cycloidal CAM Additionally there are other function blocks available in the library as well to make the library complete through input-logic-output stages (e.g. to output calculation result from pulse or analogue outputs). Connect As already explained, the Connect function provides a virtual gearbox with a variable ratio between master and slave. This function block has open and closed loop versions. While with the open loop the only feedback is taken from the master encoder, with the close loop type, a second input channel needs to be used to get feedback from the slave as well. Delta Delta CL_CONNECT (Master to Slave 1) Fig. 8 Principal scheme for Connect Simple motion control implementation 7
Movelink Movelink is another popular function which can be used to create a virtual link between master and slave axes for a certain distance of the master. The typical usage case is to process products on the conveyor without stopping the conveyor. Fig. 9 & 10 Sample application illustration While the master axis (conveyor) is running at a constant speed, the slave axis accelerates at a certain moment and reaches the speed of the master. After the defined synchronization distance is passed, the slave decelerates and depending on the mechanism, goes back to start position. Base Axis (slave axis) Slave Speed DIST START MOVELINK MOVELINK Delta Link Axis (master axis) Master Speed ACC LINK_DIST DEC Delta CL_CONNECT (Movelink to Slave 1) P_TRAIN (to Slave 1) Fig. 11 chart of Movelink Fig. 12 Principal scheme for Movelink Simple motion control implementation 8
Profile generation Profile generation function block is can be used to create an individual, smooth position profile as it is using polynomial 5 calculation. Besides this, calculated profile can be added to an external encoder feedback in order to create superimposed movements. That way, a slave axis can make an additional movement (i.e. for correction) without stopping the synchronization. Velocity Velocity Master axis 50 0 Velocity Linked axis Velocity 250 200 0 PROFILE_GEN Delta Delta Position Delta CL_CONNECT (Master to Slave 1) P_TRAIN (to Slave 1) Position Linked axis 0 Fig. 13 chart and principle scheme of profile generation in combination with master axis movement Cycloidal CAM generates a CAM profile based on master position with smooth acceleration-deceleration rate and it is very suitable to use for repeating movements as it has zero acceleration rate at the beginning and end of the curve. CYCLOIDAL_CAM Delta (Camma) Delta (Slave 1) CL_CONNECT P_TRAIN (Movelink to Slave 1) (to Slave 1) Fig. 14 Principal scheme for Cycloidal Cam Simple motion control implementation 9
Benefits The control capability provided with easy positioning function blocks can create a big advantage for many machines where simple and low accuracy motion control is enough. For this type of machines it can eliminate the need to use an additional control system thus increasing the competitiveness of OEM s in the market. Besides this, easy positioning function block library allows out of the box implementation of these functions while keeping the modularity and flexibility. Current developments of packaging machines which is driven by increasing demand of speed, modularity and quick changeover especially from food, beverage and pharmaceutical markets requires OEM s to use flexible automation architectures on their machines. Machines like palletizers, linear filling machines, shrink wrappers, intermittent vertical and horizontal packaging machines can be more competitive utilizing easy positioning function blocks. Legal disclaimer: Easy Positioning Function Block Library is provided as is without warranty of any kind and the user has the full responsibility to make sure of proper and safe operation is of the machine. Packaging trends are always evolving and end user requests are rapidly changing. Machine designs needs to be always in line with trends and even with conventional mechanical structures being used on the packaging machines since long time are being changed or scrapped. Mechanical shafts are being replaced with motors, simple movements for product changeover are done with servo motors in order to avoid human mistakes and decrease down time etc., reasons are various. Machine manufacturers needs to cope with all these changes and stay competitive with innovation. In todays challenging economical environment and highly competitive global market, manufacturers need to get the most of their automation equipment and use the most optimized solution. Good programming practices and well organized software implementations are among the important measures and this white paper explains in detail one of the examples with all the resources which you can quickly implement and develop. Simple motion control implementation 10
Omron Corporation 50 years in industrial automation Over 35.000 employees Support in every European country Over 1.800 employees in 19 European countries 800 Specialised field engineers 7% of turnover invested in R&D More than 200.000 products More than 6.950 patents registered to date Omron Industrial Automation Headquartered in Kyoto, Japan, OMRON Corporation is a global leader in the field of automation. Established in 1933 and headed by President Hisao Sakuta, Omron has more than 35,000 employees in over 35 countries working to provide products and services to customers in a variety of fields including industrial automation, electronic components industries, and healthcare. The company is divided into five regions and head offices are in Japan (Kyoto), Asia Pacific (Singapore), China (Hong Kong), Europe (Amsterdam) and US (Chicago). The European organisation has its own development and manufacturing facilities, and provides local customer support in all European countries. For more information, visit Omron s Web site at www.omron.com.