#### Abstract

At present, real-time online measurement of fluid density is of great significance to improve the automation level of petrochemical and food industries. The tuning fork density sensor is widely used because of its characteristics of real-time online measurement, high measurement accuracy, simple structure, and convenient use. The traditional tuning fork density sensor in the market has the disadvantage of low resolution and being susceptible to liquid viscosity, which makes the sensor’s measurement accuracy low and not suitable for the measurement of high-viscosity liquid density. The measurement resolution and antiviscosity interference capability of the tuning fork density sensor are two major indexes to measure the measurement performance of the sensor, among the antiviscosity interference capability refers to the degree to which the measurement results of the sensor are affected by viscosity properties. However, the structural design of the tuning fork density sensor results in the conflict between the measurement resolution and the antiviscosity interference capability of the sensor, and the improvement of one performance is bound to affect the performance of the other. Aiming at the problem of how to balance the measuring performance of the tuning fork sensor, a density calculation model based on viscosity compensation is proposed in this paper. By studying the working principle and structure design of the tuning fork, the vibration characteristics of tuning fork in liquid with different viscosities and densities are modelled and simulated. From the results of simulation analysis, the better set of dimensions with balanced measuring performance is selected. Not only does the structure of the tuning fork have the characteristics of high resonance frequency, but also the measured results are less affected by the viscosity of the liquid. To solve the problem that density measurement is still affected by high-viscosity liquid after tuning fork dimension optimization, in this paper, the partial least square model is used to fit the experimental data of the frequency-density characteristics; then, the density calculation model based on the viscosity compensation is obtained by combining the frequency-viscosity characteristic experiment. Finally, through the performance test experiment comparing with the traditional tuning fork density sensor, the measurement resolution of the improved tuning fork density sensor is as high as 0.0001 g/cm^{3}; within the viscosity range of 180 MPa·s, the accuracy reached ±0.001 g/cm^{3}, and within 480 MPa·s, the measurement accuracy reached ±0.002 g/cm^{3}. When the liquid viscosity reaches more than 10 MPa·s, the improved tuning fork density sensor has better overall measurement performance than the traditional tuning fork density sensor, and both of its measurement resolution and antiviscosity interference capability have been greatly improved.

#### 1. Introduction

In the process of chemical production, the determination of liquid density can be used to approximate the quality and chemical composition of the fluid. The accuracy and stability of the measurement directly affect the quality of the product, and the real-time measurement even endangers the stability and safety of the process equipment. Therefore, the density sensor is widely used in chemical production plant, which is of great significance to chemical production. At present, the commonly used liquid density measurement methods include vibrating tube density detection method, ultrasonic density detection method, static pressure density detection method, and float detection method [1–3].

The vibration tube density detection method [4] uses the sensitive element for the elastic oscillator. When the measured medium flows through the tube, the natural oscillation frequency of the elastic oscillator will change with the density of the measured medium, and the measurement results of this method are accurate and repeatable, but it is expensive to add the control and temperature automatic cleaning system. The float detection method [5] based on Archimedes principle, the float displacement (the displacement of the spring), and buoyancy changes immersed in the measured liquid are converted into a variety of electrical or mechanical detection signals to measure the liquid density. However, the timeliness of the measurement results is poor, which is easily affected by temperature and vibration. The basic principle of the static pressure method for density detection [6] is that the static pressure of the liquid column to be measured at a certain height is proportional to its density, and it can indirectly measure the measured medium and be applied to liquids with large viscosity. However, the static pressure density measurement is greatly affected by the structure, and the measurement error is large. The ultrasonic density detection method [7] uses the different velocity of ultrasonic wave propagation in the liquid of different density to measure the liquid density, but due to the large volume of the ultrasonic density detector in the use process, the measurement results are easily affected by the field environment, so it cannot be used flexibly in some special environments, such as pipelines and deep wells.

The tuning fork density sensor uses the principle of changing the resonant frequency of the tuning fork when the fluid flows through the fork body to measure the liquid density. Compared with the above several density measurement methods, it has the characteristics of real-time online measurement, high measurement accuracy, strong stability, simple structure, convenient use, and strong ability to be disturbed by the outside world, and it can be used in some narrow and complex environments. The measurement resolution of the tuning fork density sensor is reflected in the resonant frequency of the tuning fork. The higher the resonance frequency, the higher the resolution of the measurement frequency. The measurement precision of the measuring sensor is an important index. Furthermore, the resonant frequency of the tuning fork in liquid is affected by the density property of the liquid as well as by other factors; among which, the viscosity property of the liquid is also a factor. The higher the viscosity is, the greater the influence will be on the resonant frequency of the tuning fork, and density measurement will be affected. The influence on density measurement can be reduced by changing the structure or dimension of the tuning fork. In this paper, “antiviscosity interference capability” refers to the degree to which the measurement results of the sensor are affected by viscosity properties; in other words, it is the sensor’s capability to resist the effects of viscosity on the measured results. It is the index of measuring stability of the sensor. The stronger the antiviscosity interference capability, the less the influence of viscosity on resonance frequency in high-viscosity liquid, so the error of density measurement results is less. The measurement resolution and antiviscosity interference capability of the tuning fork density sensor are both important manifestations of the measuring performance of the tuning fork density sensor.

