Next Article in Journal
Microstructural Investigations of Low Temperature Joining of Q&P Steels Using Ag Nanoparticles in Combination with Sn and SnAg as Activating Material
Next Article in Special Issue
Improved Safety Analysis Integration in a Systems Engineering Approach
Previous Article in Journal
Multi-Searcher Optimization for the Optimal Energy Dispatch of Combined Heat and Power-Thermal-Wind-Photovoltaic Systems
Previous Article in Special Issue
Metamodelling for Design of Mechatronic and Cyber-Physical Systems
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

MC_MoveAbsolute() 4th Order Real-Time Trajectory Generation Function Algorithm and Implementation

by
Krzysztof Pietrusewicz
*,
Paweł Waszczuk
and
Michał Kubicki
Department of Industrial Automation and Robotics, West Pomeranian University of Technology, 70-310 Szczecin, Poland
*
Author to whom correspondence should be addressed.
Appl. Sci. 2019, 9(3), 538; https://doi.org/10.3390/app9030538
Submission received: 30 November 2018 / Revised: 25 January 2019 / Accepted: 28 January 2019 / Published: 5 February 2019

Abstract

:

Featured Application

The theoretical results and practical implementation of the trajectory generator presented in this article are the outcome of two research projects: The first was issued by the Polish Ministry of Science and Higher Education and the second one was part of the European Union’s 7th Framework Programme (see Funding Section).

Abstract

This paper presents the issue of generating motion trajectories in a digital servo drive in accordance with the PLCopen Motion Control standard. This standard does not limit the details of motion generation in the electromechanical systems, but indicates its interface and set of necessary parameters. Moreover, it is placed within a state machine, which allows the individual software elements to integrate with it seamlessly. This work discusses time-optimal point-to-point trajecto-ries, i.e., the initial and final reference speeds are zero, and they are compliant with the MC_MoveAbsolute() function defined in the PLCopen Motion Control standard. The smoothness of the resulting trajectory can be attributed to the use of a fourth order trajectory generator, which defines the bounds up to snap – the second derivative of acceleration. One of the aims of this article was to bridge the theoretical aspect of trajectory generation with the algorithms practical implementation, by the means of PLC code generation using the MATLAB/Simulink package.

1. Introduction

Servo drive systems are exploited widely in industries due to their efficiency, high-performance in motion control, and fast response times to dynamic reference signals [1,2]. In order to comply with the technological requirements, modern automatic machines have to guarantee decent dynamics for position and velocity control of motors, these servo drives solutions are utilized in Computer Numerically Controlled (CNC) machining, robotics, factory automation, and many other areas.
The most common control scheme implemented in servo drives to control position and velocity is the cascade control algorithm [3]. Its task is to regulate current, velocity, and position of the motor in separate closed control loops, in order to minimize overshoot and reduce the influence of external disturbances.
Nowadays, an increasing number of commercial control system manufacturers provide open architecture systems [4], meeting the need to constantly improve the servo drives functionality. This approach allows for design, testing, and integration of new control algorithms and techniques such as control laws, multi-sensor integration, or Artificial Intelligence (AI).
Simultaneously, evolution of the servo drive system programming languages is progressing. Currently, most of the commercial systems allow the user to implement custom code in the native control structure. These modifications can be written in popular programming languages such as C, C++, or Structured Text (ST).
Automatic code generation [5] is one of the ideas which facilitates implementing the code in various industrial control platforms. It is based on text languages (C, ST) and allows to compile and transfer developed code or algorithms between devices of different classes and manufacturers with minimal effort on the programmer’s part.
In the following work, generation of motion profiles (especially position) for servo drives is considered. This is a crucial aspect of applications that demand a high motion fidelity, e.g., CNC feed drives and multi-axis manipulators. In this case, constraining the acceleration profile obtained by the second order trajectory generator leads to oscillations whenever the movement direction changes (i.e., zero crossing of set velocity). This is the main reason for using third and higher order trajectory generators, for defining constraints on jerk or snap [6].
This paper is organized as follows: Section 1 serves as a brief introduction to control of digital servo drives; Section 2 is devoted to PLCopen Motion Control, particularly to one of its motion functions—MC_MoveAbsolute(). Section 3 presents a step by step algorithm to find a motion profile with boundaries defined up to the fourth derivative of position, and the trajectory generator of the fourth order is described. This topic is expanded upon in Section 4, where a real-time calculation of the beforementioned profile is discussed. Finally, Section 5 puts these solutions in context of the Programmable Logic/Automation Controller (PLC/PAC) devices that are IEC 61131-3 compliant, while Section 6 summarizes the paper.

