Real-Time Workshop User's Guide    

Code Validation

After completing the build process, the stand-alone version of the countersdemo model is ready for comparison with the Simulink model. The data logging options selected with the Workspace I/O page of the Simulation Parameters dialog box cause the program to save the control signal, enabled counter, triggered counter, and simulation time. You can now use MATLAB to produce plots of the same data that you see on the three Simulink scopes.

In both the Simulink and the stand-alone executable version of the countersdemo model, the control input is simulated with a discrete-pulse generator producing a 10 Hz, fifty percent duty cycle waveform.

Open the control signal, enabled counter, and triggered counter scopes. Running the Simulink simulation from T=0 to T=2 produces these outputs.

Type who at the MATLAB prompt to view the variable names from Simulink simulation.

Now run the stand-alone program from MATLAB.

The "!" character passes the command that follows it to the operating system. This command, therefore, runs the stand-alone version of countersdemo (not the M-file).

To obtain the data from the stand-alone program, load the file countersdemo.mat.

Then look at the workspace variables.

The stand-alone Ada program prepends rt_ to the logged variable names to distinguish them from the variables Simulink logged.

You can now use MATLAB to plot the three workspace variables as a function of time.


 Signal Properties Analyzing Data with MATLAB