Why does Real-Time Workshop 6.0 (R14) include an extra copy of bus signals in a model's generated code?
조회 수: 1 (최근 30일)
이전 댓글 표시
If the following conditions exist, Real-Time Workshop 6.0 (R14) includes an extra copy of bus signals in a model's generated code:
- A virtual bus passes into an atomic subsystem.
- On the subsystem's Block Parameters dialog box, the "Real-Time Workshop system code" option is set to 'Inline'.
- One or more bus signals connect directly to the output port of the atomic subsystem without passing through an intermediate nonvirtual block.
채택된 답변
MathWorks Support Team
2009년 6월 27일
Simulink requires that atomic subsystems own the memory they output. In part, this defines the system as an atomic unit. Hence, all outputs must originate from blocks inside the atomic subsystem. When an input port feeds its signal directly to an output port in the atomic subsystem, the input port becomes nonvirtual and makes a copy of its input signal. When passing bus signals through atomic subsystems, this rule still applies, and the result is often perceived as unnecessary copies of bus signals in the generated code.
For example, suppose a model has a bus signal with 100 elements. This bus signal is input to an atomic subsystem, where only one of the 100 elements is fed directly from the subsystem's inport to its outport. Consequently, a copy of the entire bus signal (i.e., all 100 bus elements) is included in the generated code, which is quite inefficient compared to copying only the sole direct-feedthrough element. To work around this issue, follow these steps:
1. For each bus signal that connects an atomic subsystem's input port directly to its output port, insert a Signal Conversion block between the two ports.
2. Set the Signal Conversion block's "Output" parameter appropriately:
* If the block operates on a vector or scalar signal, specify the parameter as 'Contiguous copy'.
* If the block operates on a bus signal, specify the parameter as 'Bus copy'.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 General Applications에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!