Having looked at:
https://www.electro-tech-online.com/threads/voltage-regulator.17464/
I
think I understand what you are trying to do.
You have a randomly varying signal and you are trying to detect and store transients/pulses from that signal which have an amplitude greater than the average amplitude of the signal.
Also, you only want to detect and store the first pulse of a series of pulses.
Am I correct with the above statement?
In your graphics in
https://www.electro-tech-online.com/threads/voltage-regulator.17464/, there is a bit of a confuser.
The pulse on the right hand side, is that the first pulse and the pulses "A" come after it?
If so the first pulse should surely be at the left hand side, time advances to the right on a conventional oscilloscope or trend recorder.
JimB