This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SFRA: SFRA Collect: Commanded vs Measured Variable Sample Delay

Part Number: SFRA

Hi,

I am using the SFRA library and had a question about the examples and documentation handled the collection of data.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
//! \brief Collects the response of the loop because of small signal disturbance
//! injected
//! \param *control_output pointer to the variable where control output is saved
//! note though the parameter is passed by reference
//! it is unchanged by the module
//! \param *feedback pointer to the variable where control output is saved
//! note though the parameter is passed by reference
//! it is unchanged by the module
//! \return None
//!
extern void SFRA_F32_collect(float *control_output, float *feedback);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 

In SFRA Collect, we provide the output control value at time (t1) and the measured feedback.   Should the feedback be from time t0 or from time t1?

Figure 10 makes me think that the SFRA_collect should be called with the output and measured effect of that output.  I.e SFRA_collect(&LastDutyPu, Vout1_Read);

However, the code snippet calls SFRA_collect with an output and the effect of the last output.  I.e. SFRA_collect(&DutyPu, Vout1_Read);

If the ISR frequency is running quickly, i'm assuming an off by one index error isn't a big deal but I was wondering what the right way to do it is.

Thanks,

-Colin

  • Hi Colin,

    Our expert will get back on this issue today.

  • Hi Colin,

    There is one perturbed results per one perturbation. In this ISR, the reading line is after the perturbation line. So think if the first reading is noid, the current reading corresponds to the the last perturbation. This pair will be used to calculate the transfer function Mag and Ph at one frequency.

    Thanks

  • Thanks.  Does "noid" mean null and void?

    Am I interpreting your answer correctly to mean that the exampe .c code isn't doing it correctly?  And that it should be more like:

    float last_inject_val;

    isr()

    {

        adc_val = read_adc();

        SFRA_collect(last_inject_val, adc_val);

        inject_val =  SFRA_inject();

        set_pwm(inject_val);

        last_inject_val = inject_val;

    }

  • Colin,

    Mathematically I agree with your interpretation.  In reality you will first inject a perturbation then collect one meaningful perturbed result, which is a meaningful result. SFRA is a sweep process, not a constant one, so the starting point should be the timing when perturbation is injected  Thus, I would not say the example c.code is incorrect. 

    Thanks