9
Parameter optimization for spray coating Alexander Kout * , Heinrich Müller Dortmund University of Technology, Informatik VII, Otto-Hahn-Str. 16, D-44227 Dortmund, Germany article info Article history: Received 14 August 2008 Received in revised form 26 February 2009 Accepted 3 March 2009 Available online 19 April 2009 Keywords: Robot path planning Thermal spray coating Optimization abstract The aim of planning path-oriented spray-coating processes is to find a time-dependent continuous sequence of spray gun configurations so that a coating of desired thickness is achieved when executing the sequence. A novel approach to solving the planning task, called ‘‘geometry-last”, is outlined which leads to a more general gun configuration cover problem. The gun configuration cover problem is to find a finite set of spray gun configurations, which minimizes the error between a target coating and the coat- ing induced by simultaneously activating those configurations. A suitable objective function for gun con- figuration covers is defined, and algorithmic solutions for the optimization problem are presented, including speed-up by hierarchization and use of graphics hardware. An experimental evaluation shows that good approximations of the desired coatings can be achieved within reasonable computing times. In contrast to other approaches, geometry-last gains additional flexibility required to find complex paths for free-form workpieces. Ó 2009 Elsevier Ltd. All rights reserved. 1. Introduction Path-oriented, computer-controlled manufacturing systems work by moving a tool along a path in order to affect a workpiece. Examples of production technologies where path-oriented systems are widely used include milling, grinding, and spraying. A central issue of path-oriented production is the generation of paths whose execution has the desired effect on the workpiece. For spray coat- ing, which is in the focus of this paper, a spray gun is moved along a path above the workpiece. In each configuration, which is defined by the position and orientation of the spray gun relative to the workpiece, coating material is transferred from the spray gun onto the workpiece. The desired effect on the workpiece is to minimize the error between the achieved coating thickness and the target thickness. Path planning is often performed heuristically without formal specification of the overall aim. However, as examples in the liter- ature show (cf. Section 3), a precise specification has the advantage that the structure of the computational problem can be analyzed. Based on the analysis, alternative solution methods can be found in a more systematic and comprehensive way than just by intui- tion. Although these may still be heuristic or approximative because of the inherent computational complexity of the task, the benefit is that knowledge about existing methods may be taken into account. A mathematically rigorous specification of path plan- ning in a technology-independent way has been presented by Kim et al. [7]. Based on this general view, this contribution starts with reflec- tions about separating path geometry from process-related param- eters in path planning. In path planning, the geometry of the path is usually more or less defined depending on the geometry of the workpiece, the tool, and the manufacturing machine, before pro- cess-related parameters like material properties of the workpiece or the tool are taken into account, which in particular have impli- cations on physical aspects such as speed or acceleration. This can be widely observed in milling, but applies to spray coating as well [1,5,11]. In this paper, a ‘‘path-geometry-last” alternative to this ‘‘path-geometry-first” strategy is proposed. The advantage of the geometry-last strategy is that the path can be defined in depen- dence on the process requirements. Other authors also have taken the requirement of path adaptation explicitly into account (cf. Sec- tion 3), but either observed high computational requirements, or restricted the paths to very special path patterns like a sequence of parallel path segments which limit the cases to which it can be applied. In contrast, the geometry-last approach outlined in this paper works for arbitrary paths on free-form surfaces. A crucial component of the geometry-last strategy is the so- called tool configuration cover problem. In the case of spraying, the tool configuration cover problem is to find a finite set of spray guns located over the workpiece surface, which minimizes the er- ror between a target coating and the coating induced by simulta- neously activating these guns. The tool configuration cover problem is of value for geometry-first as well as for geometry-last strategies. The formulation and solution of the tool configuration cover problem for spray coating – for which it is particular useful – is the main contribution of this paper. The tool configuration cover problem is specified as an optimization problem whose 0965-9978/$ - see front matter Ó 2009 Elsevier Ltd. All rights reserved. doi:10.1016/j.advengsoft.2009.03.001 * Corresponding author. Tel.: +49 231 755 6328; fax: +49 231 755 6321. E-mail address: [email protected] (A. Kout). Advances in Engineering Software 40 (2009) 1078–1086 Contents lists available at ScienceDirect Advances in Engineering Software journal homepage: www.elsevier.com/locate/advengsoft

Parameter optimization for spray coating

Embed Size (px)

Citation preview

Page 1: Parameter optimization for spray coating

Advances in Engineering Software 40 (2009) 1078–1086

Contents lists available at ScienceDirect

Advances in Engineering Software

journal homepage: www.elsevier .com/locate /advengsoft

Parameter optimization for spray coating

Alexander Kout *, Heinrich MüllerDortmund University of Technology, Informatik VII, Otto-Hahn-Str. 16, D-44227 Dortmund, Germany

a r t i c l e i n f o

Article history:Received 14 August 2008Received in revised form 26 February 2009Accepted 3 March 2009Available online 19 April 2009

Keywords:Robot path planningThermal spray coatingOptimization

0965-9978/$ - see front matter � 2009 Elsevier Ltd. Adoi:10.1016/j.advengsoft.2009.03.001

