Overview

Following execution, you will want to examine the outputs that were produced. Only outputs that you asked for (in the Execution specification) will be logged, since logging outputs may in some cases be resource-intensive. The outputs are returned in the first output argument of brahms.

The output argument returned is a structure, with a field named for each process or Subsystem in the root system. This layout is iterative, such that each Subsystem field is also a structure, with a field for each process or Subsystem in the Subsystem, and so on. Each process field is also a structure, having a field named for each output of that process that was logged. The contents of the output fields themselves are dependent on the data type being logged.

For numeric data, likely to be the most common data type, an output field is a numeric array, having the same primitive data type as the BRAHMS data object that was logged. The dimension of the output is [a, b, ..., N], where a, b, ... is the dimension of the logged data object, and N is the number of samples logged. For instance, a data object having dimension [1], running at 10Hz for 3 seconds, will produce an output of dimension [1, 30]; an object having dimension [5, 4, 3] running at 5Hz for 1 second will produce an output of dimension [5, 4, 3, 5].

We saw earlier how to log all the outputs of a system. As systems get larger, we are more likely to want to choose which outputs to log, to maintain performance.

Procedure

  • Go back to Solo mode.
  • Stop logging all outputs.
  • Log only particular outputs.
  • Call brahms to execute the system.

Example

Script

This example, along with the others in this section, can be found in the script developing_systems.m in the support/tutorial/system/matlab folder.

M Source Code (against 995)
% section header disp([10 '=== More On Logging ===' 10]) % back to Solo mode exe.addresses = {}; exe.launch = ''; % stop logging all outputs exe.all = false; % log some particular outputs exe = exe.log('resamp>out'); % execute the system out = brahms(psys, exe); % view the system outputs out out.resamp

Expected Output

Matlab Console
=== More On Logging === out = resamp: [1x1 struct] ans = out: [0 0 0 0.042857 0.34286 1.1429 2.1429 3.1429 4.1429 5.1429]