Simcoder sampling frequecy

Rick_22442
Rick_22442 New Altair Community Member
edited September 2023 in Community Q&A

Hi!

     I am using the simcoder to generate code for my ti dsp. Usually, the controller process frequency needs to be higher than the switching frequency. However, Psim asks the pi controller in the z domain to have the same frequency as the PWM generator. Is there any way to raise the pi controller sampling frequency to the PWM generator frequency so I can generate a code that has a higher process frequency than the switching frequency?

 

Rick Li

Tagged:

Answers

  • Rhonda_20369
    Rhonda_20369 New Altair Community Member
    edited September 2023

    Hi, Rick,

    You can try to implement at the following way:

    Assume that switching frequency is 10KHz, the system fetches ADC data at 10% of PWM period and fetches ADC data at 60% again.

    Please connect the same signal to 2 ADC channels.

    1. Set PWM1 frequency to 10KHz, set PWM ADC trigger position at 0.1, all calculations at 10% are set to 10KHz sampling frequency.

    2. Set a spare PWM (say PWM6) to 9.9999999999KHz, set PWM ADC trigger position to 0.6, all calculations at 60% are set to 9.9999999999KHz sampling frequency.

    3. the results from 9.9999999999KHz calculation go to 10KHz by inserting a 10KHz ZOH block at the ADC channel output.

    A simple example is attached.