The traditional tuning fork density sensor in the market has the disadvantages of low measurement resolution, and the measurement result is easily affected by the liquid viscosity, so the sensor has low measurement accuracy and large measurement error in the liquid with high viscosity, which is difficult to meet the measurement standard. The structural design of the tuning fork density sensor leads to the conflict between the measurement resolution and antiviscosity interference capability of the sensor. Therefore, how to improve the measurement resolution and antiviscosity interference capability of the sensor at the same time becomes the key to improve the overall measurement performance of the sensor.

In recent years, many scholars have done a lot of research on the structure design of the tuning fork density sensor and the influence of liquid viscosity on the measurement results. Heinisch et al. conducted resonance experiments of rectangular cross-section tuning forks and circular cross-section tuning forks in liquids of different density and viscosity [8]. It is verified that the resonant frequency of the rectangular section tuning fork is less affected by liquid viscosity than that of the circular section tuning fork with the same effective mass. Patimisco et al. proposed a new method based on the simulation analysis experiment of the tuning fork characteristic frequency combined with the resonance characteristics of piezoelectric tuning fork sensors in different media [9], and the effective mass of the tuning fork body is reduced by reducing the dimension of the tuning fork can reduce the resonant frequency of the tuning fork. In addition, it can also increase the frequency of the tuning fork by reducing the length of the tuning fork beams and increasing the thickness of the tuning fork beams [10, 11]. On this basis, González et al. designed a small rectangular cross-section tuning fork density sensor [12]; compared with the traditional tuning fork density sensor, the tuning fork density sensor has a high resonance frequency and high measurement accuracy in low-viscosity liquids. However, the sensor is not suitable for use in high-viscosity liquids, and the measurement error of tuning fork resonance frequency increases due to the influence of liquid viscosity. Heinisch et al. designed a tuning fork density sensor with a large volume structure by using a rectangular section tuning fork as a sensitive part [13, 14]. Although the measurement stability of the sensor in high-viscosity liquid is higher than that of the traditional tuning fork density sensor, the low resonance frequency of the tuning fork makes the measurement accuracy in low-viscosity liquid lower than that of the traditional tuning fork density sensor. Jakoby et al. designed a tuning fork density sensor that can simultaneously measure the liquid viscosity and density by studying the relationship between the resonant frequency of the piezoelectric tuning fork and the liquid density and viscosity [15]. This kind of tuning fork density sensor compared with the traditional tuning fork density sensor can correct the density measurement result through the viscosity measurement result and reduce the partial influence of liquid viscosity on the density measurement, but the viscosity measurement error of the sensor is large; the structure design of tuning fork results in the large variation of resonant frequency of tuning fork in high-viscosity liquid and low frequency; as a result, the error of measurement results is large and cannot meet the field measurement requirements in practical application.

The research on the tuning fork density sensor by scholars in the past has improved the measurement performance of the tuning fork density sensor in different degrees. However, the problem of how to improve the measurement resolution and antiviscosity interference capability of the tuning fork density sensor at the same time has not been solved. Combined with the above scholars’ research foundation and unsolved problems, this paper aims at the defects of the existing tuning fork density sensor in the market, which have low resolution and high accuracy and are easily affected by the liquid viscosity. This paper discusses the influence of liquid viscosity and tuning fork dimension design, from tuning forks of different dimensions, and the better test performance tuning fork was selected by combining theoretical analysis, simulation analysis of the influence of tuning fork dimension, and liquid viscosity on tuning fork resonance frequency. The tuning fork model of this dimension has high resonance frequency and has little change in resonance frequency in high-viscosity liquid. The experimental data of frequency-density characteristics were fitted by the partial least squares model. The experimental data of frequency-density characteristics were fitted by the partial least squares model. Then, by adding the viscosity variable parameters and combining with the analysis of a large number of experimental data of frequency-viscosity characteristics, a modified density calculation formula based on the viscosity compensation is obtained. Finally, through the performance test experiment comparing with the traditional tuning fork density sensor, the measurement resolution of the improved tuning fork density sensor is as high as 0.0001 g/cm^{3}; within the viscosity range of 180 MPa·s, the accuracy reached ±0.001 g/cm^{3}, and within 480 MPa·s, the measurement accuracy reached ±0.002 g/cm^{3}. Compared with the traditional tuning fork on market density sensor not only improves the resolution of frequency measurement but also makes the density measurement accuracy of high viscosity liquid higher. The improved sensor solves the problem of low resolution of the traditional tuning fork density sensor and large measurement error in high viscosity liquid.

