intTypePromotion=1
zunia.vn Tuyển sinh 2024 dành cho Gen-Z zunia.vn zunia.vn
ADSENSE

Úng dụng ví dụ

Chia sẻ: Trần Văn Ninh | Ngày: | Loại File: PDF | Số trang:0

193
lượt xem
30
download
 
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

Một số ví dụ ứng dụng MSP430 được đưa ra trong các phần sau đây. Phổ biến gần như tất cả trong số họ là lưu trữ dữ liệu hiệu chuẩn, các bảng biểu, hằng số, trong EEPROMs bên ngoài. EEPROMs bên ngoài được sử dụng cho lý do an toàn. Nếu máy vi tính không hoàn toàn, nó vẫn còn tương đối dễ dàng để đọc ra các giá trị tiêu thụ tích lũy. Điều này thường là không thể nếu các giá trị này cư trú trong EEPROMs nội bộ. Những EEPROMs này cũng có thể lưu trữ các bảng mô tả các lỗi...

Chủ đề:
Lưu

Nội dung Text: Úng dụng ví dụ

  1. Chapter 4 Application Examples Several MSP430 application examples are given in the following sections. Common to nearly all of them is the storage of calibration data, tables, constants, etc. in the external EEPROMs. External EEPROMs are used for safety reasons. If the microcomputer fails completely, it is still relatively easy to read out the accumulated consumption values. This is usually impossible if these values reside in internal EEPROMs. These EEPROMs can also store tables that describe the principal errors of a given measurement principle that is dependent on the input value (current, flow, heat etc.). The MSP430, with its excellent table processing capabilities, can determine the right starting value out of these tables and calculate the lin- ear, quadratic or cubic approximation value. The following figure shows the principal error of a meter. The complete range starting at 1% up to 200% is di- vided into sub ranges of different length. A stored table would contain the start- ing point, the different distances and the inherent error at the beginning of each range. With this information, the MSP430 can calculate the error at any point of the measurement range. 4-1
  2. 4.1 Electricity Meters 4.1.1 Overview The MSP430 can be used in two completely different kinds of electronic elec- tricity meters. The difference between the two methods is mainly where the electrical energy W+ U I dt is measured: - The electrical energy is measured in a front-end separated from the MSP430. Several methods exist for doing that: Hall effect sensors, Ferra- ris wheel pick-ups, analog multipliers, etc. The interface to the MSP430 is normally a train of pulses, where every pulse represents a defined amount of energy (Ws, kWs, Wh). All family members can be used for this purpose. - The electrical energy is calculated by the MSP430 itself, using its 14-bit analog-to-digital converter (ADC) for the measurement of current and volt- age. Only the MSP430C32x can be used for this purpose. The two different methods are shown in Figure 4–1 32 kHz 32 kHz COM COM SVCC SVCC LCD SEL SEL Error ms kWh MSP430C32x MSP430C31x Peripherals Voltage P0.x Voltage A1 P0.x Peripherals Pulses Frontend P0.y A0 Current Current VSS VCC VSS VCC Figure 4–1. Two Measurement Methods for Electronic Electricity Meters The second method is mainly used with the electricity meters described in this chapter. The unnecessary front end gives a cost advantage when compared 4-2
  3. to the two-chip solution. An example for the 1st method that uses a front end is shown at the end of this chapter. 4.1.2 The Measurement Principle The principle used (Reduced Scan Principle) measures current and voltage in regular time intervals and multiplies the current and voltage samples. The multiplication results are summed up, with the sum representing the con- sumed energy (Ws, kWh). While the method normally used measures voltage and current at exactly the same time, the Reduced Scan Principle (a protected TI method) alternately measures voltage and current samples. Every sample is used twice; once it is multiplied with the value measured before and once with the value measured afterwards. To further reduce the required multiplica- tions, these two multiplications are reduced to one by using the sum of the two voltage samples. This measurement principle is shown in Figure 4–3. The following shows the measurement sequence for a single-phase measure- ment. Current and voltage are measured alternately. The time, α, represents the angle between related voltage and current samples. α Voltage Current Voltage Current Time 1/ARR Repetition Time Figure 4–2. Timing for the Reduced Scan Principle (Single Phase) Where: α Inherent Phase Shift of the Measurement Method [rad] Repetition Time Length of a complete measurement cycle [s] 1/ARR Time Distance between two ADC Conversions [s] Note: The Reduced Scan Principle is intellectual property of Texas Instruments. This measurement principle may be used only with the microcomputers pro- duced by Texas Instruments. Application Examples 4-3
  4. Voltage Current φ ∆t + + Power – – Time Sampling Point Figure 4–3. Reduced Scan Measurement Principle The measured energy W (for a single phase) is: t+R ∆t W+ u n*1 ) u n)1 in t+0 Where: W Accumulated energy [Ws] in Current sample at time tn [A] un–1 Voltage sample at time tn–1 [V] un+1 Voltage sample at time tn+1 [V] ∆t Sampling interval between appertaining voltage and current measurements [s] 4-4
  5. 4.1.2.1 The Inherent Error of the Reduced Scan Principle The Reduced Scan Principle has a small inherent error caused by the phase shift ∆t, once inductive and once capacitive, due to the time interval between voltage and current measurements. Any calculated energy sample shows this error, it is independent of the phase angle ϕ between voltage and current. The value, e, of this error is: e + (cos (∆t 2p) * 1) f 100 where: e Error [%] ∆t Sampling interval between voltage and current measurements [s] f AC frequency [Hz] For example, with the values (f = 60 Hz, ∆t = 300 µs) the inherent error is –0.639%. This error can be eliminated during runtime by a multiplication of the accumulated energy with the correction factor c: 1 c+ cos(∆t 2p) f The correction factor, c, is normally included in the calibration constants (slope and offset) and not used explicitly. For a multiple-phase electricity meter, the Reduced Scan Principle is used for all phases one after the other. This is described in the following chapters. Derivation of the inherent error The flawless equation (except the quantization error) for the electric energy W is: t+R ∆t W+ in un t+0 The equation used for the Reduced Scan Principle is: t+R ∆t W+ u n*1 ) u n)1 in t+0 Application Examples 4-5
  6. Where: un = U × sinωt Voltage sample at time t in = I × sin(ωt+ϕ) Current sample at time t un–1 = U × sin(ωt–α) Voltage sample at time t – ∆t un+1 = U × sin(ωt+α) Voltage sample at time t + ∆t α Angle in radians between current and voltage samples (α = ω∆t = 2π×f×∆t) ∆t Time between appertaining current and voltage samples ϕ Phase angle in radians between voltage and current The error e of an energy sample due to the Reduced Scan Principle is: e + erroneous * 1 correct sin(ωt ) f) (U sin(ωt * α) ) U sin(ωt ) α) ) 0.5 I e+ *1 U sin ωt I sin(ωt ) f) (sin(ωt * a) sin(ωt ) α) ) 0.5 e+ *1 sin ωt (sin ωt cos α * sin α cos ωt ) sin ωt cos α ) sin α cos ωt) 0.5 e+ *1 sin ωt sin ωt cos α) (2 0.5 * 1 + cos α * 1 e+ sin ωt or in percent e + (cos α * 1) ∆t) * 1) 100 + (cos(2p f 100 This result means that the error of each energy sample calculated with the Re- duced Scan Principle shows a constant value e. This inherent error depends only on the angle α between the current and the voltage samples; it is indepen- dent of the phase angle ϕ and of the sample point of the measurement inside the sine wave. So for all samples, the same correction can be used. 4.1.2.2 The Advantages of the Reduced Scan Principle 1) Only 50% of the measurements are necessary because every measured current or voltage sample is used twice 2) Only 50% of the multiplications are necessary because two voltage sam- ples are added before the multiplication 3) Only one ADC is needed compared to up to six with the usual method. 4-6
  7. 4) The computing power gained by reducing the number of multiplications can be used by the microcomputer for other system tasks. The MSP430 is able to do the task of the front-end and of the host computer. 5) The Reduced Scan Principle is nearly independent of frequency devi- ations of the ac. See Section 4.1.2.4 for results. 6) The Reduced Scan Principle is also nearly independent of the interrupt la- tency time of the microcomputer. See Section 4.1.2.5 for results. The Reduced Scan Measurement Principle is implemented in an evaluation board for a 3-phase meter, which shows a typical error of 0.2%. 4.1.2.3 Measurement Errors for Some Sampling Frequencies Table 4–1 gives an overview for the measurement errors dependent on the sampling frequency. The inherent error shows the error for the ac frequency (50 Hz or 60 Hz). The 3rd harmonics error shows the corrected measurement error for the 3rd harmonic of the ac frequency (150 Hz or 180 Hz). The 5th har- monics error shows the corrected measurement error for the 5th harmonic of the ac frequency (250 Hz or 300 Hz). For any number of measurements (cur- rent and voltage samples together) for a full period, a rough error estimation can be made with this table. Application Examples 4-7
  8. Table 4–1. Errors Dependent on the Sampling Frequency Sample Frequencies Errors Measurements Meas rements Single Phase Two Phase Three Phase Inherent 3rd 5th per Full Period Harmonic† Harmonic† (50Hz) (60Hz) (50Hz) Error 20 1000 2400 3000 –4.89% –36.4% –95.2% 30 1500 3600 4500 –2.19% –16.9% –47.8% 40 2000 4800 6000 –1.23% –9.7% –28.0% 50 2500 6000 7500 –0.78% –6.2% –18.3% 60 3000 7200 9000 –0.55% –4.3% –13.4% 70 3500 8400 ‡ –0.40% –3.2% –9.5% 80 4000 9600 –0.30% –2.4% –7.3% 90 4500 ‡ –0.24% –1.9% –6.0% 100 5000 –0.20% –1.6% –4.7% 110 5500 –0.16% –1.3% –3.9% 120 6000 –0.13% –1.1% –3.2% 130 6500 –0.11% –0.9% –2.7% 140 7000 –0.10% –0.8% –2.4% 160 8000 –0.08% –0.6% –1.9% 180 9000 –0.06% –0.5% –1.5% 200 10000 –0.05% –0.4% –1.2% † The errors of the harmonics are corrected by the value of the inherent error ‡ Sampling frequencies above 10000Hz are not possible due to the speed of the ADC (132 ADCLKs/conversion @ ADCLK = 1.5MHz) 4.1.2.4 Measurement Error for Deviations of the AC Frequency If the ac frequency deviates from the nominal value used during the calibration, then a small error is generated. Table 4–2 shows this error dependent on the sample frequency and the ac frequency deviation. The introduced error, Fmd, is: cos(∆t (f ) ∆f) 2p) + *1 F 100 cos(∆t f 2p) md 4-8
  9. Where: Fmd Error due to the ac frequency deviation from the nominal frequency [%] ∆t Time between related current and voltage samples [s] f Nominal ac frequency (used during calibration) [Hz] ∆f Frequency deviation of the ac frequency during runtime [Hz] Table 4–2. Errors dependent on the AC Frequency Deviation Sample Frequencies Errors Measurement Three Phase Single Phase Two Phase ∆f/f = +0.5% ∆f/f = +1.0% ∆f/f = +5.0% per full Period (50Hz) (50Hz) (60Hz) 20 1000 2400 3000 –0.051% –0.103% –0.523% 40 2000 4800 6000 –0.012% –0.025% –0.127% 80 4000 –0.003% –0.006% –0.030% 130 6500 –0.001% –0.002% –0.010% The errors for negative frequency deviations are the same as shown in Table 4–2 but with positive signs. The ADC is assumed to be error-free, this way only the influence of the frequency deviation is shown. The additional error due to the deviation of the ac frequency can be reduced to nearly zero by the measurement of the actual ac frequency and an appropri- ate correction of the calculated energy. 4.1.2.5 Measurement Error Dependent on the Interrupt Latency Time The calibration of an electricity meter is made normally in an environment with- out interrupt activity. This can be completely different to the real time environ- ment where the meter has to measure the electric energy later. Therefore the interrupt latency time (here the time the interrupt request of the sampling time base is delayed by other interrupts) can have an influence on the accuracy of the measurement. Table 4–3 shows the errors introduced by different interrupt latency times. The calibration is made with a maximum interrupt latency time of 5µs (due to missing interrupt activities): this is the maximum delay caused by the completion of the current instruction (indexed,indexed mode) with MCLK = 1MHz. The conditions used for the simulations of Table 4–3 are: - The simulation conditions are the same ones as described in section 4.1.3 except where noted otherwise. - The given interrupt latency times are the maximum values; each voltage and current sample is delayed by a random time interval ranging between zero and this maximum value. - The ADC is assumed to be error-free (except the range transition error), this way only the influence of the interrupt latency time is shown. Application Examples 4-9
  10. - For other values of MCLK than 1MHz , the shown latency times are not given in microseconds but CPU cycles. - The used current is 100% except for the last line (1%) - The measurement time is 20 seconds Table 4–3. Errors dependent on the Interrupt Latency Time Maximum Interrupt Latency Time Single Single Measurement Meas rement 5 µs Phase 20 µs 40 µs 80 µs 160 µs per Full Period (50 Hz) (Calibr.) 20 1000 –0.0013% –0.0010% +0.0023% +0.0052% +0.0103% 40 2000 –0.0010% +0.0010% –0.0005% –0.0053% –0.0113% 80 4000 +0.0007% +0.0002% –0.0035% –0.0053% –0.0292% –† 130 6500 –0.0011% +0.0002% –0.0006% –0.0025% cos ϕ=0.5 –† 6500 –0.0011% 0% +0.0001% –0.0055% –† 1% In 6500 –0.0098% –0.0175% +0.0170% –0.0786% † Interrupt latency time is greater than sampling interval Table 4–3 shows the extreme low influence of the interrupt latency time: even non-realistic high latency times like 160 µs result in negligible influence. This means that the Reduced Scan Principle is not sensitive to the interrupt latency time of the system. Note: The errors shown in Table 4–3 are won by the use of random values for the interrupt latency time. Despite the relatively long simulation time (20 sec- onds) every simulation made under exactly the same conditions returned therefore a slightly different error. 4.1.2.6 Measurement Error Due to Overvoltage and Overcurrent With the simulation conditions described in Section 4.1.3, The Analog-to-Digi- tal Converter of the MSP430C32x, the ADC measures up to 111% of the maxi- mum current or voltage without additional error. It is important to know how the electricity meter behaves if the input values are above these limits: there must be a smooth transition and no oscillations or sudden changes. Due to the satu- ration the ADC shows for overflow and underflow, the errors shown in Table 4–4 result. The ADC is assumed to be error-free (with the exception of the range transition error), so only the effect of the overflow is shown. 4-10
  11. Table 4–4. Errors dependent on Overvoltage and Overcurrent Load Current 100% Vnom 110% Vnom 120% Vnom 130% Vnom 100% 0% 0% –2.4% –6.5% 110% 0% 0% –2.4% –6.5% 120% –2.4% –2.4% –4.7% –8.6% 130% –6.5% –6.5% –8.6% –12.3% 4.1.3 The Analog-to-Digital Converter of the MSP430C32x The analog-to-digital converter (ADC) of the MSP430 measures the voltage between its AVss and SVcc connections with a resolution of 14 bits. The signed voltages coming from the current and voltage interfaces are shifted into the unsigned range of the ADC by simple interfaces described below. The MSP430 subtracts the measured or calculated offset value from every mea- sured current or voltage sample: this enables signed, offset corrected mea- surements. ADC Value (Steps) 100% SVCC 3FFFh 95% SVCC 100% Current Time 100% Voltage 5% SVCC AVSS 0000h Figure 4–4. Allocation of the ADC Range Figure 4–4 shows the placement of the current and voltage coming from the voltage dividers and the current interfaces into the analog-to-digital convert- er’s range. All calculations and proposals base on a use of 90% of the ADC range for nominal (100%) values of current and voltage. This means up to 111% of the nominal values are still measured correctly. This allocation may be changed if necessary. Table 4–5 shows the influence of the analog-to-digital converter’s perfor- mance to the accuracy of the measurement of the electric energy. Two in- fluences are involved: 1) The deviation of the ADC from the linearity. Each one of the four ranges A, B, C and D has calculated deviations up to 20 ADC steps compared to the two ranges bordering on it. Application Examples 4-11
  12. 2) The saturation effect at the range limits: if the sample for the definition of the range is taken in another range than the sample for the 12-bit conver- sion (36 ADCLKs later) than the result is xFFFh for increasing input signals and x000h for decreasing input signals (x denotes the number of the range where the range sample was taken). As the results show, the two satura- tion effects compensate nearly to zero. Note: The deviations of the analog-to-digital converter used with the examples be- low (±20 steps) are greater than the specified ones. These large deviations are used only to show the relative independence of the overall accuracy from the ADC error. The actual, specified deviations are ±10 steps. It is recommended not to use the exact midpoint of the supply voltage Vcc (Vcc/2) for the common reference point. This is due to the possible slight slope deviation at the border of two ADC ranges (here B and C). This may influence the accuracy for the lowest currents. Table 4–5 shows also the influence for some extreme deviations of the analog- to-digital converter characteristic. Figure 4–5 explains the meaning of the used graphics: it shows the second deviation curve of Table 4–5 in detail. ADC Error (Steps) 20 Range C Range D 1FFFh 3FFFh ADC Value Range A Range B –20 Figure 4–5. Explanation of ADC Deviation (2nd Column of Table 4–5) 4-12
  13. The function shows the deviation at any point of the four ADC ranges. Due to the monotony of the ADC the errors at the range limits are always equal. The errors shown in Table 4–5 were calculated with a PASCAL program. The fol- lowing steps were taken: 1) Measurement and calculation of the error at 5% of the nominal current. 2) Measurement and calculation of the error at 100% of the nominal current 3) Calculation of the slope and offset for the correction (calibration) 4) Simulation of voltage and current samples: any sample is modified with the ADC error (exactly like during calibration). 5) Correction of all measured values with the calculated slope and offset 6) Calculation of the resulting error The saturation effect at the range limits is always included. The first column of Table 4–5 with an ideal ADC characteristic (zero deviation) shows only this effect and the finite ADC resolution. This column can be used as a reference for the errors of the other five columns. The calculations are made with the following conditions: - Virtual Ground location in the ADC range: 8190 steps (1FFEh) 49.98% of full ADC range - Measurement time for calibration points: 5s (calibration points are measured this time) - Measurement time for different loads: 9s - AC frequency: 50 Hz Cosine ϕ: 1 (0_) - 2048 Hz (488.3 µs sample distance) - Sample frequency: - Voltage: 100% Vpp uses 90% of the ADC range - Current: 100% Ipp uses 90% of the ADC range Note: The drawings on top of the columns of Table 4–5 indicate the ADC error in dependence of the ADC value. Figure 4–5 shows the drawing above the sec- ond column in a magnified form. Application Examples 4-13
  14. Table 4–5. Errors With One Current Range and Single Calibration Range Load Current 0.1% +0.7771% +7.79% –2.93% +0.45% +0.57% +3.94% 1% –0.0114% +0.83% –0.24% 0% +0.01% +0.38% 2% +0.0620% +0.50% +0.01% +0.01% 0% +0.24% Calibr. P. –0.0001% 0% 0% 0% 0% 0% 5% 10% +0.0005% –0.19% –0.01% 0% 0% –0.09% 25% 0% –0.27% –0.01% % 0% –0.13% 50% –0.0001% –0.31% –0.01% 0% 0% –0.15% 75% +0.0001% –0.17% 0% 0% 0% –0.09% Calibr. P. –0.0002% 0% 0% 0% 0% 0% 100% The large errors at 0.1% of the nominal current result from the relatively far dis- tance from the 5% calibration point and from the missing resolution of the ADC at this small load. The peak-to-peak value of the ADC result is only 14.7 steps. These errors can be reduced drastically by using one of the following methods. 4.1.3.1 Methods to reduce the Error of the Energy Measurement Three relatively simple methods are given to reduce the error of the energy measurement. In any case, the values used for the correction are stored in the EEPROM and are loaded into the RAM during the initialization. Using a Second Hardware Range This method is shown with all hardware examples. An analog switch like the TLC4016 switches a second resistor in parallel to the one used for the low cur- rent range. Both ranges uses its own set of calibration constants (slope and offset) that are measured during two independent calibration runs for every phase. The advantage of this method is the real increase of resolution for the low current range. Using a Second Calibration Range This method only uses a second set of calibration constants (slope and offset) without additional hardware for the low current range (e.g., from 0.1% to 5% of the nominal current). This method needs two calibrations per phase, but uses only three measurements (one measurement is used for both ranges). 4-14
  15. Table 4–6 shows the enhancement of the accuracy when a second calibration run is made for the low current range, 0.1% to 5% of the nominal value. The calculations are made with the same conditions used with Table 4–5. The en- hancement can be seen with a comparison of the two tables. The errors, for the range 5% to 100% of the nominal current, are the same as shown in Table 4–5. Table 4–6. Errors With One Current Range and Two Calibration Ranges Load Current Calibr. P. +0.004% +0.004% +0.002% +0.005% +0.005% +0.003% 0.1% 0.5% –0.236% –0.002% –0.251% –0.163% –0.161% –0.119% 1% –0.075% +0.190% –0.003% –0.041% –0.040% +0.058% 2% –0.018% +0.262% +0.098% –0.005% –0.012% +0.122% 3% –0.006% +0.062% +0.024% –0.013% –0.012% +0.022% 4% –0.010% –0.035% –0.025% –0.009% –0.007% –0.023% Calibr. P. 0.000% 0.000% 0.000% 0.000% 0.000% 0.000% 5% Measurement of the ADCs Characteristic This method uses the actual deviations of the ADC for a rough correction of the measurement results. During a first run, the ADC characteristic is mea- sured and correction constants are calculated for any of 8 to 32 software sub- ranges of the ADC. These correction constants are written into the EEPROM and loaded into the RAM for use. For every subrange, one byte is needed, which allows corrections up to ±127 steps. The correction for the samples needs only seven instructions per 14-bit value. The advantage of this method is the adaptation to the actual deviation of the individual ADC. Figure 4–6 shows the correction with the ADC characteristic using only 8 correction val- ues. The deviations reduce to one quarter of the original ones. If the correction shows a step near the virtual zero point like shown in Figure 4–6, the sub- ranges B1 and C0 can be corrected in a way that omits this step. Chapter 2, The Analog-To-Digital Converters gives more information. Application Examples 4-15
  16. ADC Deviation (Steps) ADC Characteristic Without Correction 20 Range C Range D ADC Value 3FFFH Range A Range B Correction Value Subrange D1 Corrected ADC Characteristic Subrange Subrange Subrange A0 A1 D1 –20 Correction Values For The Subranges Figure 4–6. Use of the Actual ADC Characteristic for Corrections (8 Subranges Used) Dependence on the Voltage and the Phase Angle ϕ 4.1.3.2 Table 4–7 shows the dependence of the MSP430 using the Reduced Scan Principle on the load current, the ac voltage and the phase angle, ϕ, between current and voltage. The ADC is assumed to be error-free; the saturation effect at the range limits is included. Single calibration with only one range is used. Nominal voltage is used for the load current dependence and nominal current (100%) is used with the voltage dependence. The calculations are made with the same conditions used for the calculations in Table 4–5. Table 4–7. Errors in Dependence on Current, Voltage and Phase Angle Angle ϕ ge Load Current AC Voltage 1% 10% 100% 80% 90% 110% Ind. –80_ +4.119% +0.447% +0.046% +0.048% +0.047% +0.045% –60_ +0.857% +0.099% +0.010% +0.009% +0.010% +0.010% –40_ +0.257% +0.032% +0.003% +0.003% +0.003% +0.004% –20_ +0.047% +0.009% +0.001% 0.000% +0.001% +0.001% 0_ –0.011% +0.001% 0.000% 0.000% 0.000% 0.000% +20_ +0.043% +0.004% 0.000% +0.001% +0.001% 0.000% +40_ +0.248% +0.021% 0.000% +0.004% +0.003% +0.001% +60_ +0.844% +0.075% +0.007% +0.012% +0.009% +0.005% Cap. +80_ +4.051% +0.376% +0.037% +0.056% +0.046% +0.031% 4.1.3.3 Derivation of the Measurement Formulas The electronic meter equivalent of the meter constant of a Ferraris wheel me- ter (revolutions per kWh) is the meter constant, CZ, that defines (ADC steps)2 per Ws. The corrected equation used for the electric energy W is: t+R 1 ∆t W+ u n*1 ) u n)1 [Ws] in ∆t) cos(2p f t+0 4-16
  17. With the ADC results ADCi (current sample) ADCu (voltage sample) and ADC0u and ADC0i (zero volt samples) the previous equation gets: t+R 1 ∆t W+ ADCi n * ADC0i ADCu n*1 ) ADCu n)1 * 2 ki ku ADC0u ∆t) cos(2p f t+0 Separation into variable and constant values results in: t+R 1 ∆t W+ ADCi n * ADC0i ADCu n*1 ) ADCu n)1 * 2 ki ku ADC0u ∆t) cos(2p f t+0 Where: f AC frequency [Hz] ∆t Sampling interval between appertaining voltage and current samples [s] ki Current multiplication factor [A/step]. See Section 4.1.4.5 for more details ku Voltage multiplication factor. [V/step] See section 4.1.4.6 for more details ADCin ADC value of current sample taken at time tn ADCun–1 ADC value of voltage sample taken at time tn–1 (tn – ∆t) ADCun+1 ADC value of voltage sample taken at time tn+1 (tn + ∆t) ADC0u ADC value of voltage zero point (measured or calculated) ADC0i ADC value of current zero point (measured or calculated) The first, constant part of the equation is the inverse value of the meter constant ,CZ: cos(2p f ∆t) + [Steps2/Ws] C ∆t ki ku Z The values for ki and ku for different interfaces are explained in detail in Sec- tion 4.1.4. For a system using a current transformer and a resistor divider for the voltage, the previous equation gets: (Rm ) Rc) SV wsec SV CC CC 1 ∆t W+ ∆t) cos(2p 2 14 2 14 f w Rsec Rc prim t+R ADCi n * ADC0i ADCu n*1 ) ADCu n)1 * 2 ADC0u t+0 Application Examples 4-17
  18. Where: Rsec Load resistor (secondary) of the current [Ω] transformer wsec Secondary windings of the current transformer wprim Primary windings of the current transformer SVCC Voltage at terminal SVCC (AVCC or external reference voltage) [V] Rm Voltage divider: resistor between ac connection [Ω] and analog input Rc Voltage divider: resistor between analog input [Ω] and zero volts The first, constant part of the equation is the inverse value of the meter constant CZ: ∆t) 2 28 cos(2p f w Rsec Rc prim + [Steps2/Ws] C Z 2 ∆t (Rm ) Rc) SV w sec CC With the previous value of CZ, the equation for the energy W is: t+R ADCi n * ADC0i ADCu n*1 ) ADCu n)1 * 2 ADC0u [Ws] t+0 W+ C Z If the energy W is to be expressed in kWh: t+R ADCi n * ADC0i ADCu n*1 ) ADCu n)1 * 2 ADC0u [kWh] t+0 W+ 10 9 3.6 C Z The value W needs to be corrected with the slope and offset calculated during the calibration process. 4.1.4 Analog Interfaces to the MSP430 This chapter describes some important topics that can affect the overall accu- racy of the electricity meter. 4.1.4.1 Analog and Digital Grounding The following schematics are drawn in a simplified manner to make them easi- er to understand. In reality, it is necessary to decouple the analog and the digi- tal part as shown in Figure 4–7. This is to avoid digital noise on the analog sig- nals to be measured. 4-18
  19. 230 V Reference SVCC Rex REXT Voltage MSP430C323 ISEC A1 Current A0 A5 AVSS AVCC DVSS DVCC To AVCC CA CD To Other Digital Parts To Other Analog Parts AGND 5V 0V Power Supply Figure 4–7. MSP430 14-Bit ADC Grounding 4.1.4.2 ADC Input Considerations The ADC accurately operates up to 1.5 MHz. If the processor clock MCLK is higher than this frequency, it is recommended that one of the prescaled ADC clocks (ADCLK) be used. The possible prescaled frequencies for the ADCLK are MCLK, MCLK/2, MCLK/3 and MCLK/4. The sampling of the ADC to get the range information takes 12 ADCLK cycles. This means, the sampling gate is open during this time (12 µs at ADCLK = 1 MHz). The input of an ADC terminal can be seen as an RC low-pass filter, 2 kΩ together with 42 pF. The 42-pF capacitor must be charged during the 12 ADCLK cycles to the final value in order to be measured. This means charged within 2–14 of this value. This time limits the internal resistance RI of the source to be measured: 12 (Ri ) 2 kW) 42 pF t In 2 14 ADCLK Solved for RI, the result is 27.4 kΩ. This means, to get the full 14-bit resolution of the ADC, the internal resistance of the input signal must be lower than 27.4 kΩ. The given examples use lower source resistances at the ADC inputs. Application Examples 4-19
  20. 4.1.4.3 Offset Treatment If the voltage and current samples contain offsets, the equation for the mea- sured energy W is: t+R ∆t W+ un ) Ou in ) O i t+0 t+R ∆t W+ in ) un O ) in Ou ) O un Ou i i t+0 Where: Ou Offset of voltage measurement [V] Oi Offset of current measurement [A] un Sum of the two voltage samples un–1 and un+1 [V] The terms (un × Oi) and (in × Ou) get zero when summed-up over one full period (the integral of a sine curve from 0 to 2π is zero) but the term (Oi × Ou) is added erroneously to the sum buffer with each sample result. If one of the two offsets can be made zero then the error term (Oi × Ou) is eliminated: this is the case for all proposals. Two different ways are used: - Voltage representing 0V is measured (see Sections 4.1.4.4.1 and 4.1.4.4.2) - Summed-up ADC value for a full period is used for this purpose (see Sec- tion 4.1.4.4.3). 4.1.4.4 Adaptation to the Range of the Analog-to-Digital Converter The analog-to-digital converter of the MSP430 is able to measure unsigned voltages ranging from AVss up to the reference voltage applied to the input SVcc. If signed measurements, as for electricity meters, are necessary then a virtual zero point must be provided. Voltages above this zero point are treated as positive ones, voltages below it are treated as negative voltages. A few possibilities are shown how to provide this virtual zero point. For more information see Section 3.8, Power Supplies for the MSP430. Split Power Supply To get a common reference voltage in the middle of the ADC’s voltage range, two voltage regulators with output voltages of +2.5 V and –2.5 V can be used. In this case, the common zero connection is the reference for all current and voltage measurements. This zero point is connected to one of the analog in- puts (A0 in Figure 4–8). The measured ADC value of this reference voltage is 4-20
ADSENSE

CÓ THỂ BẠN MUỐN DOWNLOAD

 

Đồng bộ tài khoản
2=>2