Patent Publication Number: US-11644490-B2

Title: Digital power metering system with serial peripheral interface (SPI) multimaster communications

Description:
PRIORITY 
     This application is a continuation application of U.S. patent application Ser. No. 13/833,744 filed on Mar. 15, 2013, now abandoned, which is a continuation-in-part application of U.S. patent application Ser. No. 13/479,916 filed on May 24, 2012, now U.S. Pat. No. 8,700,347, which is a continuation application of U.S. patent application Ser. No. 12/075,690 filed on Mar. 13, 2008, now U.S. Pat. No. 8,190,381, which claims priority to U.S. Provisional Patent Application Ser. No. 60/921,651 filed Apr. 3, 2007, the contents of all of which are hereby incorporated by reference in their entireties. 
     This application is also a continuation-in-part application of U.S. patent application Ser. No. 13/447,346 filed on Apr. 16, 2012, now U.S. Pat. No. 8,862,435, which is a continuation application of U.S. patent application Ser. No. 12/080,479 filed on Apr. 3, 2008, now U.S. Pat. No. 8,160,824, which claims priority to U.S. Provisional Patent Application Ser. No. 60/921,651 filed Apr. 3, 2007, the contents of all of which are hereby incorporated by reference in their entireties. 
    
    
     BACKGROUND 
     Field 
     The present disclosure relates to the field of power quality monitoring and control, and more particularly to identify frequencies in a power signal. 
     Description of the Related Art 
     Monitoring of electrical energy by consumers and providers of electric power is a fundamental function within any electric power distribution system. Electrical energy may be monitored for purposes of usage, equipment performance and power quality. Electrical parameters that may be monitored include volts, amps, watts, vars, power factor, harmonics, kilowatt hours, kilovar hours and any other power related measurement parameters. Typically, measurement of the voltage and current at a location within the electric power distribution system may be used to determine the electrical parameters for electrical energy flowing through that location. 
     Devices that perform monitoring of electrical energy may be electromechanical devices, such as, for example, a residential billing meter or may be intelligent electronic devices (“TED”). Intelligent electronic devices typically include some form of a processor. In general, the processor is capable of using the measured voltage and current to derive the measurement parameters. The processor operates based on a software configuration. A typical consumer or supplier of electrical energy may have many intelligent electronic devices (IEDs) installed and operating throughout their operations. IEDs may be positioned along the supplier&#39;s distribution path or within a customer&#39;s internal distribution system. IEDs include revenue electric watt-hour meters, protection relays, programmable logic controllers, remote terminal units, fault recorders and other devices used to monitor and/or control electrical power distribution and consumption. IEDs are widely available that make use of memory and microprocessors to provide increased versatility and additional functionality. Such functionality includes the ability to communicate with remote computing systems, either via a direct connection, e.g. modem or via a network. IEDs also include legacy mechanical or electromechanical devices that have been retrofitted with appropriate hardware and/or software allowing integration with the power management system. 
     Typically, an IED is associated with a particular load or set of loads that are drawing electrical power from the power distribution system. The IED may also be capable of receiving data from or controlling its associated load. Depending on the type of IED and the type of load it may be associated with, the IED implements a power management function that is able to respond to a power management command and/or generate power management data. Power management functions include measuring power consumption, controlling power distribution such as a relay function, monitoring power quality, measuring power parameters such as phasor components, voltage or current, controlling power generation facilities, computing revenue, controlling electrical power flow and load shedding, or combinations thereof. 
     SUMMARY 
     In accordance with embodiments of the present disclosure, there are provided herein methods and systems for identifying the frequencies present in a power signal. 
     In one aspect, a method for identifying frequencies present in a power signal includes steps of digitally sampling sensor data yielding digital sampled data; performing a calibration on the digital sampled data yielding calibrated digital sampled data; filtering the calibrated digital sampled data to yield calibrated and filtered sampled data; detecting n consecutive zero-crossing events in the calibrated and filtered sampled data; identifying all calibrated digital sampled data points in the range between the first zero-crossing event and the nth zero-crossing event; and storing all of the identified calibrated digital sampled data points; resampling the stored calibrated sampled data points yielding a set of resampled calibrated sampled data points. 
     The present disclosure provides for overcoming the problem of errors which occur when sampling a signal and performing a transformation from the time domain to the frequency domain. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       These and other objects, features and advantages of the present disclosure will be apparent from a consideration of the following Detailed Description considered in conjunction with the drawing Figures, in which: 
         FIG.  1    is a block diagram of an intelligent electronic device (IED), according to an embodiment of the present disclosure. 
         FIG.  2 A  is a flowchart illustrating a method for identifying harmonic and inter-harmonic information present in a power signal, according to one exemplary embodiment. 
         FIG.  2 B  is a data flow diagram of the method described in  FIG.  2 A . 
         FIG.  3    illustrates the data flow associated with those components of  FIG.  1    which are used in accordance with a method according to a 60 Hz embodiment. 
         FIG.  4    illustrates an interval, for a 60 Hz system comprising 12 consecutive cycles of sampled digital data output from A/D converters. 
         FIG.  5    illustrates a single zero-crossing event between two calibrated digital sampled data points. 
         FIG.  6    illustrates an FFT decomposition in accordance with an embodiment of the present disclosure. 
         FIG.  7    illustrates an FFT bit reversal sorting in accordance with an embodiment of the present disclosure. 
         FIG.  8    is a block diagram of an intelligent electronic device (IED), according to another embodiment of the present disclosure. 
         FIG.  9    is a block diagram of an intelligent electronic device (IED), according to a further embodiment of the present disclosure. 
     
    
    
     DETAILED DESCRIPTION 
     Preferred embodiments of the present disclosure will be described herein below with reference to the accompanying drawings. In the following description, well-known functions or constructions are not described in detail to avoid obscuring the present disclosure in unnecessary detail. The word “exemplary” is used herein to mean “serving as an example, instance, or illustration.” Any configuration or design described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other configurations or designs. Herein, the phrase “coupled” is defined to mean directly connected to or indirectly connected with through one or more intermediate components. Such intermediate components may include both hardware and software based components. 
     It is further noted that, unless indicated otherwise, all functions described herein may be performed in either hardware or software, or some combination thereof. In a preferred embodiment, however, the functions are performed by at least one processor, such as a computer or an electronic data processor, digital signal processor or embedded micro-controller, in accordance with code, such as computer program code, software, and/or integrated circuits that are coded to perform such functions, unless indicated otherwise. 
     It should be appreciated that the present disclosure can be implemented in numerous ways, including as a process, an apparatus, a system, a device, a method, or a computer readable medium such as a computer readable storage medium or a computer network where program instructions are sent over optical or electronic communication links. Several inventive embodiments of the present disclosure are described below. 
     Preferred embodiments of the present disclosure will be described herein below with reference to the accompanying drawings. 
     As used herein, intelligent electronic devices (“IEDs”) include Programmable Logic Controllers (“PLCs”), Remote Terminal Units (“RTUs”), electric power meters, protective relays, fault recorders and other devices which are coupled with power distribution networks to manage and control the distribution and consumption of electrical power. A meter is a device that records and measures power events, power quality, current, voltage waveforms, harmonics, transients and other power disturbances. Revenue accurate meters (“revenue meter”) relate to revenue accuracy electrical power metering devices with the ability to detect, monitor, report, quantify and communicate power quality information about the power that they are metering. 
       FIG.  1    is a block diagram of an intelligent electronic device (IED)  10  for monitoring and determining power usage and power quality for any metered point within a power distribution system and for providing a data transfer system for faster and more accurate processing of revenue and waveform analysis. 
     The IED  10  of  FIG.  1    includes a plurality of sensors  12  coupled to various phases A, B, C and neutral N of an electrical distribution system  11 , a plurality of analog-to-digital (A/D) converters  14 , including inputs coupled to the sensor  12  outputs, a power supply  16 , a volatile memory  18 , a non-volatile memory  20 , a multimedia user interface  22 , and a processing system that includes at least one central processing unit (CPU)  50  (or host processor) and one or more digital signal processors, two of which are shown, i.e., DSP1  60  and DSP2  70 . The IED  10  also includes a Field Programmable Gate Array  80  which performs a number of functions, including, but not limited to, acting as a communications gateway for routing data between the various processors  50 ,  60 ,  70 , receiving data from the A/D converters  14 , performing transient detection and capture and performing memory decoding for CPU  50  and the DSP processor  60 . In one embodiment, the FPGA  80  is internally comprised of two dual port memories to facilitate the various functions. 
     The plurality of sensors  12  sense electrical parameters, e.g., voltage and current, on incoming lines, (i.e., phase A, phase B, phase C, neutral N), from an electrical power distribution system  11 . The sensors  12  will sense electrical parameters, e.g., voltage and current, of the incoming lines from an electrical power distribution system  11 , e.g., an electrical circuit. Preferably, the sensors will include current transformers and potential transformers, wherein one current transformer and one voltage transformer will be coupled to each phase of the incoming power lines. A primary winding of each transformer will be coupled to the incoming power lines and a secondary winding of each transformer will output a voltage representative of the sensed voltage and current. The output of each transformer will be coupled to the A/D converters  14  configured to convert the analog output voltage from the transformer to a digital signal that can be processed by the CPU  50 , DSP1  60 , DSP2  70 , FPGA  80  or any combination thereof. 
     A/D converters  14  are respectively configured to convert an analog voltage output to a digital signal that is transmitted to a gate array, such as Field Programmable Gate Array (FPGA)  80 . The digital signal is then transmitted from the FPGA  80  to the CPU  50  and/or one or more DSP processors  60 ,  70  to be processed in a manner to be described below. 
     The CPU  50  or DSP Processors  60 ,  70  are configured to operatively receive digital signals from the A/D converters  14  (see  FIG.  1   ) to perform calculations necessary to determine power usage and to control the overall operations of the IED  10 . In some embodiments, CPU  50 , DSP1  60  and DSP2  70  may be combined into a single processor, serving the functions of each component. In some embodiments, it is contemplated to use an Erasable Programmable Logic Device (EPLD) or a Complex Programmable Logic Device (CPLD) or any other programmable logic device in place of the FPGA  80 . In some embodiments, the digital samples, which are output from the A/D converters  14  are sent directly to the CPU  50  or DSP processors  60 ,  70 , effectively bypassing the FPGA  80  as a communications gateway. 
     The power supply  16  provides power to each component of the IED  10 . Preferably, the power supply  16  is a transformer with its primary windings coupled to the incoming power distribution lines and having windings to provide a nominal voltage, e.g., 5 VDC, +12 VDC and −12 VDC, at its secondary windings. In other embodiments, power may be supplied from an independent power source to the power supply  16 . For example, power may be supplied from a different electrical circuit or an uninterruptible power supply (UPS). 
     In one embodiment, the power supply  16  can be a switch mode power supply in which the primary AC signal will be converted to a form of DC signal and then switched at high frequency, such as, for example, 100 Khz, and then brought through a transformer to step the primary voltage down to, for example, 5 Volts AC. A rectifier and a regulating circuit would then be used to regulate the voltage and provide a stable DC low voltage output. Other embodiments, such as, but not limited to, linear power supplies or capacitor dividing power supplies are also contemplated. 
     The multimedia user interface  22  is shown coupled to the CPU  50  in  FIG.  1    for interacting with a user and for communicating events, such as alarms and instructions to the user. The multimedia user interface  22  preferably includes a display for providing visual indications to the user. The display may be embodied as a touch screen, a liquid crystal display (LCD), a plurality of LED number segments, individual light bulbs or any combination. The display may provide information to the user in the form of alpha-numeric lines, computer-generated graphics, videos, animations, etc. The multimedia user interface  22  further includes a speaker or audible output means for audibly producing instructions, alarms, data, etc. The speaker is coupled to the CPU  50  via a digital-to-analog converter (D/A) for converting digital audio files stored in a memory  18  or non-volatile memory  20  to analog signals playable by the speaker. An exemplary interface is disclosed and described in commonly owned pending U.S. application Ser. No. 11/589,381, entitled “POWER METER HAVING AUDIBLE AND VISUAL INTERFACE”, which claims priority to expired U.S. Provisional Patent Appl. No. 60/731,006, filed Oct. 28, 2005, the contents of which are hereby incorporated by reference in their entireties. 
     The IED  10  will support various file types including but not limited to Microsoft Windows Media Video files (.wmv), Microsoft Photo Story files (.asf), Microsoft Windows Media Audio files (.wma), MP3 audio files (.mp3), JPEG image files (.jpg, .jpeg, .jpe, .jfif), MPEG movie files (.mpeg, .mpg, .mpe, .m1v, .mp2v .mpeg2), Microsoft Recorded TV Show files (.dvr-ms), Microsoft Windows Video files (.avi) and Microsoft Windows Audio files (.wav). 
     The IED  10  further comprises a volatile memory  18  and a non-volatile memory  20 . In addition to storing audio and/or video files, volatile memory  19  will store the sensed and generated data for further processing and for retrieval when called upon to be displayed at the IED  10  or from a remote location. The volatile memory  18  includes internal storage memory, e.g., random access memory (RAM), and the non-volatile memory  20  includes removable memory such as magnetic storage memory; optical storage memory, e.g., the various types of CD and DVD media; solid-state storage memory, e.g., a CompactFlash card, a Memory Stick, SmartMedia card, MultiMediaCard (MMC), SD (Secure Digital) memory; or any other memory storage that exists currently or will exist in the future. By utilizing removable memory, an IED can be easily upgraded as needed. Such memory will be used for storing historical trends, waveform captures, event logs including time-stamps and stored digital samples for later downloading to a client application, web-server or PC application. 
     In a further embodiment, the IED  10  will include a communication device  24 , also know as a network interface, for enabling communications between the IED or meter, and a remote terminal unit, programmable logic controller and other computing devices, microprocessors, a desktop computer, laptop computer, other meter modules, etc. The communication device  24  may be a modem, network interface card (NIC), wireless transceiver, etc. The communication device  24  will perform its functionality by hardwired and/or wireless connectivity. The hardwire connection may include but is not limited to hard wire cabling e.g., parallel or serial cables, RS232, RS485, USB cable, Firewire (1394 connectivity) cables, Ethernet, and the appropriate communication port configuration. The wireless connection will operate under any of the various wireless protocols including but not limited to Bluetooth™ interconnectivity, infrared connectivity, radio transmission connectivity including computer digital signal broadcasting and reception commonly referred to as Wi-Fi or 802.11.X (where x denotes the type of transmission), satellite transmission or any other type of communication protocols, communication architecture or systems currently existing or to be developed for wirelessly transmitting data including spread spectrum 900 MHz, or other frequencies, Zigbee, WiFi, or any mesh enabled wireless communication. 
     The IED  10  may communicate to a server or other computing device via a communication device  24 . The IED  10  may be connected to a communications network, e.g., the Internet, by any means, for example, a hardwired or wireless connection, such as dial-up, hardwired, cable, DSL, satellite, cellular, PCS, wireless transmission (e.g., 802.11a/b/g), etc. It is to be appreciated that the network may be a local area network (LAN), wide area network (WAN), the Internet or any network that couples a plurality of computers to enable various modes of communication via network messages. Furthermore, the server will communicate using various protocols such as Transmission Control Protocol/Internet Protocol (TCP/IP), File Transfer Protocol (FTP), Hypertext Transfer Protocol (HTTP), etc. and secure protocols such as Hypertext Transfer Protocol Secure (HTTPS), Internet Protocol Security Protocol (IPSec), Point-to-Point Tunneling Protocol (PPTP), Secure Sockets Layer (SSL) Protocol, etc. The server will further include a storage medium for storing a database of instructional videos, operating manuals, etc., the details of which will be described in detail below. 
     In an additional embodiment, the IED  10  will also have the capability of not only digitizing waveforms, but storing the waveform and transferring that data upstream to a central computer, e.g., a remote server, when an event occurs such as a voltage surge or sag or a current short circuit. This data will be triggered and captured on an event, stored to memory, e.g., non-volatile RAM, and additionally transferred to a host computer within the existing communication infrastructure either immediately in response to a request from a remote device or computer to receive said data in response to a polled request. The digitized waveform will also allow the CPU  50  to compute other electrical parameters such as harmonics, magnitudes, symmetrical components and phasor analysis. Using the harmonics, the IED  10  will also calculate dangerous heating conditions and can provide harmonic transformer derating based on harmonics found in the current waveform. 
     In a further embodiment, the IED  10  will execute an e-mail client and will send e-mails to the utility or to the customer direct on an occasion that a power quality event occurs. This allows utility companies to dispatch crews to repair the condition. The data generated by the meters, or IEDs, are use to diagnose the cause of the condition. The data is transferred through the infrastructure created by the electrical power distribution system. The email client will utilize a POP3 or other standard mail protocol. A user will program the outgoing mail server and email address into the meter. An exemplary embodiment of said metering is available in U.S. Pat. No. 6,751,563, which all contents thereof are incorporated by reference herein. 
     The techniques of the present disclosure can be used to automatically maintain program data and provide field wide updates upon which IED firmware and/or software can be upgraded. An event command can be issued by a user, on a schedule or by digital communication that will trigger the IED  10  to access a remote server and obtain the new program code. This will ensure that program data will also be maintained allowing the user to be assured that all information is displayed identically on all units. 
     It is to be understood that the present disclosure may be implemented in various forms of hardware, software, firmware, special purpose processors, or a combination thereof. The IED  10  also includes an operating system and micro instruction code. The various processes and functions described herein may either be part of the micro instruction code or part of an application program (or a combination thereof) which is executed via the operating system. 
     It is to be further understood that because some of the constituent system components and method steps depicted in the accompanying figures may be implemented in software, or firmware, the actual connections between the system components (or the process steps) may differ depending upon the manner in which the present disclosure is programmed. Given the teachings of the present disclosure provided herein, one of ordinary skill in the related art will be able to contemplate these and similar implementations or configurations of the present disclosure. 
     Furthermore, it is to be appreciated that the IEDs or meters described herein may take many form factors, such as a panel meter, revenue meters, socket meter, etc. Exemplary housings and form factors are disclosed in commonly owned and co-pending U.S. application Ser. No. 13/792,616, the contents of which are hereby incorporated by reference in its entirety. 
     Methods for identifying harmonic and inter-harmonic information in a power signal will now be described. 
     In one embodiment, for a 60 Hz system, the method operates on an interval basis, as illustrated in  FIG.  4   , with an interval defined as 12 consecutive cycles of sampled digital data output from the A/D converters  14 . In other embodiments, the number of cycles that defines an interval may be any positive integer greater than 2. For example, for a 50 Hz system, a preferred number of cycles is 10. Thus, in each 12 cycle interval comprising 12 cycles, a total of 12,288 digital samples are obtained with 1024 samples per cycle. The 12,288 samples are processed in accordance with the method embodiment described in  FIGS.  2   a    and  2   b.    
       FIG.  3    illustrates the data flow associated with those components of  FIG.  1    which are used in accordance with a method according to a 60 Hz embodiment. With a 60 Hz declared system setup, in each 12 cycle interval, due to variations in frequency above and below an idealized 60 Hz system, an unknown number of digital samples are obtained in each interval, substantially in the range of X=10,530 to 17,350 samples per interval. Due to the variation in sample size on account of frequency input variations, which can be substantially in the range of 42.5 Hz to 70.0 Hz, a resampling process is performed with the obtained samples. The resampling process yields 4096 samples per interval. The new 4096 sample size is used to calculate harmonic and inter-harmonic information using a well-known FFT algorithm. 
       FIG.  2 A  is a flowchart illustrating a method for identifying harmonic and inter-harmonic information present in a power signal, according to one exemplary embodiment.  FIG.  2 B  is a data flow diagram of the described method. 
     Referring initially to  FIG.  2 A , at step  202 , the three phase lines A, B, C of an electrical distribution system  11  is coupled to and monitored by a plurality of sensors  12 , as shown in  FIG.  1   . The plurality of sensors  12  are shown coupled to A/D converters  14  in  FIG.  1   . 
     At step  204 , the A/D converters  14  digitally sample the sensor data (line voltages and currents) to convert it from the analog domain to the digital domain yielding sampled data  232 , as shown in the data flow diagram of  FIG.  2 B . In one embodiment, the A/D converters  14  samples the sensed line voltages and currents of 61.44 KHz yielding 1024 samples per cycle for 60 Hz fundamental input. The A/D sampling is performed under the control of firmware embedded in the FPGA  80  and DSPs  60 ,  70  shown in  FIG.  1   . In one embodiment, 12 consecutive cycles of data are collected, where each cycle includes 1024 samples per cycle for a total of 12,288 samples per interval, as shown in  FIG.  4   . 
     At step  206 , a calibration is performed on the digitized sampled data  232  yielding calibrated digital sampled data  234 . The calibration is optionally done in firmware, for example in FPGA  80 . 
     At step  208 , the calibrated digital sampled data  234  is processed by a filtering function implemented in DSP2  70  to yield calibrated and filtered sampled data  236 . 
     At step  210 , for the exemplary 60 Hz declared system setup, 24 consecutive zero-crossing events are detected on the calibrated and filtered digital sampled data  236  output from DSP2  70 .  FIG.  5    illustrates, by way of example, a zero-crossing event between calibrated digital sampled data point (N)  502  and calibrated digital sampled data point (N+1)  504 . The positions of the 24 consecutive zero-crossing events are preferably saved in a memory. 
     At step  212 , the calibrated digital sampled data points  234  from step  206  are stored in non-volatile memory  20  and are processed in accordance with the previously determined zero-crossing event information obtained at step  210  to construct a new set of data points. Specifically, in the exemplary embodiment, 12,288 calibrated digital sampled data points are stored in a non-volatile memory comprising 12 consecutive cycles of data which is equivalent to 1 interval of operation, as defined herein. In an embodiment, processing comprises resampling the stored data points to construct a new set of data points (i.e., resampled signals) within the range of the discrete set of known data points, as required by the FFT frequency analysis described below. Within a calculation based on a sample rate conversion, the amplitude values associated with the equidistantly distributed points in time of scanning are determined. On completion of calculation the equidistantly distributed signal comprises the digitized sample values as they would arise by analog/digital conversion within an ideal measuring device. 
     At step  214 , a subsequent FFT frequency analysis is performed on the re-sampled calibrated digital sampled data points obtained at step  212  to obtain the frequencies present in the three phase lines A, B, C of an electrical distribution system  11 . The FFT frequency analysis operates under the limitation that the sample size is a power of 2. While FFTs are not limited to powers of 2 (i.e., “radix 2”) they are the most common and familiar. The “radix” is the size of an FFT decomposition. In the present application, the radix is 2. For single-radix FFTs, the transform size must be a power of the radix. In the example above, the size was 32, which is 2 to the 5th power. 
     Because the frequency inputs can be in the range of 42.5 Hz to 70.0 Hz, the total number of digital samples obtained in one interval can range from 10,530 to 17,350. Given that there is no assurance that total number of digital samples obtained will be a power of 2, it becomes necessary to perform a sample rate conversion comprising re-sampling the calibrated data samples  234  to construct a new set of data points having a sample size that is assured to be a power of 2 within the range of the discrete set of known data points. 
     The FFT operates by decomposing an N point time domain signal into N time domain signals each composed of a single point. The second step is to calculate the N frequency spectra corresponding to these N time domain signals. Lastly, the N spectra are synthesized into a single frequency spectrum. 
     Functionally, the FFT decomposes the set of data to be transformed into a series of smaller data sets to be transformed. Then, it decomposes those smaller sets into even smaller sets. At each stage of processing, the results of the previous stage are combined in special way. Finally, it calculates the DFT of each small data set. For example, an FFT of size 32 is broken into 2 FFTs of size 16, which are broken into 4 FFTs of size 8, which are broken into 8 FFTs of size 4, which are broken into 16 FFTs of size 2. Calculating a DFT of size 2 is trivial. This process is shown by way of example in  FIG.  6   . 
     The first stage breaks the 16 point signal into two signals each consisting of 8 points. The second stage decomposes the data into four signals of 4 points. This pattern continues until there are N signals composed of a single point. An interlaced decomposition is used each time a signal is broken in two, that is, the signal is separated into its even and odd numbered samples. There are Log 2  N stages required in this decomposition, i.e., a 16 point signal (2 4 ) requires 4 stages, a 512 point signal (2 7 ) requires 7 stages, a 4096 point signal (2 12 ) requires 12 stages. The present disclosure preferably uses a 4096 point signal (2 12 ) requiring 12 stages. 
     The decomposition is a reordering of the samples in the signal.  FIG.  7    shows the rearrangement pattern required. On the left, the sample numbers of the original signal are listed along with their binary equivalents. On the right, the rearranged sample numbers are listed, also along with their binary equivalents. The important idea is that the binary numbers are the reversals of each other. For example, sample 3 (0011) is exchanged with sample number 12 (1100) Likewise, sample number 14 (1110) is swapped with sample number 7 (0111), and so forth. The FFT time domain decomposition is usually carried out by a bit reversal sorting algorithm. This involves rearranging the order of the N time domain samples by counting in binary with the bits flipped left-for-right (such as in the far right column in  FIG.  7   ). 
     The next step in the FFT algorithm is to find the frequency spectra of the 1 point time domain signals. This step is trivial in that the frequency spectrum of a 1 point signal is equal to itself. This means that nothing is required to do this step. Although there is no work involved, it is noted that each of the 1 point signals is now a frequency spectrum, and not a time domain signal. 
     The last step in the FFT is to combine the N frequency spectra in the exact reverse order that the time domain decomposition took place. Unfortunately, the bit reversal shortcut is not applicable, and we must go back one stage at a time. In the first stage, 16 frequency spectra (1 point each) are synthesized into 8 frequency spectra (2 points each). In the second stage, the 8 frequency spectra (2 points each) are synthesized into 4 frequency spectra (4 points each), and so on. The last stage results in the output of the FFT, a 16 point frequency spectrum. 
     The FFT is preferred over performing an DFT given that the DFT takes N ∧ 2 operations for N points. Since at any stage the computation required to combine smaller DFTs into larger DFTs is proportional to N, and there are log 2(N) stages (for radix 2), the total computation is proportional to N*log 2(N). Therefore, the ratio between a DFT computation and an FFT computation for the same N is proportional to N/log 2(n). In cases where N is small this ratio is not very significant, but when N becomes large, this ratio gets very large. (Every time you double N, the numerator doubles, but the denominator only increases by 1. 
     In another embodiment, IED  10  is configured for high precision real time synchronized frequency/phasor/zero-crossing measurement across a wide area power distribution network. As single unit, the IED  10  measures frequency/phasor/zero-crossing parameters, all of which are time-stamped with high accurate RTC (real time clock) time, either from a GPS signal or PTP (Precision Time Protocol) IEEE1588 server, the details of which are described below in reference to  FIG.  8   . Multiple IEDs, distributed across a wide geographic area, can communicate to each other or send measurement information to a central office which can use the available information to do further analysis. 
     Referring to  FIG.  8   , an IED  10  configured for high precision real time synchronized frequency/phasor/zero-crossing measurement is illustrated. It is to be appreciated clock  102  provides time to at least one DSP  60 ,  70 , where the appropriate DSP  60 ,  70  using the time to timestamp data, for example, measured values received from the FPGA  80 , calculated parameters, etc. However, the clock  102  may need to be periodically updated or set due to drift or other factors affecting the performance of the clock  102 . The clock  102  may be set by an Inter-Range Instrumentation Group (IRIG) signal or a signal received over a network. The received time signal is then used by the at least one DSP  60 ,  70  to set clock  102 . 
     In one embodiment, a TRIG signal  104  provides a time signal to the FPGA  80 . Upon providing the time signal to the FPGA  80 , the FPGA  80  starts an internal counter which is used to determine a skew in time or difference between when the FPGA  80  receives the time signal and the point in time when the at least one DSP  60 ,  70  accesses the FPGA  80  to retrieve the time. The at least one DSP  60 ,  70  determines this differential via the internal counter which is used with the originally received time signal to accurately determine the time and transmit it to the clock  102 . 
     In another embodiment, the time signal is received at the IED over a network, via a network card  106 ,  108 . In one embodiment, network card  106  receives a time signal from a SNTP (Simple Network Time Protocol) server. In this embodiment, the network card  106  provides a time signal to the CPU  50 , which passes the time signal to the FPGA  80  along with a signal to reset the internal counter of the at least one DSP  60 ,  70 . As above, the internal counter is used to determine a skew in time or difference between when the FPGA  80  receives the time signal and the point in time when the at least one DSP  60 ,  70  accesses the FPGA  80  to retrieve the time. The FPGA  80  determines this differential via the internal counter which is used with the originally received time signal to accurately determine the time and transmit it to the clock  102 . 
     In another embodiment, the time signal is received at the IED over a network, via a network card  106 ,  108 . In one embodiment, network card  108  receives a time signal from a PTP IEEE 1588 server. The Precision Time Protocol (PTP) is a protocol used to synchronize clocks throughout a computer network; on a local area network it achieves clock accuracy in the sub-microsecond range. In this embodiment, the network card  108  provides a time signal to the CPU  50 , which passes the time signal to the FPGA  80 . Here, the network card  108  sends a signal to reset the internal counter of the FPGA  80 . As above, the internal counter is used to determine a skew in time or difference between when the FPGA  80  receives the time signal and the point in time when the at least one DSP  60 ,  70  accesses the FPGA  80  to retrieve the time. The at least one DSP  60 ,  70  determines this differential via the internal counter which is used with the originally received time signal to accurately determine the time and transmits it to the clock  102 . 
     In a further embodiment, the time differential between the FPGA  80  and the at least one DSP  60 ,  70  is achieved by providing a counter in each of the FPGA  80  and the at least one DSP  60 ,  70  which are synchronized to each other. When a timing signal is received by the FPGA  80 , the FPGA  80  latches its counter. When the at least one DSP  60 , 70  attempts to retrieve the timing signal from the FPGA  80 , the at least one DSP  60 ,  70  determines the differential based on the difference between its internal counter and the latched counter of the FPGA  80 . Based on the determined differential and the received timing signal, the at least one DSP  60 ,  70  accurately determines the time and transmits it to the clock  102 . 
     Although the IED  10  may employ one method or device to set the time, it is to be appreciated that the three above-described methods and devices may all be used in one IED  10  as a redundant time system. When all three methods are employed, each method may be given a priority so the IED can select the method with the highest priority from the methods or devices available. For example, the IED  10  may select the network card  108  employing time signals received from a IEEE 1588 server over a network. Upon a network failure, the IED  10  may switch to the TRIG signal since this signal is not dependent on the network. 
     In another embodiment, the IED  10  is configured in a SPI (Serial Peripheral Interface) multimaster implementation. Conventionally, a SPI bus can only have one component acting as a master device at one time. For example, at startup of the IED  10 , the CPU  50  will be a master device on the SPI bus to transfer data, e.g., executable instructions, to at least one of the DSPs  60 ,  70 . Once the at least one DSP  60 ,  70  receives the code, the DSP  60 ,  70  will need to take control of the SPI bus and therefore, will need to become the master device of the SPI bus. 
     The IED  10  of the present disclosure is configured to enable devices to become a master and slave at different time to control the SPI bus. Referring to  FIG.  9   , SPI bus  120  is routed to at least CPU  50 , DSP  60 , DSP  70  and clock  102 . Upon startup of the IED  10 , the CPU  50  will be the master device and transmit code to the at least one DSP  60 , 70 . Once it receives the code, the DSP  60 ,  70  will need to be the master device. In one implementation, the FPGA  80  includes at least one semaphore register which enables the components to determine the master device among themselves. Alternatively, the FPGA  80  acts as the arbiter for determining which device is the master device based on requests from other components. 
     In another embodiment, the IED  10  is configured for power factor averaging using complex numbers. In metering measurement environments, power factors are typically represented by a positive number of (1˜4), 
     (0˜1) represent power factor in quadrant4, (270˜360 degree as phasor); 
     (1˜2) represent power factor in quadrant1, (0˜90 degree as phasor); 
     (2˜3) represent power factor in quadrant2, (90˜180 degree as phasor); 
     (3˜4) represent power factor in quadrant3, (180˜270 degree as phasor); 
     But the value cannot be used to calculate average mathematically, because at the boundary of 4 to 0, it&#39;s not continuous in math, for example, to compute average from a set of value, 0.1, 3.9, 0.1, 3.9, the average is (0.1+3.9+0.1+3.9)/2=2, which is not correct. One way to derive the correct value efficiently is to convert the power factor into a complex number with following equation, and then average the complex number. First, convert PF into complex number in polar form, modulus=1, argument=360*(PF/4)=PF*90; then convert the polar form into vector form, as follows:
 
cos(PF*90))+ i  sin(PF*90)&lt;---&gt;  equation #1.
 
     One example is average five 0.2 sec PF instantaneous readings into 1 sec average PF reading, where the 0.2 sec readings are, 3.95, 0.03, 0.04, 3.97, 3.99. With straight average (3.95+0.03+0.04+3.97+3.99)/5=2.396, it&#39;s an incorrect average readings. Instead, converting PF into complex number with equation #1
 
