Clear Filters
Clear Filters

How read in simulink model value of E2E Transformer error?

16 views (last 30 days)
Hello,
How read in simulink model value of transformerError_Input where E2E Transformer write value of error?
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 Comment
Stefan
Stefan on 1 Jul 2024
Hi @Kamil,
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:
  1. In the MATLAB Command Window, configure TransformerError as the default E2E protection method.slMap = autosar.api.getSimulinkMapping(modelName); setDataDefaults(slMap, 'InportsOutports', ... 'EndToEndProtectionMethod', 'TransformerError');
  2. Set the AUTOSAR data access mode of your inport to EndToEndRead.
  3. 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).
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!

Sign in to comment.

Answers (3)

Dhruv
Dhruv on 21 Apr 2023
To read the value of 'transformerError_Input' in Simulink, try using the 'Data Store Memory' block. Following are the steps that might help:
  1. In the Simulink model, add a 'Data Store Memory' block from the Simulink library.
  2. Double-click the 'Data Store Memory' block to open its parameter dialog box.
  3. 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.
  4. Click "OK" to close the parameter dialog box.
  5. 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 Comment
Ankur Ankur
Ankur Ankur on 30 Jan 2024
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.

Sign in to comment.


Michael Wilmsen
Michael Wilmsen on 12 May 2023
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

yong tu
yong tu on 10 Jul 2024
How read in simulink model value of E2E Transformer error?

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!