Best way to test Simulink model that doesn't change over time

2 views (last 30 days)
I have a Simulink model which takes a bus of discrete values in, transforms them, and outputs the results. This essentially models a simple function like in a standard programming language. What would be the best way to test this? Most of the available tools seem to be for data that changes over time, whereas I want to simply plug some data in and confirm that the result is correct. I have tried using the Test Sequence and test manager tools but these make it hard to view the output with just one timestep and they also regularly take a significant amount of time to complete or hang (I believe due to the size of my data). There are no problems with running the model by itself and observing inputs and outputs in a small test system, so I know that it compiles and runs fine, but this setup does not make it easy to switch in and out data for standardised testing.

Answers (1)

Akshat Dalal
Akshat Dalal on 7 Oct 2024
Hey Matt,
You can probably write a matlab script that simulates your model programatically using the 'sim' command. The inputs can be stored in workspace or excel and then you can iterate through the inputs. You can also have expected outputs stored somewhere for direct comparison or write a simple logic for dynamically testing the output.
Also, you can keep the time-step and simulation time same as your model is static. This will execute the inputs only once which should be quicker to simulate and test.
If needed, you could also generate code for your model for further testing and analysis.

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!