Self-Diagnostic and Self-Compensation Methods for Resistive Displacement Sensors Tailored for In-Field Implementation

This paper presents a suitably general model for resistive displacement sensors where the model parameters depend on the current sensor conditions, thereby capturing wearout and failure, and proposes a novel fault detection method that can be seamlessly applied during sensor operation, providing self-diagnostic capabilities. On the basis of the estimation of model parameters, an innovative self-compensation method is derived to increase the accuracy of sensors subject to progressive wearout. The proposed model and methods have been validated by both numerical simulations and experimental tests on two real resistive displacement sensors, placed in undamaged and faulty conditions, respectively. The fault detection method has shown an accuracy of 97.2%. The position estimation error is < ±0.2% of the full-scale span for the undamaged sensor, while the self-compensation method successfully reduces the position estimation error from ±15% to approximately ±2% of the full-scale span for the faulty sensor.


Introduction
Displacement sensors are widely used in different applications and fields, such as industrial [1,2], medical [3,4] and automotive [5,6].Within the industrial field, the role of displacement sensors in control applications is gaining importance since the degree of industrial automation is continuously growing.In this context, there is a constant interest in displacement sensors with increasing intelligence, robust measurement methods, and improved performances [7].In particular, sensor reliability in producing accurate measurement data is crucial.Augmenting sensor diagnostic capabilities plays an increasingly important role, as undetected failures may negatively affect the industrial process into which the sensor is inserted, resulting in efficiency loss, downtimes or even threatening life safety [8].
Several solutions can be considered to prevent sensor failure and enhance sensor diagnostic coverage.A first approach is the adoption of a Preventive Maintenance (PM) policy, which implies sensor calibration and maintenance activities run on a regular time basis to avoid failures before they occur [9].Determining in advance when a sensor will enter the wearout phase is challenging, as predictions typically rely on a theoretical failure rate rather than on the current sensor conditions.While PM can reduce unexpected process downtime, it can lead to costly and unnecessary procedures and repairs.
A second possible approach involves employing Fault Detection and Identification (FDI) theory [10][11][12][13].FDI techniques recognize system faults in process components by monitoring system inputs and outputs in order to generate residuals highlighting discrepancies.Thresholds, determined through experimental tests, aid in fault symptom identification.Analytical redundancy techniques [14][15][16] detect and identify sensor failures from the exploitation of analytical models built on a specific process, which includes actuators and plants as well as sensors.However, FDI techniques require a deep knowledge of the entire process and a significant effort in model development.Furthermore, the model must be updated as the process changes.The economic effort conveyed in the model design is not easily amortized since the model is related to a specific process.Moreover, technical staff must be available for maintaining and updating the model as the process evolves over time.
A third possible approach to detect and identify sensor faults is through the use of Machine Learning (ML) techniques [17][18][19].The ML models are trained on sensor data to identify patterns or features indicative of faults.The performance of ML techniques are dependent on the quality and quantity of the available training data.In fact, the training data could be limited, biased, or not representative of all possible faults, which can limit the detectable faults.Moreover, the ML approach mainly focuses on detecting the sensor faults through certain time and/or frequency domain signal characteristic features.In particular, faults can be identified by changes in signal behavior, e.g., bias, noise, spikes, rather than by identifying underlying sensor-specific causes for the fault [20].
An alternative approach could be the adoption of smart sensors inherently capable of providing self-diagnostic information related to the alteration of their conditions due to incipient wearout or failure.The diagnostic information provided might be exploited by suitable Predictive Maintenance (PdM) techniques to optimize sensor maintenance scheduling and minimize plant downtime [21].As opposed to PM approaches, self-diagnostic sensors could avoid both unnecessary maintenance costs and plant downtime due to undetected sensor failures.Moreover, in contrast to many FDI techniques, self-diagnostic sensors place the focus within the sensor itself to make it a more reliable component, leaving out the additional system parts of a given industrial process.Therefore, in principle, a generic process can be freely modified without requiring any change in the diagnostic techniques embedded in the self-diagnostic sensor.As such, the research on displacement sensors equipped with self-diagnostic functionalities is a topic of relevant importance, which, however, has been explored to a somewhat limited extent.In particular, resistive displacement sensors would benefit from solutions for embedding self-diagnostic capabilities.However, to the authors' best knowledge, the current state of the art does not yet adequately cover the development of a resistive displacement sensor model for self-diagnostic and self-compensation purposes.
In this context, this work innovatively proposes a simple yet effective model for a generic resistive linear displacement sensor where the model parameters directly depend on the current sensor conditions, thereby capturing wearout, damaging, and failure occurrence.Furthermore, a method for the continuous estimation of the model parameters is presented.The method originally offers the advantage that it can be applied while the sensor is kept in operation online, i.e., without functionally disconnecting the sensor from the monitored process.The estimated parameters are exploited to detect failures by the proposed fault detection technique, which aims at detecting faults by identifying the underlying sensorspecific cause.The continuously updated parameters are used by the self-compensation method to compensate for the position estimation error arising over time due to progressive wearout and cumulative damage.This paper considerably extends the preliminary work previously presented [22], deepening the study and analysis of both the model for a resistive linear displacement sensor and related self-diagnostic and self-compensation methods.
A schematic comparison between the most common methods to detect and identify sensor faults and the approach proposed in this work is reported in Table 1.
The paper is organized as follows.A generic resistive linear displacement sensor model along with the proposed parameter estimation method, method for compensating position estimation errors, and fault detection method are described in Section 2. In Section 3 the numerical simulations carried out and the experimental setup arranged to test Sensors 2024, 24, 2594 3 of 17 the proposed model and methods are described and the results are reported.The obtained experimental results are discussed in Section 4. The conclusions are drawn in Section 5.
Table 1.Schematic comparison of the most common methods to detect and identify sensor faults and the approach proposed in this work.

