The invention discloses an oil cylinder displacement real-time calculation method and
system based on
sonar, relates to the technical field of
hydraulic equipment measurement and control, and is used for solving the problem that the displacement calculation precision of a long-
stroke oil cylinder is reduced under complex working conditions. Before the oil cylinder is put into use, a
piston rod (4) is driven to move point by point according to a constant step
pitch,
sonar pulses are emitted at each step
pitch position, echo waveforms, timestamps and position indexes are recorded, meanwhile, the
oil temperature is collected, the sound velocity is converted, and a binding data table is established. Then,
multiple echo waveforms are analyzed, features are extracted, the amplitude change rate, the peak drift rate and the envelope
distortion rate are calculated, fluctuation abnormal values are generated and sorted, and a
trunk step position is selected to establish a comprehensive
feature vector; the comprehensive feature vectors are matched in real time, displacement is calculated in combination with the real-time sound velocity, and displacement data are smoothly processed through Kalman filtering and a time window. In the
maintenance stage, the
piston rod (4) is pushed to the limit position, updated features are collected again, and synchronous correction of the feature chain is completed.