* Corresponding author. Tel.: +49 231 755 6328; faE-mail address: [email protected] (A. K

a b s t r a c t

The aim of planning path-oriented spray-coating processes is to find a time-dependent continuoussequence of spray gun configurations so that a coating of desired thickness is achieved when executingthe sequence. A novel approach to solving the planning task, called ‘‘geometry-last”, is outlined whichleads to a more general gun configuration cover problem. The gun configuration cover problem is to finda finite set of spray gun configurations, which minimizes the error between a target coating and the coat-ing induced by simultaneously activating those configurations. A suitable objective function for gun con-figuration covers is defined, and algorithmic solutions for the optimization problem are presented,including speed-up by hierarchization and use of graphics hardware. An experimental evaluation showsthat good approximations of the desired coatings can be achieved within reasonable computing times. Incontrast to other approaches, geometry-last gains additional flexibility required to find complex paths forfree-form workpieces.

� 2009 Elsevier Ltd. All rights reserved.

1. Introduction

Path-oriented, computer-controlled manufacturing systemswork by moving a tool along a path in order to affect a workpiece.Examples of production technologies where path-oriented systemsare widely used include milling, grinding, and spraying. A centralissue of path-oriented production is the generation of paths whoseexecution has the desired effect on the workpiece. For spray coat-ing, which is in the focus of this paper, a spray gun is moved alonga path above the workpiece. In each configuration, which is definedby the position and orientation of the spray gun relative to theworkpiece, coating material is transferred from the spray gun ontothe workpiece. The desired effect on the workpiece is to minimizethe error between the achieved coating thickness and the targetthickness.

Path planning is often performed heuristically without formalspecification of the overall aim. However, as examples in the liter-ature show (cf. Section 3), a precise specification has the advantagethat the structure of the computational problem can be analyzed.Based on the analysis, alternative solution methods can be foundin a more systematic and comprehensive way than just by intui-tion. Although these may still be heuristic or approximativebecause of the inherent computational complexity of the task,the benefit is that knowledge about existing methods may be takeninto account. A mathematically rigorous specification of path plan-ning in a technology-independent way has been presented by Kimet al. [7].

ll rights reserved.

x: +49 231 755 6321.out).

Based on this general view, this contribution starts with reflec-tions about separating path geometry from process-related param-eters in path planning. In path planning, the geometry of the pathis usually more or less defined depending on the geometry of theworkpiece, the tool, and the manufacturing machine, before pro-cess-related parameters like material properties of the workpieceor the tool are taken into account, which in particular have impli-cations on physical aspects such as speed or acceleration. This canbe widely observed in milling, but applies to spray coating as well[1,5,11]. In this paper, a ‘‘path-geometry-last” alternative to this‘‘path-geometry-first” strategy is proposed. The advantage of thegeometry-last strategy is that the path can be defined in depen-dence on the process requirements. Other authors also have takenthe requirement of path adaptation explicitly into account (cf. Sec-tion 3), but either observed high computational requirements, orrestricted the paths to very special path patterns like a sequenceof parallel path segments which limit the cases to which it canbe applied. In contrast, the geometry-last approach outlined in thispaper works for arbitrary paths on free-form surfaces.

A crucial component of the geometry-last strategy is the so-called tool configuration cover problem. In the case of spraying,the tool configuration cover problem is to find a finite set of sprayguns located over the workpiece surface, which minimizes the er-ror between a target coating and the coating induced by simulta-neously activating these guns. The tool configuration coverproblem is of value for geometry-first as well as for geometry-laststrategies. The formulation and solution of the tool configurationcover problem for spray coating – for which it is particular useful– is the main contribution of this paper. The tool configurationcover problem is specified as an optimization problem whose

Page 2: Parameter optimization for spray coating

A. Kout, H. Müller / Advances in Engineering Software 40 (2009) 1078–1086 1079

objective is the minimization of the error between the achievedand the desired coating thickness. Two algorithmic solutions ofthe optimization problem are presented. Examined aspects arespeed-up by hierarchization and the use of graphics hardware forefficient calculation. The experimental analysis shows that low er-rors can be achieved at reasonable computing times.

Section 2 is devoted to the discussion of path planningapproaches in general. Section 3 focusses on path planning forspray coating and gives a survey on related work. Section 4 definesthe gun configuration cover problem for spray coating, and pre-sents an algorithm for the selection of sample points for an errorevaluation. Finding optimal gun configuration covers is subject ofSection 5. The results of an experimental analysis of the proposedapproaches of optimization are presented in Section 6 and conclu-sions are given in Section 7.

2. Strategies of path planning

A production path can be described by a time-dependent multi-dimensional function. Each component of the function specifies afeature of the path. The features can be divided into three types.The first type is geometric features. The geometric features describethe location and orientation of the tool or of parts of the manufac-turing environment, like the spatial configuration of a robot arm.They are in particular influenced by the shape of the workpieceand of the manufacturing environment. The second type is dynam-ics features. The dynamics features characterize the movement, e.g.in terms of velocities or accelerations. They are influenced bymechanical properties of the tool and the manufacturing machine,like their mass. The third type of features is the process features. Theprocess features describe the interaction between the tool and theworkpiece. Examples of process features for spray coating are thematerial feed rate of the spray gun, the opening angle of the spraycone, or the portion of particles reflected by the workpiece surface.

Usually these features are correlated. For example, the openingangle of the spray cone may influence the inter-path-distance andthe distance of the gun from the surface. Another example of cor-relation is that possibly not all tool positions or required speedsmight be reachable for a robot arm.

Path planning aims at finding a feasible setting of the features,which yields a path with the desired effects. This can be formalizedby defining an objective function describing the quality of the pathto be planned, depending on all features. A quite general formula-tion of this type has been given in [7]. The optimization problemcan be computationally complex, for example NP-hard, and its ex-act algorithmic solution can be extremely time-consuming and notpossible in practice [1,7]. For that reason, heuristic and approxi-mating methods are of interest from the view of application.

In approaches to path planning, the geometric features usuallyplay a major role. Considering the phase in which the path geom-etry is defined in the planning process, two types of path planningapproaches can be distinguished.

The most widespread type of approach to path planning is‘‘path-geometry-first”. Approaches of that type start with the defini-tion of the geometric features of tool movement, depending on thesurface shape and on the geometry of the working environment.Afterwards, the path is attributed with other features like speedor acceleration. Finally, an adaptation of the geometric features issometimes performed for reasons of optimization, or in order toget a feasible path at all. For the definition of the geometric fea-tures many approaches have been developed in the past [8]. Adrawback is that the limited influence of the non-geometric fea-tures may lead to suboptimal solutions.

The second type, which is quite uncommon up to now, is ‘‘path-geometry-last”. It is based on the observation that a dense discrete