2. Trajectory Generation in Digital Servo Drives: PLCopen Motion Control

In References [6,7,8,9], trajectory generation algorithms used in motion solutions are presented. The dynamics of mechanical aspects of the systems are considered in order to develop a feedforward controller. The following work is further expanding the ideas presented in Reference [9], such that the mathematical foundation laid there could be implemented in a real-time system.
In Reference [10], the concept of utilizing the PLCopen Motion Control standard for controlling the digital servo drive of the CNC machine is given. In the PLCopen Motion Control standard, several states are defined that outline the operation of a digital servo drive. These states depict the actual status of the motion system, being the type of movement executed (if any), present errors, stopping, or awaiting commands from the control system. Of particular interest are the two states tied to the motion execution:
(a)
Discrete Motion – movement to a defined position;
(b)
Continuous Motion – movement without a setpoint (e.g., shaft rotating with set velocity).
The transition between particular states is achieved by calling related functions, e.g., MC_MoveAbsolute (absolute movement) or MC_MoveAdditive (additive moment in a specified direction). The entire state machine is presented in Figure 1.

MC_MoveAbsolute() – Function Description

This function block starts a controlled movement to a specified absolute position. All of the parameters needed to start the movement are transferred on a rising edge of the Execute input (Figure 2). The axis changes to the Discrete Motion state after all of them have been successfully transferred. Before the function block can be used for a real axis, the axis must be homed. States in which this function block can be used: Standstill, Discrete Motion, and Continuous Motion.
In the following figures, the timing diagrams for MC_MoveAbsolute() possible usage scenarios are shown. In Figure 3a, the first function block (MC_MoveAbsolute_0) stopped its movement before the second function block (MC_MoveAbsolute_1) was started. In Figure 3b, the second function block (MC_MoveAbsolute_1) was started before the first function block (MC_MoveAbsolute_0) completed its movement. In both cases, as seen in Figure 3a,b, the movements finish in the same position.

3. Fourth Order Position Profile Generation

In this work, the position profile will be understood as a setpoint trajectory with a sampling time specified for a real-time algorithm implementation. The following convention, adopted from [9], was used to denote the parameters: x – position, displacement (profile, m ); v – velocity (profile, m / s ); a – acceleration (profile, m / s 2 ); j – jerk (profile, m / s 3 ); d – derivative of jerk (profile, m / s 4 ); x ¯ , v ¯ , a ¯ , j ¯ , d ¯ – bound on | x | , | v | , | a | , | j | , | d | , respectively; t d ¯ , t j ¯ , t a ¯ , t v ¯ – time interval during in which | d | , | j | , | a | , | v | obtains its bound, respectively; T s – sampling time in seconds.
The fourth order position trajectory generation problem was considered within this document. One input was used to define the desired position (i.e., increment from an actual position to the new one) and another four input parameters described the movement profile including velocity, acceler-ation, jerk, and snap. These latter parameters described the boundaries which cannot be crossed while executing the movement. The generated trajectory was time-optimal, i.e., the position was reached in the shortest possible time. For simplicity we assumed that the shape of the profiles was symmetric no matter what the direction of movement was.
u = | [ x ¯ v ¯ a ¯ j ¯ d ¯ ] T |
The direction of movement can be calculated based on the following equation:
s d = sgn ( x ¯ )
where the s d variable equals 1 if the movement direction is positive, or 1 when it is negative.
While considering the real-time implementation with respect to sampling time of code execu-tion, it is necessary to round up calculated time values:
t c o r r = T s ceil ( t c a l c T s )
Fourth order trajectory profiles are shown in Figure 4.
In the following sections, calculations for the type of trajectory generation for MC_MoveAbsolute() are shown in an algorithmic way.

3.1. Calculation of Time td