Approach Description Properties
Preventive Maintenance Regular maintenance based on theoretical failure rate to avoid failures before they occur.
It is costly and prone to cause unnecessary repairs.

Analytical redundancy techniques
Detection and identification of sensor failures from models built on a specific process.
It requires deep knowledge of the entire process.The model must be updated as the process changes.

Machine Learning
Detection and identification of sensor faults through models trained on sensor data.
Faults are identified by changes in certain signal characteristic features rather than by underlying sensor-specific causes.

Method proposed in this work
Detection and identification of sensor failures from models built on the sensor itself, independently of the processes.
It can be cost effective and the effort for model development can be easily amortized.It offers augmented sensor diagnostic coverage.

Resistive Displacement Sensor Model
Resistive displacement sensors measure the linear or angular displacement of an object by sensing a resistance change related to the object position variation.With specific reference to linear displacement sensors along the direction x, as shown in Figure 1a, the sensing element is essentially composed of a resistive track, a sliding cursor, which is constrained to move along the longitudinal axis of the sensor, and a conductive track.The resistive and conductive tracks are electrically connected to each other through the sliding cursor, which is mechanically linked to the moving object under measurement.
where ρ, S, L, and ξ = ρ/S are the electrical resistivity, section area, length, and resistance per unit length of the resistive track, respectively.The conductive track is assumed to have zero resistance.The resistances measured between the sensor terminal pairs (1, 2), (2, 3), and (1, 3) can be expressed as follows: Equations ( 3) and ( 4) can be combined obtaining the following: where the term Σ is independent from the sliding cursor position x at which the resistances 12 and 23 are measured.Therefore, the sensor model is expressed by combining Equations ( 5) and ( 6) in matrix form as follows: → where the vector  is formed by the resistance terms Σ and R13, the vector  includes the sensor parameters Rc and ξ, and the square matrix  only depends on the resistive track length L. Notably, the linear model of Equation (7a), expressed in its inverted form in Equation (7b), is independent from the measurand displacement x.As such, it advantageously allows to estimate  by only knowing the resistive track length L and the The most common causes of failure for linear sensors include the following: • Wear: sensor components like the sliding cursor and the resistive/conductive track can wear out or become contaminated with dust, dirt, or other debris, causing the sensor to malfunction or eventually fail.

•
Mechanical damage: shock, vibrations or impacts can damage or even break the sliding cursor or the resistive/conductive track.

•
Environmental factors: the sensor can be affected by temperature changes or gradients, pressure variations impairing sensor sealing, moisture infiltration, or other causes producing changes in resistance, which leads to measurement errors up to complete failure.

•
Aging: the electrical properties of materials forming the resistive/conductive track and the cursor might change over time, causing sensor resistance drift or output instability, leading to inaccurate measurements up to an unacceptable level.
Considering the above-mentioned failure modes, a tailored sensor model is presented below to provide information about the actual sensor conditions and its possible alterations over time.As shown in Figure 1b, the sensing element is modeled by a resistive circuit composed of three resistors.The resistor R c represents the contact resistance between the sliding cursor and the resistive track.The resistors R p1 and R p2 represent the resistive track resistances originated from its partitioning caused by the sliding cursor according to its position.Resistances R p1 and R p2 as a function of the sliding cursor position x are given by the following: R p1 = (ρ/S)x = ξx (1) where ρ, S, L, and ξ = ρ/S are the electrical resistivity, section area, length, and resistance per unit length of the resistive track, respectively.The conductive track is assumed to have zero resistance.The resistances measured between the sensor terminal pairs (1, 2), (2, 3), and (1, 3) can be expressed as follows: Equations ( 3) and ( 4) can be combined obtaining the following: where the term Σ is independent from the sliding cursor position x at which the resistances R 12 and R 23 are measured.Therefore, the sensor model is expressed by combining Equations ( 5) and (6) in matrix form as follows: where the vector R is formed by the resistance terms Σ and R 13 , the vector p includes the sensor parameters R c and ξ, and the square matrix A only depends on the resistive track length L. Notably, the linear model of Equation (7a), expressed in its inverted form in Equation (7b), is independent from the measurand displacement x.As such, it advantageously allows to estimate p by only knowing the resistive track length L and the resistances R 12 , R 23 , and R 13 measured at any unknown cursor position x.
The parameters R c and ξ offer the advantage to directly relate the measurable sensor electrical characteristics with the elements that are most susceptible to wear and faults, i.e., the sliding cursor and resistive track [23].Although more parameters could be taken into consideration to obtain a more detailed sensor model, R c and ξ already allow the identification of the most common causes of wearout and failure for resistive displacement sensors, at the same time avoiding excessive model complexity.In addition, the estimation of R c and ξ can be advantageously performed without the knowledge of the cursor position x, allowing their continuous estimation during sensor normal operation.
The parameters p are used to detect alterations in sensor conditions up to sensor faults.For example, the wearout caused by the contact force between the sliding cursor and the resistive track can be considered.Repeated cycles of slides and/or an excessive contact force leads to a reduction in resistive track thickness by abrasion, and in turn a reduction in section S, with possible overheating and local oxidation and wear [24].Compared to the initial conditions of a brand-new sensor, the reduction in S implies an increase in ξ.The resistive element wear debris deposited between the sliding cursor and the resistive element Sensors 2024, 24, 2594 5 of 17 increases the contact resistance R c because the contact area decreases, and the debris acts as an insulator.In addition, creep and fatigue in the sliding cursor brush cause the contact force to decrease, again increasing R c [23,25].With respect to possible mechanical damage, the breakout of the sliding cursor opens the electrical contact between the resistive and conductive tracks, leading R 12 and R 23 to infinity, as well as R c .Other possible mechanical damages could be cracks in the resistive track, which typically increase the resistance R 13 and thus ξ.Additionally, the resistive track ages, leading to a change in resistivity ρ, which reflects in a change of ξ.Meanwhile, the slider cursor ages by oxidizing, causing R c to increase.
The model assumes operation at constant temperature.Such an assumption is not a substantial limitation in practice, as in the majority of industrial applications, the sensor, after a thermal transient at the machine start-up, works at a reasonably constant temperature thereof.For this reason, though track resistivity may in general depend on temperature, the proposed model can be conveniently restricted to thermal steady-state operation without suffering unacceptable inaccuracies.
Sensor condition alterations and failures are detected by monitoring the evolution of R c and ξ with respect to their initial values, i.e., those of a brand-new undamaged sensor.Initial values of R c and ξ are design parameters subject to the typical variability of the manufacturing process.In the first analysis, the detection of fault conditions can be accomplished by comparing each parameter with a respective nominal value taken as the alarm threshold.Due to product and process variability, the definition of a priori nominal alarm threshold could be ineffective for diagnostic monitoring of sensor conditions.For this reason, it is proposed to identify specific alarm thresholds for each individual sensor.