time sampling of a path yields a set of feature vectors whichdescribe configurations of the manufacturing unit or tool ‘‘cover”the workpiece. The idea of geometry-last path planning is to startwith the calculation of an optimal cover of the workpiece with afinite set of configurations of the production facility. Then a pathis constructed in those configurations. The configurations on thepath are obtained by interpolation. The advantage of geometry-lastapproaches is that the other feature types can be taken intoaccount in the definition of the path. An example is spray coatingwith spray guns whose flow rate is fixed and cannot be controlledduring the process. In this case, using geometric degrees of free-dom is useful or even mandatory.

A drawback could be that the isolated tool configurations of acover influence the workpiece surface less than the continuous toolconfigurations of a path. However, this could be taken into accountduring path definition by leading the path locally along directionsof highest errors, for example.

An interesting observation is that tool configuration cover canalso be applied as the second phase of geometry-first-based plan-ning. The covering configurations are derived from a finite set oftime sampled points on the geometric path which approximatethe path. These configurations are then optimized with respect tothe dynamics and process features.

3. Path planning for spray coating

During a thermal spray coating process, molten particles areaccelerated in a spray gun towards a prepared surface where theyimpact with a high velocity, flatten, and form a thin layer on thesubstrate [6]. Spray coating differs from contact-oriented manufac-turing methods like milling in that the applicator, that is the spraygun, does not touch the surface. This causes considerably more de-grees of freedom for the geometric path features than for examplein milling where the path must tightly follow the workpiece sur-face. This fact makes the application of the geometry-first strategyto spray coating more difficult than for milling, at least if the addi-tional degrees of freedom are not heuristically reduced.

In contrast to path planning for, e.g. milling, only little has beenpublished on path planning for spray coating in the scientific liter-ature. Path planning for spraying is mentioned mainly in conjunc-tion with spray painting [2–4]. Two main approaches can bedistinguished. The first one is automatic online path planningwithout a workpiece model, based on sensor information, e.g. opti-cal and distance information [14]. The second one is offline pathplanning based on a CAD workpiece model [1–5,7,11].

For the second approach, which is in the focus of this paper,besides intuitive heuristics, several solutions based on formulationsas an optimization problem have been proposed. Kim et al. [7] give acomprehensive formulation as an optimization problem and discusspossible approaches to its solution. Besides local improvement as anoptimization approach they interpret path planning as a problem ofcalculus of variations [15] and outline methods to transfer it to a fi-nite-dimensional optimization problem. Antonio et al. [1] presenttwo versions of problem specifications, one assuming a fixed pathgeometry and one assuming a class of feasible trajectories specifiedby constraints. Both versions are converted into nonlinear program-ming problems, and it is noted for the second case that the compu-tational requirements are too high in practice. Ramabhadran et al.[11] fix the path geometry and give formulations of objective func-tions which lead to either linear or quadratic programming prob-lems which can be solved up to three orders of magnitude fasterthan the general nonlinear program by Antonio et al. Duncan et al.[5] restrict the path geometry to the very specific pattern of parallelsweeping paths. This allows a very efficient solution, but is of lim-ited use on complex free-form surfaces because of the special path

Page 3: Parameter optimization for spray coating

1080 A. Kout, H. Müller / Advances in Engineering Software 40 (2009) 1078–1086

pattern. Although being of the geometry-first type, a rule for therequired density of the path is derived based on the coating profile.Atkar et al. [3] incrementally construct a sequence of curve seg-ments by selecting a seed segment and iteratively offsetting it side-ways within the surface to generate further segments which finallycover the surface. The distance between neighboring segments ischosen depending on the paint profile. This is an efficient approachwhich seems more flexible than the one by Duncan et al. [5], but it isstill restricted to a special path pattern which, for more complexfree-form surfaces, requires pre-segmentation of the surface intopatches which are suited for covering by this pattern of paths [2].

In contrast to those solutions, this paper advocates the geome-try-last type. It is more flexible than the geometry-first approaches,can be applied to arbitrary free-form surfaces, and its computa-tional efficiency is high enough for application in practice. In thefollowing, one of its major parts, the gun configuration cover prob-lem, is discussed.

4. Gun configuration covers and sample points

A gun configuration cover consists of a finite set of spray gunpositions equally distributed above the surface to be coated. Theposition of gun i is described by a gun base point pi on the surface,the length di of the line segment between pi and a reference pointof gun i, and two angles /i, wi specifying the direction of the linesegment relative to the surface normal at pi. Further, the centerlineof the gun lies on the line segment – the notion of the centerlineand more about the gun features will be provided in Section 5.

In the geometry-last case, the base points of the guns aredistributed on the surface in a uniform and even way. This is areasonable choice since in this way a bias of the parameter settingspossibly caused by the gun distribution is reduced. If the geometryof the path is given by a continuous curve of base points on thesurface – which is an example of the geometry-first case, the basepoints of the guns are uniformly sampled on the path.

Further, besides the information about its position, every gun ihas a spray time ti. Depending on the material flow behavior of thegun, ti influences the amount of material deposited by gun i on thesurface.

The set of feasible gun configuration covers is obtained by keepingthe pi, /i, and wi fixed and varying di and ti. A natural choice of theangles is so that the guns lie in direction of the surface normal attheir base points. If valid with respect to the surface geometry,these positions are a favorable choice since they reduce reflectionsof spray particles on the surface. Theoretically, considering theangles in the optimization process is possible, but the computationtime may increase considerably and the additional impact on thequality of the result seems to be limited. For that reason it is post-poned to future work.

A particular problem arises if the surface has a boundary. Be-cause of the surface-bounded positions, surface points near theboundary are not covered by as many guns as points far from theboundary. Thus, the desired coating thickness may not be achiev-able. An approach to cope with this problem is to virtually extendthe surface at the boundary so that the guns can also be positionedbeyond the original surface.

The goal of spraying is to achieve a target coating, that is, to min-imize the error between the target coating and the coatingachieved by a configuration cover. The error will be evaluated ona finite set of sample points on the surface to be coated. The samplepoints should be uniformly distributed over the surface, in order toavoid any bias due to point accumulations.

