User`s guide
Signal Logging
3-39
All scopes copy the last N samples from the log buffer to the target object logs
(
tg.TimeLog, tg.OutputLog, tg.StateLog, and tg.TETLog). xPC Target
calculates the number of samples
N for a signal as the value of Signal logging
buffer size in doubles
divided by the number of logged signals (1 time, 1 task
execution time (TET), outputs, states).
After you run a target application, you can plot the state and output signals.
This procedure uses the Simulink model
xpc_osc3.mdl as an example, and
assumes you have created and downloaded the target application for that
model. It also assumes that you have assigned
tg to the appropriate target PC.
1 In the MATLAB window, type
+tg or tg.start or start(tg)
The target application starts and runs until it reaches the final time set in
the target object property
tg.StopTime.
The outputs are the signals connected to Simulink Outport blocks. The
model
xpcosc.mdl has just one Outport block, labeled 1, and there are two
states. This Outport block shows the signals leaving the blocks labeled
Integrator1 and Signal Generator.
2 Plot the signals from the Outport block and the states. In the MATLAB
window, type
plot(tg.TimeLog,tg.Outputlog)
Values for the logs are uploaded to the host PC from the target application
on the target PC. If you want to upload part of the logs, see the target object
method
getlog on page 14-44.
The plots shown below are the result of a real-time execution. To compare
this plot with a plot for a non-real-time simulation, see “Simulating the
Model from MATLAB” in Chapter 3 of the xPC Target getting started
documentation.