With PLC how to draw circles?
Believe that a lot of friends thought about this question, PLC200 smart didn't develop this function, the need to write program implementation, this paper and industrial control and development of the friends discuss the interesting question, the author in debugging success on the basis of the enclosed video and procedure is introduced a method of painting circle, strong commonality, this method can draw the curve of the different according to the principle of this method.
parabolic y = x ^ 2 of the above figure is case analysis, we know that walking on one direction, at a constant speed in a direction at a constant acceleration motion, the trajectory is a parabola.
Constant speed in a same we can think of, the X axis and Y axis variable motion, the trajectory will be out of the curve.
Uniform motion in the distance divided by the time you get speed, and speed you need from the point of view of the differential calculation, namely: we assume that the X axis direction walk at a constant speed of 2 mm/s, namely: with the previous analysis, we can try to analyze the circular radius is 50 mm: you can see,
- - - - - -
Every X range corresponding to two Y value, two Y value is a negative and equal to the absolute value, corresponding to the location of the derivative value is also a is a negative and absolute value is equal, so when the X axis direction at a speed of 2 mm/s movement to the right, to get the circular-arc trajectory, in an arbitrary position corresponding to the X Y speed is: here are in the X direction at a rate of 2 mm/s, is a relatively slow speed, and then according to the formula (Vy
Write operations into interrupt program)
, can write programs draw a circle, only need to pay attention to in the map the location of the X direction and Y direction change on the way to do some processing, application and comments below to illustrate the process of the whole program.
Below is the program to establish the origin reference points come after the actual path)
first need painting circle is a two axis console (
Including stepping motor and the drawing of the platform, etc. )
, two driver, a 200 PLC
, the author use in the video is a three axis platform, drive to 3200 segment, write a program before using the wizard, set the two axes, engineering measurement system of units, convenient we calculated, also more intuitive, segmentation, 3200, my forward one revolution of the stepper motor every 5 mm, as shown in the figure below: direction control options below, the X axis choose single phase 2 output, because in the process of the circle on the X direction is negative;
Y choose single phase 1 output, because the Y axis movement by point RUN control, the author found that used in the process of debugging, the output of the single phase 2 use inching Director or Q0.
7 to control the direction control, sometimes this is because in the manual subprogram contain direction, cause the program to control conflict, so here Y using single phase 1 output, debugging results are stable.
The rest of the speed of motor, and worldwide options for some general Settings.
The author tried to achieve Y variable motion, using the configuration of the relative and absolute motion subroutine, with variable speed and real-time change the end position, the result is a Y no action, so with the relative and absolute can't control a numerical real-time speed and position of the movement of change, so the final choice a little move to realize the function of the variable speed)
and then started to write the main program: this is the author of the original program, 200 smart did not develop the corresponding function, mitsubishi PLC has a circular arc interpolation function, the author did not contact with mitsubishi PLC controller
, PLC by looking at the data and the principle of circular arc interpolation, the two methods are compared, the principle of circular arc interpolation function is to circle is decomposed into N section of line drawing, the control error in a certain scope, and the above method introduced in terms of pure mathematics is quite perfect, but there are disadvantages, it depends on the perfect interrupt operation time and speed on the X direction, if the design of operation time is longer, the Y axis acceleration step will lose more, deceleration will overshoot is more, short operation time of CPU demand is higher, the X direction step too fast will lead to lose more, also is a floating-point arithmetic, by every step itself is a little lost.
although there are so many defects in theory, but as a result of 10 ms operation clearance time is very short and walking on the X axis of slower, actual go round very smooth close to perfect circle.
everyone should read this article can do a lot of curve programming painting, oneself want to draw graphics, but according to the function of the complexity and the difficulty of the derivative makes programming the difficult easy degree of difference, draw a love, can challenge a try the following figure.
The program I will in the next article to you for reference.
As we have known for quite some time, the success of Coolmay in the future will depend greatly on our ability to strike a balance between valuable human insight and interaction with technology.
If you are interested in , click Coolmay PLC to see some items with features that you will be amazed at.plc manufacturers
provider at Coolmay PLC offers a wide variety of in many options. quality is absolutely ensured if you choose us. welcome to visit our factory.
plc manufacturers developed from Shenzhen Coolmay Technology Co., Ltd. ’s unique skills in high technology has helped to produce plc manufacturersprogrammable control systems
Overall, plc manufacturers may be a great way for manufacturers to expand their use of technology, but the price could present a significant hurdle for some businesses.