File Exchange Pick of the Week

Our best user submissions

Import Test Cases From Excel Into Simulink

Greg's pick this week is CMTDTOOL by Yasumitsu Ito.

Contents

Adding Test Cases for Your Simulink Model a Pain? Check out the CMTDTOOL

While the Signal Builder block provides a convenient way to store a variety of test cases for a particular model, it’s less convenient to create and document the tests with it.

Test vectors are nice to store in some tabular form, at which Excel….errr excels. But it’s a little tricky to try and apply those nice tables of data to a Simulink model for testing. Just highlight the test cases in Excel and the click the "Excel Selection to Signal Builder" button and CMTDTOOL will import test vectors from Excel into a Signal Builder block.

This is something Simulink already provides an example for in MathWorks documentation but the CMTDTOOL wraps a nice GUI around this functionality. Now you can execute your nicely formatted test cases against your model of your design.

Test Cases for Designs in Simulink?….Booooriiiing!

Not many engineers enjoy discussing the testing of their designs. Compared to designing and making stuff, testing seems tedious and uncomfortable. It’s similar to going to the local department of motor vehicles to get your driver’s license renewed: it has to be done, but it involves a lot of waiting around with no comfortable place to sit.

Testing is the essence of simulation. The whole reason we simulate is to test out ideas quickly with little risk. And developing better tests helps you produce better designs. We engineers just don’t enjoy making it a formal process with lots documentation.

So It’s Easy, But What Else?

Personally I think it is useful because it allows me to define test cases in a natural format and quickly apply them to my Simulink model.

CMTDTOOL is also well documented. Once you execute the set-up script, the documentation is available in the MATLAB Help Browser.

So CMTDTOOL Brings Life and Vitality to Test Case Development?

Okay, that might be a little strong. A rose is still a rose no matter what name you give it. But certainly the CMTDTOOL can make the process of applying documented test cases to Simulink models less tedious and time consuming.

What Else Can CMTDTOOL Do For Me?

Import Truth Tables from Excel As the name implies, truth tables are tabular data that describe a set of actions based on a particular set of conditions. Again we see the theme of importing tabular data from Excel.

So this

becomes

Generate Model Test Harnesses In more rigorous development environments it is not desirable to change the design specification for testing. That means, “Don’t add stuff to the model just to test it!” The test harness generation will create a new model that references the model under test. The application of the input data and analysis of the system output data is done in the new model.

Generate a Report (i.e. “Show Me the $$”) In high integrity development processes, you haven’t done any testing until you have documentation that shows the results. The CMTDTOOL provides a nice mechanism for some basic reporting on tests of Simulink designs and comparison of expected results versus results from the Simulink simulation.

When engineers use Simulink to develop software specifications for flight code in airplanes, they need to demonstrate immense amounts of documentation that prove the designs have been tested. Automating the generation of the documentation certainly makes the development process easier.

Comments

If you would like to leave any comments regarding this post, please click here.

Or you can leave a comment for Yasumitsu Ito here.




Published with MATLAB® 7.13

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.