1 Introduction

Ball-end milling is widely used in five-axis milling for the manufacture of complex free-form surface workpieces, such as blades in aerospace, and engines in automobiles [1]. The surface topography, directly decided by the ball-end milling, is crucial to the surface wear, fatigue resistance, reflection performance, and precision of assembly [2, 3]. To maximize workpiece performance, the investigation of surface topography generation has attracted researchers’ attention and manufacturers' alike. Besides, the surface topography simulation before processing not only reduces trial and error costs but also improves the machining efficiency and accuracy [4].

Generally, there are two mainstream methods for surface topography simulation. The Boolean operations method is the primary one to acquire the surface topography using the solid models of the tool and workpiece. Imani et al. [5, 6] developed B-rep solid modeling approaches to solve the geometric difficulties associated with ball-end milling simulation. The surface topography is simulated by executing successive Boolean operations between the updated part and the swept volume after the cutter swept volume has been scanned as an accurate B-rep model. To improve the calculation efficiency of the resection volume, Chung et al. [7] projected the workpiece surface on the X–Y plane, and this surface can be equivalently represented by a set of parallel lines. These parallel lines and tool envelopes are used to compute the scattered point location information on the machine surface. Liu et al. [8] gave an insight into the surface topography formed by the rotating cutter flutes, thus extending the CAM system simulation with more residual height information. Artetxe et al. [9] achieved the surface prediction of integral blade rotors using the CAM solid modelers and the cutting force model considering tool runout and workpiece flexibility. Most CAM software, such as UG [10] and Pro/E [11], support customers to realize topography simulation under different workpieces, cutting tools, and tool paths. Vericut can achieve the advanced requirements of impeller machining, which considers the variable real machining conditions [12]. However, the Boolean operations method has the problem of how the software deal with the solid model storage. Besides, the Boolean operations method assumes a spherical shape for the ball-end cutter teeth, making it unable to generate the real surface topography. The impact of this simulation error is not negligible in high-speed and micro-milling conditions [13, 14], which restricts the development of the Boolean operations method.

The Z-MAP method is another method for machined surface topography prediction. Typically, the Z-MAP method meshes the workpiece in the X–Y plane and uses a Z-buffer to store the Z-height of these grid points. The tool's cutting edge is discretized. The tool's rotational motion is represented by its parametric equation. By comparing the height of the cutting-edge element with the corresponding workpiece grid point at each time step, the Z-buffer is updated, thus obtaining the final surface topography.

The Z-MAP method is first applied in ball-end milling of sculpture surfaces [15]. Both the workpiece and the cutter mesh into square elements so that the cutter/workpiece engagement can be obtained automatically with a given cutter path. After that, more comprehensive simulation approaches for surface topography are developed, which incorporate the effects of cutting parameters [16], tool runout [17], tool deflection [18], etc. The Z-MAP method is introduced into 5-axis milling due to its flexibility. The surface topography in 5-axis milling is found to be strongly affected by the tool inclination, the tool lead angle, and the tool tilt angle [19, 20]. To better understand the surface topography formation process in high-speed milling, the surface topography simulation based on the Z-MAP method, which considers the flank wear and the varying feed rates’ effect, is developed [21], making the machining parameters can be effectively controlled to ensure the workpiece surface quality.

The Z-MAP method provides good insight into the surface topography simulation of ball-end milling. However, the simulation accuracy relies on the time-step precision, and the mesh discretization precision of both the workpiece and the cutting edge. The simulation efficiency decreases as the precision requirements increase. In other words, high-precision simulation in the Z-MAP method is much more time-consuming. Therefore, researchers are devoted to improving the traditional Z-MAP method. The accurate cutting time and cutting-edge element at each workpiece grid point are critical to surface topography simulation. In the following improved Z-MAP method, the primary nonlinear equations, which are determined by the cutting-edge trajectory and the coordinates of the workpiece grid points, are solved using the numerical iterative methods.

Gao et al. [22] proposed a numerical simulation method based on the Newton-Raphson algorithm in ball-end milling surface topography. This numerical simulation approach is mesh-independent and efficient, but the initial values must be selected properly. Based on Gao’s work, Zhang et al. [23] applied the improved Z-MAP method to the multi-axis ball-end milling. The effects of tool tilt direction and tilt angle on the surface topography are investigated. Arizmendi et al. [24] used Chebyshev polynomial expansion to solve the equivalent polynomial equations, which combined the cutting-edge trajectory and the tool-swept envelope. The tool parallel axis offset is also considered. To reduce the computing scale, the surface grid points being milled at each time step are extracted by tool-workpiece contact area identification, such as the sweep surface method [25]. Shujuan [26] and Dong [14] combined Newton’s iterative algorithm and the Z-MAP method to quickly calculate the height of the workpiece grid points falling into the tool/workpiece engagement. The kinematics model of the ball-end milling cutter is established based on the homogeneous coordinate transformation.

However, these improved Z-MAP methods using the classical numerical solutions (e.g., Newton’s iterative algorithm) are prone to approximation errors. If the initial values and convergence accuracy of the classical numerical solutions are not reasonably set, the nonlinear equation may fall into a local optimal solution [27], resulting in the discontinuous height of the adjacent grid points on the workpiece. But the initial values are difficult to determine in the actual milling process. Besides, the solved parameters of the nonlinear equation, such as cutting time and the cutter’s position angle, may lose meaning without physical constraints.

Aiming at the problem that the convergence of the classical numerical method depends on the initial values, the nonlinear equations for the cutting-edge trajectory coupled with the workpiece grid points’ coordinates are transformed into an optimization problem. Compared with the classical numerical method, the sequential quadratic programming (SQP) algorithm is more advanced in global optimization searching [28], and the physical constraints during the cutting process can be easily introduced into the analytical model.

Based on the SQP algorithm, an improved Z-MAP method is proposed for the free-form machined surface topography simulation in multi-axis milling using a ball-end cutter. Compared with the traditional Z-MAP method, this method does not require discretizing the cutter edge, but only discretizing the time. And the time interval does not need to be strictly controlled, thus significantly improving the computational efficiency. During the computation process, the nonlinear equation problem of the tool-workpiece contact point is transformed into an optimization problem by introducing a time step constraint and a tool angle constraint. This optimization issue is resolved using the SQP algorithm. In this way, the approximation errors caused by the initial value of the nonlinear equation can be avoided, thus ensuring the calculation accuracy.

The remaining parts of this paper are structured as follows. In Section 2, the cutting-edge trajectory model in multi-axis ball-end milling is established using homogeneous coordinate transformation. In Section 3, the tool-workpiece contact area identification is introduced, followed by the improved Z-MAP method using the SQP algorithm for surface topography calculation. The experimental verification is conducted in Section 4, and the major contributions are summarized in Section 5.