The following equations are used for calculation of time t d ¯ which covers the duration of a single movement section with applied snap boundary (i.e., its constrained value), as in Figure 4.
t d ¯ d max = x ¯ 8 d ¯ 4
Rounding up (4) with respect to the sampling time Ts:
T s ceil ( t d ¯ d max T s ) = T s ceil ( x ¯ 8 d ¯ 4 T s )
d d = [ T s ceil ( x ¯ 8 d ¯ 4 T s ) x ¯ 8 ( T s ceil ( x ¯ 8 d ¯ 4 T s ) ) 4 ]
If the following Equation (7) holds true:
v ¯ v max = 2 x ¯ 8 ( T s ceil ( x ¯ 8 d ¯ 4 T s ) ) 4 [ T s ceil ( x ¯ 8 d ¯ 4 T s ) ] 3
Then:
d d 1 = d d
Otherwise:
t d ¯ v max = v ¯ 2 d ¯ 3
This rounded up with respect to the sampling time ( T s ) yields the following equation:
T s ceil ( t d ¯ v max T s ) = T s ceil ( v ¯ 2 d ¯ 3 T s )
Then:
d d 1 = [ T s ceil ( v ¯ 2 d ¯ 3 T s ) v ¯ 2 ( T s ceil ( v ¯ 2 d ¯ 3 T s ) ) 3 ]
If the following Equation (12) holds true:
a ¯ a max = v ¯ 2 ( T s ceil ( v ¯ 2 d ¯ 3 T s ) ) 3 [ T s ceil ( v ¯ 2 d ¯ 3 T s ) ] 2
Then:
d d 2 = d d 1
Otherwise:
t d ¯ a max = a ¯ d ¯ 2
This rounded up with respect to the sampling time ( T s ) yields the following equation:
T s ceil ( t d ¯ a max T s ) = T s ceil ( a ¯ d ¯ 2 T s )
Then:
d d 2 = [ T s ceil ( a ¯ d ¯ 2 T s ) a ¯ [ T s ceil ( a ¯ d ¯ 2 T s ) ] 2 ]
If the following Equation (17) holds true:
j ¯ j max = a ¯ ( T s ceil ( a ¯ d ¯ 2 T s ) ) 2 [ T s ceil ( a ¯ d ¯ 2 T s ) ]
Then:
d d 3 = d d 2
Otherwise:
t d ¯ j max = j ¯ d ¯
This rounded up with respect to the sampling time ( T s ) yields the following equation:
T s ceil ( t d ¯ j max T s ) = T s ceil ( j ¯ d ¯ T s )
Then:
d d 3 = [ T s ceil ( j ¯ d ¯ T s ) j ¯ T s ceil ( j ¯ d ¯ T s ) ]
Time t d ¯ is derived from Equation (21) as:
t d ¯ = d d 3 1
The next section shows how to evaluate value of time ( t j ¯ ).

3.2. Calculation of Time tj

When time ( t d ¯ ) is calculated, the very next step is to calculate the value of time ( t j ¯ ), while taking into account movement constraints and sampling time rounding of calculated values. The value t j ¯ means the time of jerk (3rd order derivative of position), as shown in Figure 4. Derivation of time ( t j ¯ ) starts from calculations:
P = 1 9 t d ¯ 2 Q = 1 27 t d ¯ 3 x ¯ 4 d d 3 [ 2 ] t d ¯ D = P 3 + Q 2 D = Q + D 3 t j ¯ j max = R P R 5 3 t d ¯
This rounded up with respect to the sampling time (Ts) yields the following:
T s ceil ( t j ¯ j max T s ) = T s ceil ( R P R 5 3 t d ¯ T s )
Then:
d d 4 = [ t d ¯ T s ceil ( t j ¯ j max T s ) 1 2 x ¯ t d ¯ { 4 t d ¯ 3 + ( T s ceil ( t j ¯ j max T s ) ) [ 8 t d ¯ 2 + ( T s ceil ( t j ¯ j max T s ) ) ( 5 t d ¯ + T s ceil ( t j ¯ j max T s ) ) ] } ]
If the following Equation (26) holds true:
v ¯ v max = d d 4 1 d d 4 3 [ 2 d d 4 1 2 + d d 4 2 ( 3 d d 4 1 + d d 4 2 ) ]
Then:
d d 5 = d d 4
Otherwise:
t j ¯ v max = 1 4 t d ¯ 2 + v ¯ d d 3 2 t d ¯ 1.5 t d ¯
This rounded up with respect to the sampling time ( T s ) yields the following:
T s ceil ( t j ¯ v max T s ) = T s ceil ( 1 4 t d ¯ 2 + v ¯ d d 3 2 t d ¯ 1.5 t d ¯ T s )
Then:
d d 5 = [ t d ¯ T s ceil ( t j ¯ v max T s ) v ¯ t d ¯ { 2 t d ¯ 2 + ( T s ceil ( t j ¯ v max T s ) ) [ 3 t d ¯ + T s ceil ( t j ¯ v max T s ) ] } ]
If the following Equation (31) holds true:
a ¯ a max = d d 5 3 d d 5 1 ( d d 5 1 + d d 5 2 )
Then:
d d 6 = d d 5
Otherwise:
t j ¯ a max = a ¯ d d 3 2 t d ¯ t d ¯
This rounded up with respect to the sampling time ( T s ) yields the following:
T s ceil ( t j ¯ a max T s ) = T s ceil ( a ¯ d d 3 2 t d ¯ t d ¯ T s )
Then:
d d 6 = [ t d ¯ T s ceil ( t j ¯ a max T s ) a ¯ t d ¯ [ t d ¯ + T s ceil ( t j ¯ a max T s ) ] ]
Time t j ¯ is derived from Equation (35) as:
t j ¯ = d d 6 2
The following section considers calculations of acceleration phase time ( t a ¯ ).

