I'm working on an existing application that calculates the X,Y (or X,Z) coordinates for the profile of a ZK worm part from provided parameters that are used to generate a dressing program for a Siemens CNC machine.
I have 2 examples of ZK worms that I've been using for testing:
- A ZK worm with a tip (outer) diameter of 90 mm, a root diameter of 65 mm and a pitch circle diameter of 79 mm (this is an existing file that was created by my predecessor).
- A ZK worm with a tip (outer) diameter of 23 mm, a root diameter of 11.3 mm and a pitch circle diameter of 18.2367 mm (this is taken from a sample drawing provided by a customer for a tender/enquiry).
The calculations create the ZK tool (or wheel) profile points' coordinates first, then use that to calculate the work profile points' coordinates.
The first example seems to work successfully, displaying the profiles generated and creating a dressing program, and they do look to be correct from what I can tell.
However, the second example creates the wheel profile successfully, and it looks to be correct, but the worm profile generated comes out as being about 0.5 mm shorter than it should be (the tooth depth should be 5.85 mm using the specified tip and root diameters, but the worm is calculated with a tooth depth of 5.3250 mm.
After calculating the worm profile from its wheel profile, the routine then interpolates the appropriate points at the tip (OD), pitch circle (PCD) and root diameters using the defined worm profile: for the 2nd file, this process fails for 7 points below the PCD and above the root.
I believe that this is caused by the conversion routine that transforms a point in the wheel profile's coordinate system to the corresponding point in the worm profile's coordinate system using rotation matrices.
This routine makes use of the following data:
- Work: Worm point ($X_{wk}$, $Z_{wk}$, $Theta_{wk}$)
- Wheel: Wheel point ($X_{wh}$, $Z_{wh}$, $Theta_{wh}$)
- CFF: Contact point (X, Y, Z, Rotation)
- Par: Machine geometry: Lead, Centre Distance (CDIS), Helix Angle (SSA), Max Wheel Semi-Width, Approach Angle, Transverse Profile Rotation Angle, Axial Profile X Shift, Offset, Wheel Spindle Deviation)
- TSP[]: Spindle Transformation Matrix (3 x 3)
- SVA[]: Iteration Estimate Values (3 x 1)
- Mode: Options (Cartesian/Polar Coordinates, Diagnostics Mode, Internal/External, Transverse/Axial Profile, Whirling Mode)
(SSA = spindle setting angle, an alternative name for the helix angle.)
The TSP[] matrix is defined as follows:
- $\gamma$ = helix angle/SSA
- $\delta$ = approach angle
$CG = \cos \gamma, SG = \sin \gamma$
$CD = \cos \delta, SD = \sin \delta$
$$TSP = \begin{bmatrix} (CG \cdot CD) & (-SG \cdot CD) & -SD \\ SG & CG & 0 \\ (CG \cdot SA) & (-CG \cdot SD) & CD \end{bmatrix} (Eq. 1) $$
The routine uses a Newton iteration loop to find the rotation angle ($A_3$) required to calculate the worm profile point with a tolerance of $\pm 0.00001$ radians, a limit of 30 iterations and a starting increment of 0.02 radians.
Wheel point vector $XYZ_{wh}$:
$$XYZ_{wh} = \begin{bmatrix} X_{wh} \\ 0 \\ -Z_{wh} \\ \cos \theta_{wh} \\ 0 \\ -\sin \theta_{wh} \end{bmatrix} (Eq. 2)$$
It uses another routine called NEWVL2 to calculate the next estimate for $A_3$ with an initial increment of 0.02 radians.
X axis rotation matrix $TX_1$:
$$TX_1 = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos A_3 & \sin A_3 \\ 0 & -\sin A_3 & \cos A_3 \end{bmatrix} (Eq. 3)$$
$$XYZ_{wr} = TX_1 \cdot XYZ_{wh} = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos A_3 & \sin A_3 \\ 0 & -\sin A_3 & \cos A_3 \end{bmatrix} \cdot \begin{bmatrix} X_{wh} \\ 0 \\ -Z_{wh} \\ \cos \theta_{wh} \\ 0 \\ -\sin \theta_{wh} \end{bmatrix} (Eq. 4)$$
$XYZ_{wk} = TSP^T \cdot XYZ_{wr} (Eq. 5)$
$XYZ_{{wk}_2} = XYZ_{{wk}_2} + WheelSpindleDeviation (Eq. 6)$
$XYZ_{{wk}_3} = XYZ_{{wk}_3} + CentreDistance (Eq. 7)$
$PointRadius = \sqrt{(XYZ_{{wk}_2}^2 + XYZ_{{wk}_3}^2)} (Eq. 8)$
$LeadAngle = \tan^{-1} \frac{Lead}{(2 \cdot \pi \cdot PointRadius)} (Eq. 9)$
Helix point vector $XYZ_{hx}$:
$$XYZ_{hx} = \begin{bmatrix} 0 \\ 0 \\ PointRadius \\ -\sin LeadAngle \\ \cos LeadAngle \\ 0 \end{bmatrix} (Eq. 10)$$
If $(|LeadAngle| > 45 deg)$:
$A_{Rotn} = \frac{\left (\frac{\pi}{2} \right ) \cdot XYZ_{{wk}_1}}{Lead} (Eq. 11)$
X axis rotation matrix $TX_2$:
$$TX_2 = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos A_{Rotn} & \sin A_{Rotn} \\ 0 & -\sin A_{Rotn} & \cos A_{Rotn} \end{bmatrix}(Eq. 12) $$
$$XYZ_{wa} = TX_2 \cdot XYZ_{wk} = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos A_{Rotn} & \sin A_{Rotn} \\ 0 & -\sin A_{Rotn} & \cos A_{Rotn} \end{bmatrix} \cdot XYZ_{wk} (Eq. 13)$$
$XYZ_{{wa}_1} = 0 (Eq. 14)$
$A_{Rotn} = tan^{-1} \left (\frac{XYZ_{{wa}_2}}{XYZ_{{wa}_3}} \right ) (Eq. 15)$
X axis rotation matrix $TX_1$:
$$TX_1 = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos A_{Rotn} & \sin A_{Rotn} \\ 0 & -\sin A_{Rotn} & \cos A_{Rotn} \end{bmatrix} (Eq. 16)$$
$$XYZ_{xx} = TX_1^T \cdot XYZ_{hx} = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos A_{Rotn} & \sin A_{Rotn} \\ 0 & -\sin A_{Rotn} & \cos A_{Rotn} \end{bmatrix} \cdot \begin{bmatrix} 0 \\ 0 \\ PointRadius \\ -\sin LeadAngle \\ \cos LeadAngle \\ 0 \end{bmatrix} (Eq. 18)$$
If $(|LeadAngle| <= 45 deg)$:
$XYZ_{xx} = XYZ_{hx} (Eq. 18)$
$A_{Rotn} = \tan^{-1} \left (\frac{XYZ_{{wa}_2}}{XYZ_{{wa}_3}} \right ) (Eq. 19)$
X axis rotation matrix $TX_2$:
$$TX_2 = TX_2 = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos A_{Rotn} & \sin A_{Rotn} \\ 0 & -\sin A_{Rotn} & \cos A_{Rotn} \end{bmatrix} (Eq. 20)$$
$$XYZ_{yy} = TX2^T \cdot XYZ_{xx} = TX2^T \cdot \begin{bmatrix} 0 \\ 0 \\ PointRadius \\ -\sin LeadAngle \\ \cos LeadAngle \\ 0 \end{bmatrix} (Eq. 21)$$
$XYZ_{zz} = TSP \cdot XYZ_{yy} (Eq. 22)$
$f_{A{3}_old} = f_{A{3}} (Eq. 23)$
$f_{A{3}} = V_Scalar(XYZ_{zz}, 4, XYZ_{wr}, 4) (Eq. 24)$
The V_Scalar routine calculates the scalar product of the $XYZ_{zz}$ and $XYZ_{wr}$ vectors but only for the direction cosines in rows 4, 5 and 6.
For the 2nd and later iterations, it calculates the gradient as: $GRAD = (A3 - OldA3) / (f(A3) - Oldf(A3)) (Eq. 25)$
If a value is found for $A_3$, it is used to calculate the coordinates and normal angle for the worm profile point on the axial or transverse plane, depending on the value of the Mode.TransverseProfile variable.
I previously rewrote another part of this application that used Newton iteration to find a rotation angle to solve the associated equation for f(x) to get the value of 'x', but that one was simple.
Does anyone know a way to rewrite these matrix operations as an equation that can be solved?
Edit to add: the image below is taken from the DIN 3975 standard for worms and I hope will show the relationship between the wheel coordinate system and the worm coordinate system.