If the surface is represented by a mesh, and if the vertices of themesh fulfill the requirements, they can be used as sample points orbase points. However, general meshes do not have that property. A

part of a remeshing algorithm by Turk described in Section 4.1 isapplied in order to generate evenly distributed sample points.

4.1. Turk’s point distribution algorithm

The point distribution algorithm of Turk [13] assumes a surfacemesh as input. It starts by distributing points on the mesh by ran-domly choosing a face of the mesh, and then randomly setting apoint on that face. The probability for each face to be chosen is pro-portional to its area. Afterwards a repelling force is calculated be-tween all neighboring points so that the points are pushed awayfrom each other. In this way a uniform distance between the pointsis achieved.

The most time-consuming part of the algorithm is to find theneighbors of every point. This task is efficiently supported by hash-ing on a regular spatial grid in order to reduce the number of dis-tance tests. Spatial hashing assigns a point to the grid cell in whichit lies.

4.2. Visibility test

After having generated the sample points on the surface and thepositions of the guns it is necessary to determine which samplepoints on the surface are visible from each gun. The visibility testnot only has to remove all the sample points not covered by thespray cone, but also those sample points which are occluded bythe surface.

In order to compute the visibility information the computingpower of today’s PC graphics hardware is used. Visibility calcula-tion in 3D scenes is a central operation of 3D computer graphics,and is performed at considerable speed by graphics cards.

The visible sample points are determined as follows. The scenedefined by the workpiece is augmented by the sample points.Every sample point gets an individual color different from theone of the workpiece. The resulting scene is rendered on the graph-ics card from the perspective of a gun with the angle of view ad-justed to the spray cone angle. Then the rendered image has tobe read back from the framebuffer of the graphics card to theCPU in order to search for those pixels of the image that have colorsrepresenting sample points. Due to the individual colors, exactlythe visible sample points are found.

Because the readback takes a few milliseconds for every imageon a graphics card like the ATI Radeon X800 XL used in the exper-imental analysis (or similar hardware by Nvidia), and because thetime required depends on the image size, the image size should bemade as small as possible. The size is constrained by the density ofthe sample points which have to be separated by at least one pixelin the resulting image. This constraint is expressed in the followinglower bound for the minimum width w of the framebuffer image,in number of pixels,

w > 2 � tanðmax : spray angleÞ � dist: of gundist: of sample points

:

5. Optimization

The aim of optimization of a tool configuration cover is to gener-ate a coating on a given surface with a target thickness distributionwith a set of static spray guns placed over base points on the sur-face along surface vectors, e.g. surface normals, as described in Sec-tion 4. Every gun has two parameters which control the distance tothe surface and the spray time. This makes the position of the gun aparameter to be optimized, in contrast to the geometry-first ap-proaches [5,11], where the positions of the gun are fixed on a givenpath. Optimizing the position is of special interest for processes

Page 4: Parameter optimization for spray coating

A. Kout, H. Müller / Advances in Engineering Software 40 (2009) 1078–1086 1081

where the flow rate of the gun is fixed, because it helps to compen-sate this degree of freedom used by other approaches.

During the optimization of the parameters the sprayed coatingthickness is calculated at the sample points on the surface. The cal-culation is performed according to a deposition model. In Section5.1 the deposition model by Duncan et al. [5] will be recalled asan example, but the approach and its implementation is open toarbitrary models. The sprayed coating thickness is used in anobjective function described in Section 5.2, in order to evaluatethe error between the sprayed and the target coating thicknessat every sample point. The objective function is minimized usingthe methods presented in Sections 5.3 and 5.4.

5.1. Deposition model

The deposition model describes the effect of the spray gun. Inthe model of Duncan et al. [5] which is a typical representative,the particles fly on straight rays sharing a starting point insidethe gun. The resulting spray cone is assumed to be symmetric sothat it is sufficient to specify the flow rate along a ray with respectto the angle h between the direction r of the ray and the directionng of the center line of the cone, called spray angle. The spray angleis limited by the opening angle c of the cone. Moreover, Duncanet al. model the reflection of material on the surface dependingon the angle himp between the inverse ray vector �r and the surfacenormal ns, called impact angle. Reflection is of particular impor-tance for metal spray coating. Fig. 1 illustrates those parameters.

The behavior of the spray gun is described by the flow rate dis-tribution function fs. Duncan et al. [5] use

fsðhimp; h; c; rÞ ¼cosðhimpÞHðh; cÞfðhimpÞ

jjrjj2;

where the function H represents the droplet distribution for thespray angle h, and f provides the fraction of material that is not re-flected from the surface. The deposition is represented by its mass.The deposition induced by a gun is calculated by multiplying theflow rate distribution function with the mass flow rate and thespray time. In difference to that, in this paper the deposition is rep-resented by its height. It is calculated by multiplication of the flowrate distribution function by a volume flow rate Q.

The deposition model is crucial for the realism of the simula-tion. In our implementation, flexibility is achieved by defining

Fig. 1. The geometric parameters of the deposition model of Duncan et al. [5].

the flow rate distribution function by a lookup table. In this wayanalytical deposition models as well as empirical models obtainedfrom experimental data can be immediately used, the latter with-out approximation by a closed formula. An additional effect is thatthe evaluation is usually computationally more efficient, which isimportant because of the high number of evaluations required dur-ing optimization.

The location pjðdjÞ of the gun j is specified by a constant surfacebase point pjð0Þ and a variable distance dj of the gun along a fixedvector nj, typically the surface normal, at pjð0Þ,

pjðdjÞ ¼ pjð0Þ þ nj � dj:

Hence the distribution function can be expressed in terms of thedistance dj of the gun to the surface as the only variable. The twoangles h and himp only depend on the distance of the gun to the sur-face for each pair of gun j and sample point i. This leads to the par-tially discretized flow rate distribution function

fijðdj; cÞ ¼cosðhimp;iðdjÞÞ �HðhiðdjÞ; cÞ � fðhimp;iðdjÞÞ

