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.

Variable parameters for blocks during simulation in PLECS standalone

0 votes
136 views

 

Hello, 

I want to know if a block parameter is variable when the simulation is running. The problem is explained below using the above circuit as an example:

I want to change the frequency 'f' of the triangle wave generator based on the voltage input value 'Vin' that's been generated by the step function in the circuit. The desired code is shown and has been put in parameter initialization. When I run this code, it shows me an error that 'Vin' is undefined. Is it possible that the 'Vin' calculated during simulation can be used to calculate frequency 'f' of the triangle waveform generator?

 

If not, how can I generate a triangle waveform whose various parameters can be varied during simulation? I trying to use the triangle waveform for generating PWM signals. 

asked Apr 9 by ankul892 (12 points)

1 Answer

+1 vote

The initialization commands are executed prior to the simulation and you can not change parameters from there once the simulation is running. 

Not sure what the best solution is. I have used the state machine block to generate PWM signals in the past like this (f, d are inputs to the state machine):

answered Apr 10 by Falk Kyburz (232 points)
...