3.3. Calculation of Time ta

When times t d ¯ and t j ¯ are calculated, taking into account movement constraints and sam-pling time rounding of calculated values, the next step is to calculate value of time ( t a ¯ ). This means the time of acceleration (second order derivative of position), as shown in Figure 4. The derivation of time ( t a ¯ ) starts from the following calculations:
c = [ d d 6 1 ( d d 6 1 + d d 6 2 ) 3 d d 6 1 { 2 d d 6 1 2 + d d 6 2 ( 3 d d 6 1 + d d 6 2 ) } 2 d d 6 1 { d d 6 1 [ 4 d d 6 1 2 + d d 6 2 ( 8 d d 6 1 + 5 d d 6 2 ) ] + d d 6 2 3 } ]
And:
t a ¯ a max = 1 2 c 2 + c 2 2 4 c 1 ( c 3 x ¯ d d 6 3 ) c 1
This rounded up with respect to the sampling time ( T s ) yields the following:
T s ceil ( t a ¯ a max T s ) = T s ceil ( 1 2 c 2 + c 2 2 4 c 1 ( c 3 x ¯ d d 6 3 ) c 1 T s )
Then:
d d 7 = [ t d ¯ t j ¯ T s ceil ( t a ¯ a max T s ) x ¯ ( T s ceil ( t a ¯ a max T s ) ) [ c 1 ( T s ceil ( t a ¯ a max T s ) ) + c 2 ] + c 3 ]
If the following Equation (41) holds true:
v ¯ v max = d d 7 4 d d 7 1 [ d d 7 1 ( 2 d d 7 1 + 3 d d 7 2 + d d 7 3 ) + d d 7 2 ( d d 7 2 + d d 7 3 ) ]
Then:
d d 8 = d d 7
Otherwise:
t a ¯ v max = d d 6 1 [ d d 6 1 ( 2 d d 6 1 3 d d 6 2 ) d d 6 2 2 ] + v ¯ d d 6 3 d d 6 1 ( d d 6 1 + d d 6 2 )
This rounded up with respect to the sampling time ( T s ) yields the following:
T s ceil ( t a ¯ v max T s ) = T s ceil ( d d 6 1 [ d d 6 1 ( 2 d d 6 1 3 d d 6 2 ) d d 6 2 2 ] + v ¯ d d 6 3 d d 6 1 ( d d 6 1 + d d 6 2 ) T s )
Then:
d d 8 = [ t d ¯ t j ¯ T s ceil ( t a ¯ v max T s ) v ¯ t d ¯ { t d ¯ [ 2 t d ¯ + 3 t j ¯ + T s ceil ( t a ¯ v max T s ) ] + t j ¯ [ t j ¯ + T s ceil ( t a ¯ v max T s ) ] } ]
Time t a ¯ is derived from Equation (45) as:
t a ¯ = d d 8 3
The following section considers further calculations of the fourth order trajectory profile.

3.4. Final Calculation of Movement Profile Times and Direction