2 Cutting-edge trajectory model

The cutting-edge trajectory model is required for the surface topography in multi-axis ball-end milling. In this section, four rectangular reference coordinate systems are defined to describe the parametric equations of the ball-end milling cutter. The cutting-edge trajectory model in the workpiece coordinate system is then obtained through homogeneous coordinate transformation.

2.1 Reference coordinate systems

Four reference coordinate systems are defined in a ball-end milling operation (see Fig. 1).

Fig. 1
figure 1

Reference coordinate systems

  1. (1)

    The workpiece coordinate system \({O}_{W}-{X}_{W}{Y}_{W}{Z}_{W}\), denoted \(\left\{W\right\}\), is the reference of the NC program during the machining process. In this paper, the dynamic displacement of the workpiece is neglected, so the workpiece coordinate system is also considered to be the global coordinate system.

  2. (2)

    The spindle coordinate system \({O}_{S}-{X}_{S}{Y}_{S}{Z}_{S}\), denoted \(\left\{S\right\}\), is fixed on the machine tool spindle. This spindle coordinate translates and rotates with the spindle’s position movement and posture adjustment, respectively. The origin \({O}_{S}\) is located at the center of the ball-end milling cutter’s spherical part.

  3. (3)

    The tool coordinate system \({O}_{C}-{X}_{C}{Y}_{C}{Z}_{C}\), denoted \(\left\{C\right\}\), is fixed at the cutter to define the tool rotation. The coordinate axis \(\overrightarrow{{\mathbf{O}}_{\mathbf{C}}{\mathbf{Z}}_{\mathbf{C}}}\) is aligned with \(\overrightarrow{{\mathbf{O}}_{\mathbf{S}}{\mathbf{Z}}_{\mathbf{S}}}\). The directions of \(\overrightarrow{{\mathbf{O}}_{\mathbf{C}}{\mathbf{X}}_{\mathbf{C}}}\) and \(\overrightarrow{{\mathbf{O}}_{\mathbf{C}}{\mathbf{Y}}_{\mathbf{C}}}\) change as the machine tool spindle rotates.

  4. (4)

    The tool tooth coordinate system \({O}_{j}-{X}_{j}{Y}_{j}{Z}_{j}\), denoted \(\left\{j\right\}\), is mainly used to describe the three-dimensional curve of the cutting edge. The origin \({O}_{j}\) is located at the center of the ball-end milling cutter’s spherical part, and the plane \({X}_{j}{O}_{j}{Y}_{j}\) is the spherical equatorial plane. The coordinate axis \(\overrightarrow{{\mathbf{O}}_{\mathbf{j}}{\mathbf{Z}}_{\mathbf{j}}}\) is consistent with the coordinate axis \(\overrightarrow{{\mathbf{O}}_{\mathbf{C}}{\mathbf{Z}}_{\mathbf{C}}}\).

2.2 Cutting-edge definition

Cutting-edge definition aims to describe the cutter’s geometry using parametric equations. The cutting edge of a ball-end milling cutter is complex in shape and is made up of two parts: the side edge and the spherical edge. In general, the spherical edge is utilized for actual machining. Depending on the geometry of the tool, the spherical edge is divided into a helical edge and a flat edge (see Fig. 2). For the ball-end cutter with a helical edge, the tool sphere vertex \({P}_{0}\) is at the bottom. The arbitrary point \(P\), which is located at the \(j-\mathrm{th}\) cutter tooth, is described as follows.

