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.

How to achieve a variable frequency AC voltage source

0 votes
I want to achieve a variable frequency AC voltage source with the frequency variation of +- 0.5Hz frequency, but there is no block for me to realize that. Should I use C-script or this function  cannot be achieved in plecs?
asked Nov 20, 2020 by shichenseu (259 points)
Do you have a predefined set of voltage source data? Or how do you want to change the frequency? Is the frequency variation random or follows a pattern?

1 Answer

0 votes
You can use a Trigonometric Function and a Voltage Source (Controlled) component to create a voltage source of arbitrary phase and frequency.

For the time/angle input, you can use a Clock component for offline simulations and for real-time simulations you'll want to use a wrapping integrator.  There is an example of a C-Script based wrapping integrator in the C-Script documentation in the PLECS Manual (see: Event Handling - Wrapping Integrator) and variations in several of the demo models (Look in the PLL's of the STATCOM Cascaded H-Bridge Converter, Three-Phase Grid-Connected PV Inverter, and Z-Source Inverter, among others).
answered Nov 20, 2020 by Bryan Lieblick (728 points)