- The conditional RTE Write is for an outport and not an IRV (see Resource 1 )
- The targeted outport is mapped as "ExplicitSend" (see Resource 2 )
- The model is an Export Function model (see Resource 3 )
- All the outports from the root to the source are set as "Ensure Outport is virtual" (see Resource 4 )
In AUTOSAR, an IRV is a mechanism that allows for the sharing of data between different runnables within the same software component while maintaining data consistency and ensuring data protection. Runnable in AUTOSAR are the smallest schedulable units of computation within a software component. They can be thought of as functions that are executed by the operating system at specific times or upon certain events. When multiple runnables within the same software component need to exchange data, they can use IRVs to do so. You can find more information in the following documentation: Inter Runnable Variables are not supported for conditional RTE Write with Simulink. |
Conditional RTE Write in AUTOSAR is only achievable for the ports mapped as ExplicitSend. It might not be straightforward to change the access mode from Implicit to explicit, as you might be strictly confined to implicit access mode by your architecture team. Please seek your architect's input before considering this change in your design. ![]() Below is a snippet of the AUTOSAR specification, as you can see, it is specified for the Implicit Write to send the values at the end of the runnable execution. ![]() According to the AUTOSAR specification when using "ImplicitSend" for data elements, the values are only sent after the runnable has finished running. This means they are stored in a buffer while the runnable is working. Below is a graphic showing how Implicit communication works: Using "ImplicitSend" with conditional writing doesn't make sense. This is because no matter what condition you set for sending the data, it will be sent to the RTE at the end of runnable execution. For "ExplicitSend" the data is sent to RTE when it gets updated, which is why the condition has an impact on whether the data is written or not. ![]() That's why we have made a conscious decision for Implicit Write to execute unconditionally at the end of runnable execution. In contrast, conditional Explicit Write can happen in different scenarios because “Runnable can decide” when to send data. |
In Simulink, there are two different ways to model an AUTOSAR Runnable. You can either use Export Function or Rate-based behaviors. Conditional RTE Write is only supported for Export Function, you can find more information on how to model an AUTOSAR Runnable as an Export Function in the following documentation: You can also learn more about Export-Function Models in Simulink in the following documentation: The section "Designating an Export-Function Model" shows how to check if a model is rate-based or export function. You can also find out if the model is an Export-Function model by running the following command in MATLAB: get_param(model,'IsExportFunctionModel') |
Make sure to select "Ensure outport is virtual" in the parameters of the Outport block, for each outport block located between the subsystem that's executed conditionally and the system's main Outport. ![]() You can use Debug/Trace Signal to find all the signals associated with the outport and make sure that they are all virtual. You can also right-click on the signal and choose "Highlight to source" or "Highlight to destination". You can find more information about this tool in the documentation below: ![]() ![]() |