3.95&lt;---&gt;(0.996917333)+ i (−0.078459103)
 
0.03&lt;---&gt;(0.998889875)+ i (0.047106451)
 
0.04&lt;---&gt;(0.998026728)+ i (0.062790519)
 
3.97&lt;---&gt;(0.998889875)+ i (−0.047106458)
 
3.99&lt;---&gt;(0.999876632)+ i (−0.015707324)
 
The average of complex number is (0.998520089)+i(−0.006275183), first convert this number into polar form, it&#39;s argument is 359.1, here we don&#39;t really care about the modulus, convert into PF, just need to divide to 90, which is (360/4), so 1 sec average PF=359.64/90=3.996. A similar algorithm can be used to calculate average phase angle.
 
     In a further embodiment, the IED  10  is configured for transfer of data between processors with different bit/byte order without adding additional processing overhead. In this embodiment, internal communication between CPU  50  (e.g., big endian machine) and DSP  60 , 70  (e.g., little endian machine), when passing numerical binary data, data format conversion is done through parallel-&gt;serialization-&gt;parallel transmission without any software/firmware/CPU cycle overhead. In an exemplary embodiment, the sequence is, 1st, transmit side setup 2 byte word with receive side endian mode sequence; 2nd, transmit side sending data buffer from one end, such as from high address side; 3rd, receive side fill buffer from the other end, such as from low address side; 4nd, receive side define data structure backward as transmit side, different data passing correctly. 
     Assume, a block of 16 byte memory, small endian side CPU is the source, big endian side CPU is the destination. On small endian side CPU, data structure defined as {uint16 a; uint16 b; uint32 c; uint64 d;} when a=0x0100; b=0x0302; c=0x07060504; d=0x0F0E0D0C0B0A0908; memory inside the small endian CPU looks like as following: 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F, memory copy #1. When these piece of memory copied into big endian CPU&#39;s memory, either through a shared memory (e.g., a dual port ram) or transfer through a serial link, hardware can take care of the bit swapping between the two endian data format without any software/firmware/CPU cycle&#39;s load. For example, when transfer than serial link, the hardware can be configured to send least significant bit firstly or most significant bit firstly, with shared memory (e.g., dual port ram), physical pin order would be swapped as
 
 D 7_RAM&lt;---&gt; D 0_CPU
 
 D 6_RAM&lt;---&gt; D 1_CPU
 
 D 5_RAM&lt;---&gt; D 2_CPU
 
 D 4_RAM&lt;---&gt; D 3_CPU
 
 D 3_RAM&lt;---&gt; D 4_CPU
 
 D 2_RAM&lt;---&gt; D 5_CPU
 
 D 1_RAM&lt;---&gt; D 6_CPU
 
 D 0_RAM&lt;---&gt; D 7_CPU
 