Final calculations (including time of constant velocity movement ( t v ¯ )) start with:
t v ¯ v max = x ¯ d d 8 4 [ t a ¯ ( c 1 t a ¯ + c 2 ) + c 3 ] v ¯
This rounded up with respect to the sampling time ( T s ) yields the following:
T s ceil ( t v ¯ v max T s ) = T s ceil ( x ¯ d d 8 4 [ t a ¯ ( c 1 t a ¯ + c 2 ) + c 3 ] v ¯ T s )
Then:
d d 9 = [ t d ¯ t j ¯ t a ¯ T s ceil ( t v ¯ v max T s ) s d x ¯ t a ¯ ( c 1 t a ¯ + c 2 ) + c 3 + ( T s ceil ( t v ¯ v max T s ) ) t d ¯ [ t d ¯ ( 2 t d ¯ + 3 t j ¯ + t a ¯ ) + t j ¯ ( t j ¯ + t a ¯ ) ] ]
Where s d is calculated in Equation (2).
The column vector in Equation (49) is the final part of the fourth order trajectory profile generation. Now we have all the time values necessary to create the movement profile based on the parameters given by the user. This part of the algorithm is called the trajectory planner. The next part of the algorithm is called the profile generator. It is described in the following section and its purpose is to generate a movement profile out of the times t d ¯ , t j ¯ , t a ¯ , t v ¯ were calculated in previous sections.

4. Generation of Profile

The generation of a movement profile starts with the calculation of switching times t 0 t 15 as shown in Figure 4:
t 16 = [ 0 0 0 0 1 0 0 0 1 1 0 0 2 1 0 0 2 1 1 0 3 1 1 0 3 2 1 0 4 2 1 0 4 2 1 1 5 2 1 1 5 3 1 1 6 3 1 1 6 3 2 1 7 3 2 1 7 4 2 1 8 4 2 1 ] [ t d ¯ t j ¯ t a ¯ T s ceil ( t v ¯ v max T s ) ]
For simplicity, we can assume:
t v ¯ T s ceil ( t v ¯ v max T s )
Then Equation (50) can be rewritten in the following form:
t 16 = S M 4 [ t d ¯ t j ¯ t a ¯ t v ¯ ]
where S M 4 describes the switching matrix for the fourth order trajectory profile generation. After these calculations, the following holds true as shown in Figure 5:
t 16 = [ t 0 t 1 t 2 t 3 t 4 t 5 t 6 t 7 t 8 t 9 t 10 t 11 t 12 t 13 t 14 t 15 ] = [ 0 t d ¯ t d ¯ + t j ¯ 2 t d ¯ + t j ¯ 2 t d ¯ + t j ¯ + t a ¯ 3 t d ¯ + t j ¯ + t a ¯ 3 t d ¯ + 2 t j ¯ + t a ¯ 4 t d ¯ + 2 t j ¯ + t a ¯ 4 t d ¯ + 2 t j ¯ + t a ¯ + t v ¯ 5 t d ¯ + 2 t j ¯ + t a ¯ + t v ¯ 5 t d ¯ + 3 t j ¯ + t a ¯ + t v ¯ 6 t d ¯ + 3 t j ¯ + t a ¯ + t v ¯ 6 t d ¯ + 3 t j ¯ + 2 t a ¯ + t v ¯ 7 t d ¯ + 3 t j ¯ + 2 t a ¯ + t v ¯ 7 t d ¯ + 4 t j ¯ + 2 t a ¯ + t v ¯ 8 t d ¯ + 4 t j ¯ + 2 t a ¯ + t v ¯ ]
Movement starts in time ( t 0 ), while time moment ( t 15 ) is the endpoint of the generated move-ment.
t f i n a l = t 16 16 = 8 t d ¯ + 4 t j ¯ + 2 t a ¯ + t v ¯
Time values from Equation (53) are shown in the following Figure 5.

4.1. Execution of Trajectory Profile Generation

