| Electronic Components Datasheet Search |
|
AN2512 Datasheet(PDF) 29 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN2512 Datasheet(HTML) 29 Page - STMicroelectronics |
|
29 / 38 page ![]() AN2512 Example of source code 29/38 A.4 One-Wattmeter method This method is suitable only in three-phase four-wire balanced loads. The connection of the wattmeter is similar to the drawing given in Figure 18. The total power is equal to three times the reading of only one wattmeter that is connected between one phase and the neutral. Appendix B Example of source code The C code below shows an example of handling energy value (either active type 0, type1, reactive or apparent) after it has been read, unpacked and stored into register new. For signed wide-band Active energy as an example, a pointer named e should be loaded with &ActWB then, EnergyQuant() should be called. This function checks for rollover and computes a quant of energy. Later, EnergyUpdate() is called. This function updates the fractional part of integrator first (frac). If the fractional part reaches a certain limit, it is subtracted from the fractional part and the integer part (integ) of integrator increments. The value of the limit and the direction of subtraction and increment depends on the sign of quant. Some applications may have positive and negative energy integrators or quadrant integrators for Apparent energy. All this influences an implementation of both functions. With a proper limit value for the fractional part, one can prescribe a suitable bit weight of the integer part of the integrator. For example if the limit is set to 0x00140000 (with a device calibrated to provide 128000 pulses/kWh) then the lsb of the integer part represents exactly 0.01 kWh. Below is an example of source code. /* definition of STPM01 registers structure */ typedef struct STPM { long int DAP[3]; long int DRP[3]; long int DSP[3]; long int DFP[3]; long int DEV[3]; long int DMV[3]; long int CFL[3]; long int CFH[3]; } STPM_Struct; /* definition of energy integrator structure */ typedef struct energ { long int old[4]; /* previous energy value */ int quot[4]; /* quant/16 */ int quant[4]; /* new - old, measure of power */ |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |