Real Technology Tools

Signal Builder: Build signals in Simulink

In this article, we’ll see what a Simulink Signal Builder is and review the main things you need to know if you’re going to use them, such as how to:

What Is a Simulink Signal Builder

Signal builders are used for creating tests in Simulink. Let’s say you’ve created a low-pass filter and want to make sure that you didn’t make any mistakes while developing it. You may want to input a signal to your low-pass filter such as different kind of sine waves with different frequencies and look at your filter’s behavior.

A Signal Builder also allows you to construct different kinds of test cases so that you are running all of them to study your model’s behavior.

You can find Simulink blocks in the Simulink library at “Simulink/Sources.”  Here’s what the Signal Builder block looks like:

Here is what it looks like when you double-click on it:

signal builder editor default view

How to Use a Signal Builder in MATLAB & Simulink

Add a Point to a Signal in a Signal Builder

As you can see, by default you have what is called “pulse signal.” If you click on the “Start simulation” icon inside the Signal Builder, you will run the simulation with this signal as an output of the signal builder.

You can modify the signal by clicking on one line or one point and moving it around. As you can see, this only modifies the location of the straight lines delimited by points or the location of the points. The issue is that there are only six points on this signal, so how do you add points?

To do that, you need to:

  1. Hold the shift key
  2. Click on the desired location of the point on the signal

This allows you to create the signal shape that you desire in order to test your model:

Add, Delete, and Name an Output Signal in a Signal Builder

Change the Simulation Duration of a Signal Builder

You may also want to modify the simulation time of your signal builder so that you can shape your signal after more than 10 seconds from the start of your simulation. You can do that by going to Axes > Change Time Range… and setting a higher value for the “Max time” field:

Signal Builders and Tests

Add a Test Case to a Signal Builder

So, to add a test case to a Signal Builder:

  1. Click on the gear at the top right of your Signal Builder.
  2. Click Copy.

Run a Specific Test Case

If you want to run a specific test case:

  1. Select it by using the drop-down menu
  2. Click the run icon in your signal builder.

Run All of the Test Cases of Your Signal Builder

You can also run every test case of your model at once. This can be useful if you want to compare your model against an earlier version by observing the differences of behavior between those models for the same set of test cases.

It is also very useful if you want to improve the coverage of your model because if you add test cases,  the model coverage will improve provided that the additional tests are activating parts of the model that the existing ones didn’t.

To run all test cases, you can click “Run all and produce coverage” at the top of your Signal Builder:

Key takeaways:

  1. The signal builder block in Simulink allows you to test your model.
  2. You can add a point to a Signal Builder by:
    1. Holding shift.
    2. Clicking the desired location on your signal.
  3. Add  a signal by using the icons:
  4. Delete a signal by:
    1. Clicking on it.
    2. Pressing the delete key.
  5. Name an output signal using the “Name” field at the bottom left of your Signal Builder.
  6. You can add test cases to a Signal Builder by clicking on:
    1. The gear at the top right of your Signal Builder.
    2. Copy.”
  7. You can run a specific test case of your signal builder by:
    1. Choosing it in the drop-down menu.
    2. Clicking the “Start simulation” icon.
  8. Run every test case by click on “Run all and produce coverage” at the top of the Signal Builder.

For more information, you can refer to the MathWorks documentation about the Signal Builder block:

Exit mobile version