$$\left\{\begin{array}{l}x_p^j=R\sin\theta\cos\psi\\y_p^j=R\sin\theta\sin\psi\\z_p^j=-R\cos\theta\end{array}\right.$$
(1)

where R is the cutter’s radius. θ is the axial immersion angle (the angle between \(\overrightarrow{{O}_{c}{P}_{0}}\) and \(\overrightarrow{{\mathbf{O}}_{\mathbf{c}}\mathbf{P}}\)). \(\psi\) is the lag angle, which is defined as:

$$\psi=\tan\gamma_0\left(1-\cos\theta\right)$$
(2)

where \({\gamma }_{0}\) is the helix angle. When \({\gamma }_{0}\) is equal to zero, Eq. 1 can be used to describe the arbitrary point P on the flat-edged ball-end cutter.

Fig. 2
figure 2

Ball-end milling cutters with a helical edge and b flat edge

In the cutting process, the coordinate system \(\left\{C\right\}\) rotates at all times, changing with the machine tool spindle rotation. The homogeneous coordinate transformation matrix \({\mathbf{M}}_{\mathbf{C}\mathbf{j}}\) from \(\left\{j\right\}\) to \(\left\{C\right\}\) is defined as:

$${\mathbf M}_{\mathbf C\mathbf j}=\begin{bmatrix}\cos\varphi_j^C&-\sin\varphi_j^C&0&0\\\sin\varphi_j^C&\cos\varphi_j^C&0&0\\0&0&1&0\\0&0&0&1\end{bmatrix}$$
(3)
$${\varphi }_{j}^{C}={\varphi }_{j}+\omega t=\left(j-1\right)2\pi /N+\omega {t}_{1}$$
(4)

where \({\varphi }_{j}^{C}\) is the angle at the present time \({t}_{1}\) in the coordinate system \(\left\{C\right\}\), which includes the intersection angle \({\varphi }_{j}\) and the rotation angle \(\omega {t}_{1}\). \({\varphi }_{j}\) is the angle between the first and the \(j-\mathrm{th}\) cutter tooth. N is the number of cutter teeth. \(\omega\) is the spindle speed (r/min). \({t}_{1}\) is the rotation time of the spindle (s).

2.3 Tool path definition

The tool path definition includes two aspects, the cutter’s posture adjustment, as well as position movement (see Fig. 3) Both aspects need to be properly considered to prevent position interference between the cutter and the workpiece in the actual machining process.

Fig. 3
figure 3

Cutter’s a posture adjustment and b position movement

Posture adjustment refers to adjusting the cutter so that its axis forms a specific angle with the normal line of the machined surface (see Fig. 3(a)). The side tilt angle, denoted \(\alpha\), is the angle between the projection line of the vector \(\overrightarrow{{\mathbf{O}}_{\mathbf{S}}{\mathbf{Z}}_{\mathbf{S}}}\) on the plane \({Y}_{w}{O}_{w}{Z}_{w}\) and the vector \(\overrightarrow{{\mathbf{O}}_{\mathbf{W}}{\mathbf{Z}}_{\mathbf{W}}}\). The forward tilt angle, denoted \(\beta\), is the angle between the projection line of the vector \(\overrightarrow{{\mathbf{O}}_{\mathbf{S}}{\mathbf{Z}}_{\mathbf{S}}}\) on the plane \({X}_{w}{O}_{w}{Y}_{w}\) and the vector \(\overrightarrow{{\mathbf{O}}_{\mathbf{W}}{\mathbf{Y}}_{\mathbf{W}}}\) of the coordinate system \(\left\{W\right\}\). To rotate the cutter to the target position depicted in Fig. 3(a), the steps are detailed as follows.

  1. (1)

    Rotate \(\left\{S\right\}\) around the vector \(\overrightarrow{{\mathbf{O}}_{\mathbf{W}}{\mathbf{Y}}_{\mathbf{W}}}\) by a tilt angle \({\beta }{\prime}\), where \({\beta }{\prime}=\mathrm{arctan}\left(\mathrm{tan}\beta \mathrm{cos}\alpha \right)\).

  2. (2)

    Rotate \(\left\{S\right\}\) around the vector \(\overrightarrow{{\mathbf{O}}_{\mathbf{W}}{\mathbf{X}}_{\mathbf{W}}}\) by a side tilt angle \(\alpha\).

  3. (3)

    Define the counterclockwise rotation around the positive direction of the respective reference coordinate system as positive, otherwise as negative.

The homogeneous coordinate transformation matrixes of the cutter’s rotation can be expressed as:

$${\mathbf{R}}_{{\varvec{\upalpha}}}=\begin{array}{cc}\left[\begin{array}{cccc}1& 0& 0& 0\\ 0& \mathrm{cos}\alpha & -\mathrm{sin}\alpha & 0\\ 0& \mathrm{sin}\alpha & \mathrm{cos}\alpha & 0\\ 0& 0& 0& 1\end{array}\right]& {\mathbf{R}}_{{{\varvec{\upbeta}}}{\prime}}=\left[\begin{array}{cccc}\mathrm{cos}{\beta }{\prime}& 0& \mathrm{sin}{\beta }{\prime}& 0\\ 0& 1& 0& 0\\ -\mathrm{sin}{\beta }{\prime}& 0& \mathrm{cos}{\beta }{\prime}& 0\\ 0& 0& 0& 1\end{array}\right]\end{array}$$
(5)

Therefore, the posture adjustment transformation matrix \({\mathbf{M}}_{\mathbf{S}\mathbf{C}}\) of {C} with respect to \(\left\{S\right\}\) is

$${\mathbf{M}}_{\mathbf{S}\mathbf{C}}={\mathbf{R}}_{{\varvec{\upalpha}}}{\mathbf{R}}_{{{\varvec{\upbeta}}}{\prime}}=\left[\begin{array}{cccc}\mathrm{cos}{\beta }{\prime}& 0& \mathrm{sin}{\beta }{\prime}& 0\\ \mathrm{sin}\alpha \mathrm{sin}{\beta }{\prime}& \mathrm{cos}\alpha & -\mathrm{sin}\alpha \mathrm{cos}{\beta }{\prime}& 0\\ -\mathrm{cos}\alpha \mathrm{sin}{\beta }{\prime}& \mathrm{sin}\alpha & \mathrm{cos}\alpha \mathrm{cos}{\beta }{\prime}& 0\\ 0& 0& 0& 1\end{array}\right]$$
(6)

Position movement reflects the translation of the cutter during milling (see Fig. 3(b)), The direction of the vector \(\overrightarrow{{\mathbf{O}}_{\mathbf{W}}{\mathbf{X}}_{\mathbf{W}}}\) and the vector \(\overrightarrow{{\mathbf{O}}_{\mathbf{W}}{\mathbf{Y}}_{\mathbf{W}}}\) are defined as the interval feed direction and the feed direction, respectively. The unidirectional linear feed cutting is applied in the simulation. \({f}_{p}\) is the feed spacing (mm), and q represents the feed order. The position movement transformation matrix \({\mathbf{M}}_{\mathrm{WS}}\) of \(\left\{S\right\}\) with respect to \(\left\{W\right\}\) is expressed as:

$${\mathbf{M}}_{\mathbf{W}\mathbf{S}}=\left[\begin{array}{cccc}1& 0& 0& {x}_{0}+\left(q-1\right){f}_{p}\\ 0& 1& 0& {y}_{0}+{v}_{f}{t}_{2}\\ 0& 0& 1& {z}_{0}+{w}_{h}+R-{a}_{p}\\ 0& 0& 0& 1\end{array}\right]$$
(7)

where \(\left[{x}_{0}{y}_{0}{z}_{0}\right]\) is the initial cutter location of \({O}_{\mathrm{S}}\) in the coordinate system \(\left\{W\right\}\). \({v}_{f}\) is the feed rate (mm/s), which equals to \(\omega {f}_{z}N\). \({f}_{z}\) is the feed per tooth (mm/(r·z)). \({t}_{2}\) is the feeding duration in the current feed order (s). The workpiece is initialed as a flat surface with a height of \({w}_{h}\) (mm). \({a}_{p}\) is the cutting depth (mm).

The cutting-edge trajectory model is then obtained based on the above homogeneous coordinate transformation matrices. The trajectory model is expressed as

$${\lbrack\begin{array}{cc}x_P^W\left(t,\theta\right)&\begin{array}{ccc}y_P^W(t,\theta)&z_P^W(t,\theta)&1\end{array}\end{array}\rbrack}^T={\mathbf M}_{\mathbf W\mathbf S}{\mathbf M}_{\mathbf S\mathbf C}{\mathbf M}_{\mathbf C\mathbf j}\begin{bmatrix}x_P^j&y_P^j&z_P^j&1\end{bmatrix}^T\\$$
(8)

3 Surface topography simulation

The improved Z-MAP method based on the SQP algorithm is described in detail in this section. In the traditional Z-MAP method, both the cutting edge and the workpiece need to be discretized simultaneously for simulation precision. At each time step, each cutting-edge element’s positions are calculated based on the trajectory model, making it time-consuming. The improved Z-MAP method avoids cutting-edge discretization and does not require strict time step limits. The X–Y coordinates of the workpiece grid points are used to establish nonlinear equations with the cutting-edge trajectory model. These nonlinear equations are then transformed into optimization problems by introducing constraints on the time step and axial immersion angle. These optimization issues are resolved using the SQP algorithm. The Z coordinates of the grid point and the cutting edge are then compared to update the workpiece surface. The integrated surface topography simulation algorithm is summarized at last.

3.1 Workpiece surface discretization

The principle of the Z-MAP method is to discretize the workpiece surface into X–Y grid points with height information. As shown in Fig. 4, the workpiece’s dimension is \({L}_{x}\times {L}_{y}\times {w}_{h}\), and the flat surface is divided into \(m\times n\) grid points. The matrix \(\mathbf{Z}\left[\mathbf{i}\mathbf{i},\mathbf{j}\mathbf{j}\right],\left(ii=\mathrm{1,2},\dots ,m+1,jj=\mathrm{1,2},\dots ,n+1\right)\) stores the Z coordinates of these grid points and is initialized with the workpiece’s height \({w}_{h}\). The surface topography simulation continuously updates the matrix \(\mathbf{Z}\left[\mathbf{i}\mathbf{i},\mathbf{j}\mathbf{j}\right]\) during the milling process based on the cutting-edge trajectory model (Eq. 8).

Fig. 4
figure 4

Discretization of the workpiece

The workpiece discretization directly affects the simulation accuracy and computational efficiency. If m and n are set too small, the micro surface topography is difficult to be reflected in simulation. On the other hand, when m and n are set too large, the calculation time cost increases significantly with less improvement of simulation accuracy. To balance both accuracy and efficiency, the workpiece discretization satisfies the following condition.

$$\mathrm{max}\left({L}_{x}/m,{L}_{y}/n\right)\le \frac{1}{10}\mathrm{min}\left({f}_{z},{f}_{\mathrm{p}}\right)$$
(9)

The time step is another important simulation parameter to be determined. The traditional Z-MAP method requires a small time step to ensure that each workpiece grid point is milled. With the improved Z-MAP method, restrictions on the time step are loosened. A time step \(\Delta t\) in the range of \(\left({5}^{\circ }\sim {10}^{\circ }\right)/\omega\) can generally produce the desired result since the accurate cutting-edge element and cutting time are inversed with the grid point coordinates and the cutting-edge trajectory model.

3.2 Tool-workpiece contact area identification

Identification of the tool-workpiece contact area is the most important part of topography simulation. In this section, the instantaneous sweep polygon of the ball-end cutter in the milling process is established. The overlapping area between swept polygon and the workpiece surface is exactly the contact area at that time interval. So, the identification of the contact area becomes the problem of determining whether the workpiece grid point is inside the sweep polygon. A simple solution to this geometric problem is represented at last.

The cutting depth \({a}_{p}\) is generally smaller than the cutter’s radius R during milling (see Fig. 5). The axial immersion angle \({\theta }_{im}\) is calculated as

Fig. 5
figure 5

Ball-end cutter milling workpiece

$${\theta }_{\mathrm{im}}=2\mathrm{arccos}\left(\left(R-{a}_{p}\right)/R\right)$$
(10)

The cutter inclination angle \({A}_{t}\) is determined by both the side tilt angle \(\alpha\) and the forward tilt angle \(\beta\). \({A}_{t}\) is denoted as

$$A_{\mathrm t}=\arccos\left(\cos\alpha\cos\beta\right)$$
(11)

Not all cutting edges are involved in milling, and the minimum and maximum axial immersion angles \({\theta }_{\mathrm{min}},{\theta }_{\mathrm{max}}\) are solved by

$$\left\{\begin{array}{c}{\theta }_{\mathrm{min}}={A}_{\mathrm{t}}-0.5{\theta }_{\mathrm{im}},{\theta }_{\mathrm{min}}\in \left[0,\pi /2\right]\\ {\theta }_{\mathrm{max}}={A}_{\mathrm{t}}+0.5{\theta }_{\mathrm{im}},{\theta }_{\mathrm{max}}\in \left[0,\pi /2\right]\end{array}\right.$$
(12)

Suppose that the current cutting time is \({t}_{c}\) and the next cutting time is \({t}_{c}+\Delta t\), the four endpoints \({P}_{k}\left(k=\mathrm{1,2},\mathrm{3,4}\right)\) forming the cutting-edge sweep polygon can be calculated using Eq. 13 with \({\theta }_{\mathrm{min}}\) and \({\theta }_{\mathrm{max}}\).

$$\begin{array}{l}{P}_{k}={\left[{x}_{p}^{W}\left({t}_{k},\theta \right){y}_{p}^{W}\left({t}_{k},{\theta }_{k}\right){z}_{p}^{W}\left({t}_{k},{\theta }_{k}\right)\right]}^{T}\\ \left\{\begin{array}{l}\begin{array}{c}k=1,{t}_{k}={t}_{c},{\theta }_{k}={\theta }_{\mathrm{min}}\\ k=2,{t}_{k}={t}_{c},{\theta }_{k}={\theta }_{\mathrm{max}}\end{array}\\ k=3,{t}_{k}={t}_{c}+\Delta t,{\theta }_{k}={\theta }_{\mathrm{min}}\\ k=4,{t}_{k}={t}_{c}+\Delta t,{\theta }_{k}={\theta }_{\mathrm{max}}\end{array}\right.\end{array}$$
(13)

The next step is to create the cutting-edge instantaneous sweep polygon and search for the workpiece grid points falling into it. In this way, the number of grid points, whose Z coordinates need to be updated, is significantly reduced. The four endpoints \({P}_{k}\left(\mathrm{k}=\mathrm{1,2},\mathrm{3,4}\right)\) need to be arranged in the order in which they make up a closed polygon \({\text{ABCD}}\). Otherwise, the grid point originally in the sweep polygon may be incorrectly identified as outside the sweep polygon, as shown in Fig. 6(a)–(b). When the cutter cuts in or out of the workpiece, the sweep polygon is not completely inside the workpiece surface, as shown in Fig. 6(c). In this case, the tool-workpiece contact area becomes the overlap area between the sweep polygon and the workpiece surface.

Fig. 6
figure 6

Identification of tool-workpiece contact area. a Incorrect and b correct identification of grid point within sweep polygon. c Identification of grid points in the contact area

Tool-workpiece contact area identification is now a point containment problem for polygons, which can be described as, given a polygon ABCD and an arbitrary point Q, determining whether Q is inside the polygon [29]. The vector cross-multiplication method is computationally efficient in solving the point containment problem and robust in dealing with complicated constraints during the actual milling process [30]. The vector cross-multiplication values of the point Q to two sequential adjacent points \(\left\{\overrightarrow{QA}\times \overrightarrow{QB},\overrightarrow{QB}\times \overrightarrow{QC},\overrightarrow{QC}\times \overrightarrow{QD},\overrightarrow{QD}\times \overrightarrow{QA}\right\}\) are calculated. If these cross-multiplication values are all positive or all negative and not zero, the point is in the polygon. If these cross-multiplication values are all positive or all negative and have zero, the point is on the polygon. Otherwise, the point is outside the polygon. Therefore, the vector cross-multiplication method is applied in this paper to extract the grid points inside the sweep polygon, thus realizing the tool-workpiece contact area identification.

3.3 The SQP algorithm

After extracting the grid points \(\left({x}_{ii},{y}_{jj}\right)\) inside the sweep polygon, the first and second rows of Eq. 8 are used to solve the cutting time \({t}^{*}\) and the axial immersion angle \({\theta }^{*}\). The nonlinear constraint equation system is defined as follows.

$$\left\{\begin{array}{c}{f}_{x}\left(t,\theta \right)={x}_{P}^{W}\left(t,\theta \right)-{x}_{ii}=0\\ {f}_{y}\left(t,\theta \right)={y}_{P}^{W}\left(t,\theta \right)-{y}_{jj}=0\end{array}\right.$$
(14)

The results of the above nonlinear equations \(\left({t}^{*},{\theta }^{*}\right)\) are substituted into Eq. 8, and the height of the cutter edge element at the current cutting time is obtained.

$${z}_{{P}^{*}}^{W}={z}_{P}^{W}({t}^{*},{\theta }^{*})$$
(15)

\(Z\left[ii,jj\right]\) is then replaced with a smaller value by contrast with \({z}_{{P}^{*}}^{W}\) and \(Z\left[ii,jj\right]\), thus updating the workpiece surface topography.

The nonlinear equation system in Eq. 14 is transformed into a functional optimization problem, which is rewritten as

$$\begin{array}{cc}\mathrm{min}& F\left(t,\theta \right)={f}_{x}^{2}\left(t,\theta \right)+{f}_{y}^{2}\left(t,\theta \right)\\ \mathrm{s}.\mathrm{t}.& t\in \left[{t}_{c},{t}_{c}+\Delta t\right]\\ & \theta \in \left[{\theta }_{\mathrm{min}},{\theta }_{\mathrm{max}}\right]\end{array}$$
(16)

If solutions to the nonlinear equation system in Eq. 14 exist, the optimal value of the evaluation function \(F\left(t,\theta \right)\) in Eq. 16 is expected to be zero. Unlike the nonlinear equation system, the functional optimization problem gives these parameters physical meaning by introducing cutting time and axial immersion angle constraints. In addition, this transformation avoids determining the initial values of \(t\) and \(\theta\), making it easier to obtain a global solution.

For constrained optimization issues like Eq. 16, the SQP algorithm is better suited for global searching. To accommodate the solution form of the SQP algorithm, the quadratic programming model is defined as:

$$\begin{array}{cc}\mathrm{min}& F\left(t,\theta \right)={f}_{x}^{2}\left(t,\theta \right)+{f}_{y}^{2}\left(t,\theta \right)\\ \mathrm{s}.\mathrm{t}.& \begin{array}{cc}{g}_{u}\left(t,\theta \right)=0& u=\mathrm{1,2},\dots ,{n}_{g}\end{array}\\ & \begin{array}{cc}{h}_{v}\left(t,\theta \right)\ge 0& v=\mathrm{1,2},\dots ,{n}_{h}\end{array}\end{array}$$
(17)

where \({g}_{u}\left(t,\theta \right)\) are the equality constraints, and \({n}_{g}\) is the number of \({g}_{u}\left(t,\theta \right)\). There are no equality constraints in the optimal model but \({g}_{u}\left(t,\theta \right)\) is still retained in the following description for generality. The inequality constraints \({h}_{v}\left(t,\theta \right)\) are applied to limit the range of parameters, where \(t\in \left[{t}_{c},{t}_{c}+\Delta t\right]\) and \(\theta \in \left[{\theta }_{\mathrm{min}},{\theta }_{\mathrm{max}}\right]\). \({n}_{h}\) is the number of \({h}_{v}\left(t,\theta \right)\).

In general, the SQP algorithm possesses three main steps for solving constrained optimization problems.

  1. (1)

    SQP subproblem construction

$$\begin{array}{l}\mathrm{min}\nabla F{\left(\mathbf{x}\right)}^{T}{\varvec{\updelta}}+\frac{1}{2}{{\varvec{\updelta}}}^{T}\mathbf{Q}{\varvec{\updelta}}\\ \begin{array}{c}\begin{array}{cc}\mathrm{s}.\mathrm{t}.& {g}_{u}\left(\mathbf{x}\right)+\nabla {g}_{u}\left(\mathbf{x}\right){\varvec{\updelta}}=0\end{array}\\ \;\;\;\;\;\;\;\;\;\;{ h}_{v}\left(\mathbf{x}\right)+\nabla {h}_{v}\left(\mathbf{x}\right){\varvec{\updelta}}\ge 0\end{array}\end{array}$$
(18)

where \(\mathbf{x}=\left[t,\theta \right]\). \({\varvec{\updelta}}\) is the search direction in the range of the vector x. Q is the iterative Hessian matrix.

  1. (B)

    Iterative Hessian matrix calculation

Using the Lagrange multiplier method, Eq. 18 is rewritten:

$$L\left(\mathbf{x},\kappa ,\mathrm{\hslash }\right)=F\left(\mathbf{x}\right)-\sum_{u=1}^{p}{\kappa }^{u}{g}_{u}\left(\mathbf{x}\right)-\sum_{v=1}^{q}{\mathrm{\hslash }}^{v}{h}_{v}\left(\mathbf{x}\right)$$
(19)

where \(L\left(\mathbf{x},\kappa ,\mathrm{\hslash }\right)\) is the Lagrange function with equal variables. \({\kappa }^{u}\) is the Lagrange factor of the equality constraints. Correspondingly, \({\mathrm{\hslash }}^{v}\) is the Lagrange factor of the inequality constraints.

In the solution of Eq. 19, the search direction and corresponding point are updated:

$${\mathbf{x}}_{\tau +1}={\mathbf{x}}_{\tau }+{{\varvec{\updelta}}}_{\tau }$$
(20)

where \(\tau\) is the number of iterations.

Suppose that the search direction and the derivative of the Lagrange function are specified as:

$$\left\{\begin{array}{l}{\mathbf{s}}_{\tau }={\mathbf{x}}_{\tau +1}-{\mathbf{x}}_{\tau }\\ {\wp }_{\tau }={\nabla }_{x}L\left({\mathbf{x}}_{\tau +1},{\kappa }_{\tau +1},{\mathrm{\hslash }}_{\tau +1}\right)-{\nabla }_{x}L\left({\mathbf{x}}_{\tau },{\kappa }_{\tau },{\mathrm{\hslash }}_{\tau }\right)\end{array}\right.$$
(21)

the iterative Hessian matrix \(\mathbf{Q}\) can be approximately calculated as:

$${\mathbf{Q}}_{\tau +1}={\mathbf{Q}}_{\tau }+\frac{{\stackrel{-}{\overline{Q}} }_{\tau }{\overline{\mathcal{Q}} }_{\tau }^{T}}{{s}_{\tau }^{T}{\overline{\zeta }}_{\tau }}-\frac{{\mathbf{Q}}_{\tau }{s}_{\tau }{s}_{\tau }^{T}{\mathbf{Q}}_{\tau }^{T}}{{s}_{\tau }^{T}{\mathbf{Q}}_{\tau }{s}_{\tau }}$$
(22)
  1. (C)

    Evaluation function calculation

\({V}_{L}\left(\mathbf{x},\gamma ,\psi \right)\) is formulated as follows to guarantee the descending searching direction, and is called the evaluation function.

$${V}_{L}\left(\mathbf{x},\Upsilon ,\psi \right)=z\left(\mathbf{x}\right)+\sum_{u=1}^{p}{\Upsilon }^{\left(u\right)}\left|{g}^{\left(u\right)}\left(\mathbf{x}\right)\right|+\sum_{v=1}^{q}{\psi }^{\left(v\right)}\left|\mathrm{min}\left\{0,{h}^{\left(v\right)}\left(\mathbf{x}\right)\right\}\right|$$
(23)

where \(\Upsilon\) represent the penalty factor. \(\psi\) is given as

$${\psi }_{\tau }^{\left(v\right)}=\left\{\begin{array}{lc}{\mathrm{\hslash }}_{0}^{v}\tau =0\\ max\left\{\left|{\mathrm{\hslash }}_{\tau +1}^{v}\right|,\frac{1}{2}\left[{\psi }_{\tau -1}^{\left(v\right)}+\left|{\mathrm{\hslash }}_{\tau +1}^{v}\right|\right]\right\}\tau \ge 1\end{array}\right.$$
(24)

where \(\tau\) is the number of iterations, and \({\mathrm{\hslash }}_{0}^{v}\) is the initial value of \({\mathrm{\hslash }}^{v}\).

3.4 Surface topography simulation algorithm

Figure 7 gives the detailed surface topography simulation algorithm in the form of a flow chart.

  1. (1)

    First of all, the machining parameters and cutter parameters are initialed, which include the cutter’s radius R, the helix angle \({\gamma }_{0}\), the number of cutter teeth N, the side tilt angle \(\alpha\), the forward tilt angle \(\beta\), the spindle speed \(\omega\), the feed per tooth \({f}_{z}\), the feed spacing \({f}_{p}\), the feed order q, and the cutting depth \({a}_{p}\). The simulation time interval \(\Delta t\) is set in \(\left({5}^{\circ }\sim {10}^{\circ }\right)/\omega\).

  2. (2)

    To begin with, the workpiece surface, with a dimension of \({L}_{x}\times {L}_{y}\), is discretized into \(m\times n\) grid points with height information. The height matrix \(Z\left[ii,jj\right]\) is initialed as \({w}_{h}\).

  3. (3)

    The simulation algorithm carries out the interval feed cycle, feed time cycle, and cutter teeth cycle. These three cycles are dependent on the feed order q, the single feed time \(max\left({t}_{2}\right)\), and the number of cutter teeth \(j=1,\dots ,N\), respectively.

  4. (4)

    At each time step, the cutting-edge instantaneous sweep polygon on the \(j-\mathrm{th}\) tooth is created and then the grid points falling into the tool-workpiece contact area are searched.

  5. (5)

    For each grid point inside the contact area, the cutting time \({t}^{*}\) and the axial immersion angle \({\theta }^{*}\) are solved by the SQP algorithm. So that the cutting-edge’s position \({z}_{P}^{W}\left({t}^{*},{\theta }^{*}\right)\) is obtained.

  6. (6)

    By contrast \({z}_{P}^{W}\left({t}^{*},{\theta }^{*}\right)\) with the workpiece height `, the workpiece height matrix is updated with a smaller value.

  7. (7)

    With all cycles completed, the simulated surface topography in ball-end milling is generated.

Fig. 7
figure 7

Flow chart of the surface topography simulation algorithm

The most novel part of this improved Z-MAP simulation algorithm is the workpiece surface topography update. The traditional Z-MAP method calculates each cutting-edge element’s position using the trajectory model and then updates its z-coordinate to the nearest workpiece grid point, which means all cutting-edge elements need to participate in the calculation at each time interval whether they are cutting the workpiece or not. In the proposed simulation algorithm, the instantaneous sweep polygon of the cutter tooth is established to search for grid points inside the tool-workpiece contact area, making that the number of grid points to be updated is significantly reduced. The cutting time and the axial immersion angle of each workpiece grid point are calculated by the SQP algorithm, which not only avoids cutting-edge discretization but also gives an accurate solution to the updated z coordinates.

4 Time complexity analysis and case study

According to the algorithm flow described in the previous section, this section provides a time complexity analysis to demonstrate the efficiency of the proposed algorithm. Additionally, a case study is included for comparing the accuracy and stability of the proposed method with other Z-MAP methods.

4.1 Time complexity analysis

The differences between the three surface topography algorithms are introduced firstly, including the proposed algorithm, the improved Z-MAP method based on the Newton iteration approach [26], and the traditional Z-MAP method. The proposed algorithm has been given in Fig. 7. The improved Z-MAP method using the Newton iteration approach only differs from the proposed algorithm in the calculation of the cutting time and the axial immersion angle. The traditional Z-MAP method has a cutting-edge element cycle nested in the cutter teeth cycle, and the workpiece surface topography update process is more intuitive. At each time step, all the cutting-edge elements’ positions are calculated through the cutting-edge trajectory model, and the workpiece surface is updated by comparing the height of the cutting-edge element and the height of the adjacent workpiece grid point.

Table 1 presents the time complexity of three topography simulation methods The time complexity of the proposed algorithm is denoted as \(O\left({C}_{1}\cdot {K}_{1}\cdot {I}_{1}\right)\), where \({C}_{1}\) represents the time complexity of the interval feed cycle, feed time cycle, and cutter teeth cycle. \({K}_{1}\) is the number of grid points to be updated at the time step. \({I}_{1}\) is the time complexity of the SQP algorithm. \({I}_{1}\) is considered to be \(O\left({n}_{1}^{3}\right)\), where \({n}_{1}=2\) is the number of variables [31]. Similarly, the time complexity of the Newton-based Z-MAP method is denoted as \(O\left({C}_{1}\cdot {K}_{1}\cdot {I}_{2}\right)\), where I2 is the time complexity of the classical Newton iteration algorithm. \({I}_{2}\) is also considered to be \(O\left({n}_{2}^{3}\right)\), where \({n}_{2}=2\) is the dimension of equations [32]. As for the traditional Z-MAP method, the time complexity is denoted as \(O\left({C}_{2}\cdot {K}_{2}\cdot {I}_{3}\right)\), where \({C}_{2}\) has the same meaning as \({C}_{1}\), but \({C}_{2}={10}^{3}{C}_{1}\). Since that, the traditional Z-MAP method requires a strict time step, which is set as 10–6 s, while the improved Z-MAP method has the time step set as 10–3 s. \({K}_{2}\) is the time complexity of the cutting-edge element cycle. In the traditional Z-MAP method, the axial immersion angle \(\theta \in \left[0,pi/2\right]\) is discretized into 10–5 rad elements, thus \({K}_{2}\approx {10}^{5}\). \({I}_{3}\) is the time complexity of the matrix operation in the cutting-edge trajectory model. \({I}_{3}\) is considered to be \(O\left({n}_{3}^{3}\right)\), where \({n}_{3}=4\) is the dimension of the homogeneous coordinate transformation matrix.

Table 1 Time complexity of three topography simulation methods

From the time complexity analysis, it can be seen that the improved Z-MAP algorithm is less than that of the traditional Z-MAP algorithm. The proposed method and the Newton-based Z-MAP method have similar time complexity, indicating that the proposed method is able to improve simulation efficiency.

4.2 Case study

To compare the efficiency and the accuracy, a simulation case is presented. The simulation parameters are almost the same as those described in Section 5.1. The forward tilt angle \(\beta\), the feed per tooth \({f}_{z}\), and the feed spacing \({f}_{p}\) are set as 0°, 0.8 mm/(r·z), and 0.4 mm, respectively. In the Newton-based method [26], the initial values are set as \(\left[{t}_{0},{\theta }_{0}\right]=\left[{t}_{c}-\Delta t,0.5\left({\theta }_{\mathrm{min}}+{\theta }_{\mathrm{max}}\right)\right]\), where \({\theta }_{\mathrm{min}}=0\mathrm{rad}\), and \({\theta }_{\mathrm{max}}=0.451\mathrm{rad}\) are calculated by Eq. 12. The termination condition of the iteration is \(\left[{t}_{k}-{t}_{k-1},{\theta }_{k}-{\theta }_{k-1}\right]=\left[{10}^{-5},{10}^{-5}\right]\).

Figure 8 gives the topography simulations of the three methods. The time cost of the proposed algorithm, the Newton-based algorithm, and the traditional Z-MAP method are 230 s, 200 s, and 500 s, respectively. Although the proposed method takes longer time than the Newton-based algorithm, it can achieve the same simulation accuracy as the traditional method without the unexpected unsmooth areas. These unsmooth areas show that the approximate error generated from the Newton iteration method damages the simulation surface’s continuity. The line \(y=0.11\) passing through the unsmooth area is selected for comparison. In most cases, the prediction results of the three methods are consistent, but there are errors in the Newton method in special areas. At the workpiece grid point \(\left(x,y\right)=\left(0.84,0.11\right)\), the predicted height of the proposed algorithm, the Newton-based algorithm, and the traditional Z-MAP method are -7.4114 μm, -4.7962 μm, and -7.9643 μm, respectively. The traditional Z-MAP method is used as a benchmark for simulation accuracy due to its high accuracy of cutter teeth and time discretization. It can be seen that the Newton-based algorithm has almost 3 μm approximation error, which is not allowed in high-precision simulation. In contrast, the proposed method is more stable in simulation results than the Newton-based algorithm.

Fig. 8
figure 8

Topography simulation of the three methods. a Newton-based Z-MAP method. b Traditional Z-MAP method. c The proposed method. d Selected line comparison

The false selection of the initial value may be the reason why the classical Newton numerical solver generates unexpected approximation errors. The workpiece grid point \(\left(x,y\right)=\left(0.84, 0.11\right)\) is taken as an example. This point is updated when the feed order \(q=4\), the single feed time \({t}_{c}=0.006\mathrm{s}\), \(\Delta t={10}^{-3}\mathrm{s}\), and the cutter tooth \(j=2\). Table 2 gives the results of SQP and Newton numerical solver under different initial values. The initial value \({\theta }_{0}=0.5\left({\theta }_{\mathrm{min}}+{\theta }_{\mathrm{max}}\right)=0.226\mathrm{rad}\). The SQP algorithm has constraints \({t}^{*}\in \left[{t}_{c},{t}_{c}+\Delta t\right]=\left[\mathrm{0.006,0.007}\right],{\theta }^{*}\in [{\theta }_{\mathrm{min}},{\theta }_{\mathrm{max}}]=[\mathrm{0,0.451}]\) and can converge to the same solution stably at different initial values. While the Newton numerical solver converges to (0.0043, -0.0348) when the initial value is \({t}_{0}={t}_{c}-\Delta t\), which is beyond the range of the cutting time and axial immersion angle. Therefore, the SQP method with physical constraints introduced in the simulation can reduce the influence of the initial value on the convergence results, making the simulation results more stable.

Table 2 Results of SQP and Newton numerical solver under different initial values

5 Ball-end milling experiments

Several ball-end milling experiments with various cutting parameters are carried out to validate both the accuracy and the efficiency of the proposed method in this section.

5.1 Experiment setup

The ball-end milling experiment setup is illustrated in Fig. 9. The experiments are performed utilizing a DMU50 five-axis machining center (Fig. 8(a)–(b)). The ball-end milling cutter, whose diameter is 10 mm, is composed of tungsten steel. Besides, the cutter has two teeth with a helix angle of \({35}^{\circ }\). The workpiece material is aluminum alloy 7050 with high strength and small plastic deformation. Four milling experiments have been conducted, and the workpiece size of each experiment is 3 mm × 3 mm (Fig. 8(c)). After milling, the machined surfaces are measured by the VK-X3000 surface profiler from KEYENCE (Fig. 8(d)), with a height resolution of 1 nm.

Fig. 9
figure 9

Experimental setup

The cutting parameters are listed in Table 3. Different surface topography factors are considered, which include the forward tilt angle \(\beta\), the feed per tooth \({f}_{z}\), and the feed spacing \({f}_{p}\). Among the common parameters of these experiments, the spindle speed \(\omega\) is 3000 r/min. The cutting depth \({a}_{p}\) is set as 0.5 mm.

Table 3 Experiment cutting parameters

The simulation parameters are presented as follows. The simulated surface dimension is set as 1.5 mm × 1 mm, which matches the visual field of the surface profiler system. The surface is divided into 100 × 100 grid points with dimensions 0.03 × 0.032 mm. In the traditional Z-MAP method, the time interval is 1 × 10–5 s, and the cutting-edge position angle unit is 1 × 10–4 rad to ensure that all grid points can be milled. In the proposed method, the time interval is 1 × 10–3 s, and the cutting edge doesn’t need to be discretized. In addition, the computer information used for surface topography simulation is as follows. The computer processor is 12th Gen Intel(R) Core(TM) i7-12700 CPU @ 2.10 GHz, memory capacity 64 GB, Windows 10 system, software environment Matlab 2021a.

5.2 Results and discussion

The surface topography simulation accuracy and efficiency of the proposed method are identified by comparing with both the experimental measurements and the traditional Z-MAP method simulations. The profiles in the interval feed direction under different cutting parameters are selected to further illustrate the differences between measurement and simulation.

The experimental measurements and the surface topography simulations are presented in Figs. 10, 11, 12, and 13. In addition to 3D height maps, 2D profiles of 0.7 mm length, extracted at the center of the area, along the interval feed direction are presented. Although numerous burrs appear on the measured surface (especially on the workpiece edges), the effect of the cutting parameters on the machined surfaces can be observed. Multiple periodic peaks are shown in the feed direction, and the 2D profile fluctuates with a range of [-5, 5] μm (see Fig. 10). Under the influence of the tilt angle, the workpiece is unevenly milled by the ball-end cutter, resulting in periodic spherical depressions on the measured surface topography (see Fig. 11). When the feed per tooth increases from 0.2 mm/(rz) to 0.5 mm/(rz), the number of peaks in the feed direction decrease, and the 2D profile fluctuates greatly with a range of [-10, 10] μm (see Fig. 12). In experiment No. 5, fewer cycles are shown in the interval feed direction than that of experiment No. 1. Only one peak appears on the surface topography at the 0.8 mm feed spacing, as the visual field in the interval feed direction is 1.5 mm (see Fig. 13).

Fig. 10
figure 10

Surface topography measurement and simulation of No. 1. a Measurement. b Traditional Z-MAP simulation. c Improved Z-MAP simulation. d Profiles in the interval feed direction

Fig. 11
figure 11

Surface topography measurement and simulation of No. 2. a Measurement. b Traditional Z-MAP simulation. c Improved Z-MAP simulation. d Profiles in the interval feed direction

Fig. 12
figure 12

Surface topography measurement and simulation of No. 3. a Measurement. b Traditional Z-MAP simulation. c Improved Z-MAP simulation. d Profiles in the interval feed direction

Fig. 13
figure 13

Surface topography measurement and simulation of No. 4. a Measurement. b Traditional Z-MAP simulation. c Improved Z-MAP simulation. d Profiles in the interval feed direction

Even though the measured profiles fluctuate, the simulated profiles are in good agreement with the measurement. In Fig. 10(d) about 0.55 mm, the measured profile includes much vibration. The possible reason may be the tool vibration and the cutting force. In Fig. 11(d) about 0.45 mm, the measured profile is much smaller than that of the simulation, which may be caused by the workpiece plastic deformation and the slenderness of the cutting tool.

There are many factors that affect the topography of the machined surface in the actual cutting process, such as material elasticity, tool wear, tool runout, the machine tool volumetric error, and measuring instrument noise. Moreover, the initial cutting angles of the adjacent tool paths are different in real machining, which also contributes to the errors between the simulation and the measurement. These error sources are complex and strongly random, which are difficult to simulate, and the deviations between simulated and measured topography are acceptable.

The simulated topographies by the proposed method and the traditional Z-MAP method are almost identical in most cases. These two simulation methods are based on the same kinematics model. In the traditional Z-MAP method, the theoretical topography can be obtained as long as the units of time-step and cutting edge are small enough (without considering the tool runout, tool defection, etc.). While the proposed method obtains the topography by solving the system of trajectory equations, which avoids cutting-edge discretization. From the simulation results, there are minor differences between these two calculation methods, showing the accuracy of the proposed method.

The Root-Mean-Square Error (RMSE) of the proposed method and the traditional Z-MAP method on the selected profile is listed in Table 4. The RMSE of the four experiments is within 0.15 μm, illustrating that the proposed method has almost the same accuracy level as the traditional Z-MAP method.

Table 4 RMSE of the proposed method and the traditional Z-MAP method in the selected profile

The time costs of three topography simulation methods in the four experiments are given in Fig. 14. The simulation parameters and environment are already illustrated in the Experiment Setup section. Although the proposed method takes a little longer time than the Newton-based Z-MAP method, considering the stability of the solution, this time loss is acceptable. In the traditional Z-MAP method, the computing time of experiments No. 1–2 and No. 4 are 58 min, 57 min, and 53 min, respectively. The feed per tooth of the No. 3 is bigger than the other experiments, resulting in faster feed rates and less simulation time, which is 27 min. In the proposed method, the computing time of the four experiments is within 30 min, which are 15 min, 21 min, 11 min, and 20 min, respectively. The proposed method reduces the time cost by 74.1%, 63.2%, 59.3%, and 62.3% compared to the traditional Z-MAP method. The proposed method costs only half as much time as the traditional Z-MAP method, showing higher efficiency for surface topography simulation.

Fig. 14
figure 14

Time costs of three topography simulation methods

6 Conclusions

In this paper, an improved Z-MAP method based on the SQP algorithm for fast surface topography simulation of ball-end milling is proposed. Experiments and numerical simulations are conducted to validate this proposed method. The following are the primary conclusions:

  1. (1)

    The proposed method establishes a cutting-edge trajectory model based on the homogeneous coordinate transformation, which includes both the cutter’s posture adjustment and position movement. The cutting-edge instantaneous sweep polygon is presented, followed by the identification of the workpiece grid points falling into it. In this way, the number of grid points, whose Z coordinates need to be updated, is significantly reduced.

  2. (2)

    At each simulation time interval, the workpiece grid points’ coordinates are used to establish nonlinear equations with the cutting-edge trajectory model, so that the accurate cutting time and the axial immersion angle can be obtained. The proposed method transforms these nonlinear equations into an optimization problem and the SQP algorithm is applied for the solution. Therefore, the updated Z coordinates of the grid points are no longer affected by the initial values and exhibit global optimality.

  3. (3)

    The ball-end milling experiments and numerical simulations are conducted for validation. Experimental results indicate that the simulated surface topography is consistent with the measured surface topography. Compared to the traditional Z-MAP method, the proposed method shows almost the same level of accuracy and needs less computing time.

The improved Z-MAP method has a broad application prospect in the ball-end milling surface quality estimation and cutting parameters optimization. The improved Z-MAP method is validated with a rectangular plate in this paper but can be easily applied in projectable free-form surface milling, which only changes the workpiece's initial height and the axial immersion angle during milling. The shortcoming of the proposed method is that it cannot support non-projectable surfaces, such as the surface of the impeller. This method can be also applied to more types of tool shapes such as torus, flat-end, etc. by changing the cutting-edge definition and the axial immersion angle. Furthermore, this method can be strengthened by considering the spindle eccentricity, the cutter runout, and the workpiece deformation, which will be our future work.