# Macromodel of Precise Signal-Phase Meter

Authors: Matej Šalamon; Bojan Jarc
Journal: Modelling and Simulation in Engineering
 (2012)

---

## Abstract

This paper presents a precise macromodel of a signal-phase meter, which allows continuous phase measurement during simulation. It has been developed as a support tool during the design process of a signal-conditioning circuit for incremental position encoders. The development of a signal conditioning circuit requires precise measurements of small signal phases, amplitudes and offsets using the analog/digital circuit simulator. The phase measurement cannot be performed directly with a simulator, therefore an appropriate macro-model is needed for a circuit simulator. The structure of the signal-phase meter is based on the conventional signal-phase measuring method and is intended for the measuring of a cosine-signal phase with a known frequency. It recommends that the time variations of an input signal’s parameters (amplitude, phase, frequency, and offset voltage) are slow and small as possible. Rapid change of a signal’s parameters decreases the simulation result’s accuracy. A macro-model’s precision mainly depends on the chosen parameters for the macro-model and for the simulation. We show that with the proposed meter’s model, the phase angle can be measured with an accuracy of more than ±0,02%.


---

## Body

## 1. Introduction

Position encoders are sensors that convert their linear or rotary displacements into appropriate electrical signals and are widely used in many computer-controlled machines. Position signals can be generated by magnetic, capacitive, or optical means, and represent displacement information in absolute or incremental forms [1, 2].Ideally, the linear optical incremental position encoders produce two 90° shifted analog signals, which enable us to detect the position of an encoder’s head. However, due to encoder’s and optical grating’s mechanical limitations, these signals have unideal sine/cosine shapes, variable amplitudes, offset voltages, and additional phase shifts. The influences of such various unwanted effects are reduced and corrected by a signal-conditioning circuit, which is usually an encoder’s integral part, realized as an integrated circuit. Thus, the signal-conditioning circuit is an analog/digital circuit, generally developed using an analog/digital circuit simulator. The development of such circuit, always requires very precise signal-phase measurements, which cannot be performed directly by a simulator.This paper deals with the SPICE macromodel of signal-phase meter, which enables a precise phase measurement whilst simulation is running. It is based on well-known practically implemented conventional phase-measurement techniques, as described in [3–7]. Although structures, similar to our model, can be found in [8], to our knowledge, this type of model has never been developed.This paper is organized as follows. Section2 briefly describes the conventional signal-phase measurement techniques. A detailed description of the proposed macromodel is given in Section 3. Section 4 comprises examples of signal-phase measurement using the proposed model and the SPICE simulator. This model’s accuracy and other properties are also described. The conclusions are given in Section 4.


## 2. Conventional Signal-Phase Measurement Techniques

Conventional phase-measurement techniques between two signals of the same frequency [3] usually apply a square wave-conversion to signals. Phase is then determined by measuring the time difference, either between the zero crossing-points or between the pulse centers [4–7]. Due to certain disadvantages of conventional phase measurement methods, especially in cases of harmonically distorted signals, many authors suggest signal digitalization and further digital signal processing. The author in [6] presents a theory of high-precision phase measurement and a practical algorithm for phase calculation between two signals. The possibility for its implementation is described in [7]. Similarly, improved ways of phase measuring can also be found in [4, 9, 10].


## 3. Macromodel Description

The proposed phase meter macromodel consists of basic components (resistors, capacitors, etc.) and analog behavioral functions (differentiators, multipliers, etc.). Their real circuit implementation would be difficult, but usage within a simulator is simple. It is intended for the phase-measurements of cosine signals with known frequencies and excludes measurement of the sine-signal phase. It could however, also be generalized for such cases.A generalized expression of macromodel’s input cosine signalvc(t) can be written using the equation:
(1)vc(t)=Ac(t)·cos(2πf(t)·t+φ(t))+Vc(t),
where Ac(t): amplitude time waveform, f(t): frequency time waveform, Vc(t): offset voltage time waveform, and φ(t): signal phase time waveform.Figure1 shows a block diagram of the phase meter macromodel. The input signals are the voltage signals vc(t) and f(t). The signal f(t) in volts is proportional to the input-signal frequency in hertz. The output signal φ(t) in volts quantifies a measured phase in degrees. The phase is measured between the input vc(t) and internally generated cosine signal (the latter is not shown in this figure).Figure 1
Block diagram of signal-phase meter macromodel.The model does not measure the frequencyf(t). It is presumed that f(t) is known in advance. This simplifies the model’s structure. It also requires a quantification of the following expected maximal input signal parameters: the frequency fmax, the amplitude Amax, and the phase φmax.The macromodel was developed modularly with appropriate sub models:(i)
peak-detector,(ii)
offset voltage corrector and amplitude corrector,(iii)
signal-phase calculator.The peak detector generates both the maximal(vcmax) and minimal (vcmin) input-signal time values. They are required for input signal amplitude normalization performed using the offset voltage corrector and the amplitude corrector. The normalized signal vcnorm(t) drives the phase calculator, where the phase difference is calculated between the input signal and the internally generated ideal cosine signal. The ideal cosine signal has the amplitude 1 V and the same frequency as the input-signal vc(t).The entire signal-phase meter macromodel was constructed in the ICAP (ICAP/4 for Windows 8.1.11) SpiceNet as detailed in the following subsections. The usage of the macromodel requires a schematic form (*.dng file) conversion to the text netlist form (*.cir file) and its inclusion to the SPICE library file (*.lib file) as shown in  Figure2.Figure 2
Block diagram of the Spice macromodel generation.