When the trajectory profile generation is executed (i.e., by the user) and output of the reference position trajectory has started, then the generation of snap profile is based on the following calcula-tions.
When:
s t a r t = TRUE
Then:
d d l o c a l d d 9 5
The new value of t 16 is calculated based on Equation (52) and the resulting Equation (53). The variable s t a r t is set based on the algorithm shown in the following part of this subsection.
Until:
t e x e c t 16 1
Then:
p 1 = 0
When:
t e x e c > t 16 1
Then:
p 1 = d d 9 5
where t e x e c stands for the actual profile generation execution time. Calculations of p 2 p 16 values are based on the following conditions/equations:
I f t e x e c t 16 2 , p 2 = 0 I f t e x e c > t 16 2 , p 2 = d d 9 5
Which gives the following algorithm:
FOR j = 1 16 , I f t e x e c t 16 j , p j = 0 I f t e x e c > t 16 j , p j = d d 9 5
p 1 p 16 are calculated iteratively in each time sample of algorithm execution. Then the actual value/shape of derivative of jerk signal is calculated with the following equation:
p d j e r k = d i r [ ( p 1 p 2 p 3 + p 4 ) + + ( p 5 + p 6 + p 7 p 8 ) + + ( p 9 + p 10 + p 11 p 12 ) + + ( p 13 p 14 p 15 + p 16 ) ]
where the d i r variable stands for direction of movement. It is a two-valued variable:
d i r = { 1 , 1 }
calculated with Equations (65)–(68).
When the previous trajectory profile generation is finalized, i.e., time of execution ( t e x e c ) is greater than the sum of t f i n a l [ s ] calculated with Equation (54) and some non-zero settling time ( T s e t [ s ] ) has passed, then the system is ready for a new trajectory generation:
r e a d y = TRUE
Determining direction of movement for Equation (63) starts with verifying the condition:
d i r c a l c , k = ( d i r > 0 ) A N D ( r e a d y = TRUE ) A N D N O T ( e n a b l e = TRUE )
Input E N = TRUE means that the user wishes for execution of the trajectory profile calculation (and profiled movement generation) and information about the readiness of the module for calculations is passed from the input variable r e a d y to the variable E N s t a r t . The rising edge of the condition:
( d i r c a l c , k 1 ) O R ( E N s t a r t )
enables determination of direction, i.e., calculation of variable d i r :
I F d i r k 1 0 T H E N d i r k = 1 E L S E d i r k = 1
Equation (68) is used when we want to switch operation mode of the movement, i.e., motor/servo is mounted in an opposite direction.

4.2. Generation of Start Signal

Generation of the s t a r t signal that triggers Equation (56) and results in a new value of the t 16 variable (calculated based on Equation (52) and consequently Equation (53)) is connected with the equation:
I F ( E N s t a r t k E N s t a r t k 1 ) > 0 T H E N G e n S t a r t k = 1
The same s t a r t variable is used for triggering new profile calculations (Equations (1)–(53)).
s t a r t k = G e n S t a r t k 1

4.3. Calculation of Execution Time

Calculation of trajectory profiling execution time ( t e x e c ) is based on the following expressions:
I F ( G e n S t a r t k 0.5 ) T H E N ( t e x e c , k = T s 2 ) E L S E ( t e x e c , k = t e x e c , k + T s ) t e x e c , k = t e x e c , k 1
This finishes the algorithm of trajectory profile generation. The next step is to calculate actual values out of the process involving integrating snap signal values. It is shown in the next subsection.

4.4. Generation of Motion Profile Step

To output the motion profile of all the derivatives and the position itself, the following steps need to be executed in a real-time control platform:
  • Reference signal d k (derivative of jerk/snap) is the zero-order-hold sampled value of p d j e r k variable.
  • Reference signal j k (jerk) is the numerically integrated value of signal d k  with respect to the sampling time (Ts):
    j k = T s d k 1 + j k 1
  • Reference signal a k (acceleration) is the numerically integrated value of signal j k with respect to the sampling time ( T s ):
    a k = T s j k 1 + a k 1
  • Reference signal v k (velocity) is the numerically integrated value of signal a k with respect to the sampling time ( T s ):
    v k = T s a k 1 + v k 1
  • Reference signal x k (position) is the numerically integrated value of signal v k with respect to the sampling time ( T s ):
    x k = T s v k 1 + x k 1
These steps finish the trajectory generation procedure.

5. Implementation of Trajectory Generator According to IEC 61131-3

The proposed algorithm was prepared to be transferrable to real-time implementation (e.g., PLC/PAC), which could later be used in industrial control platforms.
The algorithm was divided into the following sections:
  • Plan Trajectory (Figure 6) – Equations (1)–(49);
  • Generate profile (Figure 6) – Equations (50)–(71); while
  • Generate Motion (Figure 6) subsystem calculates Equations (72)–(75).
In Figure 7, two examples of generated trajectories are shown:
The function blocks code for the 4th order trajectory generator is presented in Figure 8, with the Simulink model presented in Figure 6 serving as a base for this conversion. Structured text code generated with a Simulink PLC Coder is about 900 lines long, and the total memory allocated for this function block in PLC is 3 kB. This means that the devised solution is implementable in the majority of PLC/PAC controllers which are IEC-61131-3 [11,12] standard compliant.

