Testing large-scale models in SIMULINK

10 views (last 30 days)
We are creating a synthetic envrionment where all our subsystems are software models (i.e. no actual physical system is present). In the previous designs of our system, the component models were done in C. To improve our approach, we hae decided to take SIMULINK approach and see how much we can improve in efficiency. The confusions we are faced with are:
1) Testing - How to unit-test a large scale and multirate system in SIMULINK without involving HIL and PIL testing (i.e. xPC target)? What we have done so far is create a wrapper model which will then connect to a set of CONSTANT/STEP/SEQUENCE STAIR blocks (i.e. test inputs) in SIMULINK and displays outputs (after simulation run) in a scope. Is that what SIMULINK is actually useful for? Because it took us a long time to knock out that test model. Are you supposed to do testing like this?
2) Understanding the correct use of SIMULINK - Because we are creating a software model of one/many physical systems and then joining them together to complete integration, we don't have the luxury to do HIL or PIL testing as there is no proper interface. But, we do need the generated C code because our target computer (i.e. the one which will be used to run the simulation) can use C code. In a case like ours, can we even use SIMULINK or is it atually not fit for purpose for this case? Because, we are starting to think that it may not be.
P.S. I have visited a lot of SIMULINK tutorial videos and it seems that everything is pointing to using different blocksets (e.g. SimMechanics, Simelectronics, SimHydraulics, xPC target) for HIL and PIL testing instead of focusing on old fashioned black-box testing a SIMULINK model. What is the solution for testing a large-scale model without HIL or PIL?

Accepted Answer

Abhishek
Abhishek on 17 Sep 2013
For testing Simulink models, there are a few features in Simulink which might help you:
  1. Signal logging in Simulink: http://www.mathworks.com/help/simulink/signal-logging.html Using signal logging, you can save the signal data for post-processing.
  2. Simulation Data Inspector: http://www.mathworks.com/help/simulink/validate-system-behavior.htmlSimulation Data Inspector is a post-processing tool which lets you record and compare simulation data. For a programmatic workflow, you might be interested in the API: http://www.mathworks.com/help/simulink/ug/record-and-inspect-signal-data-programmatically.html
  3. Signal Builder block: http://www.mathworks.com/help/simulink/gs/overview.htmlThere is a tutorial on how you can use Signal Builder block and SDI to run test simulations and then compare the results: http://www.mathworks.com/help/simulink/gs/overview.html
  4. You might also be interested in Simulink Verification and Validation: http://www.mathworks.com/products/simverification/description5.html. You can automate the harness model generation through the functions in this tool. This will probably address your concern about creation of the wrapper model for unit testing.
To answer your second question, Simulink is perfect for your use case. I am not sure I understand the part “..we don't have the luxury to do HIL or PIL testing as there is no proper interface”. If you are interested in generating C code and run it on a target computer, I would recommend taking a look at one of our products called “Embedded Coder”: http://www.mathworks.com/products/embedded-coder/. Here is a quick introduction to Embedded coder: http://www.mathworks.com/videos/introduction-to-embedded-coder-68810.html
I hope it helps answer your questions.
Thanks,
  4 Comments
Mohammed Manna
Mohammed Manna on 17 Sep 2013
This is the first time I am hearing Model in the Loop (MIL). So I create a model and i run unit test or whichever test I like or need on that model? Sounds like you have clicked the right button. Would you be kind to educate me on that? Especially, what Mathworks has in this area? I am very keen not to depend on the add-on (paid) blocksets (except Embedded Coder). Also, if you have any tutorial video from Mathworks that covers this topic, I will be grateful to know about it.
In case you did not manage to figure out what I am trying to do, I am more than happy to explain it slightly more. The reason I kept it minimised in my original post is that there are sensitive product information which I am not meant to disclose.
Nathan Crosty
Nathan Crosty on 17 Sep 2013
Really that is the main purpose of "Simulink..." it is to be able to "Simulate" your model. That means, solving using ODE's in a non-real time configuration. I think that you should take some of the keywords and do some reading. Look up ODE, Simulation, Closed Loop Model, Model in the Loop. That should be a good start.

Sign in to comment.

More Answers (1)

Jens
Jens on 13 Jan 2014
Edited: Jens on 13 Jan 2014
It seems like you are looking for a testing tool that provides closed loop as well as real-time functionalities. TPT is such a testing and verification tool for Simulink models in MiL, SiL, PiL and xPC Target. TPT can be used with or without models of the environment and can be applied to all systems that can be executed and simulated in Simulink.

Categories

Find more on Test Model Components in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!