### 3.1.  Peak Detector

The main task of the peak detector is the detection and holding back of those extreme values from input signalvc(t). The current peak value is kept constant until the next peak-value occurs.The peak detector sub-model works as an analog memory of peak values. Therefore, it could also be used in the other cases [11], where the analog peak values should be temporarily stored.Figure3 presents the structure of peak detector sub-model. It has two inputs (in, Vfreq) and two outputs (peak, npeak). in is driven by cosine signal vc(t), from which the minimal vcmin(t) and maximal vcmax(t) time values are generated. Since the concept of the macromodel requires knowledge of the frequency, there is a second voltage driven input Vfreq. The Vfreq input voltage in volts must be proportional to the input signal frequency in hertz. Other than Vfreq, additional parameters (dv, Amax, maxfreq) are required for the peak detector to operate. They are further described in this sub section.Figure 3
Peak detector submodel.Capacitor C1 is needed for temporal storage of the input signals’ local minimum values, whilst capacitor C2 stores its local maximum values. Appropriate control of switches X1 and X2 ensures, that both capacitors are timely charged to the input-voltages’ local extremes. The charging period is followed by a hold-back period, when the capacitors’ voltages are kept constant. Capacitors C1 and C2 are connected to outputsnpeak and peak.The input-voltages’ extreme values occur during the time instants when the first derivative of the input signal is equal to zero. A second derivative sign is required in order to distinguish between the local minimum and maximum.Although the input signal parameters could be time variable values, it was assumed that they are constant, in order to simplify the model. In this case, the first derivative of the input signalvc(t) can be written using the equation:
(2)v˙c(t)=dAc(t)dt·cos(2πf(t)·t+φ(t))-Ac(t)·(2πf(t)+2πdf(t)dt·t+dφ(t)dt)·sin(2πf(t)t+φ(t))+dVc(t)dt.
If it is assumed that Ac(t)=Ac, Vc(t)=Vc, φ(t)=φ,f(t)=f, (2) can be simplified to
(3)v˙c(t)≈-2·π·Ac·f·sin(2πft+φ).Switches X1 and X2 are controlled by input-signal derivative values which have been previously normalized. According to (3), the derivative of the input signal can be normalized using constant (2·π·Amax·f), where Amax stands for the expected maximal input-signal amplitude. The first and second derivatives’ normalizations are performed using the voltage-controlled sources B4 and B5, respectively. Both sources B4 and B5 are linked to sources B1 and B2, which generate the control voltages for switches X1 and X2. X1, X2 are switched “ON” at a positively control voltage, otherwise they are switched “OFF”.The “ON” resistances(RON) of switches X1 and X2 are inversely-proportional to the values of their control voltages. By choosing a value for the control voltage equal to 1/RON and RON equal to 1 Ω, the “ON” time constant τON=RON·C, only depends on capacitance C.X1 is “ON” when the values of the second and first derivatives are correspondingly positive and negative. Simultaneously, the value of the first derivative must be greater than the negative reference voltageVON. Vice versa applies for switch X2. X2 is “ON” if the second derivative is negative and the first derivative is positive. Simultaneously, the value of the first derivative must be smaller than the reference voltage VON, generated by source B3.The reference voltageVON is the threshold value of the first derivative, when the switches X1 and X2 must be toggled “ON” to ensure adequate charging time Δt for capacitors C1 and C2. In Δt the capacitors are charged to input voltage extreme values with Δv tolerance.Since the capacitor’s charging-time is substantially shorter than the input signal period, it can be presume that during the charging periods, the input signal voltage is constant. In the worst-case scenario, at maximal frequencyfmax and maximal amplitude Amax, capacitor C is charging from 0 V to Amax. At the permitted tolerance Δv, the capacitor will be charged to the value (Amax-Δv) within the time interval:
(4)Δt=τON·lnAmaxΔv.Since, within the time Δt, the cosine signal will reach the value:
(5)vc(Δt)=Amax-Δv=Amaxcos(2πfmax·Δt),
the capacitor’s charging time can be written as
(6)Δt=acos(1-Δv/Amax)360·fmax.Equalizing (4) and (6), the capacitances C1 and C2 are
(7)C=C1=C2=acos(1-Δv/Amax)360·fmax·RON·ln(Amax/Δv).ChoosingRON equal to 1 Ω, the capacitances depend solely on the permitted tolerance Δv, and the expected fmax and Amax.C1 and C2 start to charge at the time instant:(8)tON=T2-Δt=12·f-Δt,
For example, for the time Δt before extreme-value occurrence. According to (6), (8), and the normalized (3), the reference voltage VON can be calculated using
(9)VON=v˙c(t=tON)≈-sin(2πf·tON)=-sin(2πf·(12·f-Δt))=-sin(π(1-acos(1-Δv/Amax)180)).After the charging periodΔt, the switches X1 and X2 disconnect the connections between the input and capacitors C1 and C2, correspondingly. Whilst the switches are “OFF”, the capacitors remain charged to the input signals’ extreme values. Since switches X1 and X2 are “OFF”, the resistances are very high (e.g., ROFF = 1 GΩ), during the “OFF” period the voltages on the capacitors will not change significantly.Using the sub-model requires setting the parameters:Δv, fmax, and Amax, which are labeled in Figure 3 as dv, maxfreq, and Amax,consecutively. These parameters enable the calculation of reference voltage VON according to (9), and the capacitances C1 and C2 according to (7).


