Main Content

Manage Signal Lines

As a model grows, model components help functionally and visually organize blocks in the model. To similarly organize signal lines in the model, you can apply a variety of strategies, such as grouping signals into buses.

To demonstrate how to reduce signal line clutter, this example implements a model with multiple sensors and actuators. The system has two springs, dampers, and masses. A beam connects the two masses.

Sensors read the displacement of the masses. The controller regulates the height at the center of the beam $x$ and levels the beam by computing the force the actuators must apply to the masses. The controller uses the height difference between the beam ends, $delta$, to level the beam.

The model named ex_modeling_signals represents the system and its environment, operator, and controller.

To display signals after simulation, the model uses two Scope blocks. One Scope block shows the goal and actual beam levelness. The other Scope block shows the goal and actual position of the beam at its center, along with the actual beam position at both ends.

Mark Signals for Logging

To reduce the number of signal lines, you can connect a viewer directly to signal lines or enable data logging for signal lines. By choosing a way to visualize simulation data without using a sink block, you can avoid extra signal lines.

The model named ex_modeling_simulation_data_inspector removes the Scope blocks and related signal lines then enables data logging for those signals.

In the Operator subsystem, the signals labeled x_goal and delta_goal are marked for logging, as indicated by the icon that appears above each signal.

In the Controller subsystem, the signals labeled x and delta are marked for logging.

In the Mechanical System subsystem, the signals labeled x1 and x2 are marked for logging.

The Simulation Data Inspector lets you view the logged signal data after simulation.

Group Signals in Buses

To further reduce the number of signal lines, you can group signal lines into a bus by using a Bus Creator or Out Bus Element block. All signal lines retain their identities when grouped in a bus and can be separated downstream from the bus.

By creating buses, the model named ex_modeling_composite_signals provides an even more readable system representation.

This model enables data logging for the signal lines associated with the buses named x_sensor and goal instead of logging data individually for each of the signals in these buses.

The simulation results remain the same after signals are grouped in buses.

Related Topics