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.

Error - Generate 3 X 120 phase shifted PWM

0 votes

Hello All,

I am trying to generate 3 PWM which are 120degree phase apart in Fixed step simulation model and having trouble with choosing sample time. 

PWM generator high resolution period as sample time for 65khz signal which create issue in choosing integer multiple sample times !  

PLECS MSG : Required sample time period (3.846153846153846e-06)


Any help would be much appreciated. 

Thanks in Advance 


asked Apr 22, 2021 by sreerajarole (17 points)
Hello ! Thank you for the reply.

Attached the PLECS stand alone model

2 Answers

+1 vote
Best answer

When using a fixed time step, you have to make sure that all fixed-step events in the model are an integer multiple of the defined fixed step size parameter.  With Tsw=1/65e3:

  • The PWM modulator requires a fixed time step that's an integer divisor of Tsw/4 (your current time step of 3.846e-06 from the error message).
  • Phase shifts require a time step that's an integer divisor of Tsw/3 and 2*Tsw/3.
  • You probably want something less than that in order to accurately generate the PWM waveforms for different duty cycles.  The PWM duty cycle quantization is directly linked with the fixed step size.
So with the points above, your fixed step solver size should be an integer divisor of Tsw/12 in order to eliminate the error messages.  The divisor factor determines your PWM quantization error.  Attached is a model that shows this.  Note it uses variables set in the Model Initialization Commands.

Using a variable step solver simplifies this process greatly.  It might also run faster by avoiding unnecessary solver steps.  Also note there's no provision against having fixed-step periodic events when using a variable-step solver.  Please reconsider if there's another way to model the fixed-step portion of your system in a way that's compatible with a variable-step solver.

Lastly, you probably want to implement the phase delay by shifting the carrier as you would in most hardware, not by delaying the PWM signals, as shown in the attached model.

answered Apr 27, 2021 by Bryan Lieblick (1,995 points)
selected May 3, 2021 by sreerajarole
Hello Bryan,

Thank you very much for the detailed information. Much appreciated.
0 votes
Please upload your model to the forum ,only in this way, can others help you examine your error.
answered Apr 23, 2021 by shichenseu (299 points)
Hello ! Thank you very much for the reply. Attached the model
Why do you require a fixed step simulation for this model?

And you really mean to feed the modulator an index of 0.5? If the reference signal is sinusoidal, for example, you can simply vectorize the phase parameter for the Sine Wave Generator block, as, e.g. [0 -2*pi/3 2*pi/3].
Hello Kris !

Thanks for the reply.

I am trying to integrate the PLECS plant with my Simulink model which has requirement to run in fixed step.

Currently just to demonstrate,  0.5 value fixed value is used to see whether I can generate PWM with 50% duty cycle and phase shift it.