#### 2. Principle and Structure Analysis of Tuning Fork Density Sensor

##### 2.1. Working Principle

The tuning fork density sensor is mainly composed of tuning fork and piezoelectric components. As a harmonic oscillator, the tuning fork is driven by the piezoelectric actuator at the root of the tuning fork finger to vibrate together. Piezoelectric components include piezoelectric vibration initiator and piezoelectric vibration pickup. The piezoelectric vibration generator uses the inverse piezoelectric effect to convert the piezoelectric signal into mechanical vibration signal. The piezoelectric vibration pickup sensor uses piezoelectric effect to convert mechanical vibration signal into electrical signal output [16, 17].

In industrial applications, tuning fork structure has been constantly improved. The common tuning fork structure is shown in Figure 1.

The tuning fork fingers are symmetrical and vertical. The distance between the fixed fork fingers is constant. The vibration state of the tuning fork body will not change with the depth of insertion into the measured medium when it is inserted into a liquid with low viscosity and without bubbles in the liquid.

Usually, the resonant frequency of the fork is fixed and equal to the natural frequency when the piezoelectric vibration generator is driven in vacuum. When the liquid to be measured flows through the tuning fork finger, the resonance frequency of the fork body changes. The resonant frequency of the fork is related to the effective mass of the fork. The liquid flows through the fork and attaches to the fork, which changes the effective mass of the fork, and thus, the resonance frequency of the fork shifts.

The general relationship between vibration frequency and density is as follows [18]:where denotes the density of the liquid to be measured, *f* is the output frequency of the sensor, and *k*_{1}, *k*_{2}, and *k*_{3} are the constant coefficient of the sensor, and they are associated with the basic properties of liquids and the tuning fork structure.

The fork part of the tuning fork density sensor is directly in contact with the measured liquid, and the structure of the fork also affects the natural frequency of the fork when it vibrates. Therefore, the optimization of tuning fork dimensions has a vital impact on the accuracy and stability of measurement data.

##### 2.2. Calculation of Natural Frequencies of Forks

When the tuning fork works, it is fixed by threads with pipes or other installation positions [19]. The vibration of tuning fork is generated by the contraction vibration and bending vibration of fork body caused by electromechanical coupling. Therefore, the visible tuning fork body part is a cantilever beam structure [20]. Its vibration frequency is related to the material, length, and thickness of the tuning fork.

From the Euler–Bernoulli beam model, the differential equation of transverse free vibration motion of the beam is obtained as [21, 22]where *E* is the elastic modulus of the beam, *J* is the coefficient of bending section, *ρ* is the material density of the beam, *b* is the width of fork, and *c* is the thickness of fork. *y* (*x*) is the main mode function of beam structure, and *β* is the characteristic parameters of mode shapes. The root of the fork body is taken as the elastic constraint end, and the constraint end of the fork body is taken as the boundary condition. The separation variable method is used to solve the problem.

The boundary conditions at the constraint end are as follows:

The boundary conditions at the free end are as follows:

The equation is the motion equation of the classical Euler–Bernoulli beam model. In this paper, the detailed solution process is not given. Finally, the relationship between the *i*-order natural frequency *P*_{i} of the fork and the related parameters of the fork is obtained as follows:where is proportional to the natural frequency *p*_{i} and is a function of the mode order of the fork. In the ideal cantilever equation,

The free vibration of the tuning fork in air is similar to the free vibration of a cantilever beam fixed on one side. In general, the free vibration of the fork body is the first-order natural frequency. Bring into equation (5), and the natural frequency can be calculated.

##### 2.3. The Influence of Tuning Fork Structure on Measuring Performance

When the piezoelectric tuning fork is driven by the measured liquid, the simplified vibration model of the piezoelectric tuning fork under the external force of the measured liquid is as follows:where *F* is the force of the liquid under test, is the viscous force constant, is the relative velocity of the liquid under test, the effective mass of the cantilever beam, and *k* is the elastic constant of the tuning fork.

As shown in Figure 2, the measured liquid contacts with the surface of the fork and attaches to the surface of the fork, resulting in a change in the effective mass of the fork as a whole when the tuning fork vibrates downward and downward along the *x*-axis. The following contents will be analyzed by two different contact surfaces and action modes of liquid and tuning fork.

