Call an AUTOSAR client port from MATLAB Function Block or Stateflow Chart

I would like to call an AUTOSAR client port directly from a MATLAB Function Block and/or a Stateflow Chart transition, instead of just from a Function Caller block. Is this possible?

 Accepted Answer

Unfortunately it is not possible to call a client port directly from a Stateflow chart or a MATLAB Function block.
As a workaround for MATLAB Function blocks, you may use one of the following:
1) Call the client port directly from the MATLAB Function block using "coder.ceval" with the RTE function name in C (i.e. "Rte_Call_..."):
2) Create a Simulink function in the model, and place a function caller block inside of the Simulink function (which is mapped to the client port). Then call the Simulink function directly from MATLAB Function block. Note that this will result in an extra function wrapping around the call to the client port in the generated code.
As a workaround for Stateflow charts, you may use one of the following:
1) Call the client port directly from a Stateflow transition by using the C action language and specifying the RTE function name in C (i.e. "Rte_Call_..."). Note that you will not be able to simulate this model unless you provide the necessary header and source files in the Simulation Target settings:
2) Create a Simulink function in the model, and place a function caller block inside of the Simulink function (which is mapped to the client port). Then call the Simulink function directly from a Stateflow transition. Note that this will result in an extra function wrapping around the call to the client port in the generated code.
3) Create a Simulink function inside the Stateflow chart, and place a function caller block inside of this Simulink function (which is mapped to the client port). Then call the Simulink function directly from a Stateflow transition. This approach, as compared to #2, has the ability to inline the call to the client port in the generated code.

More Answers (0)

Categories

Products

Release

R2018b

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!