jjriðdjÞjj2� dij;

where dij denotes a visibility term which is equal to 1 if the samplepoint i is visible to the gun j, and zero otherwise.

5.2. Objective function

The objective function is the central part of the optimizationprocess. It determines the goal of optimization, but it also affectsthe optimization methods which can be used.

The objective function Z proposed here consists of three terms,

Zðd0; . . . ; dN; t0; . . . ; tNÞ ¼ Zeðd0; . . . ;dN; t0; . . . ; tNÞþ Cd � Zdðd0; . . . ; dNÞ þ Ct � Ztðt0; . . . ; tNÞ;

where dj and tj denote the distance and the spray time of gun j,j ¼ 0; . . . ;N, respectively. The term Ze describes the deposition errorover all sample points i, i ¼ 0; . . . ;M, in terms of the thickness of thesprayed layer,

PNj¼0ðfijðdjÞ � Q � tj, and of the target thickness, Si. Q is a

constant volume flow rate. The error is expressed as the mean of thesquares of the differences normalized by the mean Smean of the Si,

Zeðd0; . . . ;dN; t0; . . . ; tNÞ ¼1M

XM

i¼0

Si �PN

j¼0ðfijðdjÞ � Q � tjÞSmean

!2

;

However, solely optimizing the thickness might lead to solutionsthat are not applicable. A constraint which is typical for many spraysystems is that the local variation of the distances and spray timesshould be smooth. The reason is that extreme changes of gun dis-tances and spray times along a path possibly cannot be executed.For that reason smoothness terms for the distance, Zd, and of time,Zt , are added to the objective function,

Zdðd0; . . . ;dNÞ ¼1N

XN

j¼0

dj � dj;int

dmean

� �2

;

Ztðt0; . . . ; tNÞ ¼1N

XN

j¼0

tj � tj;int

tmean

� �2

:

The first term consists of the mean of the squares of the differencesof dj to an interpolated distance dj;int of gun j, normalized by themean distance dmean over all guns. The idea is that the interpolatedvalue dj;int can be considered as the result of a local low-pass filter-ing. Hence the difference ðdj � dj;intÞ2 can be seen as high-pass filtervalue whose amount is lower for a smoother function.

The smoothness term Zt is defined analogously.The additional factors Cd and Ct for the smoothness terms help

to control their weight. They are defined as

Page 5: Parameter optimization for spray coating

1082 A. Kout, H. Müller / Advances in Engineering Software 40 (2009) 1078–1086

Cd ¼cd

gapmean; Ct ¼

ct

gapmean;

where cd > 0, ct > 0 are constant, and gapmean denotes the mean dis-tance to the neighbors. This implies that the coefficients Cd and Ct

increase with the density of the guns.The values dmean and tmean are calculated on a set Nj of neighbor-

ing guns of gun j. Nj is efficiently found with the spatial hashing ap-proach used for Turk’s remeshing algorithm in Section 4.1, or bytaking the adjacent vertices from the remeshed mesh.

The interpolation tj;int of the time values is calculated by an in-verse distance weighted approach using the neighborhood Nj ofgun j defined by Shepard [12]:

tj;int ¼Xi�Nj

wiðpjÞ � ti

wiðpjÞ ¼1=jjpi � pjjj2P

k�Nj1=jjpk � pjjj2

:

For the interpolation dj;int of the gun locations, two approaches arepossible. The first one is to interpolate the distance values. The sec-ond one is to interpolate the gun positions in space, followed by thecalculation of the distance values of the positions as the interpo-lated distance values dj;int . The second approach is more favorablesince it does not follow the curvature of the surface as tightly asthe first one does.

Although minimizing the sum of squared differences works wellbecause the objective function is differentiable, the real intention isto minimize the maximum error. This could be expressed byreplacing the sum with the maximum, but unfortunately thisobjective function is no longer differentiable. As an alternative aniterated approach is proposed. The objective function is changedto a weighted least-squares expression by introducing a weightfactor wi for each term. At the beginning all weights are set toone. After solving this objective function in the first iteration, theweights are adjusted proportional to the error between the targetlayer thickness Si and the sprayed layer thickness Ai, and the sec-ond iteration is performed. The introduced weights have the effectthat areas with higher errors are emphasized in the second itera-tion, which reduces the maximum error. Schematically, iterativeweighted least-squares works by repeating

minai ; i¼0;...;n

Xn

i¼0

wi � ðSi � FðaiÞÞ2;

wi :¼ wi � jSi � FðaiÞj;wi :¼ wi=wmean;

as long as an improvement can be noticed. Si denotes a target value,FðaÞ the approximating function depending on a parameter vector a,and ai the free parameters, i ¼ 0; . . . ; n. The normalization in the laststep is applied to keep the objective function balanced.

5.3. Gradient descent

Optimization methods such as iterative descent methods fitwell to nonlinear least-squares objective functions. Since theJacobian and the Hessian matrix of the objective function can becomputed, the Newton method is applicable [10]. However, thecomputation of the Hessian matrix is time-consuming, and it isnot sure whether the faster convergence rate would result in alower computing time in comparison to simpler approaches. Amore robust method in terms of local optima and numeric stabilityis the ordinary gradient descent method, in which no matriceshave to be computed or inverted like in the Gauss–Newton meth-od. Although this comes at the expense of more iterations, the opti-mization method chosen is a gradient descent method. In the caseof steepest descent, which is used here, the descending direction is

the negative gradient of the objective function, and the step lengthis found by line search [9].

The computation of the gradient rZ ¼ oZodk; oZ

otk

� �k¼0;...;N

; of the

high-dimensional least-squares function Z, where

oZodk¼ 2

M

XM

i¼0

wiSi �

PNj¼0ðfijðdjÞ � Q � tjÞ

S2mean

� �dfikðdkÞ � Qddk

� tk

� � !

þ Cd2Nðdk � dk;intÞ

d2mean

;

oZotk¼ 2

M

XM

i¼0

