- In the MATLAB Command Window, configure TransformerError as the default E2E protection method.slMap = autosar.api.getSimulinkMapping(modelName); setDataDefaults(slMap, 'InportsOutports', ... 'EndToEndProtectionMethod', 'TransformerError');
- Set the AUTOSAR data access mode of your inport to EndToEndRead.
- Create new inport, set it's DataType to be uint16, set it's AUTOSAR data access mode to be ErrorStatus and than map it to relevant Port and Element (inport from the step 2).
How read in simulink model value of E2E Transformer error?
16 次查看(过去 30 天)
显示 更早的评论
Hello,
How read in simulink model value of transformerError_Input where E2E Transformer write value of error?
In help Configure AUTOSAR Sender-Receiver Communication - MATLAB & Simulink (mathworks.com) it is describe that:
The generated C code contains RTE read and write API calls that pass the transformer error argument.
void Runnable(void)
{
Rte_TransformerError transformerError_Input;
float64 tmpRead;
…
/* Inport: '<Root>/Input' */
Rte_Read_RPort_InputDE(&tmpRead, &transformerError_Input);
…
/* Outport: '<Root>/Output'... */
(void) Rte_Write_PPort_OutputDE(data, &transformerError_Input);
…
}
I see in generated C code that it is created local variable transformerError_Input but i don't know where in simulink model there is an equivalent of transformerError_Input.
For example:
If i need to rewrite the value from local variable transformerError_Input, how can i do it in simulnik model.
1 个评论
Stefan
2024-7-1
in R2024b release you will have new feature regarding this.
Here you can find more info: https://www.mathworks.com/help/releases/R2024b/autosar/release-notes.html#mw_8998e3fa-70f2-43ff-b235-d064f411d847
When you install R2024b version, in order to extract transformerError_Input you will need to do following steps:
All of this you should do in Code Mappings (AUTOSAR blockset).
New ErrorStatus inport will store the information about the Transformer Error (errorCode also as transformerClass).
Keep in mind following:
- The error status value is now sixteen bits (that's why you must set datatype to be uint16) in size. It combines the return value of the Rte_Read function as the least significant eight bits and the transformer error code as the most significant eight bits.
This means that you will need to use bit shift block (shift to the right by 8) to get the most significan eight bits and than compare it with your bitmask (expected E2ETransformer fault).
Available RTE faults (least significant eight bits) you can find in Rte.h file while Transformer faults (most significant eight bits) you will find in the E2EXf.h file (from your SIP) or, of course, you can find everything in the AUTOSAR documentation.
I hope you will find this helpfull!
回答(3 个)
Dhruv
2023-4-21
To read the value of 'transformerError_Input' in Simulink, try using the 'Data Store Memory' block. Following are the steps that might help:
- In the Simulink model, add a 'Data Store Memory' block from the Simulink library.
- Double-click the 'Data Store Memory' block to open its parameter dialog box.
- In the 'Data store name' field, enter 'transformerError_Input' (without the quotes). This should match the name of the variable used in the generated code.
- Click "OK" to close the parameter dialog box.
- Connect the output of the 'Data Store Memory' block to a scope or another block to view the value of 'transformerError_Input'.
To rewrite the value of 'transformerError_Input' in the Simulink model, one can use the 'Data Store Write' block. Refer to the documentation link below for further information:
1 个评论
Ankur Ankur
2024-1-30
I have multiple PDUs which are E2E encrypted. I need to read the type of faults like CRC or Rolling counter and then react to it in Application. Is there a way I can get this transformer error. By the way, I need code generation of this configuration, not only for simulation.
Michael Wilmsen
2023-5-12
Hi Dhruv,
how should this work?
The data type "Rte_TransformerError " is not known in the model workspace or data dictionary (just generated afterwards).
What if I have more signal groups to be E2E protected, how should I know in advance which variable name is used in the generated code?
Isn't there any approach which is more robust. What is Mathwork's way to check the E2E Transformer output. I need to forward this information to the components to provide some qualifiers or similar...
Michael
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!