I am designing a frequency sensor and have been attempting to use the built-in RMS block to detect the amplitude (peak) of an input sine wave. My attempt runs into the following problem:
Approach tried: Use the RMS block to infer peak amplitude of the input sine wave.
Problem faced: The RMS block computes RMS assuming a predefined/reference frequency, so it does not produce correct results for an input sine of unknown or varying frequency. As a result it fails to detect the peak reliably when the input frequency is not fixed.
Required behavior: I need a block with the same ease-of-use as the existing RMS block but which correctly senses RMS/peak for any unknown input frequency (i.e., frequency-independent RMS or a true instantaneous peak detector for sine waves).
Could someone please advise how to build or configure such a block in PLECS, or suggest alternative approaches (blocks/algorithms) that reliably measure RMS/peak for unknown-frequency sine inputs?
If however, you are looking at a grid connected converter and need to know the peak voltage of your grid you could use the PLECS “Single-Phase PLL” component.
Could you provide a bit more detail on the application? It would be easier to suggest a solution with more context. For example, a peak detection algorithm implemented on a digital microcontroller would be modeled differently than one for an analog peak detection circuit.
The reference you provided helped me solve my problem…I was exactly searching for that algorithm that would let me detect the global maxima of a time varying function in its total simulation…and it it helped me eventaully to build a accurate frequency sensor…where I even replaced the C script derivative block with my own designed derivative algorithm..its giving quite accurate frequency detection…independent of the input amplitude or phase angle..