Parameter Estimation
To determine the initial parameters and monitor their evolution during the sensor operation, the proposed estimation method derives the parameters of the vector p online, i.e., without functionally disconnecting the sensor from the monitored process, and without knowing the cursor position x.
Online estimation is a substantial advantage of the proposed method and is mandatory for its effective practical application since both the initial parameters and their variations during operation in the field must be determined.
As illustrated in the flow chart of Figure 2, the estimation method can be divided into two phases.In the first phase, denoted as the measuring phase, the resistance set represented by the three-component vector S R = [R 12 , R 23 , R 13 ] measured at an unknown cursor position x is used to evaluate the resistance vector R = [Σ, R 13 ].In the second phase, denoted as the estimation phase, the previously evaluated R is used to compute p as reported in Equation (7b).
In the proposed method, each resistance set S R , measured at an unknown position x, is used to derive a correspondent estimation of p.The estimated parameters reflect the sensor local conditions at the unknown position x where S R is measured.This provides indirect indications of possible nonhomogeneities.
As an alternative, p can be computed using the average of N resistance sets S R measured in N different cursor positions.Provided that the N positions are sufficiently spread, this results in spatial averaging along the resistive track with a correspondent reduction the residual dependence of p on the cursor position x.
In this work, the parameters p are estimated starting from each single resistance set S R , i.e., N = 1.This offers the advantage of maintaining a biunivocal correspondence between p and the position x without introducing spatial averaging.
Since the parameters p are estimated starting from the direct measurement of the resistances R 12 , R 23 , and R 13 , the lower the measurement uncertainty of the resistance measurement, the better the parameter estimation will be.The uncertainties u c (R c ) and u c (ξ) resulting from the resistance uncertainties u(R 12 ), u(R 12 ), and u(R 13 ) can be considered Sensors 2024, 24, 2594 6 of 17 in defining a fault detection method that is robust with respect to measured data.From Equation (7b), the composite uncertainties u c (R c ) and u c (ξ) are given by the following: Sensors 2024, 24, x FOR PEER REVIEW 6 of 17 As an alternative, p can be computed using the average of N resistance sets SR measured in N different cursor positions.Provided that the N positions are sufficiently spread, this results in spatial averaging along the resistive track with a correspondent reduction the residual dependence of  on the cursor position x.
In this work, the parameters  are estimated starting from each single resistance set SR, i.e., N = 1.This offers the advantage of maintaining a biunivocal correspondence between p and the position x without introducing spatial averaging.Since the parameters p are estimated starting from the direct measurement of the resistances 12, 23, and 13, the lower the measurement uncertainty of the resistance measurement, the better the parameter estimation will be.The uncertainties uc(Rc) and uc(ξ) resulting from the resistance uncertainties u(R12), u(R12), and u(R13) can be considered in defining a fault detection method that is robust with respect to measured data.From Equation (7b), the composite uncertainties uc(Rc) and uc(ξ) are given by the following:

Cursor Position Estimation and Compensation
There are several methods to obtain the cursor position of a resistive displacement sensor.Considering the schematization of a generic resistive displacement sensor of Figure 1a, one common method involves exciting the sensor with a known constant voltage at the terminal pair (1, 3) while reading at high-input impedance the voltage divider output at the terminal pair (2, 3), which varies as a function of the cursor position x.This method does not account for the sensor conditions represented by parameters p. Actually, the reading is to first order independent from p as long as ξ is uniform along the sensor stroke L. As no information on the sensor conditions is extracted, sensor faults cannot be anticipated nor predicted.

