Best way to test Simulink model that doesn't change over time
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
Akshat Dalal
2024-10-7
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Outputs 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!