### 3.2. Offset/Amplitude Corrector

The offset voltage corrector removes the offset voltageVDC from the input cosine signal vc(t). Assuming a constant offset voltage, it can be written as
(10)VDC=Vcmin+Vcmax2,
where Vcmin stands for the minimal and Vcmax stands for the maximal input cosine signal amplitudes.The cosine-time waveform without offset voltage can thus be expressed as(11)vAC(t)=vc(t)-Vcmin+Vcmax2.The absolute minimal and maximal peak values are equal and are(12)Ac0=|Vcmax-VDC|=|Vcmin-VDC|.
The signal vAC(t) is normalized with Ac0, thus providing a constant equalizer output amplitude of value 1 V. The normalized signal waveform describes (13):
(13)vcnorm(t)=vc(t)-(Vcmin+Vcmax)/2Ac0=2·vc(t)-Vcmin-Vcmax2·|Vcmax-VDC|=2·vc(t)-Vcmin-VcmaxVcmax-Vcmin.The offset voltage corrector and amplitude corrector sub-model is shown in Figure4. The inputs’ peak and npeak are connected to the peak detector. The output signal vcnorm(t) is the normalized cosine signal with a constant amplitude value of 1 V and a frequency f.Figure 4
Offset/amplitude corrector sub-model.The offset voltage and amplitude correction are performed by controlled voltage source B17, which generates voltage according to (13). B17 additionally limits the output signal’s amplitude within the range [-1V,1V]. Limitation is performed for the cases of variable input-signal amplitude, which will be described later. Should the output voltage exceed the permitted range [-1V,1V], the signal phase calculation would not be feasible. The process of amplitude limitation does not affect the signal phase measurements, since they are always performed at zero crossing instant.


### 3.3. Signal-Phase Calculator

