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

조회 수: 5 (최근 30일)
Afraa Ibtissem Derbal
Afraa Ibtissem Derbal 2024년 10월 25일
답변: Altaïr 2024년 10월 29일
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

답변 (1개)

Altaïr
Altaïr 2024년 10월 29일
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!

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by