- About this Journal ·
- Abstracting and Indexing ·
- Aims and Scope ·
- Article Processing Charges ·
- Articles in Press ·
- Author Guidelines ·
- Bibliographic Information ·
- Citations to this Journal ·
- Contact Information ·
- Editorial Board ·
- Editorial Workflow ·
- Free eTOC Alerts ·
- Publication Ethics ·
- Reviewers Acknowledgment ·
- Submit a Manuscript ·
- Subscription Information ·
- Table of Contents

Modelling and Simulation in Engineering

Volume 2012 (2012), Article ID 856497, 7 pages

http://dx.doi.org/10.1155/2012/856497

## Macromodel of Precise Signal-Phase Meter

Faculty of Electrical Engineering and Computer Science, University of Maribor, SI-2000 Maribor, Slovenia

Received 5 April 2012; Accepted 11 July 2012

Academic Editor: Azah Mohamed

Copyright © 2012 Matej Šalamon and Bojan Jarc. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### 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%.

#### 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. Section 2 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 signal can be written using the equation:
where : amplitude time waveform, : frequency time waveform, : offset voltage time waveform, and * φ*(

*t*): signal phase time waveform.

Figure 1 shows a block diagram of the phase meter macromodel. The input signals are the voltage signals (*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 (

*t*) and internally generated cosine signal (the latter is not shown in this figure).

The model does not measure the frequency *f*(*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 , the amplitude , and the phase .

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 and minimal 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 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 (*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 Figure 2.

##### 3.1. Peak Detector

The main task of the peak detector is the detection and holding back of those extreme values from input signal (*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.

Figure 3 presents the structure of peak detector sub-model. It has two inputs (*in*, ) and two outputs (*peak*, ). *in* is driven by cosine signal (*t*), from which the minimal and maximal time values are generated. Since the concept of the macromodel requires knowledge of the frequency, there is a second voltage driven input . The input voltage in volts must be proportional to the input signal frequency in hertz. Other than , additional parameters (*dv*, , ) are required for the peak detector to operate. They are further described in this sub section.

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 outputs 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 signal (*t*) can be written using the equation:
If it is assumed that , , *, *, (2) can be simplified to

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 , where 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 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/ and equal to 1 Ω, the “ON” time constant , 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 voltage . 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 , generated by source B3.

The reference voltage 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 frequency and maximal amplitude , capacitor C is charging from 0 V to . At the permitted tolerance Δ*v*, the capacitor will be charged to the value (Δ*v*) within the time interval:

Since, within the time Δ*t*, the cosine signal will reach the value:
the capacitor’s charging time can be written as

Equalizing (4) and (6), the capacitances *C*1 and *C*2 are

Choosing equal to 1 Ω, the capacitances depend solely on the permitted tolerance *v*, and the expected and .

C1 and C2 start to charge at the time instant:
For example, for the time *t* before extreme-value occurrence. According to (6), (8), and the normalized (3), the reference voltage can be calculated using

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., = 1 GΩ), during the “OFF” period the voltages on the capacitors will not change significantly.

Using the sub-model requires setting the parameters: *v*, , and , which are labeled in Figure 3 as *dv*, , and *, *consecutively. These parameters enable the calculation of reference voltage according to (9), and the capacitances *C*1 and *C*2 according to (7).

##### 3.2. Offset/Amplitude Corrector

The offset voltage corrector removes the offset voltage from the input cosine signal (*t*). Assuming a constant offset voltage, it can be written as
where stands for the minimal and stands for the maximal input cosine signal amplitudes.

The cosine-time waveform without offset voltage can thus be expressed as

The absolute minimal and maximal peak values are equal and are
The signal (*t*) is normalized with , thus providing a constant equalizer output amplitude of value 1 V. The normalized signal waveform describes (13):

The offset voltage corrector and amplitude corrector sub-model is shown in Figure 4. The inputs’ *peak* and are connected to the peak detector. The output signal is the normalized cosine signal with a constant amplitude value of 1 V and a frequency *f*.

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 . Limitation is performed for the cases of variable input-signal amplitude, which will be described later. Should the output voltage exceed the permitted range , 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 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.

The calculation of phase difference is periodic within the period *T* = 1/*f*, according to the following:
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 (*t*) is negative and the value of the normalized signal is within the range: . Here, stands for the reference voltage, provided by the source B11, according to (9).

When the signal 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 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): expected maximum input-signal amplitude;(ii): expected maximum input-signal frequency;(iii): 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): time to start recording data;(ii): total analysis time;(iii): data-step time;(iv): maximum time-step.

The most influential simulation parameter is . It must be lower or equal to the capacitors’ C1–C3 charging-times. Using (6), the recommended maximum time step can be calculated as where stands for the smallest values:

Any increase of model’s accuracy can be achieved with a decrease in the parameters *dv *or* d φ*. According to (15), this decreases 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 tolerance .

##### 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 were (*t*) = 1 V, , * φ*(

*t*) = 0.1°, and . Using these parameters the following macromodel parameters were defined: , = 1 kHz, and = 0.1°. Simulations were performed at three different tolerances

*dv*of values: V, V, and V. Using (15) and (7), the simulation parameters : 2.25

*μ*s, 712 ns and 225 ns, were calculated. The rest of simulation parameters were = 5 ms, = 100 ms, and = 10

*μ*s.

Figure 6 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.

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.

Table 1 shows the worst case results for all three examples.

From Figure 6 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 ≤ (*t*) ≤ 1.1 V; 0 ≤ mV; 100 Hz ≤ *f*(*t*) ≤ 10 kHz; −2° ≤ * φ*(

*t*) ≤ +5°. Figure 7 shows the parameters’ time waveforms used in our example.

According to the intervals of the input-signal parameters, the following macromodel parameters were set: = 10 kHz, Amax = 1.1 V, and = 5°. The value of the permissible tolerance *dv* was chosen as *dv* = V. According to (15) the maximum time step was calculated as = 101 ns. The transient analysis results are shown in Figure 8.

Δ* φ*(

*t*) waveform shows the phase error between the actual

*(*

*φ**t*) and measured (

*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 Section 4, 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.

#### References

- J. Rozman and A. Pleteršek, “Optical encoder head with improved linearity,”
*Informacije MIDEM*, vol. 39, no. 1, pp. 22–27, 2009. View at Google Scholar · View at Scopus - J. Rozman and A. Pleteršek, “Linear optical encoder system with sinusoidal signal distortion below -60 dB,”
*IEEE Transactions on Instrumentation and Measurement*, vol. 59, no. 6, pp. 1544–1549, 2010. View at Publisher · View at Google Scholar · View at Scopus - K. M. Ibrahim and M. A. H. Abdul-Karim, “A novel digital phase meter,”
*IEEE Transactions on Instrumentation and Measurement*, vol. 36, no. 3, pp. 711–716, 1987. View at Google Scholar · View at Scopus - R. Micheletti, “Phase angle measurement between two sinusoidal signals,”
*IEEE Transactions on Instrumentation and Measurement*, vol. 40, no. 1, pp. 40–42, 1991. View at Publisher · View at Google Scholar · View at Scopus - S. M. Mahmud, “Error analysis of digital phase measurement of distorted waves,”
*IEEE Transactions on Instrumentation and Measurement*, vol. 38, no. 1, pp. 6–9, 1989. View at Publisher · View at Google Scholar · View at Scopus - S. M. Mahmud, “High precision phase measurement using adaptive sampling,”
*IEEE Transactions on Instrumentation and Measurement*, vol. 38, no. 5, pp. 954–960, 1989. View at Publisher · View at Google Scholar · View at Scopus - S. M. Mahmud, “High precision phase measurement using reduced sine and cosine tables,”
*IEEE Transactions on Instrumentation and Measurement*, vol. 39, no. 1, pp. 56–60, 1990. View at Publisher · View at Google Scholar · View at Scopus - T. Kishibe, T. Masuda, and H. Tanoue, “Phase correction circuit of encoder signal,” U.S. Patent 7 933 373, April 26, 2011.
- B. Djokić and E. So, “Phase measurement of distorted periodic signals based on nonsynchronous digital filtering,”
*IEEE Transactions on Instrumentation and Measurement*, vol. 50, no. 4, pp. 864–867, 2001. View at Publisher · View at Google Scholar · View at Scopus - M. Sedlacek and M. Krumpholc, “Digital measurement of phase difference—a comparative study of DSP algorithms,”
*Metrology and Measurement Systems*, vol. 12, no. 4, pp. 427–448, 2005. View at Google Scholar - M. Šalamon and T. Dogša, “The model of chaoticness detector,”
*Informacije MIDEM*, vol. 39, no. 2, pp. 93–99, 2009. View at Google Scholar · View at Scopus - “Intusoft Newsletter Issue 73,” February 2004, http://www.intusoft.com/nlpdf/nl73.pdf.
- T. Dogša, M. Šalamon, B. Jarc, and M. Solar, “Optical encoder scanning head modelling and ultra small phase shift measurement,”
*Informacije MIDEM*, vol. 39, no. 3, pp. 162–167, 2009. View at Google Scholar · View at Scopus