Cursor Position Estimation and Compensation
There are several methods to obtain the cursor position of a resistive displacement sensor.Considering the schematization of a generic resistive displacement sensor of Figure 1a, one common method involves exciting the sensor with a known constant voltage at the terminal pair (1, 3) while reading at high-input impedance the voltage divider output at the terminal pair (2, 3), which varies as a function of the cursor position x.This method does not account for the sensor conditions represented by parameters p. Actually, the reading is to first order independent from p as long as ξ is uniform along the sensor stroke L. As no information on the sensor conditions is extracted, sensor faults cannot be anticipated nor predicted.
On the other hand, the resistances R 12 and R 23 depend on both the cursor position x at which they are measured and the parameters p.By manipulating Equations ( 3) and ( 4), the actual cursor position x can be expressed as follows: An estimated cursor position x' can be derived from Equation (10) by employing the current parameter estimates p c = [R cc , ξ c ].The closer the match between p c and p, the lower the difference will be between x' and x.The position estimation error e pos due to the difference between the actual unknown ξ and its current estimation ξ c is as follows: Sensors 2024, 24, 2594 7 of 17 where R 12 and R 23 are the resistances measured in the current sensor conditions.Since the parameters vary as the sensor conditions change, it is crucial that the current parameters p c are continuously updated since x' depends on ξ c .If instead of p c the nominal parameters p 0 = [R c0 , ξ 0 ] relative to an undamaged sensor are used as estimates of p during the sensor life, the estimated position x 0 is subject to an estimation error e pos0 given by the following: The position estimation error e pos0 can be seen as the sum of e pos given by Equation ( 11) and an additive error δ related to the difference between the current parameter ξ c and ξ 0 employed for estimating position.
The additive error δ is zero when ξ c = ξ 0 , i.e., when ξ does not vary from the undamaged conditions.It also shows that the error is higher the farther the cursor is from L/2.As the position error e pos does not depend on R c as long as R c is finite and Equation ( 11) remains valid, the proposed estimation method is unaffected by R c .
Starting from Equation ( 12), if the estimate of ξ is constantly updated, the position estimation error e pos0 can be reduced to e pos by nulling the additive position estimation error δ.In this perspective, the method proposed to reduce the position estimation error can be seen as a self-compensation method.

Fault Detection
The parameters R c and ξ are known to play a crucial role in defining the conditions of the resistive displacement sensor as they are directly affected by sensor wearout and faults [23].Therefore, the proposed fault detection method focuses on assessing progressive sensor wearout or sudden failure by comparing the variation in R c and ξ with reference values by means of alarm thresholds.Innovatively, this approach is built on a model that allows determination of the sensor conditions during its operation, without disconnecting it from the host system and without requiring knowledge of the cursor position x.
As illustrated in the flow chart of Figure 3, faults are detected on the basis of parameter variations ∆p = [∆R c , ∆ξ] = |p c − p 0 |, where p c = [R cc , ξ c ] and p 0 = [R c0 , ξ 0 ] represent the sensor parameters in the current and initial undamaged conditions, respectively.The nominal parameters p 0 are calculated as the spatial average of the initial parameters R c and ξ estimated along the entire sensor stroke.The parameters p 0 could be determined during factory calibration or directly in the field, during the first installation.It is expected that R c and ξ variations are mostly related to sliding cursor and resistive track faults, respectively.
Fault detection is based on threshold surpassing.Specifically, if both ∆R c and ∆ξ are lower than their respective alarm thresholds T 1 and T 2 , then no fault is detected.Differently, the sensor is faulty, and the fault could affect the resistive track, the sliding cursor, or both depending on which threshold is surpassed.
The thresholds T 1 and T 2 can be set empirically on the basis of ensemble standard deviations σ(R c0 ) and σ(ξ 0 ) derived from a suitably large population representative of undamaged sensors, or from each individual sensor at the installation time in the field.Assuming that model parameters for an undamaged sensor are random variables with normal distribution, it is reasonable to suppose that changes that exceed the range of ±3σ(R c0 ) and ±3σ(ξ 0 ) are ascribable to an occurred alteration in the sensor conditions due to wearout or fault.
The thresholds T1 and T2 can be set empirically on the basis of ensemble standard deviations σ(Rc0) and σ(ξ0) derived from a suitably large population representative of undamaged sensors, or from each individual sensor at the installation time in the field.Assuming that model parameters for an undamaged sensor are random variables with normal distribution, it is reasonable to suppose that changes that exceed the range of ±3σ(Rc0) and ±3σ(ξ0) are ascribable to an occurred alteration in the sensor conditions due to wearout or fault.

Results
The sensor model, along with the parameter estimation, the self-compensation, and the fault detection methods have been simulated and experimentally tested.
The simulations have estimated the parameters from a set of resistance values corrupted with pseudorandom numerical noise, while in the experimental tests the parameters have been derived from measurements on a Device Under Test (DUT), i.e., a resistive displacement sensor, placed in two different conditions, namely undamaged and faulty.
The term undamaged here refers to a sensor that has never been used and has been stored in compliance with the requirements described in the sensor datasheet.Instead, the term faulty here indicates a sensor subject to a resistive track and sliding cursor wearout, where the resistive track wear along x is virtually uniform.Wear has been considered among the failures listed in Section 2.1 as it represents the main and most common failure mode.
The simulations have been aimed at evaluating the parameter estimation variability with respect to the measurement accuracy of resistances 12, 23, and 13.The experimental tests have been aimed at assessing the fitting accuracy of the sensor model defined as the difference between the measured resistances 12, 23, and 13 and those synthetized from the sensor model.Furthermore, the estimated parameters have been employed to evaluate the self-compensation method in reducing the position estimation error and the effectiveness of alarm thresholds T1 and T2 in detecting wear failure.

Results
The sensor model, along with the parameter estimation, the self-compensation, and the fault detection methods have been simulated and experimentally tested.
The simulations have estimated the parameters from a set of resistance values corrupted with pseudorandom numerical noise, while in the experimental tests the parameters have been derived from measurements on a Device Under Test (DUT), i.e., a resistive displacement sensor, placed in two different conditions, namely undamaged and faulty.
The term undamaged here refers to a sensor that has never been used and has been stored in compliance with the requirements described in the sensor datasheet.Instead, the term faulty here indicates a sensor subject to a resistive track and sliding cursor wearout, where the resistive track wear along x is virtually uniform.Wear has been considered among the failures listed in Section 2.1 as it represents the main and most common failure mode.
The simulations have been aimed at evaluating the parameter estimation variability with respect to the measurement accuracy of resistances R 12 , R 23 , and R 13 .The experimental tests have been aimed at assessing the fitting accuracy of the sensor model defined as the difference between the measured resistances R 12 , R 23 , and R 13 and those synthetized from the sensor model.Furthermore, the estimated parameters have been employed to evaluate the self-compensation method in reducing the position estimation error and the effectiveness of alarm thresholds T 1 and T 2 in detecting wear failure.

