Disclosure of Invention
In view of this, the embodiment of the present invention provides an in-situ measurement method for a sealing surface of a triple eccentric butterfly valve, so as to solve the problem of a secondary machining error caused by the adoption of offline measurement to disassemble a workpiece in the prior art.
The embodiment of the invention provides an in-place measuring method for a sealing surface of a three-eccentric center butterfly valve, which comprises the following steps:
acquiring coordinate information of an external contour data point of a workpiece to be detected, which is arranged on a rotary table;
establishing a first space linear equation for the coordinate information of the data points through least square fitting;
selecting an optimal bus equation from the first space linear equation according to a preset taper angle;
fitting through an optimal generatrix equation to obtain a first conical surface equation;
obtaining m fitted coordinates of the central point, and substituting the coordinates of the central point into the first conical surface equation to obtain corresponding m second conical surface equations; the center point is selected from a preset area in a plane where a conical vertex of the workpiece to be measured is located, the plane is parallel to the upper surface of the rotary table, the preset area is a circular area containing the conical vertex and having a radius of r, or the preset area is a square area containing the conical vertex and having a side length of r, and m is a natural number greater than or equal to 1;
and selecting the second conical surface corresponding to the set with the minimum error from the minimum distance value sets from the data points to the m second conical surfaces as the best fitting conical curved surface.
Optionally, the obtaining of the coordinate information of the external contour data point of the workpiece to be measured placed on the turntable includes: when the rotary table rotates for a preset angle, the laser sensor performs one-time acquisition operation on the workpiece to be detected; after the rotary table rotates for a circle, the laser sensor moves downwards along the Z axis by a preset distance for the next acquisition operation.
Optionally, before the establishing the first spatial straight-line equation by least-squares fitting on the coordinate information of the data points, the method further includes:
setting the optimal data meeting the requirements in the data points as standard points, and taking the rest data points as data points to be screened;
setting a relative distance deviation threshold value;
and calculating the relative distance between the data point to be screened and the standard point, wherein if the relative distance is less than or equal to the relative distance deviation threshold value, the data point to be screened is a qualified data point.
Optionally, the selecting an optimal generatrix equation from the first spatial linear equation according to the preset taper angle includes:
acquiring a direction vector of a first space linear equation;
acquiring an included angle between a first space straight line and a standard straight line according to the direction vector;
calculating the cone angle of a cone taking the first space straight line as a bus according to the included angle;
taking all first space straight lines with the cone angle ranging from 18 degrees to 23 degrees as second space straight lines;
and selecting one straight line from the second space straight lines as an optimal bus.
Optionally, obtaining the direction vector of the first spatial line equation comprises:
calculating the sum of squares of residuals of the first space linear equation;
and deriving the residual sum of squares to obtain a coefficient of a first space straight line equation and a direction vector of the first space straight line.
Optionally, obtaining m fitted coordinates of the central point, and substituting the coordinates of the central point into the first conical surface equation to obtain m corresponding second conical surface equations includes:
and substituting the equation of the second space straight line into the general equation of the first conical surface to obtain the equation of the second conical surface, wherein the equation of the second conical surface is related to the coefficient of the equation of the first space straight line.
Optionally, selecting, as the best-fit conical curved surface, the second conical surface corresponding to the set with the smallest error from the minimum distance value sets of the data points to the m second conical surfaces includes:
obtaining a general expression of the minimum distance value from the data point to the m second conical surfaces by utilizing a Lagrange multiplier method of the multivariate function conditional extremum;
substituting the data points into a general expression of the minimum distance value to obtain a minimum distance value set from the data points to m second conical surfaces;
and respectively calculating errors of the minimum distance value sets from the data points to the m second conical surfaces, and selecting the second conical surface corresponding to the minimum distance value set with the minimum error as a best-fit conical curved surface.
Optionally, the obtaining a general expression of the minimum distance values from the data points to the m second conical surfaces by using a lagrangian multiplier method of the multivariate function conditional extremum includes:
obtaining a Lagrange function according to the coordinates of the data points;
respectively deriving from Lagrange functions according to the three-dimensional coordinate parameters to obtain coordinate algebraic expressions related to the Lagrange parameters and the coordinates of the data points;
substituting the coordinate algebraic expression into the equation of the second conical surface to obtain a third conical surface equation related to the Lagrangian parameter;
obtaining a specific numerical value of the Lagrangian parameter by calculating an extreme value of the third conical surface equation;
and solving the minimum distance value from the data point to the m second conical surfaces by a coordinate algebraic expression related to the Lagrange parameter and the coordinate of the data point.
The embodiment of the invention provides an in-place measuring method for a sealing surface of a three-eccentric butterfly valve, which comprises the steps of placing a workpiece to be measured of the three-eccentric butterfly valve on a rotary table, collecting coordinate information of a sealing surface data point of the workpiece to be measured through a laser sensor, and transmitting data collected by the laser sensor to a computer through an encoder; judging whether the data points can be fitted on the conical surface or not by calculating the distance from the data points (the data points except the data points fitting the space straight line) to the conical surface; otherwise, searching the central point of the next plane, continuously fitting to obtain a conical surface, and calculating the distances from the rest data points to the conical surface to judge whether the data points can be fitted to the conical surface; repeating the above steps, fitting error till | Deltaij≤Δ00And l, the conical surface is explained as the best fitting surface.
Through the in-place measuring method of the sealing surface of the three-eccentric butterfly valve, provided by the embodiment, more complete correct measuring data of a workpiece can be obtained, so that the measuring accuracy of a measuring system is improved, and a guiding effect is provided for subsequent processing. The measuring is carried out while processing is carried out, the processing error is mastered at any time, and the secondary processing error caused by disassembling the workpiece after offline measurement is avoided.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Currently, in-situ measurement obtains a plurality of discrete data of the processed curved surface by in-situ measurement, and according to the data, a continuous curved surface is expected to be obtained to be matched with known data, and the process is a curved surface fitting process. The surface fitting technology is widely applied to the fields of computer graphics, numerical calculation and the like. The current common surface fitting methods include: least squares, interpolation, scaling algorithms, etc.
The interpolation method is to construct an nth-order polynomial P according to the interpolation principlen(x) So that P isn(x) The data at each test point just passes through the real test point; although interpolation can retain the original data points, in general many data points are collected to reflect the actual situation to the greatest extent possible, resulting in an interpolation polynomial Pn(x) The number of times is very high, which not only increases the calculated amount, but also influences the fitting precision, and is not beneficial to the curved surface fitting of the workpiece in the actual production process of the engineering. The scaling algorithm is a direct iterative algorithm with contraction and expansion of search space as basic features, and can realize optimal fitting without providing proper initial values under the condition of simpler search space, but once the search space is complicated, the search efficiency is reduced, andand difficult to implement for multi-parameter non-linearity problems. The least squares method is to select an approximate function f (x) based on known data such that the root mean square error of the function f (x) is minimized. Although the least square fitting is not enough under the condition of reserving certain original data points, the greatest advantage of the least square fitting is that the fitting precision can be regulated and controlled, and different fitting precisions can be selected according to actual use conditions. The least square normal linear fitting curved surface is simple and direct, is convenient to operate and is beneficial to the feedback of the actual processing process.
The embodiment of the invention provides an in-place measuring method for a sealing surface of a three-eccentric center butterfly valve, which comprises the following steps of:
and step S10, acquiring coordinate information of the external contour data points of the workpiece to be measured placed on the turntable.
In this embodiment, a to-be-measured triple eccentric butterfly valve workpiece is placed on the rotary table, coordinate information of a sealing surface data point of the to-be-measured workpiece is collected through the laser sensor, and data collected by the laser sensor is transmitted to the computer through the encoder.
In step S20, a first spatial straight-line equation is established by least-squares fitting to the coordinate information of the data points.
In this embodiment, the to-be-measured triple eccentric butterfly valve workpiece rotates along with the rotary table, the laser sensor performs information acquisition on the sealing surface of the to-be-measured triple eccentric butterfly valve workpiece to obtain three-dimensional coordinate information of the sealing surface of the to-be-measured triple eccentric butterfly valve workpiece, and linear fitting is performed on data points to obtain equations of a plurality of first space straight lines.
The least squares method is to select an approximate function f (x) based on known data such that the root mean square error of the function f (x) is minimized. Although the least square fitting is not enough under the condition of reserving certain original data points, the greatest advantage of the least square fitting is that the fitting precision can be regulated and controlled, and different fitting precisions can be selected according to actual use conditions. The least square normal linear fitting curved surface is simple and direct, is convenient to operate and is beneficial to the feedback of the actual processing process.
In the embodiment, the machining error condition can be fed back in time by adopting the least square normal linear fitting curved surface under the in-place measuring condition, and technical guidance is provided for subsequent machining, so that the machining precision of the workpiece is further improved.
And step S30, selecting an optimal generatrix equation from the first space linear equation according to a preset taper angle.
In this embodiment, since the sealing surface of the to-be-measured triple offset butterfly valve workpiece is approximately a conical surface, one straight line is selected from the equations of the plurality of first spatial straight lines in step S20 as the optimal generatrix of the fitted conical surface. And selecting the optimal bus according to the cone angle between the first space linear equation and the standard straight line.
And step S40, obtaining a first conical surface equation through optimal generatrix equation fitting.
In this embodiment, a line segment and a cone angle are determined in a world coordinate system, so that a plurality of conical surfaces can be obtained, and the vertexes of the conical surfaces are not determined.
And step S50, obtaining the coordinates of m fitted central points, and substituting the coordinates of the central points into the first conical surface equation to obtain corresponding m second conical surface equations. The center point is selected from a preset area in a plane where a conical vertex of the workpiece to be measured is located, the plane is parallel to the upper surface of the rotary table, the preset area is a circular area containing the conical vertex and having a radius of r, or the preset area is a square area containing the conical vertex and having a side length of r, and m is a natural number larger than or equal to 1.
In this embodiment, the laser sensor performs data acquisition on the coordinate of the vertex of the sealing surface of the workpiece to be measured of the three-eccentric center butterfly valve, and in the process that the workpiece to be measured rotates along with the turntable, the x-axis coordinate and the y-axis coordinate of the vertex of the sealing surface of the workpiece to be measured may change, while the z-axis coordinate of the vertex of the sealing surface of the workpiece to be measured generally does not change. If the vertex of the sealing surface of the to-be-tested triple eccentric butterfly valve workpiece is just right above the center of the rotary table when the to-be-tested triple eccentric butterfly valve workpiece is placed, the coordinate of the vertex of the sealing surface of the to-be-tested workpiece cannot be changed in the rotating process of the rotary table.
Taking a circular area as an example, in any measurement process, determining a circular area with the vertex coordinate of the sealing surface as the center of a circle and r as the radius, dividing the circular area into m unit areas on average according to a preset size, selecting the center coordinate of the unit area as a fitting center point, and substituting the m fitting center point coordinates into the first conical surface equation in the step S40 to obtain m second conical surface equations. The values of the radii r and m can be set according to actual needs.
And step S60, selecting the second conical surface corresponding to the set with the minimum error from the minimum distance value sets from the data points to the m second conical surfaces as the best fitting conical curved surface.
In this embodiment, whether the data point can be fitted to the conical surface is determined by calculating the distance from the data point (the data point divided by the fitting space straight line) to the conical surface; otherwise, searching the central point of the next plane, continuously fitting to obtain a conical surface, and calculating the distances from the rest data points to the conical surface to judge whether the data points can be fitted to the conical surface; repeating the above steps, fitting error till | Deltaij≤Δ00And l, the conical surface is explained as the best fitting surface.
Through the in-place measuring method of the sealing surface of the three-eccentric butterfly valve, provided by the embodiment, more complete correct measuring data of a workpiece can be obtained, so that the measuring accuracy of a measuring system is improved, and a guiding effect is provided for subsequent processing. The measuring is carried out while processing is carried out, the processing error is mastered at any time, and the secondary processing error caused by disassembling the workpiece after offline measurement is avoided.
As an optional implementation manner, acquiring coordinate information of an external contour data point of a workpiece to be measured, which is placed on a turntable: when the rotary table rotates for a preset angle, the laser sensor performs one-time acquisition operation on the workpiece to be detected; after the rotary table rotates for a circle, the laser sensor moves downwards along the Z axis by a preset distance for the next acquisition operation.
In the embodiment, a workpiece to be measured is placed on a rotary table, the rotary table drives the workpiece to be measured to rotate at a constant speed, the laser measures data once when the workpiece to be measured rotates at the same angle, and the laser sensor completes measurement once after the workpiece rotates for one circle; and then the laser sensor moves downwards along with the Z axis by a proper distance, the laser measures data once when the workpiece rotates by the same angle, and the laser sensor finishes one measurement after rotating for one circle. Repeating the above operations to finally obtain all data points.
All measured data points are characterized by: there is one data band having the same value and another data band having the same value.
The turntable drives the workpiece to rotate at a constant speed, and data points can be divided into data point rows according to the average rotation angle.
As an optional implementation manner, before step S20, the method further includes:
and step S11, setting the optimal data meeting the requirements in the data points as standard points, and taking the rest data points as the data points to be screened.
In step S12, a relative distance deviation threshold is set.
And step S13, calculating the relative distance between the data point to be screened and the standard point, and if the relative distance is less than or equal to the relative distance deviation threshold value, the data point to be screened is a qualified data point.
In the present embodiment, the relative distance deviation is used to remove the abnormal data points; each time the measurement is completed by one circle, the data points of the group of data have two obviously different values, and the group of data with smaller values is closer to the standard value. Assuming that the acquired data point column has optimal data meeting the requirement, the optimal data is set as a standard point. As shown in fig. 2, the standard point set is set according to the above method, the relative average distance D between other data points and the standard point set is calculated, meanwhile, the relative distance deviation threshold epsilon is set according to the requirement, if D is less than or equal to epsilon, the data point meets the requirement, and finally, all the data points meeting the requirement are obtained.
As an alternative embodiment, step S30 includes:
step S301, a direction vector of the first spatial linear equation is obtained.
Step S302, acquiring and obtaining an included angle between the first space straight line and the standard straight line according to the direction vector.
And step S303, calculating the cone angle of the cone taking the first space straight line as the generatrix according to the included angle.
And step S304, taking all the first space straight lines with the cone angle ranging from 18 degrees to 23 degrees as second space straight lines.
Step S305, selecting one straight line from the second space straight lines as an optimal bus.
In the present embodiment, a straight line having a taper angle of 20 ° is selected as the optimal generatrix.
As an alternative embodiment, step S301 includes:
calculating the sum of squares of residuals of the first space linear equation;
and deriving the residual sum of squares to obtain a coefficient of a first space straight line equation and a direction vector of the first space straight line.
In this embodiment, assume that the equation of a straight line is:
wherein
The data point coordinates of the sealing surface of the three-eccentric center butterfly valve workpiece to be detected are acquired by the laser sensor.
The sum of the squares of the residuals is found to be:
Qijand Qi,j+1I.e. the optimization criterion, for QijAnd Qi,j+1Respectively obtaining the following derivatives:
the coefficients of the first spatial line equation are:
from the normal vector of the plane, the normal linear direction vector
The direction vector of the space straight line is
Then, in step S302, an included angle between the first spatial straight line and the standard straight line is obtained according to the direction vector: according to
A first spatial straight line l can be calculated
ijAt an angle to the normal line of
Step S303, calculating according to the included angle to obtain a cone angle alpha of a cone taking the first space straight line as a generatrixij。
As an alternative embodiment, step S50 includes: and substituting the equation of the second space straight line into the general equation of the first conical surface to obtain the equation of the second conical surface, wherein the equation of the second conical surface is related to the coefficient of the equation of the first space straight line.
In the embodiment, the second spatial straight line is a taper angle α between the same standard straight lineijA first space straight line of 20 degrees, and a second space straight line l2:
Substituting the equation of the conical surface: g (x, y, z) ═ a2(x2+y2)-z2And the coefficient a in the equation is obtained by fitting calculation according to the data points on the second space straight line.
Obtaining a conical surface equation:
determination of the center point Cm(x, y, z), coordinate C of the center pointm(x, y, z) is substituted into the equation of the conical surface to obtain:
as an alternative embodiment, step S60 includes:
step S601, a lagrangian multiplier method of the multivariate function conditional extremum is used to obtain a general expression of the minimum distance between the data point and the m second conical surfaces.
Specifically, step S601 includes:
step S6011 obtains a Lagrangian function according to the coordinates of the data points.
The lagrange function is listed:
Lij=(x-xij)2+(y-yij)2+(z-zij)2+λ[a2(x2+y2)-z2]
wherein (x, y, z) is a point on the conical surface, (x)ij,yij,zij) Is a second spatial straight line l2Point (c) above.
Step S6012, deriving from the Lagrangian functions according to the three-dimensional coordinate parameters respectively, and obtaining coordinate algebraic expressions related to the Lagrangian parameters and the coordinates of the data points.
Derivation of the lagrangian function in step S6011:
l 'of'x=0,L'y=0,L'z0, find the xyz coordinate algebraic expression for λ and the data point coordinates:
and step S6013, substituting the coordinate algebraic expression into the equation of the second conical surface to obtain a third conical surface equation related to the Lagrangian parameter.
Substituting the xyz coordinate algebraic expression in the step S6012 into the equation G (x, y, z) of the conical surface to obtain:
step S6014, the specific numerical value of the Lagrangian parameter is obtained by calculating the extreme value of the third conic equation.
The value of λ can be obtained by obtaining an extremum for G (λ).
And step S6015, the minimum distance values from the data points to the m second conical surfaces are obtained through a coordinate algebraic expression related to the Lagrangian parameter and the coordinate of the data points.
The set of known data points X e { X ═ X (X)
ij,y
ij,z
ij) Calculate the spatial point (x)
ij,y
ij,z
ij) Distance to the conical surface:
step S602, substituting the data point into the general expression of the minimum distance value to obtain a minimum distance value set from the data point to the m second conical surfaces.
As is known from step S6012,
and the value of λ obtained in step S6014 is substituted into the distance formula d
ijAnd (5) calculating the minimum value of the distances from the data points to the m second conical surfaces.
And step S603, errors are respectively calculated for the minimum distance value sets from the data points to the m second conical surfaces, and the second conical surface corresponding to the minimum distance value set with the minimum error is selected as the best fitting conical curved surface.
Order to
When delta
ijAnd when the ratio is less than 0.2%, stopping iteration, and finding the best fitting conical surface.
As shown in fig. 3, the algorithm for linearly fitting the sealing surface of the triple offset butterfly valve by using the least squares under the in-place measurement condition includes the following steps:
the method comprises the following steps: during laser measurement, a workpiece is placed on a rotary table, the rotary table drives the workpiece to rotate at a constant speed, the laser measures data once when the workpiece rotates at the same angle, and after the workpiece rotates for one circle, the laser sensor completes one measurement; and then the laser sensor moves downwards along with the Z axis by a proper distance, the laser measures data once when the workpiece rotates by the same angle, and the laser sensor finishes one measurement after rotating for one circle. Repeating the above operations to finally obtain all data points. The encoder transmits the data obtained by the acquisition and measurement to the computer.
Step two: removing abnormal data points by using the relative distance deviation; each time the measurement is completed by one circle, the data points of the group of data have two obviously different values, and the group of data with smaller values is closer to the standard value. And setting a standard point set according to the method, calculating the relative average distance D between other data points and the standard point set, simultaneously setting a relative distance deviation threshold epsilon according to requirements, if D is less than or equal to epsilon, enabling the data points to meet the requirements, and finally obtaining all the data points meeting the requirements.
Step three: establishing a space linear equation of data points and performing least square fitting; finally obtaining a space straight line l by solving the optimization criterion, namely the sum of squares of residual errors
ijAnd the direction vector of the straight line is
Step four: and calculating a cone angle according to the obtained space straight line, fitting to obtain a three-dimensional curved surface, and constraining the three-dimensional curved surface into a conical surface to obtain a general equation of the conical surface.
Step five: for the obtained general conic surface equation, the central point C is determinedm(x, y, z) sequentially obtaining a conical surface for further fitting; the Lagrange multiplier method of the extreme value of the multivariate function condition is utilized to solve the distance equation d between the data point set and the conical surfaceij(ii) a By calculating the distance equation d between the data point set and the conical surfaceijMean value ofijAnd judging the conical surface obtained by final fitting as an optimal solution.
Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations fall within the scope defined by the appended claims.