Use the following steps to integrate
the SFRA in the project:
- To enable the SFRA functionality,
the predefine symbol SFRA_ENABLE must be added in the project properties as
shown in Figure 4-2.
- To start an SFRA sweep, put the
SFRA object in the watch window.
- Write SFRA_OBJ.start to 1, when you
want the SFRA sweep to start as shown in Figure 4-39.
- Monitor the SFRA_OBJ.FreqIndex
variable; the variable gradually increments as SFRA sweep is performed.
- Once the SFRA_OBJ.FreqIndex reaches
Vec_Length, the SFRA sweep is complete.
- As part of the SFRA initialization,
the Open Loop and Plant Magnitude and phase are stored in arrays called.
__attribute__ ((section(".sfradata"))) float32_t plantMagVect[SFRA_FREQ_LENGTH];
__attribute__ ((section(".sfradata"))) float32_t plantPhaseVect[SFRA_FREQ_LENGTH];
__attribute__ ((section(".sfradata"))) float32_t olMagVect[SFRA_FREQ_LENGTH];
__attribute__ ((section(".sfradata"))) float32_t olPhaseVect[SFRA_FREQ_LENGTH];
__attribute__ ((section(".sfradata"))) float32_t freqVect[SFRA_FREQ_LENGTH];
- Put these in the watch window to
inspect and study the response.
- Once the sweep is complete, click
on View-> MemoryBrowser inside CCS.
- Inside Memory Browser, enter
&freqVect to see the frequency vector and select 32-bit floating point,
- Click on save memory, shown
encircled in Figure 4-41.
- A pop-up
window appears. Select TI data and specify the file name *.dat in the location
you prefer.
- Click on Next and specify the
address from the memory browser for the start of the array and then the
length.
- Make sure 32-bit floating point is
selected. Click Finish.
- This saves the data in *.dat
file.
- Repeat this step for plantMagVect,
plantPhaseVect, olMagVect, olPhaseVect, so you have 5 *.dat files.
- If you want to use this data in
MATLAB or other tools, the data can be populated to an excel file.
- Open the SFRA.xlsx file located at
<project directory>\libraries\SFRA\scripts in excel.
- You can choose to re-name and save
the file.
- This excel sheet has five columns,
in the first column is the frequency data.
- Open the *dat file that was saved.
- Select the data from the second
line onwards to the end of the file and do Ctrl+C to copy the data.
- Open the Excel File, go to the
first element under the corresponding vector and do Ctrl+V to copy the array.
- Repeat the steps for each
column.
- Once the excel file is updated for
all five columns, use the MATLAB script to import the SFRA data. Then, use the
script inside sisotool to design compensator and carry out stability
analysis.