The signal phase calculator calculates the phase differenceφ(t) between the normalized cosine signal vcnorm(t) and the internally generated cosine signal of amplitude 1 V. The signals frequencies are equal and known in advance. The ideal cosine signal is generated using a voltage-controlled oscillator modeled with Laplace transformation and a voltage-controlled source, as proposed in [12]. Figure 5 shows the signal phase calculator sub-model.Figure 5
Signal-phase calculator sub-model.The calculation of phase difference is periodic within the periodT = 1/f, according to the following:
(14)φ(t)=(acos(vcnorm(t))-2πft)180π.
It is performed using the controlled voltage source B9. When the switch X3 is switched ON, the capacitor C3 charges to a voltage value proportional to the phase difference measured over the previous period. When the switch X3 is switched OFF, the precharged value is held constant at the Vphase output. X3 is controlled by the source B7. It ensures that the switch is turned on once per period. This event occurs when a second derivative of input signal vc(t) is negative and the value of the normalized signal vcnorm(t) is within the range: 0<vcnorm(t)<VON1. Here, VON1 stands for the reference voltage, provided by the source B11, according to (9).When the signalvcnorm(t) reaches zero value, X3 switches OFF. The voltage of C3 remains constant. Its value in volts is proportional to the phase-difference value φ(t) in degrees. For the same reason described for the peak-detector sub-model, the X3 switch “OFF” resistance has to be high enough. This ensures that the voltage on C3 will not change significantly until the next toggle of the switch X3.The capacitance of C3 is calculated using an equation similar to (7) where Amax is replaced with the predicted maximum value of the input-signal phase fimax. In the worst case scenario, C3 must be charged to the voltage value proportionally to the fimax value in degrees, with the permissible phase-tolerance dφ. The same values of the permissible tolerances were used for the phase calculator and the peak detector in order to reduce the number of model parameters.


### 3.4. Macromodel Parameters