This swapping can done with physical PCB layout or a programmable logic (FPGA), as long as it&#39;s implemented with hardware, it will not require any software/firmware/CPU cycle loads.
 
     Inside in big endian CPU&#39;s memory, the same data structure {uint16 a; uint16 b; uint32 c; uint64 d;} would be save as follows: 0x01 0x00 0x03 0x02 0x07 0x06 0x05 0x04 0x0F 0x0E 0x0D 0x0C 0x0B 0x0A 0x09 0x08, memory copy#2. It would take considerable loads for software/firmware/CPU cycles to do these byte order swapping to convert memory copy#1 into copy#2, even the hardware take care of the bit swapping within byte boundary. But once inside big endian CPU side, if we define the data structure with backward ordering as the other end, {uint64 d; uint32 c; uint16 b; uint16 a; inside big endian CPU side, the memory would be saved follows: 0x0F 0x0E 0x0D 0x0C 0x0B 0x0A 0x09 0x08 0x07 0x06 0x05 0x04 0x03 0x02 0x01 0x00, memory copy#3. To get memory copy#3 from memory copy#1, the transfer order needs to be setup backward either on transmit side or receive side, for example, via the CPU&#39;s DMA engine, and it will not require any software/firmware/CPU cycle loads. 
     While preferred embodiments are disclosed herein, many variations are possible which remain within the concept and scope of the present disclosure. Such variations would become clear to one of ordinary skill in the art after inspection of the specification, drawings and claims herein. The present disclosure therefore is not to be restricted except within the spirit and scope of the appended claims. 
     Furthermore, although the foregoing text sets forth a detailed description of numerous embodiments, it should be understood that the legal scope of the present disclosure is defined by the words of the claims set forth at the end of this patent. The detailed description is to be construed as exemplary only and does not describe every possible embodiment, as describing every possible embodiment would be impractical, if not impossible. One could implement numerous alternate embodiments, using either current technology or technology developed after the filing date of this patent, which would still fall within the scope of the claims. 
     It should also be understood that, unless a term is expressly defined in this patent using the sentence “As used herein, the term ‘______’ is hereby defined to mean . . . ” or a similar sentence, there is no intent to limit the meaning of that term, either expressly or by implication, beyond its plain or ordinary meaning, and such term should not be interpreted to be limited in scope based on any statement made in any section of this patent (other than the language of the claims). To the extent that any term recited in the claims at the end of this patent is referred to in this patent in a manner consistent with a single meaning, that is done for sake of clarity only so as to not confuse the reader, and it is not intended that such claim term be limited, by implication or otherwise, to that single meaning. Finally, unless a claim element is defined by reciting the word “means” and a function without the recital of any structure, it is not intended that the scope of any claim element be interpreted based on the application of 35 U.S.C. § 112, sixth paragraph.