If the effect of the shear plane in the *x*-axis direction on the tuning fork body is not considered, only the *l* × *c* plane contacts and interacts with the measured liquid. Due to the influence of liquid viscosity and density and the change of damping state of fork, the force of fork oscillates accordingly. Under the inertia of Newtonian fluid, the effect of the mass of the liquid adhering to the fork is equivalent to the force exerted on the fork. Then, the simplified vibration model of the tuning fork body under the external force of the measured liquid is as follows:where represents the equivalent mass of the liquid adhering to the tuning fork and *y* represents the displacement of the liquid layer. Reynolds number is defined aswhere is the liquid viscosity, is the length of the fork, is the resonant frequency of the tuning fork, and is the liquid density. When the tuning fork is in a Newtonian liquid with a high Reynolds number and if it ignores the effect of the viscosity of the liquid, the effective mass of the measured liquid that attached to the tuning fork body can be as follows:where is the effective mass of the piezoelectric tuning fork. When only the influence of the shear plane in the *x*-axis direction is considered, the *b* × *c* and *l* × *c* planes at the root of the fork shear with the liquid. The effect of liquid on the shear area of plane *b* × *c* is negligible because of its small contact area with the measured liquid. The effective mass of the liquid tested attaching to the tuning fork body is expressed aswhere is the viscosity of the liquid under test and is the vibration frequency of the tuning fork in the liquid under test. The effective mass of the tested liquid adhering to the tuning fork body can be expressed by equations (10) and (11) as follows:where, where *V*_{1} is the volume of liquid attached to the fork, which is the function related to the length, width, and thickness of fork, *l, c*, and *b*, which is proportional to *V*_{1}. = *ρ*_{1}*lcb*, and *ρ*_{1} is the density of the material that makes up the tuning fork. Therefore, from equation (11), it can be obtained that in the tested liquid, the relationship between resonance frequency and corresponding parameters of liquid and tuning fork is

If and remain the same, reduce fork dimensions *l*, *c*, and *b*, the resonance frequency of tuning fork increases with the influence of viscosity, and the slope of the curve increases at the corresponding point. It can be shown that the decrease of fork dimensions will make the resonant frequency of tuning fork increase under the influence of viscosity . If the influence of the measured liquid on the surface of the fork is neglected, the vibration frequency of the fork without interference is as follows:where *k* is a constant related to the dimensions of the tuning fork. When the tuning fork density sensor works in the measured liquid, if the total effective mass of the liquid attached to the fork body is , the vibration frequency of the piezoelectric tuning fork in the measured liquid is as follows:

The resolution of the measurement frequency of the piezoelectric tuning fork is as follows:

The frequency resolution of the tuning fork has an important influence on the result of density measurement. It can be seen from equation (17) that the measurement resolution is related to the resonance frequency of the fork and the effective mass of the liquid attached to the fork. The effective mass of the liquid is far greater than the liquid which attached to fork, so the effective mass of the attached liquid can be ignored. Therefore, the smaller the effective mass of the fork, the higher the resolution of the sensor and the higher the sensitivity of the measurement.

Combined with equations (13) and (17), there is a conflict between the resolution of frequency measurement of the tuning fork and the antiviscosity interference capability. Although increasing the tuning fork dimensions can reduce the influence of liquid viscosity on the tuning fork resonance frequency, it also reduces the resonant frequency and the resolution of frequency measurement, decreasing the tuning fork dimension results in the reverse. Therefore, the relationship between the resolution of the balanced tuning fork frequency measurement and the antiviscosity interference capability is the key to improve the overall measurement performance of the tuning fork density sensor.

In the following part, the relationship between the dimension of the tuning fork and the resolution of the frequency measurement and the antiviscosity interference capability of the tuning fork will be explored in combination with the simulation experiment, so as to improve the dimension of the tuning fork and improve the overall measurement performance of the tuning fork density sensor.

The following part will study the relationship between the dimension of tuning fork and the resolution and antiviscosity interference capability of the tuning fork by simulation experiment.

#### 3. Simulation Analysis of Tuning Fork Resonant Frequency

##### 3.1. Modal Analysis of Tuning Fork Resonance

The resonant natural frequency of the tuning fork is simulated and analyzed by COMSOL. The natural frequencies of the first six-order modes are obtained by COMSOL modal analysis to verify the calculation of the natural frequencies of the fork vibration.

The three views of the piezoelectric tuning fork are drawn by Solidworks as shown in Figure 3.

The cross-sectional area of the fork model is 12 × 2 mm^{2}, and the length is 40 mm. The structure design document is imported into COMSOL, solid mechanics is selected as the physical field, and the characteristic frequency and mode shape are selected as the research object. The material is selected as structural steel. The density of material parameters is 8030 kg/m^{3}, the elastic modulus is 2.1 × 105 MPa, and Poisson’s ratio is 0.3. The simulation starts after a series of preprocessing, such as grid construction and constraint application [23].

The lower the order, the easier the excitation and the lower the energy required. This is related to the excitation energy transmitted by the vibration generator composed of piezoelectric ceramic sheets. In practical measurement and experiment, the vibration mode of the tuning fork is the first order. The vibration patterns of the fork under different modes are shown in Figure 4.

##### 3.2. Simulation of Natural Frequencies of Tuning Forks with Different Structures

