1. Introduction
Wire + arc additive manufacturing (WAAM) has been drawing attention from industries and researchers around the world. High deposition rate, geometry flexibility, energy efficiency and the low initial cost of equipment and consumables are some of the attractive characteristics of this process. Based on arc welding processes, for which the technology is reasonably established, and, consequently, more acceptable by end-users, WAAM uses readily available consumables, which have been standardized and tested in the field. Notwithstanding, the trajectory planning (also known as path planning) for the deposition torch is one of the key factors for the success of this technology, although not always commented on, and sometimes even neglected. Trajectory planning, being a key factor, in turn, encompasses some complexity. The operational optimization of torch movements (in terms of building time, number of stops and restarts and overcoming of geometric obstacles) is the first function of trajectory planning. However, other roles are expected from efficient trajectory planning. According to Rodrigues et al. [
1], mediocre planning may result in porosity, internal defects, lack of fusion between adjacent beads and high residual stresses. Debroy et al. [
2] cited that printed piece anisotropy can be avoided and/or eliminated with good strategies for torch path.
Nonetheless, additive manufacturing trajectory is basically planned as a stack of flat slices that configure the geometry to be printed. Additive manufacturing slices can be defined as thin thickness, flat layers that are geometrically described by the top view cross-section. The layers are usually generated using slicing softwares, which basically is responsible for the conversion of a 3D object model to specific instructions for the printer. The top view cross-section of the layers delineates geometric shapes with different sizes and outline complexities. In relation to bulky parts, geometric complexity is an obstacle to be overcome. An example of printing difficulties is found in slices composed by nonconvex cross-sectional polygons, with or without obstacles (such through- or blind-holes of different shapes).
According to Gerdjikov and Wolff [
3], convex polygons are those in which every internal angle is less than 180°, as illustrated in
Figure 1a. Note that in the nonconvex configuration,
Figure 1b, at least one internal angle is between 180° and 360°, so that points of a line segment between two points on the polygon boundary of the polygon can be located outside the polygon. In the case of nonconvex geometries, inefficient trajectories can lead to voids inside the printed part [
4]. When holes are presented, “empty” trajectories (paths with no deposition) are used to avoid this obstacle; low surface quality due to geometric irregularities caused by frequent arc extinction and reignition are the consequences [
5].
From current literature, there are at least three classical pattern strategies for trajectory planning applicable to WAAM, namely, raster, zigzag and contour [
6,
7,
8]. However, due to the geometric complexities, some of these strategies have been adapted towards layer geometry simplification (polygonal division) or merged with others (hybrid trajectory planning strategies), sharing the merits of various approaches.
Figure 2 illustrates examples of classical and hybrid strategies adopted by different researchers. The raster strategy is likely the most basic one (
Figure 2a) and can be uni- or bi-directional. If proper parametrization is applied to the several starts and stops when raster strategy is employed, this becomes a flexible strategy. Material and heat accumulation can be eliminated by setting idle times between stops and starts. To obtain a continuous deposition per layer, an old concept used in WAAM to fill a polygon is based on a zigzagging pattern. As illustrated in
Figure 2b, with a one-way movement in a given direction up to reach a polygon border, the torch, then, faces the edge of this border for a given spacing value, before inverting the trajectory direction (in cycled pattern). Wang et al. [
6] claim process efficiency decay off this approach, due to arc extinctions that forcedly occur in parts with more complex geometries (such as internal holes). The likely first adaptation of the zigzag strategy carried out in WAAM was proposed several years before by Dwivedi and Kovacevic [
7]. This strategy was called continuous (
Figure 2c), consisting of zigzag trajectories planned to leave staggered gaps between the paths, in such a way that the gaps were sequentially closed by another zigzag trajectory in the inversed direction. It is noteworthy that the continuous strategy can be hybridlike adapted to other strategies, for example, spiral, as illustrated in
Figure 2d.
Another adaptation to the zigzag strategy was proposed in Wang et al. [
6] and illustrated in
Figure 2e. The authors proposed a deposition trajectory strategy based on the water-pouring rule. In summary, the algorithm for deposition strategy is based on the identification of inflection points (such as nonconvex angles) in the geometry of the polygon that represents layer area (see this approach description in
Figure 2e). Initially, the torch follows a zigzag pattern until an inflection point is met. Then, torch movement direction is reversed, so that the new shape (a partition of the polygon) after the inflection point is filled using the same pattern. However, a return line is planned so that the torch can escape from the bottom of the polygonal partition. The same procedure is maintained until all polygon partitions are filled.
In the contour strategy,
Figure 2f,g, the arc torch follows the subsequent inscribed edges of an external polygon, through parallel displacements (pre-established offsets) relative to the polygon edges. The torch sweep can follow either parallel (2f) or spiral (2g) patterns, in either in-outward or out-inward orientation. However, in the case of parallel scanning, the transition between two edges is made by connecting its starting points, as indicated by red arrows in
Figure 2f. These contour strategies are easily applied to convex polygons, but may not perform satisfactorily when it comes to nonconvex polygons. According to Ding et al. [
8] and Xiong et al. [
11], problems such as voids inside the parts or at very acute angled corners, and heat accumulation in the center of the workpiece (which cause residual stress and/or deformation) are recurrent in these strategies. The out-inward scanning direction is prone to generate material accumulation at the center, unless a programmed progressive adjustment of the parameters is made.
Skeletal structures (
Figure 2h,i) are contour adaptation approaches to solve the limitations of nonconvex shapes. Ding et al. [
8] proposed the medium axis transformation (MAT) method for solid parts (
Figure 2h), with and without holes, and for thin-walled parts. Applying MAT, they skeletonized two-dimensional geometry and performed contour-like in-outward oriented sweeps. However, this method presented noncontinuous trajectories for bulky parts, with several arc stops and restarts to avoid the torch depositing beyond the polygon edges (these interruptions are emphasized by green/red circles in
Figure 2h). Ding et al. [
9] improved his approach and presented an adaptive medial axis transformation (A-MAT), by adapting the spacing between contours around the polygon skeleton and through re-parametrization (noticeable by gap variations between lines), resulting in continuous paths (
Figure 2i).
Unlike the classical strategies presented so far, the polygon division strategy (
Figure 2j) aims to reduce the complexity of nonconvex geometries by partitioning them into simpler polygons, for subsequent deposition planning, as also proposed by Dwivedi and Kovacevic [
7]. According to the authors, each simple polygon is filled with one of the continuous strategies, yet in such a way that the trajectories are interconnected as a single path. However, with an increasing complexity of the initial polygon, its decomposition can result in simple but not necessarily convex polygons (see partition 2 in
Figure 2j, as an example). To work around this problem, Ding et al. [
10] performed a similar approach, but dividing the nonconvex polygon into only convex polygons (
Figure 2k). Each sub-polygon was filled with a continuous strategy (in this case, a hybrid contour and zigzag), interconnected as a single path. Still using the same strategy, Liu et al. [
4] segmented a nonconvex polygon into convex polygons to apply the contour and zigzag deposition strategy, but focusing on surfaces with corners of sharp angles, as illustrated in
Figure 2l. In this strategy, a calculated displacement of the vertex of acute angles was applied to correct voids left during trajectory planning by contour strategy. However, this strategy of dividing polygons also presents difficulties when manufacturing parts with circular holes [
6].
With a similar view of that described above, Wang et al. [
6] cite that, although there are many strategy planning strategies, these strategies can be classified into three categories, according to their origin and evolution. The first class originated in the raster method and subsequently developed into the zigzag, continuous line and convex polygon methods. The second category originated from the contour method, which in turn developed into the medial axis transformation and adaptive medial axis transformation methods. The third category is the hybrid method that combines the advantages of these previous two categories by applying them in different regions.
In general, the strategies above mentioned (among others that can be also applied and not openly reported) were developed as solutions to solve deposition flaws in layer building for specific cases. New setbacks always appear when trying to replicate them in other geometries. In addition, there is no concern in trying an optimization of the trajectory planning (in terms of time or number of stops and restarts, for instance). In most cases they are based on a one only solution, with low path flexibilities (the flexibility is more trial and error related, mostly based on swapping from in-outward to out-inward direction in the contour strategy, or the change of the angle in the zigzag strategy, or even intercalating/bidirecting raster strategy). These remarks indicate that there is room for creating more strategies for generating trajectories for WAAM. Therefore, the objective of this work was to propose an alternative deposition strategy for WAAM, for which innovation would be its applicability in different and more complex geometries (higher flexibility), rather than being a solution for only one case. The objective extends to the use of the proposed strategy for trajectory optimization.
2. The Proposal of a Novel Strategy for WAAM Deposition: Pixel
The Pixel deposition trajectory strategy to be introduced in this work can be defined as a complex multitask procedure to carry out the trajectory planning of WAAM parts. The end-user, as a nonpassive agent, is required to input the height between layers, path widths, path overlapping and number of interactions and to take the final decision on the trajectory to adopt. The operation of the procedure is made through computational algorithms (heuristics), with accessible computational resources and tolerable computational time. A heuristic, or a heuristic technique, is defined in current literature as to optimization (for instance, according to Yang [
12]), as any approach aiming to find a trial and error solution that may not be optimal but is sufficient (acceptable), considering a reasonably practical timeframe. In a few words, the model layers in Pixel are fractioned in squared grids, over which the trajectory is planned. To model the problem, a set of dots is generated and distributed within the top-view cross-section outline of the slice, resembling pixels on a screen (a dot matrix to form a raster graphic, in other words, a grid composed of a collection of small squares). The useful intersections between the grid lines and the edges of the slice are hereafter referred to as nodes. The technique used in this Pixel strategy for optimization was based on creating a trajectory from a well-known route optimization named travelling salesman problem (TSP), whose challenge is to find the shortest yet most efficient route for the torch to take, given a list of specific positions. There might be other approaches for solving this problem, not yet explored in current literature on additive manufacturing. Unlike existing algorithms, the Pixel strategy uses an adapted greedy randomized adaptive search procedure (GRASP) metaheuristic to additive manufacturing. GRASP is aided by four distinct concurrent heuristics of trajectory planning, namely nearest neighbor, biased, alternate and random contour, and the 2-opt algorithm. This approach consists of iterations made up from successive constructions of randomized initial solutions (global search) and subsequent iterative improvements (local search). After all the recurrent loops, a trajectory is defined and written in machine code.
To detail the proposal, the Pixel strategy itself is flowcharted as in
Figure 3. A basic process chain for WAAM begins with a 3D CAD model that is converted into an AMF or STL format file, which is accordingly sliced by dedicated software, hereafter alluded to as the “printing process planning software” (PPPS). From a PPPS is expected more than the basic functions of slicing the model and generating a machine code for the WAAM printer. In general, before machine code generation, a proper PPPS should also define the tool path (trajectory) planning. The first steps of the process, i.e., reading the STL file from the 3D model, orientation optimization and introduction of the layer heights and digital slicing of the model, are usually common to traditional, yet comprehensive, printing process planning. They will not be discussed further here, keeping the arguments concentrated on the following four steps of the proposed Pixel torch trajectory planning:
1 Discretization of the layers (through distribution of dots all over the layer surfaces, i.e., modelling the environment as a grid);
2 Starting position definition and node connections (generating an initial trajectory);
3 Trajectory Optimization (recurrent start position choices and reconnections of the nodes from the trajectory generated in the previous step, in order to obtain the shortest path to be travelled by the torch);
4 Storage of the generated optimized trajectories (to compose a set of batches of trajectories to be selected and, accordingly, supply instructions to the printing machine, in the form of coordinates in an array).
These four steps are repeated over all layers generated by the slicing process (in the case of layers with the same cross section, a trajectory generated in the initial layer can be replicated to the others). After concluding the loop, the best (according to the criterion) stored array of coordinates is converted into G code (machine code), which is sent to the WAAM printer. The entire algorithm described here has been implemented in the open-source software Scilab.
2.1. Discretization of Layers and Node Indexing
The discretization process, as proposed here, consists of four phases, that is, insertion of offset contours in the sliced layers, generation of a grid to generate dots (these two first stages are demonstrated in
Figure 4), simplification of dots (as illustrated in
Figure 5) and indexing of nodes (as established in
Figure 6). In the first phase, the process provides a new contour to the original polygon (
Figure 4a) at an offset distance from the slice edges, represented by the letter “
v” in
Figure 4b, composed of a simplified shape (for example purposes). From this equidistance, an internal (inscribed) surface contour is created to reduce excess or avoid material shortages at the edges of the original layer shape (for other geometries rather than that in
Figure 4a, the offset would take another profile, yet keeping the same role). Then, in a second phase, equally spaced horizontal and vertical line segments (from the lower and most left positioned vertex of the offset contour) are virtually plotted over the plane, performing a grid. The intersections of these lines (blue dots in
Figure 4c) and between these lines and the edges of the offset (green dots in
Figure 4d) and the offset contour vertices (red dots in
Figure 4b), all together form the pixel dots. It is emphasized that the spacing value is an input to the algorithm in question, to be defined by the process analyst, and should be considered as the distance between two weld beads arranged side by side (considering potential overlapping). It is therefore justified that equidistance may not be obtained at the top and right edges of the offset contour.
It is important to emphasize that coincident dots may arise, due to layer topology and the spacing values of the segments, as illustrated in
Figure 5. In this example, the coincident dot arose because a straight segment (in yellow) of the grid crosses the offset contour (in red) at one of the vertices, which is also taken as an intersection of the discretization. There are cases where dots are coincident, or almost coincident, also highlighted in
Figure 5. Therefore, a simplification of the model should be applied. Only one of these overlapping dots is considered and the others are eliminated from the discretization, which reduces the processing time to generate the trajectory. In addition, nearby dots with Euclidean distance of up to 1.0 mm are likewise removed from the model, as they will not generate significant differences during deposition. Considering the elimination of dots created during the initial discretization, the remaining dots (useful dots) are going to be referred hereafter as nodes.
Given continuity to the discretization protocol, the assigned nodes are ordered from left to right and bottom to top and, following, indexed (coded) numerically in ascending order. This indexing of each node is already illustrated in
Figure 6, where
i1 represents the first node of the layer (with a respective coordinate). Accordingly, the following nodes in the same horizontal row are indexed in ascending order, arranged to the right, i.e., dot
in represents the last node of the first horizontal layer row and dot
in+1 represents the first node of the second horizontal layer row. Hence, the indexing resumes at the second row from the first column, following the same pattern until the last dot (
imax) is reached at the rightmost point of the utmost row.
2.2. Starting Position Definition and Node Connections to Define a Trajectory
The sets of nodes and their connections were modelled according to the travelling salesman problem (TSP). This approach is based on the problem of a traveling salesman who leaves an initial city and must visit all the cities programmed in a row and return to the city of departure. As a goal, he/she should plan the shortest route, however not going to a city already visited. In general, two solutions for the TSP are known. In the first, a start node is defined at random by a computer routine and a first route is generated, applying the rule of no-duplicated visits, followed by other routes improved by local search heuristics. The second solution would be to create alternative routes from different start nodes. By one means or the other (or even together), the best route is eventually provided. Aziz Ouaarab [
13] and Zia et al. [
14] showed the different approaches to solve the TSP in specific cases, such as railway track optimization, robot movement, vehicle routing, among others. Wasser et al. [
15], in turn, successfully applied heuristic of trajectory planning in additive manufacturing of polymers.
To simulate this problem as a base for the Pixel strategy, each node (the remaining dots) created on the surface (
Section 2.1) corresponds to a city of the TSP and the node connections resemble the path travelled by the salesmen, i.e., the deposition trajectory.
Figure 7 is a diagrammatic representation of this problem, in which the set of interconnected nodes i
s represented by
i1,
i2, i3, …, i16, where
i1 ≠
i2 ≠
i3 ≠… ≠ i16 for the case in which
16 is the total number of nodes of this example. Trajectory (
T) is represented by a set of connections between nodes, without repetitions, where
, for instance, represents an effective link between
node i1 and
node i5. Note that in this representation the last visited “city” (
i7) and the initial visited “city” (
i1) are not connected (even the first node is not visited again).
The distance between two
nodes ip and
iq is calculated by the vector distance between the two coordinates (
ipx,ipy) and (
iqx,,iqy)
,, as expressed in Equation (1), which represents the Euclidean distance (
d).
The total trajectory distance (
DT), the objective function, is calculated according to the summation of all connections between two nodes in
T, as described in Equation (2):
where
n represents the total number of connections between nodes in
T and
f represents the indexes of each connection.
In Pixel trajectory deposition strategy, different heuristics of trajectory planning were used for sequential node connections (sometimes referred to as heuristics for simplification) following the TSP principle. The four heuristics employed in the current work are denominated nearest neighbor, biased, alternate and random contour, and they are described in the next subsections. Their goal was to force, with each of the heuristics, so as to have access by the algorithms to some of the strategies shown in
Figure 2, yet under the concept of the Pixel strategy. For implementation of the heuristics in the Pixel strategy, a computer program was developed.
2.3. Trajectory Optimization
Trajectories in WAAM should preferably be continuous, or with minimal interruptions, to reduce manufacturing time and improve the surface homogeneity of the printed parts (the shorter the route, the better the objective function of the optimization). For this, the paths generated (node connections to define a trajectory) in the previous subsections must always connect neighboring nodes, yet never pass through nodes already “visited” or present path crossing (which will result in accumulation of material in these regions). In
Figure 13a, for example, the nearest neighbor heuristic presented path crossings, which showed the need for improvement. In the other heuristics, although they did not present path crossings, the algorithms could deliver trajectories with path crossings as a function of other starting nodes and/or higher geometry complexity. Paths with no deposition (“empty” trajectories) to avoid path crossing, in turn, can be adopted, however, at the expense of arc stops and starts (regions predisposed to imperfections) and potentially increased manufacturing time. Therefore, penalties are inserted in the algorithm when path crossings (and other constraints) are identified (first optimization constraint factor).
To perform optimization for the objective function, Equation (2), and constraints in the Pixel strategy, a local search through the 2-opt algorithm, commonly used as heuristics of improvements for TSP [
16], was initially applied. This improvement consisted of initially choosing two paths between the nodes of the generated trajectory and reversing their connections to verify if a reduction in path distance would occur.
Figure 14a presents an example where path 1 initially chosen by one sequential node connection heuristic was represented by
node A interconnected to
node B and path 2 represented by
node C interconnected to
node D. When applying the 2-opt algorithm, the chosen paths were undone and uncrossed, that is,
node A now generated a path connecting to
node C, and
node B generated a path interconnected to
node D, as illustrated in
Figure 14b. If there is a reduction in the Euclidean distance, the new solution is adopted, otherwise the swap is undone and another pair of neighboring nodes is chosen and the process is repeated over and over again. This operation is repeated until no further improvements occur with path crossings. With this, a great local solution is obtained.
Despite the good results obtained by the 2-opt heuristic, this technique is restricted to a maximum or minimum local only (such as entering a valley or climbing a peak of the search space). In order to allow exploration of other valleys/peaks in the space, the local search is boosted by previously using the metaheuristic greedy randomized adaptive search procedure (GRASP), which consists of a higher-level heuristic procedure designed to find a better solution to an optimization problem. GRASP basically consists of a multiboot iterative technique of global search from successively constructed randomized solutions and subsequent iterative improvements of the same. According to Sohrabi et al. [
17], each iteration performs two perfectly defined phases. According to these authors, the first phase creates viable solutions to the problem, which promotes diversity, and the second phase consists of the optimization from the created solutions.
Figure 15 shows the GRASP flowchart adapted to the Pixel strategy for WAAM, which starts with the input of the number of interactions from the process analyst. After a random selection for picking up the starting node, the algorithm performs the trajectory planning using the four heuristics presented in the previous section, that is, the nearest neighbor heuristic, the biased heuristic, the alternate heuristic and the random contour heuristic. After that, each of them is optimized with the 2-opt algorithm, which will result in four values of local minima. The lowest value obtained (shortest route, unless defined other objective function) is stored in an array of best values. Then, a subsequent interaction is performed until the number of interactions is zeroed out. In this application of GRASP, the loop resumes from the random selection of a new starting node, which allows diversity in the initialization phase and a global exploration of the search space.
One outstanding point of this adaptation is that GRASP has an array of better values and related metrics as outputs. At first, the process analyst chooses the trajectory that will print the part, usually based on the shortest distance, already avoiding the path crossings and node visit duplication. To monitor the functionality of the Pixel strategy, the algorithm delivers a report that relates the trajectories of the best value matrix to its heuristics of trajectory planning. With this, it is possible to check if there is tendency of one or more heuristics of trajectory planning to always generate the shortest routes (a self-learning evaluation for the process analyst).
This strategy is useful for the process analyst to make decisions systematically, considering that the algorithm can be executed with all four heuristic of trajectory planning, or only with the selected ones. The latter option reduces the computational time to generate the trajectories. As another alternative to reduce computational time, the algorithm’s stop criterion is optionally added for when the first trajectory without path crossings is found, as it would already be a viable trajectory for WAAM.