Simulation Results
Simulations have been performed in MATLAB 2022b to repeatedly estimate the model parameters R c and ξ from a set of resistances R 12 , R 23 , and R 13 corrupted with numerical noise.The parameter mean values µ and standard deviations σ have been calculated from the estimates across the repetitions taken at different positions.
The resistances R 12 , R 23 , and R 13 forming the resistance set S R have been synthetized from their respective analytical expressions reported in Equations ( 3)-( 5), fixing the ideal parameters p = R c , ξ = [100 Ω; 50,000 Ω/m], the sensor stroke L = 100 mm and sweeping Sensors 2024, 24, 2594 9 of 17 the displacement from x = 0 to x = L with a step of 1 mm.The values chosen for p are representative of the actual sensor that has been experimentally tested as detailed in Section 3.2.In particular, R c = 100 Ω includes non-idealities like the conductive track resistance and the resistance of the connecting terminals.A normally distributed pseudorandom numerical noise with a standard deviation σ n = 1 Ω has been added to corrupt R 12 , R 23 , and R 13 .
For each considered cursor position x, the parameters have been estimated from the corresponding resistance set S R .Then, the mean values µ and standard deviations σ with respect to x have been calculated from the estimates.The obtained results are reported in Table 2 as the difference between p and the estimated parameter mean values µ, along with their standard deviations σ.  the displacement from x = 0 to x = L with a step of 1 mm.The values chosen for  are representative of the actual sensor that has been experimentally tested as detailed in Section 3.2.In particular,  = 100 Ω includes non-idealities like the conductive track resistance and the resistance of the connecting terminals.A normally distributed pseudorandom numerical noise with a standard deviation σn = 1 Ω has been added to corrupt 12, 23, and 13.
For each considered cursor position x, the parameters have been estimated from the corresponding resistance set SR.Then, the mean values µ and standard deviations σ with respect to x have been calculated from the estimates.The obtained results are reported in Table 2 as the difference between  and the estimated parameter mean values µ, along with their standard deviations σ.Figures 4 and 5 report the parameter estimation errors as a function of the position along the sensor stroke.
The simulation evaluates the variability of estimated parameters with respect to the measurement accuracy of resistances 12, 23, and 13.The parameter estimation is adequate for the application scope because the percentage deviations between the ideal parameters  and the mean values of the estimated parameters are less than ±0.1%.Furthermore, the parameter standard deviations σ(Rc) and σ(ξ) agree with the corresponding composite uncertainties uc(Rc) = √3/2 Ω and uc(ξ) = 10 Ω/m, obtained from Equations ( 8) and ( 9) by setting

Experimental Setup
The DUT is a resistive linear displacement sensor (Gefran PK), with a displacement full-scale span (FSS) L = 100 mm, a nominal resistive track resistance of 5 kΩ and an independent linearity error of ±0.05% FSS.
Sensor wearout has been intentionally provoked by sliding the cursor back and forth The simulation evaluates the variability of estimated parameters with respect to the measurement accuracy of resistances R 12 , R 23 , and R 13 .The parameter estimation is adequate for the application scope because the percentage deviations between the ideal parameters p and the mean values of the estimated parameters are less than ±0.1%.Furthermore, the parameter standard deviations σ(R c ) and σ(ξ) agree with the corresponding composite uncertainties u c (R c ) = √ 3/2 Ω and u c (ξ) = 10 Ω/m, obtained from Equations ( 8) and ( 9) by setting u(R 12 ) = u(R 23 ) = u(R 13 ) = σ n = 1 Ω.

Experimental Setup
The DUT is a resistive linear displacement sensor (Gefran PK), with a displacement full-scale span (FSS) L = 100 mm, a nominal resistive track resistance of 5 kΩ and an independent linearity error of ±0.05% FSS.
Sensor wearout has been intentionally provoked by sliding the cursor back and forth throughout the whole sensor stroke for 10 6 cycles.Figure 6 shows the stress-test machine adopted to induce wear, while Figure 7 shows the wearout effect produced on the resistive track.

Experimental Setup
The DUT is a resistive linear displacement sensor (Gefran PK), with a displacement full-scale span (FSS) L = 100 mm, a nominal resistive track resistance of 5 kΩ and an independent linearity error of ±0.05% FSS.
Sensor wearout has been intentionally provoked by sliding the cursor back and forth throughout the whole sensor stroke for 10 6 cycles.Figure 6 shows the stress-test machine adopted to induce wear, while Figure 7 shows the wearout effect produced on the resistive track.
The assembled experimental setup comprises a linear positioning stage, a digital multimeter, and a personal computer, as shown in Figures 8 and 9.
The sensor parameters are estimated from the resistance sets SR measured in M different cursor positions along the sensor stroke.Resistances have been measured by means of a 6.5-digit digital multimeter (Keithley DAQ6510, Cleveland, OH, USA) equipped with a multiplexer module (Keithley 7700), providing a specified resistance measurement accuracy u(R) = 1 Ω in the 10 kΩ range of interest.
The sensor cursor displacement has been set by a precision linear positioning stage (Physik Instrumente LS-270, Karlsruhe, Germany) with a calibrated position accuracy in the order of ±1 µm.A LabVIEW script has been developed to implement the parameter estimation method and handle the experimental setup.The script is designed to move the linear stage to M different positions and trigger the digital multimeter to measure the components of SR at each position.The assembled experimental setup comprises a linear positioning stage, a digital multimeter, and a personal computer, as shown in Figures 8 and 9

Experimental Results
Experimental tests have been carried out to estimate the parameters of an undamaged (U) sensor and a faulty (F) sensor, denoted as pu = [Rcu, ξu] and pf = [Rcf, ξf],

