Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

Errors in simple peak detector (State-Souce dependence during switching)

0 votes
I built a very simple peak detector (attached), but i get an error that i have state/source-dependence during switching.

It must be a basic error, so what am i doing wrong ?

Model attached
asked Apr 11, 2020 by srinath (26 points)
Sorry, have added the model to original post

1 Answer

0 votes

Hi Srinath,

As the error states, the capacitor state is directly dependent on the voltage source. What this means has been elaborately answered here -- If you add a small resistance in series either to the source or to the capacitor, you won't have this direct dependence anymore.

Also, if all you're trying to do is find out the peak value of your periodic waveform, then this could be implemented in a better way either using the C-script block or the State Machine block. Please see the attached example.


answered Apr 12, 2020 by Manu Parimi (297 points)
edited Apr 12, 2020 by Manu Parimi