MATLAB Answers

What is the difference between ImplicitReceive and ExplicitReceive in AUTOSAR Code?

190 views (last 30 days)
What is the difference when changing DataAccessMode for AUTOSAR inputs between ImplicitReceive and ExplicitReceive?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 22 Aug 2019
Edited: MathWorks Support Team on 22 Aug 2019
ImplicitReceive: The input is always buffered. So, the input value remains the same in a single execution of the runnable, no matter how many times it is used.
ExplicitReceive: The input is NOT buffered. So, the input value changes whenever it is used within a single execution of the runnable.
As per the AUTOSAR specification:
"Implicit sending and receiving aims at the optimization of computation effort for sender-receiver communication. Instead of executing the full amount of functionality for each call to a send resp. receive API the implicit communication only receives implicitly received values latest before the start of the execution of a RunnableEntity and sends implicitly sent values earliest after termination of the RunnableEntity."
You may find more information on the difference between implicit and explicit sending and receiving in sections 7.5.1.3 and 7.5.1.4 of the AUTOSAR Specification, linked below. Choosing between these two options will depend on your modeling goals.
The generated code for each setting is different. Below is an example of generated code in the two cases.
1) ImplicitReceive
/* Model step function for TID1 */
void Runnable_2s(void) /* Sample time: [2.0s, 0.0s] */
{
/* Update for RateTransition: '<Root>/RateTransition' incorporates:
* DiscreteIntegrator: '<Root>/Integrator'
*/
Rte_IrvIWrite_Runnable_2s_IRV1(rtDW.Integrator_DSTATE);
/* Update for DiscreteIntegrator: '<Root>/Integrator' incorporates:
* Inport: '<Root>/In2_2s'
*/
rtDW.Integrator_DSTATE += 2.0 * Rte_IRead_Runnable_2s_ReceivePort_In2();
}
2) ExplicitReceive
/* Model step function for TID1 */
void Runnable_2s(void) /* Sample time: [2.0s, 0.0s] */
{
real_T tmpRead;
/* Inport: '<Root>/In2_2s' */
Rte_Read_ReceivePort_In2(&tmpRead);
/* Update for RateTransition: '<Root>/RateTransition' incorporates:
* DiscreteIntegrator: '<Root>/Integrator'
*/
Rte_IrvIWrite_Runnable_2s_IRV1(rtDW.Integrator_DSTATE);
/* Update for DiscreteIntegrator: '<Root>/Integrator' */
rtDW.Integrator_DSTATE += 2.0 * tmpRead;
}

  0 Comments

Sign in to comment.

More Answers (1)

Vincenzo Salvo
Vincenzo Salvo on 23 Oct 2019
Edited: Vincenzo Salvo on 23 Oct 2019
Is it possible to rename tmpRead variable when the ExplicitReceive option is active?
How? I wasn't able to change it using the "signal name must resolve to Simulink signal object" flag...
Thank you in advance

  0 Comments

Sign in to comment.

Sign in to answer this question.