wiSi �

PNj¼0ðfijðdjÞ � Q � tjÞ

S2mean

� �fikðdkÞ � Qð Þ !

þ Ct2Nðtk � tk;intÞ

t2mean

;

is not more time-consuming than a normal function evaluation. Inthe implementation, the derivative of the flow rate distributionfunction fikðdkÞ with respect to the distance is approximated by adifference quotient of two function values,

dfikðdkÞddk

� fikðdk þ DdkÞ � fikðdkÞDdk

:

The offset Ddk in the difference quotient is chosen according to thelength of a step of the gradient descent iteration.

A step Dx of the gradient descent iteration is in principle calcu-lated by multiplying the gradient with a factor a � ZðxÞ=jjrZðxÞjj2,a > 0,

Dx ¼ �arZðxÞjjrZðxÞjj2

� ZðxÞ:

However, it has turned out that a more sophisticated choice of thestep length is required here. First, dividing the first sum in the for-mulas of the partial derivatives oZ

odkand oZ

otkby M is replaced with a

division by Mk, where Mk is the number of sample points visiblefrom the spray gun k. This makes the length of the resulting modi-fied gradient vector v independent from those sample points whichare not influenced by the gun k.

Second, the step length is separately calculated for the deriva-tives with respect to distance variables dk and time variables tk,

Ddx ¼ �avdðxÞjjvdðxÞjj2

� vdðxÞ;

Dtx ¼ �avtðxÞjjvtðxÞjj2

� vtðxÞ;

where vd and vt are the vectors compiled from those components ofv which correspond to derivatives with respect to distance and timevariables, respectively. The reason is that the two types of variables,the distances and the spray times, are in totally different ranges sothat the derivatives would differ by several orders of magnitudewithout this modification. This implies that a gradient containingall variables is unbalanced, with the effect that only one type ofthe variables is optimized.

Third, starting with a ¼ 1, the value of a is successively reducedduring iteration. A reduction takes place if the achieved value ofthe objective function does not show a further reduction. The ais multiplied by a factor between 0 and 1, e.g. by 0.5 which hasturned out as well suited.

Descent methods need an initialization. For that purpose everygun is set to the mean distance and the mean spray time, where themean distance is defined by the mean between the minimal andmaximal allowed distances. The mean spray time is found by anoptimization process where all guns have a constant distanceand use the same variable for the spray time.

Page 6: Parameter optimization for spray coating

Table 1Coating errors for several basic surface shapes.

Shape Average coating error [%] Maximum coating error [%]

Plane 0.025 0.07Saddle 0.031 0.12Cylinder 0.035 0.13Sphere 0.036 0.10Interior cylinder 0.043 0.11Interior sphere 0.043 0.14

0.015

0.02

0.025

0.03

0.035

0.04

0.045

0 0.5 1 1.5 2 2.5 3 3.5 4

aver

age

erro

r [%

]

distance smoothness coefficient

0.03

0.04

0.05

0.06

0.07

0.08

0.09

0.1

0.11

0.12

0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000

aver

age

erro

r [%

]

number of triangles

Fig. 2. The coating error in dependence on the smoothness coefficient Cd (top) andin dependence on the mesh density (bottom).

A. Kout, H. Müller / Advances in Engineering Software 40 (2009) 1078–1086 1083

5.4. Hierarchization

Solving the optimization problem with the gradient descentmethod might take many iterations to finish. A way to reducethe number of iterations is hierarchization. The problem is firstsolved with a small number of guns. Then this solution is trans-ferred onto a larger set of guns as initial values. This should resultin less iterations required during the most dense stage of theoptimization.

The different density levels of guns could be generated startingwith the level of maximum density and the selecting guns for thelower density levels. Unfortunately, the resulting gun distributionmight not be sufficiently uniform. For that reason every level ofdetail is generated independently, as described in Section 4.

The transfer of the result of one level of hierarchy to the nextfiner one is achieved by interpolation of the distance and spraytime values to the newly generated guns, and a subsequent adap-tation of the interpolated time values. The interpolation is per-formed by inverse distance weighting as described in Section 5.2.While the interpolated distance values are directly used, the spraytime values need to be adjusted to the new density, by multiplyingthe interpolated spray time ti of the new guns i with a factor ci,0 < ci 6 1,

t0i ¼ ti � ci:

Theoretically, the ratio of the number N of guns in the previous andthe number N0 of guns in the current stage,

ci ¼NN0

could be a possible uniform choice. However, it turns out that thisfactor should be corrected slightly, in order to take small irregular-ities in the distribution of the guns into account. Correction is per-formed by minimizing the objective function Z depending on the ci

by steepest descent. In the first steps of iteration, the individual ci

are replaced with a global variable initialized by the ratio of gunnumbers. If no further improvement can be noticed, the ci are chan-ged individually.

Hierarchization is of advantage if the overhead caused by pro-cessing the additional coarse level is compensated by less itera-tions on the finest level. Since the computing time of an iterationon the finest level can be expected to be significantly higher thanon the coarser levels (especially if the visibility test is used), hier-archization can be useful. Furthermore, the hierarchical method isless sensitive with respect to the initialization values because theguns do not depend as strongly on each other at low densities asthey do at higher densities. This is advantageous when applyingthe optimization process to complex surfaces.

6. Analysis

The proposed optimization method has been computationallyanalyzed on a set of basic surface types typical for the local shapesof smooth free-form surfaces: ‘‘plane”, ‘‘cylinder”, ‘‘sphere”, and‘‘saddle”. Furthermore, the CAD model of a real workpiece has beenused. The quality of approximation of the desired coating, the com-puting time, and insights into the distribution of the spray timeand the distance of the guns are of major concern for the evalua-tion. In all experiments, the opening angle of the spray cone hasbeen set to c = 18.33�, the volume flow rate to Q ¼ 56 mm3=s,and the weights Cd and Ct of the objective function to 5=gapmean.