The different structures of the tuning fork will lead to the change of the resonant frequency of the tuning fork. For the first mode shape of the tuning fork, by changing the length, width, and thickness of the tuning fork, the natural frequency of the first resonant frequency is simulated, compared with theoretical calculation equation (5) to verify the influence of the structure of the tuning fork on the resolution of frequency measurement in equation (17). Table 1 shows the simulation results of the first natural frequency of the tuning fork model with different length, width, and thickness for COMSOL simulation software. Among them, the tuning fork structure with the length *l* = 80 mm, width *c* = 20 mm, and thickness *b* = 5 mm is the common rectangular structure tuning fork density sensor in the market; according to equation (17), the length, width, and thickness of the tuning fork are reduced to reduce the effective mass of the fork body and improve the resolution of frequency measurement. The simulation results and theoretical calculation results of the first-order natural frequencies of tuning forks with different structures are shown in Table 1.

It can be seen from Table 1 that when the length of the tuning fork of the same cross-sectional area is 40 mm and 80 mm, respectively, the natural frequency is inversely proportional to the square of the length of the fork body, which is consistent with the relationship between the length of the fork body and its natural frequency in equation (5).

##### 3.3. Simulation of the Influence of Liquid Viscosity on Tuning Fork Resonance Frequency

COMSOL finite element was used to simulate the vibration frequency of the tuning fork in liquids of different viscosity, and the fluid-solid coupling was selected as the simulation physical field; the characteristic frequency was used as the research object to establish the model [24]. The fluid property is liquid water, and the density is set to 1 g/cm^{3}. In the constraint condition of the fluid, the velocity parameters of the inlet and outlet are set to 0 m/s, and the static state of the liquid is consistent with the state of the liquid in the experimental environment. The geometric model is shown in Figure 5.

The material property in the cuboid region is liquid water, and the color change of the fork is represented by the change of pressure. The setting of liquid density parameters is based on the density of different liquids measured by experiments, so that the simulation results and experimental results can be compared and analyzed easily.

In order to explore the influence of liquid viscosity on tuning fork resonance frequency, the overall measurement performance of the tuning fork density sensor was improved. In the process of simulation, the resonant frequencies of the rectangular cross-section tuning fork and circular cross-section tuning fork in liquid were simulated with the liquid viscosity as the parameter variable, and the circular cross-section tuning fork structure is used as a reference structure for comparison. By evaluating the frequency resolution and antiviscosity interference capability of the tuning fork, the tuning fork dimension with more balanced measuring performance is selected as the tuning fork used in the following experiment. Among them, the structure of the tuning fork with smaller dimensions and higher first-order natural frequency is selected as the research object. The simulation results of resonance frequencies of different structural tuning forks in different viscosities are shown in Tables 2 and 3.

In the table, is the change rate of the resonant frequency in the corresponding viscosity liquid and represents the influence of the liquid viscosity on the resonant frequency of the tuning fork. The larger the is, the greater the influence of the liquid viscosity on the resonant frequency of the tuning fork is:where *f*_{1} represents the resonant frequency of the structural tuning fork in a liquid with a viscosity of 1 MPa·s and a density of 1 g/cm^{3} and *f*_{2} represents the resonant frequency of the tuning fork under the current liquid viscosity.

From Tables 2 and 3, it can be seen that the reduction of fork dimensions will lead to the reduction of antiviscosity interference capability of the tuning fork, and the resonance frequency of tuning fork will increase under the influence of liquid viscosity, and this is consistent with the derivation of the previous theoretical part. When the effective mass of the fork body is the same, the influence of liquid viscosity on the tuning fork with rectangular section is less than that with circular section; therefore, the traditional tuning fork density sensor mostly adopts the structure of the tuning fork with rectangular section.

The change of with the increase of viscosity that forms different dimensions of the tuning fork is shown in Figure 6.

With the increase of liquid viscosity, the change rate of resonant frequency of the first seven groups of tuning fork structures increases gradually but is relatively stable. In the last five groups, when the viscosity reached 150 MPa·s, increased dramatically, and this shows that the tuning fork resonance frequency is greatly affected by the viscosity and a tuning fork of the corresponding dimension will have a huge deviation in measuring the liquid density in a liquid with a viscosity of 150 MPa·s. Therefore, the last five groups are not suitable for density measurement in high-viscosity liquid. The first 7 groups should be selected.

Of the first 7 groups of measurements, has small rate of change with the increase of viscosity , and this shows that the influence of viscosity on the resonant frequency with the increase of viscosity in the measurement process is approximately similar. In addition, the choice of the tuning fork density sensor should be related to the actual measurement environment, which can be measured in limited space, so the sensor with simple structure and small dimension is preferred. Therefore, group 6 and 7 are preferred, the resonant frequency of the two groups of tuning forks is less affected by the viscosity and is almost the same with different viscosity. However, the resonant frequency of group 6 is higher, which means that the measurement resolution of the resonant frequency of this dimension tuning fork is higher, and this can also be said to be group 6 of tuning forks measured more performance. Finally, group 6 of the tuning fork is selected in this paper, which has a length of 40 mm and a cross-sectional area of 12 ∗ 2 mm^{2}.