Experimental Results
Experimental tests have been carried out to estimate the parameters of an undamaged (U) sensor and a faulty (F) sensor, denoted as pu = [Rcu, ξu] and pf = [Rcf, ξf], The sensor parameters are estimated from the resistance sets S R measured in M different cursor positions along the sensor stroke.Resistances have been measured by means of a 6.5-digit digital multimeter (Keithley DAQ6510, Cleveland, OH, USA) equipped with a multiplexer module (Keithley 7700), providing a specified resistance measurement accuracy u(R) = 1 Ω in the 10 kΩ range of interest.
The sensor cursor displacement has been set by a precision linear positioning stage (Physik Instrumente LS-270, Karlsruhe, Germany) with a calibrated position accuracy in the order of ±1 µm.A LabVIEW script has been developed to implement the parameter estimation method and handle the experimental setup.The script is designed to move the linear stage to M different positions and trigger the digital multimeter to measure the components of S R at each position.

Experimental Results
Experimental tests have been carried out to estimate the parameters of an undamaged (U) sensor and a faulty (F) sensor, denoted as p u = [R cu , ξ u ] and p f = [R cf , ξ f ], respectively.For the undamaged and faulty sensors, the respective resistance sets S Ru and S Rf have been repeatedly measured M times for the position x ranging from 0 to L with a 1 mm step resulting in M = 100, as schematized in Figure 10.From each set S Ru and S Rf , the parameters p u and p f have been estimated according to Equation (7b).
Table 3 reports the mean values P u = [µ(R cu ), µ(ξ u )] and P f = [µ(R cf ), µ(ξ f )], and standard deviations σ u = [σ(R cu ), σ(ξ u )] and σ f = [σ(R cf ), σ(ξ f )] for p u and p f obtained over the M repetitions at varying x.From P u and P f inserted into Equations ( 3)-( 5), the terms , where the subscript m indicates outcomes from the model.Hence the model residuals have been computed for the undamaged and faulty sensor as r u = [r 12u , r 23u , r 13u ] = S Ru − R mu and r f = [r 12f , r 23f , r 13f ] = S Rf − R mf , respectively.The residuals r u and r f have been evaluated for all the M repetitions at which S Ru and S Rf have been measured.The root mean square errors (RMSE) of the residuals are also reported in Table 3. Figure 11 shows the estimated parameters p u and p f while Figure 12a,b report the residuals r u and r f as a function of repetition index ranging from 1 to M = 100.
the basis of the parameter variations ∆pu = |pu − Pu| and ∆pf = |pf − Pu|.The fault detection thresholds T1 and T2 have been set based on the pu standard deviations σu, resulting in T1 = 3σ(Rcu) = 13.5 Ω and T2 = 3σ(ξu) = 3.9 Ω/m.Table 3. Parameter mean values µ and standard deviations σ, along with the RMSE of the residuals r12, r23 and r13 obtained in the experimental test.Parameter estimations are performed from the resistance sets SR measured M = 100 times for x ranging from 0 to L with a 1 mm step.Since the resistance measurement uncertainty is u(R) = 1 Ω, the parameter composite uncertainties are uc(Rc) = 0.9 Ω and uc(ξ) = 10 Ω/m.The uncertainties of the parameter mean values µ, standard deviations σ, and RMSE of the residuals r12, r23 and r13 are derived from uc(Rc), uc(ξ), and u(R).The position estimation error e pos is evaluated for both the U and F sensors, for all the cursor positions at which S Ru and S Rf are measured.The true, i.e., actual, cursor position x is assumed to be given by the linear positioning stage taken as the reference.The position estimations x' are derived from Equation ( 10) by employing µ(ξ u ) and µ(ξ f ) for the U and F sensor, respectively.Figure 13 shows the position estimation error e pos for both the U and F sensors as a function of x. Figure 14 shows e pos obtained for the faulty sensor both with and without the application of the self-compensation method described in Section 2.3, where the uncompensated cursor positions are intentionally estimated using µ(ξ u ) in order to simulate a mismatch between the nominal, i.e., initial, and the current sensor conditions.
The standard deviations of the parameters Rc and ξ can be analyzed to compare the variability of the parameters obtained in the simulations with those from experimental results.Although the noise standard deviation σn in simulations is taken equal to the resistance measurement uncertainty u(R), i.e., u(R) = σn = 1 Ω, the experimental standard deviations of Rc, σ(Rcu) = 4.5 Ω and σ(Rcf) = 21.9Ω, are larger than σ(Rc) = 0.8 Ω for simulations.This is consistent with the fact that σ(Rcu) and σ(Rcf) cannot be imputed exclusively to u(R), in fact they can be ascribed to the nonideality of R12 and R23 trends as a function of x due to the presence of faults, described by the residuals r12 and r23.Similarly, the residual