In Table 1, the coating errors of the sprayed layer for the basicshapes are shown. The coating error has been calculated as the dif-ference between the sprayed layer thickness and the desired layerthickness, divided by the desired layer thickness. The desired layer

thickness is constant over the whole surface. The density of theguns and of the sample points is about the same for all examples,cf. Fig. 6 where the spray guns are indicated by small spheres. Itcan be noticed that the flat surface has the lowest error and thatthe error increases with the curvature. This can be explained withthe increasing reflection of material which effectively reduces thesize of the footprint induced by a gun, and thus leads to higher dis-cretization errors since the gun density is not adapted. Further-more, the smoothness constraint is somewhat restricting theoptimization process because it prefers a flat solution. Fig. 2, top,demonstrates this effect for a spherical patch and the hierarchicalversion, by showing the mean error depending on the smoothnesscoefficient Cd.

The density of the mesh representing the workpiece surface hasalso an effect on the quality of the approximation. Fig. 2, bottom,shows the mean error relative to the number of triangles of mesh-ings of a spherical patch of increasing density, without changingthe densities of the guns and the sample points. With an increasingnumber of triangles, the error first drops quickly and decreasesslightly afterwards.

Page 7: Parameter optimization for spray coating

0

2

4

6

8

10

12

14

0 10000 20000 30000 40000 50000 60000 70000 80000

Run

time

[s]

Area [mm2]

OptimizationVisibility test

Fig. 3. Computing time for different surface areas on a flat plane.

1e-07

1e-06

1e-05

0.0001

0.001

0 2 4 6 8 10 12 14 16 18

Obj

ectiv

e Fu

nctio

n

Iterations

last stage of the hierarchical methodgradient descent

1e-05

0.0001

0.001

0.01

0.1

0 2 4 6 8 10 12 14 16 18 20

Obj

ectiv

e Fu

nctio

n

Iterations

last stage of the hierarchical methodgradient descent

Fig. 4. Values of the objective functions reached on a flat surface with a targetcoating of constant thickness (top) and of hill-like thickness distribution (bottom).

1084 A. Kout, H. Müller / Advances in Engineering Software 40 (2009) 1078–1086

Fig. 3 shows time measurements of the gradient descent meth-od over 100 iterations. Flat rectangular surface patches of differentsurface area have been used, and there has been one point on64 mm2 in the average, for the gun base points as well as for thesampling points. For a surface area of 40,000 mm2 this results inabout 600 gun base points and sampling points, respectively. Thetarget coating is equally thick at any point on the surface. The met-ric system has been used in this experiment in order to relate it tothe real world.

It can be easily seen that the computing time grows about lin-early with the area of the surface. The time requirement of the vis-ibility test, which is performed before the optimization, alsoincreases linearly, and takes one seventh of the time of the optimi-zation process. The visibility calculation is executed before theoptimization because the simple surfaces used here have no under-cuts. The asymptotic time complexity of the algorithm is OðNg � NsÞ,where Ns is the number of sample points, and Ng is the number ofgun base points.

Increasing the density of the guns decreases the mean error rel-ative to the desired thickness of the generated coating, whileincreasing the density of the sample points increases the error.The latter can be explained by the fact that a low density of samplepoints smoothes out the details of a surface so that a better approx-imation can be expected than in the case of fine details better rep-resented by a dense sampling.

Despite the use of a simple gradient descent method, the con-vergence of the objective function is fast. In Fig. 4, top, whichshows the values of the objective function depending on the num-ber of iterations for a flat surface and a desired coating of constantthickness, the gradient descent method converges in two iterationsto a value of 10�5 for the objective function, from where it drifts to-wards 10�6. The hierarchical version has a similar progression. Thisseems disappointing, but it can be explained by the fact that thestarting solution is close to the the optimal solution so that the gra-dient descent process does not have much work to do.

On more complex surfaces the hierarchical method can play outits strengths and produces better results than the gradient descentversion. Fig. 4, bottom, shows a comparison for a flat surface with ahill-like desired coating. In this case, the gradient descent methodgets stuck at a considerably higher value than the hierarchicalmethod.

The experiments show that the hierarchical method is almostnot affected by a randomized starting solution, which is not thecase for the gradient descent method. This may be due to the factthat in the early stages the density of the guns is so low that theydo not influence each other on the surface.

Fig. 5 shows the original layer generated by the hierarchicalmethod, and the first three iterations of weighted least squares.The surface sprayed is flat, but the desired coating thickness ismodulated with a cosine wave depending on the distance to themiddle, so that a little hill is generated in the center. This leadsto a rather bad result in the first iteration because the least-squaresmethod smooths it out. The weighted least-squares iterations exhi-bit a significant improvement in reducing not only the maximumerror but also the mean error. This leads to a better overall impres-sion of the error images in Fig. 5.

Fig. 6 shows the optimization results for the basic surfaceshapes. The sphere and the cylinder patches are coated from thefront and the back side. To the saddle this would not bring new in-sights since it behaves in the same way on both sides. The relativelayer thickness error, which is in average below 0:1%, is displayedby a color coding on the surface. The locations of the spray guns areshown by small spheres. Their colors indicate the individual spraytimes. It can be noticed that a smooth deposition as well as asmooth behavior of distance and spray time of the gun has beenachieved.

Fig. 7 shows a more complex surface of a real workpiece. It hasbeen derived for manufacturing tests from the B-pillar of a carbody. The application background is coating of a mold for deepdrawing.

The surface mesh consists of 48,064 triangles. For the calcula-tion, 18,123 sample points and 14,612 gun configurations havebeen used. The vectors at the gun base points were interpolatedfrom vectors at the mesh vertices, as follows. The vectors at thevertices are initialized by the mean of the normals of their incidenttriangles. This is followed by iterative averaging. In every step ofiteration, the vector of a vertex is replaced with the mean of the

Page 8: Parameter optimization for spray coating

Fig. 5. Minimization of the maximal error with weighted least-squares on a flat surface with a hill-like target layer thickness. The error is coded in the surface color. (Forinterpretation of the references to colour in this figure legend, the reader is referred to the web version of this article.)