##### 3.4. Simulation of Tuning Fork Resonance Frequency in Liquid with Different Density

Through the simulation analysis of the influence of tuning fork dimensions and liquid viscosity on tuning fork resonance frequency, the rectangular tuning fork’s dimension of 40∗12∗2 mm^{3} with more balanced measurement performance is selected. The simulation results of resonance frequency of the tuning fork of this structure in liquids of different densities are shown in Figure 7, in which the viscosity of the liquid property is set to 1 MPa·s. The variation range of resonant frequency in the fluid medium of 0.88∼1.262 g/cm^{3} is 984.19∼959.11 Hz. The resonance frequency changes obviously with the change of liquid density.

#### 4. Experimental Results of Density Measurement of Tuning Fork Density Sensor

##### 4.1. Experimental Equipment and Procedures

In this experiment, the fork section area of tuning fork density sensor is 12 × 2 mm^{2}, the length is 40 mm, and the material is 316 L steel. In order to avoid erroneous action when piezoelectric ceramics contact with liquid, piezoelectric ceramics are selected as exciter and pickup of the tuning fork. Therefore, the installation position of piezoelectric ceramics is the root of the tuning fork. The bottom of the tuning fork is sealed with an airtight enclosure, as shown in Figure 8.

In the process of measurement, the change of the measured density will cause the resonance frequency deviation of the tuning fork sensor. Therefore, in order to keep the tuning fork sensor working at the resonant frequency, it is required that the driving signal frequency can follow the change of tuning fork vibration frequency in real time. That is to say, the driving circuit should have frequency-tracking function. Because it is easy to realize the phase and amplitude conditions of self-excited oscillations of the tuning fork oscillator by using the phase-locked technology, the integrated phase-locked loop CD4046 is used in the driving circuit to realize the design of the frequency-tracking circuit.

The resistance of piezoelectric ceramic chip in frequency signal sensitive element is very high, but the output signal of sensitive element is weak voltage signal or electric charge signal. Therefore, the preamplifier must be added to the frequency measurement circuit to amplify the signal and then filter the signal [25]. The system block diagram of frequency detection circuit is shown in Figure 9. The charge conversion circuit transforms the high resistance signal from the piezoelectric ceramic plate as the vibration pickup into the low internal resistance voltage signal. The voltage signal is amplified by the amplifier circuit of the instrument. Finally, after filtering the high-frequency interference signal by the low-pass filter, the voltage signal is input into the oscilloscope to measure the resonance frequency of the fork [26].

The instruments used in the experiment include tuning fork density sensor, Terraco oscilloscope, 500 ml measuring cylinder, voltage regulator, 10 groups of sample solutions, and densitometer. The oscilloscope is used to accurately measure the frequency of electrical signals generated by fork vibration. The measuring cylinder is used to ensure that the fork penetrates into the liquid at the same depth. The regulated power supply is used for power supply. A densitometer is used to calibrate the density of sample solution, it is a high-precision electronic densitometer with a measurement accuracy up to 0.0001 g/cm³, and the results are compared with those measured by the density sensor. A viscometer is used to calibrate the viscosity of liquid to test the influence of viscosity on the measurement results of the sensor, and the viscometer is a rotary viscometer with a measurement accuracy up to 0.01 MPa·s. The experimental equipment is shown in Figure 10.

The specific experimental process is shown in Figure 11.

##### 4.2. Density-Frequency Characteristic Experiment

The stability of the resonant frequency of the tuning fork sensor affects the resolution of the instrument. The more stable the resonant frequency is, the higher the resolution of the instrument is.

At the temperature of 25°C, the density of the tested liquid is 0.9021 g/cm^{3}. When the ambient temperature is fixed, the liquid to be measured is injected into the vector cylinder to make it level with the top cap of the tuning fork. After the sensor works stably, its resonance frequency is recorded every 1 minute. The experimental results are shown in Table 4. According to the experimental data, the frequency stability curve of the fork sensor is shown in Figure 12.

It can be seen from Table 4 that the data fluctuation range is small and the dispersion degree is small. No matter in which medium, the stability of the sensor is very good. The stability of resonance frequency in liquid is better than that in air that means the resonance frequency measurements in liquid have a smaller range of fluctuations than those in air, and the stability is 0.017%. A stable frequency output can reduce the measurement error.

##### 4.3. Density-Frequency Characteristic Experiment

