This week, I am working on a project with MathWorks consulting where I have been asked to implement in Simulink a simulator already existing in a different language.
As you can imagine, to debug and validate my work, I need to compare a lot of signals in my model with the original data I received.
As a first step, I am trying to validate the static behavior of the model. This means that I simulate the model for only one time step and validate that the outputs are as expected for different inputs.
If the output does not match, then I need to inspect intermediary signals to figure out where the difference originates.
The first, most obvious, way to see the value of a signal in Simulink is the Display block. In my case, using Display blocks quickly made my model look like:
As you can see, the model quickly becomes a mess. And since those displays are only temporary, I will need to remove them later.
Value Label Display
Another option that I often find more convenient to quickly view the value of a signal for debugging is the Value Label Display.
In the Display menu, I can decide if I want the label to be displayed when hovering over the block, or when clicking on it.
There are also options to control how often the labels are updated, and their accuracy. In my case, I chose the long format to see all the digits available.
Once this is enabled, you can simply click on blocks to enable the displays and simulate the model to see the values.
Once your debugging is completed, you can remove all the labels in one click from the Display menu.
Now it's your turn
What is your preferred method to to view signal values during debugging? Let us know by leaving a comment here.
コメントを残すには、ここ をクリックして MathWorks アカウントにサインインするか新しい MathWorks アカウントを作成します。