Fig. 6. Optimization for basic surface shapes. The coating error is coded in the surface color. The little balls show the gun positions, and their color indicate the spray time.(For interpretation of the references to colour in this figure legend, the reader is referred to the web version of this article.)

A. Kout, H. Müller / Advances in Engineering Software 40 (2009) 1078–1086 1085

Page 9: Parameter optimization for spray coating

Fig. 7. Coating of a complex surface. The coating error is coded in color on thesurface. The mean coating error is 0:62%, and the maximum error is 8:77%. (Forinterpretation of the references to colour in this figure legend, the reader is referredto the web version of this article.)

1086 A. Kout, H. Müller / Advances in Engineering Software 40 (2009) 1078–1086

vectors of its adjacent vertices on the mesh. In the example, thishas been iterated five times. In this way, an improved location ofthe guns in comparison to using normals is achieved.

The desired coating thickness has been 1:0 mm. The mean errorachieved is 0.62%, the maximum error 8:77%.

The distances of the spray guns have been constrained to theinterval between 32:5 mm and 65:0 mm. The observed distancesof the result lie between 42:5 mm and 54:0 mm, the mean distanceis 48:2 mm. The observed spray times of the guns are between0:37 s and 0:43 s, the mean time is 0:39 s. The overall time of cal-culation has been 207 s, of which 32 s have to be accounted tothe visibility calculation.

7. Conclusions

An alternative scheme to the usual geometry-first strategy toplanning path-oriented production processes has been outlined.The so-called geometry-last approach starts with the calculationof an optimal cover of the workpiece with a finite set of tool config-urations. This leads to the tool configuration cover problem whichturns out to be of value for the geometry-first scheme as well. A for-mulation of the tool configuration cover problem as an optimizationproblem has been presented for the case of spray coating for whichthe approach is particular useful. Solutions to the problem based onsteepest descent have been described, which include the methods ofspeed-up by hierarchization and use of graphics hardware. It hasbeen shown in experiments that good solutions of the optimizationproblem can be obtained in a quite efficient way. A next step may beto choose the gun base points adaptively depending on the observederror. Another step could be to include the orientation of the sprayguns. Furthermore, spraying at the boundaries of a surface may beaddressed in future work, in particular in order to minimize theamount of material sprayed not hitting the surface.

The second step of the geometry-last-approach is the construc-tion of a path, by taking the information of the first step into ac-count. This information is of particular value in the case of free-form workpieces where paths adapted to the surface are required,in contrast to simple path patterns like parallel paths mostly foundin literature up to now. For instance, the information can be usedto determine the inter-path distance by taking into account thedensity of the gun positions of the gun configuration cover prob-lem, in particular if they are chosen adaptively. Path constructionhas not been treated in this paper, and will be a subject of futurework. The first step could be to derive the geometry of a surfacepath by taking the locations of the gun base points into account.The distances and spraying times could be transferred to the pathin a similar way as done between the levels of the hierarchical ap-proach of solution. The resulting path might be used to initialize afurther, now path-dependent solution of the tool configurationcover problem.

Acknowledgement

This research was funded by the German Research Foundation(DFG) as part of the collaborative research center 708 ‘‘3D-SurfaceEngineering of Tools for Sheet Metal Forming – Manufacturing,Modeling, Machining”.

References

[1] Antonio J. Optimal trajectory planning for spray painting. Proc IEEE Int ConfRobot Automat 1994;3:2570–7.

[2] Atkar PN, Conner DC, Greenfield A, Choset H, Rizzi A. Hierarchicalsegmentation of surfaces embedded in r3 for auto-body painting. In:Proceedings of the IEEE international conference on robotics and automation,Barcelona, Spain, 2005. p. 574–9

[3] Atkar PN, Conner DC, Greenfield A, Choset H, Rizzi A. Uniform coverage ofautomotive surface patches. Int J Robot Res 2005;24(11):883–98.

[4] Conner DC, Greenfield A, Atkar PN, Rizzi A, Choset H. Paint decompositionmodelling for trajectory planning on automotive surfaces. IEEE Trans AutomotSci Eng 2005;2:381–92.

[5] Duncan S, Jones P, Wellstead P. A frequency-domain approach to determiningthe path separation for spray coating. IEEE Trans Automat Sci Eng 2005;2(3).

[6] Fauchais P, Fukumoto M, Vardelle A, Vardelle M. Knowledge concerning splatformation: an invited review. J Therm Spray Technol 2004;13:337–60.

[7] Kim T, Sarma SE. Optimal sweeping paths on a 2-manifold: a new class ofoptimization problems defined by path structures. IEEE Trans Robot Automat2003;19(4):613–36.

[8] Latombe JC. Robot motion planning. Boston (MA): Kluwer AcademicPublishers; 1991.

[9] Madsen K, Nielsen HB, Tingleff O. Methods for non-linear least squaresproblems. Informatics and mathematical modelling. Technical University ofDenmark; 1999.

[10] Nocedal J, Wright S. Numerical optimization. Springer; 1999.[11] Ramabhadran R, Antonio JK. Fast solution techniques for a class of optimal

trajectory planning problems with applications to automated spray coating.IEEE Trans Robot Automat 1997;13(4):519–30.

[12] Shepard D. A two-dimensional interpolation function for irregularly-spaceddata. In: Proceedings of the 23rd ACM national conference. New York (NY),USA: ACM Press; 1968. p. 517–24.

[13] Turk G. Generating textures on arbitrary surfaces using reaction–diffusion. In:SIGGRAPH’91: proceedings of the 18th annual conference on computergraphics and interactive techniques. New York (NY), USA: ACM Press; 1991.p. 289–98.

[14] Vincze M, Pichler A, Biegelbauer G, Häusler K, Andersen A. Automatic roboticspray painting of low volume high variant parts. In: Proceedings of the 33rdinternational symposium on robotics (ISR), 2002.

[15] Weinstock R. Calculus of variations. Dover Publications; 1974.