In preparation for the experiment, the density of 15 groups of sample solutions was measured by a floating densitometer with an accuracy of 0.0001 g/cm^{3}. The liquid density range of 15 samples was 0.8453–1.2761 g/cm^{3}. During the experiment, the density of the sample solution was measured at 25°C, and the viscosity of the liquid was 0.96 ± 0.01 MPa·s. At temperature 25°C, the density of 15 samples was 0.8453, 0.8611, 0.8802, 0.9111, 0.9511, 0.9852, 1.0762, 1.1058, 1.1281, 1.1661, 1.2103, 1.2251, 1.2453, 1.2653, and 1.2761 (g/cm^{3}). The fork part of the tuning fork density sensor is immersed in the sample solution completely. The comparison between the resonant frequency of the tuning fork in different density liquid and the simulated resonant frequency is shown in Table 5. The resonance frequency of the density sensor fork measured in the measured liquid is lower than the simulation result of COMSOL.

The first natural frequency of the tuning fork obtained by COMSOL simulation is close to the actual resonant frequency, and the relative error remains at about 0.47%. Due to the influence of the actual measurement environment, such as the influence of air damping on the resonance motion of the fork, the impurities attached to the fork change the natural frequency of the fork, so the actual measured natural frequency is less than the simulation results.

##### 4.4. Data Processing and Analysis

Considering that there are errors in the measurement process of tuning fork frequency, which makes the measurement result nonrandom deviation, the partial least square model is selected for fitting [27]. The density calculation model of density *y* and frequency *x* is obtained by fitting the relationship between vibration frequency and liquid density, equation (1):

Figure 13 describes the frequency-density curve and its standard residual based on the least square model fitting.

**(a)**

**(b)**

It can be seen from Figure 13 that the distribution of residuals is satisfactory. The determination coefficient (*R*^{2}) measures the overall fit of the regression equation, and it always describes the linear correlation between the fitting curve and the measured data. The *R*^{2} value of the fitting curve is 0.993, which indicates the high linear correlation of the measured points.

The resonance frequency of the fork body of the density sensor in different solutions is substituted into equation (19) to obtain the fitting density and the fitting relative error calculated. Table 6 shows the comparison between the density of the measured liquid calculated by the frequency-density fitting formula and the measurement results of the electronic densitometer, and the density range of the measured liquid is 0.8453–1.2761 g/cm^{3}.

As can be seen from the data in Table 6, it is within the measurement range of 0.8453−1.2761 g/cm^{3}. The maximum relative error between the calculated result of fitted density-frequency relationship equation (19) and the actual measurement result is −0.21%, and the resolution of the system can reach 0.0001 g/cm^{3}.

##### 4.5. Effect of Viscosity on Measurement Results

As an important property of liquid, viscosity has a great influence on the vibration frequency of the tuning fork. The high-viscosity liquid produces higher damping, which reduces the resonant frequency of the tuning fork. Therefore, the frequency-density characteristic of the sensor is obtained by testing the influence of different viscosity liquid on the resonant frequency of the tuning fork. Combined with the theoretical analysis and data fitting to obtain the density calculation model based on viscosity compensation, this model greatly improves the measurement accuracy of liquid density.

The mixed solution of ethanol, propanol, isopropanol, glycerin, edible oil, crude oil, fruit juice, syrup, and other liquids was prepared as the test solution. The viscosity range was 0.21–182.81 MPa·s. In liquids of different viscosity, the comparison of the sensor measured density by the fitting formula (fitting density), and actual liquid density is shown in Figure 14; the relative error of the fitting density is also shown in the figure.

When the liquid viscosity deviates from 0.96 MPa·s, the fitting error of density will gradually increase with the increase of viscosity. Frequency-density fitting equation (19) is used to compensate the viscosity through the sensor’s measurement results and the actual density of the liquid in the above different viscosity and different density range, in order to obtain the density calculation model suitable for liquids with different viscosity. González et al. [12] proposed that the relationship between tuning fork resonance frequency and liquid viscosity can be equivalent towhere is the effective mass of the tuning fork, *V*_{fl} is the effective volume of the liquid attached to the tuning fork, *L*_{fl} is the effective area of the viscous loss of the liquid, is the resonant frequency of the tuning fork in the liquid, and *f*() is a function of the resonant frequency.Frequency-density fitting equation (21) is substituted to obtain the density calculation model based on viscosity compensation for the structural tuning fork density sensor:

In the equation, the calculation of *V*_{fl}, , and *L*_{fl} is complex, so the model is simplified:where *k*_{m/v} and *k*_{l} are the coefficients related to *V*_{fl}, *m*, and *L*_{fl}. The density calculation model of the tuning fork sensor based on viscosity compensation is obtained by using the partial least squares model fitting from the above experimental data:

The density calculation model after viscosity compensation, the density calculation model without viscosity compensation, and the actual measured value are compared as shown in Figure 15.

Because the liquid used in the experiment is difficult to prepare the solution to the ideal viscosity in the preparation process, the viscosity of the measured point may be different from that shown in the curve. In different viscosity liquid, the actual measured value is more close to the curve after viscosity compensation, and the measurement accuracy is ±0.001 g/cm^{3}.

