Other Parts Discussed in Thread: SFRA
I am not sure is my SFRA correctly configured. I am using it for Solar inverter, based on TMDSSOLAR(P/C)EXPKIT. I want to turno on SFRA in open loop so I can tune the current loop controller. My output voltage wave has no disturbances. ALthough after I turn on SFRA , it does not looks like stable system.
Output voltage:

My SFRA output is:

When I SFRA's output from other projects the line is more flat than in mine and this is only open loop.
I follow the implementation from the User guide and I also check example projects and implementation in other designs.
My implementation:
void A1(void) // Dash Board Measurements
//--------------------------------------------------------
{
SFRA_F32_runBackgroundTask(&sfra1);
SFRA_GUI_runSerialHostComms(&sfra1);
//-------------------
//the next time CpuTimer0 'counter' reaches Period value go to A2
A_Task_Ptr = &A2;
//-------------------
}
(...)
interrupt void inverterISR(void)
{
invDutyPU = SFRA_F32_inject(invSine * invModIndex);
invDuty= ((float32_t)(INV_PWM_PERIOD)) * (fabsf(duty));
if(duty>=0)
{
EPWM_setCounterCompareValue(base1,EPWM_COUNTER_COMPARE_A,0);
EPWM_setCounterCompareValue(base2,EPWM_COUNTER_COMPARE_A,invDuty);
}
else
{
EPWM_setCounterCompareValue(base1,EPWM_COUNTER_COMPARE_A,invDuty);
EPWM_setCounterCompareValue(base2,EPWM_COUNTER_COMPARE_A,0);
}
SFRA_F32_collect(&invDutyPU,&inv_meas_cur_diff_inst);
}
void setupSFRA(void)
{
//
//Resets the internal data of sfra module to zero
//
SFRA_F32_reset(&sfra1);
//
//Configures the SFRA module
//
SFRA_F32_config(&sfra1,
INV_PWM_SWITCHING_FREQUENCY,
SFRA_AMPLITUDE,
SFRA_FREQ_LENGTH,
SFRA_FREQ_START,
SFRA_FREQ_STEP_MULTIPLY,
plantMagVect,
plantPhaseVect,
olMagVect,
olPhaseVect,
clMagVect,
clPhaseVect,
freqVect,
1);
//
//Resets the response arrays to all zeroes
//
SFRA_F32_resetFreqRespArray(&sfra1);
//
// Initializes the frequency response array ,
// The first element is SFRA_FREQ_START
// The subsequent elements are freqVect[n-1]*SFRA_FREQ_STEP_MULTIPLY
// This enables placing a fixed number of frequency points
// between a decade of frequency.
// The below routine can be substituted by a routine that sets
// the frequency points arbitrarily as needed.
//
SFRA_F32_initFreqArrayWithLogSteps(&sfra1,
SFRA_FREQ_START,
SFRA_FREQ_STEP_MULTIPLY);
//
// configures the SCI channel for communication with SFRA host GUI
// to change SCI channel change #define in the sfra_gui_scicomms_driverlib.c
// the GUI also changes a LED status, this can also be changed with #define
// in the file pointed to above
//
SFRA_GUI_config(SFRA_GUI_SCI_BASE,
SysCtl_getLowSpeedClock(DEVICE_OSCSRC_FREQ),
SFRA_GUI_SCI_BAUDRATE,
SFRA_GUI_SCIRX_GPIO,
SFRA_GUI_SCIRX_GPIO_PIN_CONFIG,
SFRA_GUI_SCITX_GPIO,
SFRA_GUI_SCITX_GPIO_PIN_CONFIG,
SFRA_GUI_LED_INDICATOR,
SFRA_GUI_LED_GPIO,\
SFRA_GUI_LED_GPIO_PIN_CONFIG,
&sfra1,
(uint32_t)1);
}
// DEFINES:
#define INV_PWM_SWITCHING_FREQUENCY 20000
#define SFRA_FREQ_START 100
#define SFRA_FREQ_STEP_MULTIPLY (float32_t)1.059253 // 1.05
#define SFRA_AMPLITUDE (float32_t)0.01 //0.05
#define SFRA_GUI_VBUS_CLK 50000000
#define SFRA_FREQ_LENGTH 100