6. Summary

The article presents, in a step by step manner, the procedure for implementation of a 4th order trajectory generator that mirrors the MC_MoveAbsolute() function. Due to the straightforward nature of Equations (1)–(75), it is easily implementable in any of the available textual or graphical programming languages for real-time control systems.
The implementation of the presented algorithm is possible in control systems adhering to the IEC 61131-3 standard (e.g., PLC), and its source code was generated as a result of applying the fast prototyping paradigms, i.e., it was generated from the Simulink model. As an example, generated profiles are given with different parameters (i.e., boundaries). It is also possible to generate motion profiles of lower orders than fourth—the algorithm itself is scalable and following the procedure presented here will lead to obtaining simpler solutions constrained on third or second derivatives.
The most important contribution of this work is the unique nature of the presented approach, as it allows for practical implementation of this algorithm in commonly used real-time control systems.
The algorithm presented here is fully parametrized. It can be fully integrated by way of interfaces and its functionality, with other motion control features (i.e., collision avoidance or trajectory generation profile correction). As proposed in this paper, the implementation of MC_MoveAbsolute() is parametrized through its inputs (as it can be found in all functions and function blocks in graphical IEC 61131-3 compliant programming languages). Modularity of the approach enables the user to combine a proposed solution with an extension boom elasticity estimation feature (loader or forestry cranes applications) or dynamic collision avoidance (multi-axis serial robotic manipulators).
The function presented here can be implemented without any problems in all PLC/PAC-based control systems. The short sampling time (not more than 200 microseconds) requirement is fulfilled by most available control platforms. In the case of PLC/PACs with higher sampling times proposed, the algorithm can be extended with sampling time correction. In other cases, the integer multiple of sampling time requirement needs to be fulfilled by all times for t0t15 times in Equation (53).

Author Contributions

Conceptualization, K.P. and M.K.; data curation, M.K.; formal analysis, P.W. and M.K.; funding acquisition, K.P.; investigation, K.P., P.W. and M.K.; methodology, K.P. and M.K.; project administration, K.P.; resources, K.P.; software, K.P.; supervision, K.P.; validation, P.W. and M.K.; visualization, P.W.; writing—original draft, K.P., P.W. and M.K.; writing—review and editing, K.P. and M.K.

Funding

This research was partially funded by: (a) Ministerstwo Nauki i Szkolnictwa Wyższego, grant number R03 042 02, (b) Ministerstwo Nauki i Szkolnictwa Wyższego, grant number N N502 336936 and, (c) Marie Curie 7PR, FP7-PEOPLE-2012-IAPP (Industry-Academia Partnerships and Pathways) grant number 324496.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Biaggiotti, L.; Melchiorri, C. Trajectory Planning for Automatic Machines and Robots; Springer: Berlin/Heidelberg, Germany, 2008; ISBN 978-3-540-85628-3. [Google Scholar]
  2. Pillay, P.; Krishnan, R. Application Characteristics of Permanent Magnet Synchronous and Brushless dc Motors for Servo Drives. IEEE Trans. Ind. Appl. 1991, 27, 986–996. [Google Scholar] [CrossRef]
  3. Mariethoz, S.; Domahidi, A.; Morari, M. High-bandwidth explicit model predictive control of electrical drives. IEEE Trans. Ind. Appl. 2012, 48, 1980–1992. [Google Scholar] [CrossRef]
  4. Gu, J.S.; De Silva, C.W. Development and implementation of a real-time open-architecture control system for industrial robot systems. Eng. Appl. Artif. Intell. 2004, 17, 469–483. [Google Scholar] [CrossRef]
  5. Moreira, T.G.; Wehrmeister, M.A.; Pereira, C.E.; Pétin, J.F.; Levrat, E. Automatic code generation for embedded systems: From UML specifications to VHDL code. In Proceedings of the 2010 8th IEEE International Conference on Industrial Informatics, Osaka, Japan, 13–16 July 2010; pp. 1085–1090. [Google Scholar] [CrossRef]
  6. Lambrechts, P.; Boerlage, M.; Steinbuch, M. Trajectory planning and feedforward design for high performance motion systems. In Proceedings of the 2004 American Control Conference, Boston, MA, USA, 30 June–2 July 2004; Volume 5, pp. 4637–4642. [Google Scholar] [CrossRef]
  7. Boerlage, M.; Steinbuch, M.; Lambrechts, P.; van de Wal, M. Model-based feedfordward for motion systems. In Proceedings of the IEEE Conference on Control Applications, Istanbul, Turkey, 25 June 2003; Volume 2, pp. 1158–1163. [Google Scholar]
  8. Boerlage, M. MIMO jerk derivative feedforward for motion systems. In Proceedings of the 2006 American Control Conference, Minneapolis, MN, USA, 14–16 June 2006; pp. 3892–3897. [Google Scholar] [CrossRef]
  9. Lambrechts, P.; Boerlage, M.; Steinbuch, M. Trajectory planning and feedforward design for electromechanical motion systems. Control Eng. Pract. 2005, 135, 145–157. [Google Scholar] [CrossRef]
  10. Pietrusewicz, K. Multi-degree of freedom robust control of the CNC X-Y table PMSM-based feed-drive module. Arch. Electr. Eng. 2012, 61. [Google Scholar] [CrossRef]
  11. Programmable Controllers-Part 3: Programming Languages, IEC 61131-3:2013; International Electrotechnical Commission, 2013.
  12. John, K.H.; Tiegelkamp, M. IEC 61131-3: Programming Industrial Automation Systems: Concepts and Programming Languages, Requirements for Programming Systems, Decision-Making Aids; Springer: Heidelberg, Germany, 2010; Volume 2, ISBN 978-3-642-12014-5. [Google Scholar]
