How to export data from a s-function to model

3 visualizzazioni (ultimi 30 giorni)
Andreas Kleis
Andreas Kleis il 19 Nov 2020
Modificato: Andreas Kleis il 30 Nov 2020
I create a test for an Autosar SW module. The module is available as Simulink model as well as automatically generated and manually extended C code. I'd like to create a back to back test for model and code using the thrid-party tool 'EverTest'. Therefore the module under test is inserted twice in a variant sub-system; first variant is the model block, second variant is the code imported as a s-function block. The variant sub-system goes along with some test harness around for closed-loop testing.
The module calls a function of another module to pass a status information. For the model related part of the test, i offered a Simulink function with the same name as a stub. This stub passes the status argument to a data store, which can be evaluated from the test. The test verifies, whether the status changes - what means the call worked.
Since the RTE functions of the module are not available in code, i created a C wrapper for inports, outports and so on. I again offered a stub to replace the missing external function. The wrapper/stub is accepted and the test execution works ... except one point. I haven't found a way to pass the status information from C code to the test harness model. The test can't verify, whether the status changes in C code execution.
Code can't forward to the Simulink function and neither code is able to access the data store nor the model to access a global C variable.
Tool environment:
  • Matlab / Simulink 2016b
  • Autosar Blockset
  • Embedded Coder
  • EverTest
edit:
I solved the problem by creating a s-function with additional outports for the status information. These outports pass the status to the data stores too. To meet the inports and outports of the variant subsystem, i encapsulated the s-function in another subsystem.

Risposte (0)

Categorie

Scopri di più su Test Model Components in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by