An entire macromodel of the precise signal-phase meter, suitable for SPICE simulators consists of all previous described sub-models. It performs precise cosine signal phase measurements at any frequency, amplitude, and offset voltage on condition that the input signal-frequency time waveform is known in advance. The model’s operation is based on the assumption that the input-signal parameters are constant. However, its usefulness in situations of time variable parameters was also examined. The signal phase  measurement, whilst the signal’s frequency, amplitude, and offset voltage are time-variable, is a very problematic task [13] and in general it has not been fully explored as yet.Using the macromodel of the signal-phase meter requires knowledge of the four model parameters that have an influence on its accuracy and precision. These parameters are(i)
Amax: expected maximum input-signal amplitude;(ii)
maxfreq: expected maximum input-signal frequency;(iii)
fimax: expected maximum input-signal phase;(iv)
dv: admissible tolerance of input signal peak values (equal to the admissible tolerance for the measured signal phase).The accuracies of signal-phase measurements depend on the macromodel’s accuracy, and on the simulation parameter values. They are transient (.TRAN) analysis parameters:(i)
tstart: time to start recording data;(ii)
tstop: total analysis time;(iii)
tstep: data-step time;(iv)
tmax: maximum time-step.The most influential simulation parameter istmax. It must be lower or equal to the capacitors’ C1–C3 charging-times. Using (6), the recommended maximum time step can be calculated as
(15)tmax≤Δt=acos(1-A)360·maxfreq,
where A stands for the smallest values:
(16)A={dvAmax;dvAmax<dφfimax,dφfimax;dvAmax>dφfimax.Any increase of model’s accuracy can be achieved with a decrease in the parametersdvordφ. According to (15), this decreases tmax which reduces the integration step time. Therefore, more accurate results prolong the simulation duration.


## 3.1.  Peak Detector

The main task of the peak detector is the detection and holding back of those extreme values from input signalvc(t). The current peak value is kept constant until the next peak-value occurs.The peak detector sub-model works as an analog memory of peak values. Therefore, it could also be used in the other cases [11], where the analog peak values should be temporarily stored.Figure3 presents the structure of peak detector sub-model. It has two inputs (in, Vfreq) and two outputs (peak, npeak). in is driven by cosine signal vc(t), from which the minimal vcmin(t) and maximal vcmax(t) time values are generated. Since the concept of the macromodel requires knowledge of the frequency, there is a second voltage driven input Vfreq. The Vfreq input voltage in volts must be proportional to the input signal frequency in hertz. Other than Vfreq, additional parameters (dv, Amax, maxfreq) are required for the peak detector to operate. They are further described in this sub section.Figure 3
Peak detector submodel.Capacitor C1 is needed for temporal storage of the input signals’ local minimum values, whilst capacitor C2 stores its local maximum values. Appropriate control of switches X1 and X2 ensures, that both capacitors are timely charged to the input-voltages’ local extremes. The charging period is followed by a hold-back period, when the capacitors’ voltages are kept constant. Capacitors C1 and C2 are connected to outputsnpeak and peak.The input-voltages’ extreme values occur during the time instants when the first derivative of the input signal is equal to zero. A second derivative sign is required in order to distinguish between the local minimum and maximum.Although the input signal parameters could be time variable values, it was assumed that they are constant, in order to simplify the model. In this case, the first derivative of the input signalvc(t) can be written using the equation:
(2)v˙c(t)=dAc(t)dt·cos(2πf(t)·t+φ(t))-Ac(t)·(2πf(t)+2πdf(t)dt·t+dφ(t)dt)·sin(2πf(t)t+φ(t))+dVc(t)dt.
If it is assumed that Ac(t)=Ac, Vc(t)=Vc, φ(t)=φ,f(t)=f, (2) can be simplified to
(3)v˙c(t)≈-2·π·Ac·f·sin(2πft+φ).Switches X1 and X2 are controlled by input-signal derivative values which have been previously normalized. According to (3), the derivative of the input signal can be normalized using constant (2·π·Amax·f), where Amax stands for the expected maximal input-signal amplitude. The first and second derivatives’ normalizations are performed using the voltage-controlled sources B4 and B5, respectively. Both sources B4 and B5 are linked to sources B1 and B2, which generate the control voltages for switches X1 and X2. X1, X2 are switched “ON” at a positively control voltage, otherwise they are switched “OFF”.The “ON” resistances(RON) of switches X1 and X2 are inversely-proportional to the values of their control voltages. By choosing a value for the control voltage equal to 1/RON and RON equal to 1 Ω, the “ON” time constant τON=RON·C, only depends on capacitance C.X1 is “ON” when the values of the second and first derivatives are correspondingly positive and negative. Simultaneously, the value of the first derivative must be greater than the negative reference voltageVON. Vice versa applies for switch X2. X2 is “ON” if the second derivative is negative and the first derivative is positive. Simultaneously, the value of the first derivative must be smaller than the reference voltage VON, generated by source B3.The reference voltageVON is the threshold value of the first derivative, when the switches X1 and X2 must be toggled “ON” to ensure adequate charging time Δt for capacitors C1 and C2. In Δt the capacitors are charged to input voltage extreme values with Δv tolerance.Since the capacitor’s charging-time is substantially shorter than the input signal period, it can be presume that during the charging periods, the input signal voltage is constant. In the worst-case scenario, at maximal frequencyfmax and maximal amplitude Amax, capacitor C is charging from 0 V to Amax. At the permitted tolerance Δv, the capacitor will be charged to the value (Amax-Δv) within the time interval:
(4)Δt=τON·lnAmaxΔv.Since, within the time Δt, the cosine signal will reach the value:
(5)vc(Δt)=Amax-Δv=Amaxcos(2πfmax·Δt),
the capacitor’s charging time can be written as
(6)Δt=acos(1-Δv/Amax)360·fmax.Equalizing (4) and (6), the capacitances C1 and C2 are
(7)C=C1=C2=acos(1-Δv/Amax)360·fmax·RON·ln(Amax/Δv).ChoosingRON equal to 1 Ω, the capacitances depend solely on the permitted tolerance Δv, and the expected fmax and Amax.C1 and C2 start to charge at the time instant:(8)tON=T2-Δt=12·f-Δt,
For example, for the time Δt before extreme-value occurrence. According to (6), (8), and the normalized (3), the reference voltage VON can be calculated using
(9)VON=v˙c(t=tON)≈-sin(2πf·tON)=-sin(2πf·(12·f-Δt))=-sin(π(1-acos(1-Δv/Amax)180)).After the charging periodΔt, the switches X1 and X2 disconnect the connections between the input and capacitors C1 and C2, correspondingly. Whilst the switches are “OFF”, the capacitors remain charged to the input signals’ extreme values. Since switches X1 and X2 are “OFF”, the resistances are very high (e.g., ROFF = 1 GΩ), during the “OFF” period the voltages on the capacitors will not change significantly.Using the sub-model requires setting the parameters:Δv, fmax, and Amax, which are labeled in Figure 3 as dv, maxfreq, and Amax,consecutively. These parameters enable the calculation of reference voltage VON according to (9), and the capacitances C1 and C2 according to (7).


## 3.2. Offset/Amplitude Corrector

The offset voltage corrector removes the offset voltageVDC from the input cosine signal vc(t). Assuming a constant offset voltage, it can be written as
(10)VDC=Vcmin+Vcmax2,
where Vcmin stands for the minimal and Vcmax stands for the maximal input cosine signal amplitudes.The cosine-time waveform without offset voltage can thus be expressed as(11)vAC(t)=vc(t)-Vcmin+Vcmax2.The absolute minimal and maximal peak values are equal and are(12)Ac0=|Vcmax-VDC|=|Vcmin-VDC|.
The signal vAC(t) is normalized with Ac0, thus providing a constant equalizer output amplitude of value 1 V. The normalized signal waveform describes (13):
(13)vcnorm(t)=vc(t)-(Vcmin+Vcmax)/2Ac0=2·vc(t)-Vcmin-Vcmax2·|Vcmax-VDC|=2·vc(t)-Vcmin-VcmaxVcmax-Vcmin.The offset voltage corrector and amplitude corrector sub-model is shown in Figure4. The inputs’ peak and npeak are connected to the peak detector. The output signal vcnorm(t) is the normalized cosine signal with a constant amplitude value of 1 V and a frequency f.Figure 4
Offset/amplitude corrector sub-model.The offset voltage and amplitude correction are performed by controlled voltage source B17, which generates voltage according to (13). B17 additionally limits the output signal’s amplitude within the range [-1V,1V]. Limitation is performed for the cases of variable input-signal amplitude, which will be described later. Should the output voltage exceed the permitted range [-1V,1V], the signal phase calculation would not be feasible. The process of amplitude limitation does not affect the signal phase measurements, since they are always performed at zero crossing instant.


## 3.3. Signal-Phase Calculator

The signal phase calculator calculates the phase differenceφ(t) between the normalized cosine signal vcnorm(t) and the internally generated cosine signal of amplitude 1 V. The signals frequencies are equal and known in advance. The ideal cosine signal is generated using a voltage-controlled oscillator modeled with Laplace transformation and a voltage-controlled source, as proposed in [12]. Figure 5 shows the signal phase calculator sub-model.Figure 5
Signal-phase calculator sub-model.The calculation of phase difference is periodic within the periodT = 1/f, according to the following:
(14)φ(t)=(acos(vcnorm(t))-2πft)180π.
It is performed using the controlled voltage source B9. When the switch X3 is switched ON, the capacitor C3 charges to a voltage value proportional to the phase difference measured over the previous period. When the switch X3 is switched OFF, the precharged value is held constant at the Vphase output. X3 is controlled by the source B7. It ensures that the switch is turned on once per period. This event occurs when a second derivative of input signal vc(t) is negative and the value of the normalized signal vcnorm(t) is within the range: 0<vcnorm(t)<VON1. Here, VON1 stands for the reference voltage, provided by the source B11, according to (9).When the signalvcnorm(t) reaches zero value, X3 switches OFF. The voltage of C3 remains constant. Its value in volts is proportional to the phase-difference value φ(t) in degrees. For the same reason described for the peak-detector sub-model, the X3 switch “OFF” resistance has to be high enough. This ensures that the voltage on C3 will not change significantly until the next toggle of the switch X3.The capacitance of C3 is calculated using an equation similar to (7) where Amax is replaced with the predicted maximum value of the input-signal phase fimax. In the worst case scenario, C3 must be charged to the voltage value proportionally to the fimax value in degrees, with the permissible phase-tolerance dφ. The same values of the permissible tolerances were used for the phase calculator and the peak detector in order to reduce the number of model parameters.


## 3.4. Macromodel Parameters

An entire macromodel of the precise signal-phase meter, suitable for SPICE simulators consists of all previous described sub-models. It performs precise cosine signal phase measurements at any frequency, amplitude, and offset voltage on condition that the input signal-frequency time waveform is known in advance. The model’s operation is based on the assumption that the input-signal parameters are constant. However, its usefulness in situations of time variable parameters was also examined. The signal phase  measurement, whilst the signal’s frequency, amplitude, and offset voltage are time-variable, is a very problematic task [13] and in general it has not been fully explored as yet.Using the macromodel of the signal-phase meter requires knowledge of the four model parameters that have an influence on its accuracy and precision. These parameters are(i)
Amax: expected maximum input-signal amplitude;(ii)
maxfreq: expected maximum input-signal frequency;(iii)
fimax: expected maximum input-signal phase;(iv)
dv: admissible tolerance of input signal peak values (equal to the admissible tolerance for the measured signal phase).The accuracies of signal-phase measurements depend on the macromodel’s accuracy, and on the simulation parameter values. They are transient (.TRAN) analysis parameters:(i)
tstart: time to start recording data;(ii)
tstop: total analysis time;(iii)
tstep: data-step time;(iv)
tmax: maximum time-step.The most influential simulation parameter istmax. It must be lower or equal to the capacitors’ C1–C3 charging-times. Using (6), the recommended maximum time step can be calculated as
(15)tmax≤Δt=acos(1-A)360·maxfreq,
where A stands for the smallest values:
(16)A={dvAmax;dvAmax<dφfimax,dφfimax;dvAmax>dφfimax.Any increase of model’s accuracy can be achieved with a decrease in the parametersdvordφ. According to (15), this decreases tmax which reduces the integration step time. Therefore, more accurate results prolong the simulation duration.


## 4.  Phase-Measurement Simulation Results

The following section presents the phase measurement simulation results using the proposed macromodel for the SPICE simulator. The focus was on the phase measurements of the input-cosine signal with constant and time-variable parameters. In the further described simulation examples the transient analysis (.TRAN) with the GEAR integration method was used, with a relative error toleranceRELTOL=10-6.


### 4.1. Phase Measurements of the Input Signal with Constant Parameters

This example focused on the phase measurement of a cosine signal with constant parameters, which wereAc(t) = 1 V,  f(t)=1kHz, φ(t) = 0.1°, and Vc(t)=1mV. Using these parameters the following macromodel parameters were defined: Amax=1V, maxfreq = 1 kHz, and fimax = 0.1°. Simulations were performed at three different tolerances dv of values: 10-4 V, 10-5 V, and 10-6 V. Using  (15) and (7), the simulation parameters tmax: 2.25 μs, 712 ns and 225 ns, were calculated. The rest of simulation parameters were tstart = 5 ms, tstop = 100 ms, and  tstep = 10 μs.Figure6 shows the simulation results at three different permissible tolerances dv. Δφ(t) is the phase error between measured and the actual phase of the input signal.Figure 6
The phase-errors Δφ between the measured and actual input-signal phase for the three different macromodel parameters dv.Despite the constant input signal parameters,Δφ is time variable. Its time variability is the consequence of the simulator’s internal integration time step, which varies whilst the transient analysis is running. The integration time-step automatically adapts to the time changes of circuit signals. Therefore, Δφ(t) are not constant-time waveforms.Table1 shows the worst case results for all three examples.Table 1
Relative and absolute maximal phase errors.
d
v
[
V
]
max|Δφ| [%]
max|Δφ| [°]
10−4
2.8
2.8
·
10
-
3
10−5
0.27
276.2
·
10
-
6
10−6
0.02
23.7
·
10
-
6From Figure6 and Table 1, it can be concluded that reducing the parameter dv decreases the phase error Δφ.


### 4.2. Phase Measurements of Input Signal with Time-Variable Parameters

At the macromodel development stage, it was assumed that the input signal parameters are not time variable. Nevertheless, its suitability for cases of time variable parameters has also been verified.The chosen intervals of the time-variable input signal parameters were as follows: 0.8 V ≤Ac(t) ≤ 1.1 V; 0 ≤ Vc(t)≤100 mV; 100 Hz ≤ f(t) ≤ 10 kHz; −2° ≤ φ(t) ≤ +5°. Figure 7 shows the parameters’ time waveforms used in our example.Input signal-time waveformvc(t) and its parameters’ time waveforms: φ(t), f(t), Vc(t), Ac(t).
(a)
(b)
(c)
(d)
(e)According to the intervals of the input-signal parameters, the following macromodel parameters were set:maxfreq = 10 kHz, Amax = 1.1 V, and  fimax = 5°. The value of the permissible tolerance dv was chosen as dv = 10-4 V. According to (15) the maximum time step was calculated as tmax   = 101 ns. The transient analysis results are shown in Figure 8.Simulation results:φ: actual signal-phase time waveform, φi: signal-phase time waveform measured using the proposed macromodel, and Δφ: phase-error time waveform.
(a)
(b)Δφ(t) waveform shows the phase error between the actual φ(t) and measured φi(t) signal phases. Noticeable, the phase error is a result of an assumption that the input-signal parameters are constant. Consequently, the derivatives in (2) are equal to zero which, in our case, is untrue. Rapid changes in input-signal parameters increase the phase-error. This clearly illustrates the time waveform 4 within the time-range from 20 ms to 80 ms, when simultaneous changes in amplitude, frequency, phase, and offset voltage occur. In continuation, the time variations of the parameters were moderate and the phase error Δφ was significantly reduced. Therefore, the highest precision signal phase can only be measured under stationary conditions, when the smallest possible phase error can be expected.


## 4.1. Phase Measurements of the Input Signal with Constant Parameters

This example focused on the phase measurement of a cosine signal with constant parameters, which wereAc(t) = 1 V,  f(t)=1kHz, φ(t) = 0.1°, and Vc(t)=1mV. Using these parameters the following macromodel parameters were defined: Amax=1V, maxfreq = 1 kHz, and fimax = 0.1°. Simulations were performed at three different tolerances dv of values: 10-4 V, 10-5 V, and 10-6 V. Using  (15) and (7), the simulation parameters tmax: 2.25 μs, 712 ns and 225 ns, were calculated. The rest of simulation parameters were tstart = 5 ms, tstop = 100 ms, and  tstep = 10 μs.Figure6 shows the simulation results at three different permissible tolerances dv. Δφ(t) is the phase error between measured and the actual phase of the input signal.Figure 6
The phase-errors Δφ between the measured and actual input-signal phase for the three different macromodel parameters dv.Despite the constant input signal parameters,Δφ is time variable. Its time variability is the consequence of the simulator’s internal integration time step, which varies whilst the transient analysis is running. The integration time-step automatically adapts to the time changes of circuit signals. Therefore, Δφ(t) are not constant-time waveforms.Table1 shows the worst case results for all three examples.Table 1
Relative and absolute maximal phase errors.
d
v
[
V
]
max|Δφ| [%]
max|Δφ| [°]
10−4
2.8
2.8
·
10
-
3
10−5
0.27
276.2
·
10
-
6
10−6
0.02
23.7
·
10
-
6From Figure6 and Table 1, it can be concluded that reducing the parameter dv decreases the phase error Δφ.


## 4.2. Phase Measurements of Input Signal with Time-Variable Parameters

At the macromodel development stage, it was assumed that the input signal parameters are not time variable. Nevertheless, its suitability for cases of time variable parameters has also been verified.The chosen intervals of the time-variable input signal parameters were as follows: 0.8 V ≤Ac(t) ≤ 1.1 V; 0 ≤ Vc(t)≤100 mV; 100 Hz ≤ f(t) ≤ 10 kHz; −2° ≤ φ(t) ≤ +5°. Figure 7 shows the parameters’ time waveforms used in our example.Input signal-time waveformvc(t) and its parameters’ time waveforms: φ(t), f(t), Vc(t), Ac(t).
(a)
(b)
(c)
(d)
(e)According to the intervals of the input-signal parameters, the following macromodel parameters were set:maxfreq = 10 kHz, Amax = 1.1 V, and  fimax = 5°. The value of the permissible tolerance dv was chosen as dv = 10-4 V. According to (15) the maximum time step was calculated as tmax   = 101 ns. The transient analysis results are shown in Figure 8.Simulation results:φ: actual signal-phase time waveform, φi: signal-phase time waveform measured using the proposed macromodel, and Δφ: phase-error time waveform.
(a)
(b)Δφ(t) waveform shows the phase error between the actual φ(t) and measured φi(t) signal phases. Noticeable, the phase error is a result of an assumption that the input-signal parameters are constant. Consequently, the derivatives in (2) are equal to zero which, in our case, is untrue. Rapid changes in input-signal parameters increase the phase-error. This clearly illustrates the time waveform 4 within the time-range from 20 ms to 80 ms, when simultaneous changes in amplitude, frequency, phase, and offset voltage occur. In continuation, the time variations of the parameters were moderate and the phase error Δφ was significantly reduced. Therefore, the highest precision signal phase can only be measured under stationary conditions, when the smallest possible phase error can be expected.


## 5. Conclusion

The objective of this paper was to present a new macromodel of a precise signal-phase meter, as required for the development of integrated circuits, implemented within linear position encoders. The macromodel is suitable for precise phase measurements whilst transient analysis is running. Namely the reduction of various unwanted effects of an encoder’s head requires very accurate signal-phase measurements during the encoder development stage.In order to simplify the concept of a macromodel, it was assumed that signal parameters are not time-variable values. As shown in Section4, as such a signal phase was measured within an accuracy of more than ±0.02%. Simulations also showed a substantial decrease in the results’ accuracies due to the rapid-time change of the signal parameters. The signal-phase measurement under such conditions is a very problematic task [13] and has not yet been fully explored. Therefore any improvement in the presented macromodel in this direction would not be meaningful. However, this macromodel concept represents an idea for real-world implementation of a precise signal-phase meter.



---

*Source: 856497-2012-09-12.xml*