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, as shown in this image.

Sensors read the displacement of the masses. The controller regulates the height at the center of the beam 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, , to level the beam.

Model ex_modeling_signals represents the system.

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.

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.

Model ex_modeling_simulation_data_inspector removes the Scope blocks and related signal lines, then enables data logging for those signals.

To view the logged signals after simulation, open the Simulation Data Inspector by clicking the highlighted Simulation Data Inspector button.

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, model ex_modeling_composite_signals provides an even more readable system representation.

The simulation results remain the same after signals are grouped in buses. This example enables data logging for signal lines associated with buses x_sensor and goal instead of logging data individually for each of the signals in these buses.

Related Topics