Discussion
Considering the simulation results described in Section 3.1, the normally distributed pseudorandom numerical noise added to R 12 , R 23 , and R 13 and the resulting parameter variability are reflected in the parameter composite uncertainties u c (ξ) and u c (R c ) expressed in Equations ( 8) and ( 9).Assuming the resistance uncertainties equal to the noise standard deviation, i.The standard deviations of the parameters R c and ξ can be analyzed to compare the variability of the parameters obtained in the simulations with those from experimental results.Although the noise standard deviation σ n in simulations is taken equal to the resistance measurement uncertainty u(R), i.e., u(R) = σ n = 1 Ω, the experimental standard deviations of R c , σ(R cu ) = 4.5 Ω and σ(R cf ) = 21.9Ω, are larger than σ(R c ) = 0.8 Ω for simulations.This is consistent with the fact that σ(R cu ) and σ(R cf ) cannot be imputed exclusively to u(R), in fact they can be ascribed to the nonideality of R 12 and R 23 trends as a function of x due to the presence of faults, described by the residuals r 12 and r 23 .Similarly, the residual r 13 explains the difference between the experimental standard deviations σ(ξ u ) = 1.3 Ω and σ(ξ f ) = 9.9 Ω with the simulated one σ(ξ) = 11.5 Ω.
Considering the experimental results described in Section 3.3, Figure 11 shows a visible dependence of R cf on the repetition index and, in turn, versus position x.Such dependence shows nonuniform variations along the resistive track length L, with regions where the contact resistance between the sliding cursor and the resistive track is higher.The microscope analysis confirms that the regions where the contact resistance is higher match with the regions where the resistive track is mostly worn.Therefore, the proposed method theoretically allows detection of local faults through R c trend analysis.
The sensor model goodness of fit is evaluated on the basis of the residuals r u and r f .As shown in Figure 12a,b, for the undamaged sensor the RMSEs of r u are ∼0.2% of the resistive track nominal resistance, which is adequately low for fault detection and estimation of position x'.For the faulty sensor, the RMSEs of r f increase compared to the undamaged case due to the trends of R 12 and R 23 as a function of x caused by nonhomogeneous resistive track wear along its length.
As shown in Figure 13, the position estimation error e pos for the undamaged sensor is approximately constant throughout the sensor stroke, with a mean value of 0.2 mm.For the faulty sensor, e pos is an order of magnitude higher spanning a range of roughly 2 mm.As reported in Figure 14, the self-compensation method successfully reduces e pos to a span of about 2 mm in the faulty case versus the value of 30 mm obtained intentionally using µ(ξ u ) to represent the case when the parameter estimates are not updated to the current values.
Given the chosen thresholds T 1 = 3σ(R cu ) and T 2 = 3σ(ξ u ), the results obtained in applying the fault detection method are shown in the confusion matrices of Figure 15.
evaluates the number of actual faults identified, while recall assesses the effectiveness in detecting faults among all instances of faults.The performance metrics obtained for the resistive track and sliding cursor fault detections are reported in Table 4.
The false negative sliding cursor fault detections are due to the variability of Rc as a function of x caused by nonhomogeneous wear of the resistive track.A possible solution could be acting on threshold values.For example, lowering T1 to equal σ(Rcu) results in the sliding cursor fault detection recall increasing to 96.0%.However, threshold lowering makes the fault detection method more prone to false positives, leading the precision to drop to 78.6%.
Moreover, the uncertainty of the standard deviations of the parameters in the thresholds T1 and T2 has an impact on the accuracy and precision metrics for resistive track fault detection.In particular, accuracy and precision vary within [97.5%; 100%] and [95.2%; 100%], respectively.The fault detection method has been evaluated using accuracy, precision, and recall performance metrics.Accuracy measures the fault detection correctness, precision evaluates the number of actual faults identified, while recall assesses the effectiveness in detecting faults among all instances of faults.The performance metrics obtained for the resistive track and sliding cursor fault detections are reported in Table 4.
Table 4. Accuracy, precision and recall performance metrics for the sliding cursor and resistive track fault detections.Accuracy = (TP + TN)/(TP + TN + FP + FN), precision = TP/(TP + FP), and recall = TP/(TP + FN), where TP, TN, FP, and FN are the true positive, true negative, false positive, and false negative fault predictions, respectively.The false negative sliding cursor fault detections are due to the variability of R c as a function of x caused by nonhomogeneous wear of the resistive track.A possible solution could be acting on threshold values.For example, lowering T 1 to equal σ(R cu ) results in the sliding cursor fault detection recall increasing to 96.0%.However, threshold lowering makes the fault detection method more prone to false positives, leading the precision to drop to 78.6%.

Type of Fault
Moreover, the uncertainty of the standard deviations of the parameters in the thresholds T 1 and T 2 has an impact on the accuracy and precision metrics for resistive track fault detection.In particular, accuracy and precision vary within [97.5%; 100%] and [95.2%; 100%], respectively.

Conclusions
This work introduces a suitably general model for resistive displacement sensors and proposes thereof an innovative fault detection method that can be applied with the sensor in operation providing self-diagnostic capabilities.Based on the output of the self-diagnostic step, a self-compensation method with automatic updating is in turn derived to increase the accuracy in sensors subject to progressive wearout.The proposed model and methods have been validated by both numerical simulations and experimental tests on real devices.
The position is estimated by exploiting the sensor model and the initial value of ξ.The self-compensation method reduces the position estimation error by considering the difference between the current and initial values of ξ, which causes a position estimation error.The self-compensation method successfully reduces the position estimation error e pos in the faulty case, intentionally obtained using µ(ξ u ), from a span of 30 mm to a span of 2 mm.The proposed fault detection method evaluates the progressive sensor wearout or sudden failure by comparing the variation in the current parameters R c and ξ with respect to their initial values against the alarm thresholds T 1 and T 2 , respectively.The fault detection method, for T 1 = 3σ(R cu ) and T 2 = 3σ(ξ u ), has shown a resistive track and sliding cursor fault detection accuracy of 99.0% and 95.5%, respectively.Lowering T 1 from 3σ(R cu ) to σ(R cu ) has increased the sliding cursor fault detection recall to 96.0%, involving the precision to drop to 78.6% as the threshold lowering makes the fault detection method more prone to false positives.
The future work will involve the implementation of the proposed methods and their testing in a dynamic industrial process.

Patents
There is a patent application resulting from the work reported in this manuscript [26].

Figure 1 .
Figure 1.(a) Schematization of a generic resistive linear displacement sensor with (b) the corresponding resistive circuit modeling.

