How to create a bus copy in code generation using embedded coder ?

5 Ansichten (letzte 30 Tage)
Afraa Ibtissem Derbal
Afraa Ibtissem Derbal am 25 Okt. 2024
Beantwortet: Altaïr am 29 Okt. 2024
hello, for my application I need to copy value of a bus variable into another one, but I need it to be a real memory copy :
for example ETPU_bus is a bus we created in our model, we would like the variable to be copies into etpud_bus_data_core2, the same way a memcpy would do it
but in the generated code we get :
this would translate to passing down the adress of the struct elemnt to another ( knowing that ETPU_bus for example is a struct that has an array as an element )
any idea how to force the code to copy element by element ?
Thank you

Antworten (1)

Altaïr
Altaïr am 29 Okt. 2024
There are a couple of ways element-by-element copy of a bus signal can be achieved in code generation.
1. One option is to create a dummy atomic subsystem between the inport and outport, as illustrated below.
2. Alternatively, a 'Signal Conversion' block can be inserted between the two ports, with the 'Output' parameter set to 'Signal Copy'. Ensure the "Exclude this block from 'Block reduction' optimization" checkbox is selected.
More information about the ‘Signal Conversion’ block can be found here:
I believe this will assist you!

Kategorien

Mehr zu Simulink Coder finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by