TotalHarmonicDistortion
Output the total harmonic distortion (THD)
Library
Modelica/Blocks/Math
Description
This block determines the total harmonic distortion (THD) over the given period 1/f
.Consider that the input u
consists of harmonic RMS componentsU1
, U2
, U3
, etc.The total RMS component is then determined by:
The calculation of the total harmonic distortion is based on the parameter useFirstHarmonic
.The default value useFirstHarmonic = true
represents the standard THD calculation used inelectrical engineering.The non-default value useFirstHarmonic = false
calculates the THD typically used for the assessment of audio signals.
If useFirstHarmonic = true
, the total higher harmonic content (harmonic order numbers > 1)refers to the RMS value of the fundamental wave:
If useFirstHarmonic = false
, the total higher harmonic content (harmonic order numbers > 1)refers to the total RMS:
In case of a zero input signal or within the first period of calculation, the boolean output signalvalid
becomes false
to indicate that the calculation result is not valid. Validcalculations are indicated by valid = true
.
Parameters
Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|
mo_f | f | Base frequency | Scalar | |
mo_useFirstHarmonic | useFirstHarmonic | THD with respect to first harmonic, if true; otherwise with respect to total RMS | Scalar | true |
Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|
mo__nmodifiers | Number of Modifiers | Specifies the number of modifiers | Number | |
mo__modifiers | Modifiers | Add new modifier | Structure | |
mo__modifiers/varname | Variable name | Cell of strings | ||
mo__modifiers/attribute | Attribute | Cell of strings | 'start' | |
mo__modifiers/value | Value |
Ports
Name | Type | Description | IO Type | Number |
---|---|---|---|---|
u | implicit | Connector of Real input signal | input | 1 |
y | implicit | Connector of Real output signal | output | 1 |
valid | implicit | True, if output y is valid | output | 2 |