Figure 1 .
Figure 1.(a) Schematization of a generic resistive linear displacement sensor with (b) the corresponding resistive circuit modeling.
Figures 4 and 5 report the parameter estimation errors as a function of the position along the sensor stroke.

Table 2 . 7 Figure 4 .
Figure 4. Estimation error of the parameter Rc versus the position x along the sensor stroke.Figure 4. Estimation error of the parameter R c versus the position x along the sensor stroke.

Figure 4 . 17 Figure 5 .
Figure 4. Estimation error of the parameter Rc versus the position x along the sensor stroke.Figure 4. Estimation error of the parameter R c versus the position x along the sensor stroke.Sensors 2024, 24, x FOR PEER REVIEW 10 of 17

Figure 5 .
Figure 5. Estimation error of the parameter ξ versus the position x along the sensor stroke.

Figure 5 .
Figure 5. Estimation error of the parameter ξ versus the position x along the sensor stroke.

Figure 6 .
Figure 6.Stress-test machine employed to induce wearout in the resistive track and sliding cursor.Figure 6. Stress-test machine employed to induce wearout in the resistive track and sliding cursor.

Figure 6 .Figure 7 .
Figure 6.Stress-test machine employed to induce wearout in the resistive track and sliding cursor.Figure 6. Stress-test machine employed to induce wearout in the resistive track and sliding cursor.Sensors 2024, 24, x FOR PEER REVIEW

Figure 7 .
Figure 7. Images obtained with a digital microscopy system (Leica DMS300) of the undamaged (a) and wearout (b) resistive track. .

Figure 7 .
Figure 7. Images obtained with a digital microscopy system (Leica DMS300) of the undamaged (a) and wearout (b) resistive track.

Figure 8 .
Figure 8. Block diagram of the adopted experimental setup.

Figure 9 .
Figure 9. Photo of the assembled experimental setup.

Figure 8 .
Figure 8. Block diagram of the adopted experimental setup.

Figure 7 .
Figure 7. Images obtained with a digital microscopy system (Leica DMS300) of the undamaged (a) and wearout (b) resistive track.

Figure 8 .
Figure 8. Block diagram of the adopted experimental setup.

Figure 9 .
Figure 9. Photo of the assembled experimental setup.

Figure 9 .
Figure 9. Photo of the assembled experimental setup.

Figure 10 .Table 3 . 17 Figure 10 .
Figure 10.Schematization of S Ru and S Rf measurement processes.The resistance sets S Ru and S Rf are measured from the undamaged and faulty sensor over M repetitions taken for x varying from 0 to L with a 1 mm step.Table 3. Parameter mean values µ and standard deviations σ, along with the RMSE of the residuals r 12 , r 23 and r 13 obtained in the experimental test.Parameter estimations are performed from the resistance sets S R measured M = 100 times for x ranging from 0 to L with a 1 mm step.Since the resistance measurement uncertainty is u(R) = 1 Ω, the parameter composite uncertainties are u c (R c ) = 0.9 Ω and u c (ξ) = 10 Ω/m.The uncertainties of the parameter mean values µ, standard deviations σ, and RMSE of the residuals r 12 , r 23 and r 13 are derived from u c (R c ), u c (ξ), and u(R).

Figure 11 .
Figure 11.Parameters pu and pf estimated, respectively, from the measured resistance sets SRu and SRf as a function of the repetition index ranging from 1 to M = 100.

Figure 11 .
Figure 11.Parameters p u and p f estimated, respectively, from the measured resistance sets S Ru and S Rf as a function of the repetition index ranging from 1 to M = 100.

Figure 11 .Figure 12 .
Figure 11.Parameters pu and pf estimated, respectively, from the measured resistance sets SRu and SRf as a function of the repetition index ranging from 1 to M = 100.

Figure 12 .
Figure 12.Residuals ru = SRu − Rmu (a) and rf = SRf − Rmf (b) resulting from the measured SRu and SRf as a function of the repetition index ranging from 1 to M = 100.Figure 12. Residuals r u = S Ru − R mu (a) and r f = S Rf − R mf (b) resulting from the measured S Ru and S Rf as a function of the repetition index ranging from 1 to M = 100.

Figure 13 .
Figure 13.Position estimation error epos for to the undamaged (U) and faulty (F) sensors versus the actual cursor position x.Figure 13.Position estimation error e pos for to the undamaged (U) and faulty (F) sensors versus the actual cursor position x.

Figure 13 .
Figure 13.Position estimation error epos for to the undamaged (U) and faulty (F) sensors versus the actual cursor position x.Figure 13.Position estimation error e pos for to the undamaged (U) and faulty (F) sensors versus the actual cursor position x.Lastly, the fault detection method discriminates the fault and no-fault conditions on the basis of the parameter variations ∆p u = |p u − P u | and ∆p f = |p f − P u |.The fault detection thresholds T 1 and T 2 have been set based on the p u standard deviations σ u , resulting in T 1 = 3σ(R cu ) = 13.5 Ω and T 2 = 3σ(ξ u ) = 3.9 Ω/m.

Figure 13 .
Figure 13.Position estimation error epos for to the undamaged (U) and faulty (F) sensors versus the actual cursor position x.

Figure 14 .
Figure 14.Position estimation error epos for to the faulty (F) sensor, with and without the selfcompensation method applied, versus the actual cursor position x.The uncompensated cursor positions have been deliberately estimated using µ(ξu) to simulate a discrepancy between the nominal and current sensor conditions.

Figure 14 .
Figure 14.Position estimation error e pos for to the faulty (F) sensor, with and without the selfcompensation method applied, versus the actual cursor position x.The uncompensated cursor positions have been deliberately estimated using µ(ξ u ) to simulate a discrepancy between the nominal and current sensor conditions.

Figure 15 .
Figure 15.Confusion matrices for the sliding cursor and resistive track fault detections.