How harmonics and THD are calculated from a COMTRADE record
Which cycles are analysed, how each harmonic is measured, why nothing above the Nyquist order is reported, and the THD and K-factor formulas SagSwell uses.
The Harmonics tab in SagSwell shows, for every voltage and current channel, the amplitude of each harmonic, the THD and the K-factor. This page describes the calculation behind those numbers and the limits a COMTRADE record places on them.
Which cycles are analysed
- Before the event: up to eight whole cycles of the record’s quiet part, ending a quarter of a cycle before the first sag or swell (or before fault inception). Short pre-trigger sections give fewer cycles, down to one.
- During the event: two cycles starting at the deepest point of the disturbance.
Whole cycles matter: a Fourier transform over a non-integer number of cycles spreads the fundamental into the neighbouring harmonics and inflates THD.
How each harmonic is measured
For harmonic order h, over the M samples of the window:
X_h = (2/M) · Σ x_k · e^(−j·2π·h·f0·k/fs) V_h (RMS) = |X_h| / √2
Each order is evaluated directly at h × f0, the nominal frequency from the .cfg. The window is rectangular, which is exact when it holds whole cycles at the nominal frequency.
Nothing above the Nyquist order
A recorder sampling n points per cycle cannot see anything above harmonic n/2. Worse, asking for a higher order does not return zero: it returns an alias of a lower one. On a power meter sampling 32 points per cycle, orders 31 and 33 fold straight back onto the fundamental. A real meter record read without this limit gave a voltage THD of 124.8% where the true value was 1.7%.
Nyquist order = floor( fs / (2 · f0) ) reported up to min(50, Nyquist order)
SagSwell stops the spectrum at the Nyquist order and says on the chart where it stopped, so a short spectrum is shown as short rather than padded with aliases.
THD and K-factor
THD = √( V2² + V3² + … + V_H² ) / V1 × 100 % K = Σ h² · I_h² / Σ I_h² (h = 1 … H)
H is the highest order reported. THD is not given for a channel with no meaningful fundamental, such as an unused current input reading a few milliamps of noise.
Reading the result
A record lasts seconds, and IEEE 519 is assessed statistically over days or weeks, so a record’s THD is a snapshot of one moment, not an assessment of a site. The IEEE 519 guide covers the limits and why that distinction matters. The variable-speed-drive sample is a good record to try the Harmonics tab on.
Questions people ask
- What is the highest harmonic a COMTRADE record can show?
- Half the number of samples per cycle (the Nyquist order). At 32 samples per cycle that is the 16th harmonic; at 128 samples per cycle, the 64th. SagSwell reports up to the 50th or the Nyquist order, whichever is lower.
- Which part of the record is used for THD?
- Two windows: up to eight whole cycles of the undisturbed part before the first event, and two cycles at the deepest point of the disturbance. The pre-event figure is the one to compare with steady-state limits.
- Why does a channel show no THD at all?
- Because THD is a percentage of the fundamental. A channel with nothing connected has no fundamental, only noise, and dividing by almost zero would give a meaningless figure in the thousands of per cent, so none is shown.
- Is THD the same as TDD?
- No. THD divides by the fundamental at that moment; TDD (used for currents in IEEE 519) divides by the maximum demand current, which a short record does not contain.
References
- IEEE Std 519-2022, IEEE Standard for Harmonic Control in Electric Power Systems
- IEC 61000-4-7:2002+A1:2008, General guide on harmonics and interharmonics measurements
- IEEE Std C57.110-2018, Recommended Practice for Establishing Liquid-Immersed and Dry-Type Power Transformer Capability When Supplying Nonsinusoidal Load Currents (K-factor)
Free tools
- COMTRADE to CSV converter
- COMTRADE file checker
- ITIC (CBEMA) curve checker
- Symmetrical components calculator (positive, negative, zero sequence)
- Sample COMTRADE files
More guides
- How to open COMTRADE files online (.cfg, .dat, .cff)
- The COMTRADE file format explained (IEEE C37.111)
- The COMTRADE .cfg file, line by line (with an annotated example)
- COMTRADE viewer for Mac, Linux and Chromebook (no install)
- Free COMTRADE viewers compared (2026): browser, desktop and code
- Voltage sags, swells and interruptions: the IEEE 1159 categories
- ITIC (CBEMA) curve: chart, corner points and SEMI F47
- Harmonics and THD from a fault record: what IEEE 519 does and does not tell you
- Opening COMTRADE records in SagSwell: files, pairs, zip and demo records
- The waveform view: zoom, cursors, channels and values at the cursor
- The record summary: sampling, frequency, voltage range, THD, unbalance and trip
- The harmonics view: spectrum, IEEE 519 limits by bus voltage and NEMA MG-1 derating
- The file check: what SagSwell read, inferred or found wrong in a COMTRADE file
- Events, sites and notes: grouping records from several recorders
- What SagSwell Pro adds: diagnosis, event replay, PQ timeline, reports and sharing
- Is it safe to open COMTRADE files online? Where your records go
- How to read a fault record: a step-by-step method
- Voltage sag types A to G: what the three phases tell you about the fault
- Fault, motor start or transformer energising? Telling sag causes apart in a record
- CT saturation in fault records: how to recognise it
- Transformer inrush or internal fault? Reading the difference in a record
- How one-cycle RMS is calculated from a COMTRADE record
- How sags, swells and interruptions are detected and classified
- How phasors and symmetrical components are calculated
- How to get COMTRADE files from an SEL relay
- How to export COMTRADE fault records from Siemens SIPROTEC 5 (DIGSI 5)
- How to get COMTRADE disturbance records from ABB Relion relays (PCM600)
- How to extract COMTRADE disturbance records from MiCOM P40 Agile relays (S1 Agile)
- How to get COMTRADE oscillography from GE Multilin UR relays
- SIGRA alternative: a free browser viewer for COMTRADE fault records
- WaveWin alternative: opening COMTRADE without installing software
- TransView alternative: a browser COMTRADE viewer for power-quality questions