<< Chapter < Page | Chapter >> Page > |
Figure 21 shows the block-diagram for the real time implementation. The DSP will deliver two outputs. The first is the reference spectrum; the second is an estimated spectrum of the output of the all-pole filter. Three real-time models will be created, each one corresponding to an estimator. The user will be able to select the desired estimator through a Graphic User Interface (GUI).
The real-time implementation model will be created from the simulation model, after the following changes:
Equipment Used:
The GUI shown in Figure 32 will be used to select the model. Upon selecting a model, its correspondent load file will be loaded to the DSP.
Periodogram
BurgM-Cov
function Spectrum_OpeningFcn(hObject, eventdata, handles, varargin)
modelName = gcs;%connect to target:
CCS_Obj = connectToCCS(modelName);% Identify RTDX channel names/modes
CodegenDir = fullfile(pwd, ['Periodogram' '_c6000_rtw']);
OutFile = fullfile(CodegenDir, ['Periodogram' '.out']);
%load the model to the DSK:CCS_Obj.load(OutFile,20);
handles.CCS_Obj=CCS_Obj;handles.output = hObject;
%remember the current model:handles.last_model=1;
CCS_Obj.run;% Update handles structure
guidata(hObject, handles);
%1. halts the current model
%2. loads the current model%inputs:
%m - 3 levels flag that tells which model to load.%CCS_Obj - the target object
function ChangeModel(m,CCS_Obj)CCS_Obj.halt;
switch mcase 1
model='Periodogram';case 2
model='Burg';case 3
model= 'MCov_AR';end
CodegenDir = fullfile(pwd, [model '_c6000_rtw']);
OutFile = fullfile(CodegenDir, [model '.out']);
CCS_Obj.load(OutFile,20);CCS_Obj.run;
if last_y~=15000r.writemsg(chan_struct(2).name,1/last_y);
end
function listbox1_Callback(hObject, eventdata, handles)
handles.last_model=get(hObject,'Value') ;ChangeModel(handles.last_model,handles.CCS_Obj);
guidata(hObject, handles);
The handler saves the new model as the current model and invokes the change model function we described above.
Now you can run the model, and observe the results in the oscilloscope for the various estimators.
Notification Switch
Would you like to follow the 'From matlab and simulink to real-time with ti dsp's' conversation and receive update notifications?