Figure 1. PLCopen Motion Control standard state execution state diagram.
Figure 1. PLCopen Motion Control standard state execution state diagram.
Applsci 09 00538 g001
Figure 2. PLCopen Motion Control MC_MoveAbsolute()function block.
Figure 2. PLCopen Motion Control MC_MoveAbsolute()function block.
Applsci 09 00538 g002
Figure 3. MC_MoveAbsoluteuse() example. (a): first use scenario; (b): second use scenario.
Figure 3. MC_MoveAbsoluteuse() example. (a): first use scenario; (b): second use scenario.
Applsci 09 00538 g003
Figure 4. Fourth order trajectory profiles in point-to-point movement (MC_MoveAbsolute).
Figure 4. Fourth order trajectory profiles in point-to-point movement (MC_MoveAbsolute).
Applsci 09 00538 g004
Figure 5. Fourth order trajectory profiles in point-to-point movement with profile times shown.
Figure 5. Fourth order trajectory profiles in point-to-point movement with profile times shown.
Applsci 09 00538 g005
Figure 6. MATLAB/Simulink implementation of 4th order profile generator.
Figure 6. MATLAB/Simulink implementation of 4th order profile generator.
Applsci 09 00538 g006
Figure 7. Two examples of generated trajectory profiles: (a,b) derivative of jerk, (c,d) jerk, (e,f) acceleration, (g,h) velocity, (i,j) position.
Figure 7. Two examples of generated trajectory profiles: (a,b) derivative of jerk, (c,d) jerk, (e,f) acceleration, (g,h) velocity, (i,j) position.
Applsci 09 00538 g007
Figure 8. Code fragment generated via Simulink PLC Coder.
Figure 8. Code fragment generated via Simulink PLC Coder.
Applsci 09 00538 g008

Share and Cite

MDPI and ACS Style

Pietrusewicz, K.; Waszczuk, P.; Kubicki, M. MC_MoveAbsolute() 4th Order Real-Time Trajectory Generation Function Algorithm and Implementation. Appl. Sci. 2019, 9, 538. https://doi.org/10.3390/app9030538

AMA Style

Pietrusewicz K, Waszczuk P, Kubicki M. MC_MoveAbsolute() 4th Order Real-Time Trajectory Generation Function Algorithm and Implementation. Applied Sciences. 2019; 9(3):538. https://doi.org/10.3390/app9030538

Chicago/Turabian Style

Pietrusewicz, Krzysztof, Paweł Waszczuk, and Michał Kubicki. 2019. "MC_MoveAbsolute() 4th Order Real-Time Trajectory Generation Function Algorithm and Implementation" Applied Sciences 9, no. 3: 538. https://doi.org/10.3390/app9030538

APA Style

Pietrusewicz, K., Waszczuk, P., & Kubicki, M. (2019). MC_MoveAbsolute() 4th Order Real-Time Trajectory Generation Function Algorithm and Implementation. Applied Sciences, 9(3), 538. https://doi.org/10.3390/app9030538

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop