This example compares the result of the total harmonic distortion (THD) with respect to the fundamental wave and with respect to the total root mean square (RMS). In this simulation model a non-sinusoidal voltage wave form is created by the superposition two voltage waves:

- Fundamental wave with RMS voltage
`V1`

and frequency`f1`

- Third harmonic wave with RMS voltage
`V3`

and frequency`3*f1`

This simulation model compares numerically determined THD values with results, obtained by theoretical calculations:

- Compare the numerically determined THD value
`thd1.y`

and the theoretical value`THD1`

, both with respect to the fundamental wave; also plot`thd1.valid`

- Compare the numerically determined THD value
`thdRMS.y`

and the theoretical value`THDrms`

, both with respect to the RMS value; also plot`thdRMS.valid`

Generated at 2023-10-02T00:32:21Z by OpenModelicaOpenModelica 1.22.0~dev.02-2-ge84afdd using GenerateDoc.mos