modelDemoSignalCharacteristic
Demonstrate characteristic values of a signal
Extends from Modelica.Icons.Example (Icon for runnable examples).
Information
This example demonstrates how to calculate characteristic values of the pulse signal y
| Characteristic quantity | Numerically calculated | Analytically calculated |
| Mean | mean.y |
y_mean |
| Rectified mean | rectifiedMean.y |
y_rect |
| Root mean square | rootMeanSquare.y |
y_rms |
| First harmonic | harmonic.y_rmsharmonic.y_arg |
y1_rmsy1_arg |
The output of these blocks is updated after each period of the signal.
Using a simple pulse series, these values can be calculated analytically. Propagating these values as initial values for the output, we can compare the numerical solution with the analytical solution: The output is constant from the beginning.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real | app | 1 | Peak-to-peak value of pulse signal |
| Real | dutyCycle | 0.5 | Duty cycle of pulse signal |
| Real | offset | 0 | Offset of pulse signal |
| Modelica.Units.SI.Frequency | f | 50 | Base frequency of pulse signal |
| Real | y_mean | offset + app*dutyCycle | Mean value |
| Real | y_rect | abs(offset + app)*dutyCycle + abs(offset)*(1 - dutyCycle) | Rectified mean |
| Real | y_rms | sqrt((offset + app)^2*dutyCycle + offset^2*(1 - dutyCycle)) | Root mean square |
| Real | y1_cos | ((offset + app)*(sin(dutyCycle*2*pi) - sin(0)) + offset*(sin(2*pi) - sin(dutyCycle*2*pi)))/pi/sqrt(2) | First harmonic cosine rms component |
| Real | y1_sin | ((offset + app)*(-cos(dutyCycle*2*pi) + cos(0)) + offset*(-cos(2*pi) + cos(dutyCycle*2*pi)))/pi/sqrt(2) | First harmonic sine rms component |
| Real | y1_rms | sqrt(y1_cos^2 + y1_sin^2) | RMS value of first harmonic |
| Real | y1_arg | atan2(y1_sin, y1_cos) | Argument of first harmonic |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Real | y | pulse.y | Investigated pulse signal |
| Sources.Pulse | pulse | ||
| Math.Mean | mean | ||
| Math.RectifiedMean | rectifiedMean | ||
| Math.RootMeanSquare | rootMeanSquare | ||
| Math.Harmonic | harmonic |