Figure 16 shows the frequency-viscosity curve of the density calculation model after viscosity compensation under the same density. In the experiment of low-viscosity liquid, edible oil and crude oil with the same density and different viscosity were used for testing, respectively. The viscosity of edible oil is 10.29 MPa·s, 13.75 MPa·s, 18.25 MPa·s, and 19.9 MPa·s. The viscosity of crude oil is 41.3 MPa·s, 44.51 MPa·s, 45.76 MPa·s, 47.8 MPa·s, and 51.36 MPa·s. The maximum relative error between the actual viscosity and the calculated viscosity is 0.36%, and the resonance frequency of the sensor is stable.

**(a)**

**(b)**

In the experiment of high-viscosity liquid, syrup with high viscosity is used as the tested liquid. When the viscosity reaches 500 MPa·s, the slope of the curve tends to be stable. In the same density liquid, the resonance frequency will be reduced by 2.5 Hz for every 1 MPa·s increase of viscosity. If the model without viscosity compensation is used, the error of 0.06 g/cm^{3} will be caused; at this time, the viscosity has a great impact on the tuning fork density sensor. Therefore, the viscosity compensation of the density calculation model is very important to improve the measurement accuracy of the sensor.

##### 4.6. Measuring Performance Test of Tuning Fork Density Sensor

During the test, the traditional tuning fork density sensor is used. The cross-section area of the fork is 20 ∗ 5 mm^{2}, and the length is 100 mm. The resolution of the tuning fork density sensor is 0.0005 g/cm^{3}, and the tuning fork density sensor has a resonance frequency of 481.65 Hz in the air. Compared with the traditional tuning fork density sensor, the improved tuning fork density sensor has higher resonance frequency and higher resolution and sensitivity. At the same time, the density calculation model based on viscosity compensation can greatly reduce the measurement error in a certain range of viscosity. In the measurement performance test, the improved tuning fork density sensor is compared with the traditional tuning fork density sensor, and the measurement error and vibration frequency stability are used to verify whether the measurement performance of the sensor is improved.

It can be seen from Table 7 that the measurement accuracy of the traditional tuning fork density sensor is ±0.002 g/cm^{3} in the liquid with a viscosity range of 50 MPa·s. However, with the increase of viscosity, the density measurement began to deviate from the actual value. At 182.81 MPa·s, the measurement error of the sensor is −0.007 g/cm^{3}, which is lower than the industry average standard. At 480.11 MPa·s, the error is −0.065 g/cm^{3}, which cannot meet the field measurement requirements.

The improved tuning fork density sensor has a resolution of up to ±0.0001 g/cm^{3} in liquid with a viscosity range of 180 MPa·s, the measurement accuracy is ±0.001 g/cm^{3}, and within 180–480 MPa·s, the measurement accuracy is ±0.002 g/cm^{3}. In high-viscosity liquid, the accuracy of the improved tuning fork density sensor is much higher than that of the traditional tuning fork density sensor.

#### 5. Conclusions

This paper identifies a better set of dimensions for a tuning fork in order to improve its performance compared to traditional tuning fork density sensor. In the process, although the resolution of the measurement is improved, the influence of viscosity on the resonant frequency of the tuning fork increases with the decrease of tuning fork dimensions. In order to solve this problem, this paper uses the partial least square model to fit the density calculation formula through the frequency-density characteristic experiment and then combines the frequency-viscosity characteristic experiment to get the density calculation model based on the viscosity compensation. The improved tuning fork density sensor has a resolution of up to ±0.0001 g/cm^{3}, in a liquid with a viscosity range of 180 MPa·s, and the measurement accuracy is ±0.001 g/cm^{3}. Within 180–480 MPa·s, the measurement accuracy is ±0.002 g/cm^{3}. Through the dimension optimization and the density calculation model based on the viscosity compensation, the improved tuning fork density sensor has the characteristics of high measurement resolution and high antiviscosity interference capability. Compared with the traditional tuning fork density sensor, the overall measurement performance of the sensor is higher than that of the traditional tuning fork density sensor in both high- and low-viscosity liquids. The problem that the traditional tuning fork density sensor has low resolution, not suitable for high-viscosity liquid, and the measurement performance of resolution and antiviscosity interference capability conflict with each other is solved.

#### Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

#### Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.

#### Acknowledgments

The authors gratefully acknowledge the financial supports by the National Natural Science Foundation of China under grant no. 51775543, the Natural Science Foundation of Jiangsu Province under grant no. BK20180189, the Joint Funds of the National Natural Science Foundation of China under grant no. U1610111, the Sichuan Science and Technology Program under grant no. 2019YFG0195, the Scientific Research Starting Project of SWPU under grant no. 2018QHZ016, and the Young Scholars Development Fund of SWPU under grant no. 201799010002. The authors gratefully acknowledge the financial supports by the Changzhou Key Laboratory of High Technology under grant no. CM20183004 are also acknowledged.