Why do the testpointed labels at the output of a virtual subsystem do not show up in the C-API code in Real-Time Workshop 5.3 (R2009a)?
1 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2010-7-22
编辑: MathWorks Support Team
2020-8-7
I found that my labeled, test-pointed signals (at the output of an atomic subsystem that I use from a library) do not appear in the C-API interface. Specifically, subsystem outputs do not appear in the structure unless they are buffered with Signal Conversion blocks or Gain blocks (at least not with labels that correspond to the signal names).
There is no indication in the Documentation about this limitation. I would expect to be able to access a signal with its label through the generated code. In the current scheme if the source of the signal does not have any label associated then I will get the following code in the signal record:
{ 0, 4, "tt1/Subsystem1",
"", 0, 0, 0, 0, 0 },
{ 1, 8, "tt1/Subsystem1",
"", 0, 0, 0, 0, 0 },
The code seems to be referring to a subsystem without specifying the port number and does not show the local label from the user. It is not clear as to why I cannot associate the signal with a Simulink entity through labeling.
采纳的回答
MathWorks Support Team
2020-8-7
编辑:MathWorks Support Team
2020-8-7
The behavior you see is expected. The reason being that the signal label in <model>_capi.c is the label of the signal from the driving block (block which defines the memory). When you set a testpoint at the output port of a virtual subsystem, it is the driving block (and not the subsystem) that gets allocated a separate memory buffer. Virtual subsystem is only a graphical convenience and normally does not own the memory for the signal.
In general, we recommend labeling and testpointing the signal at the output of the driving block. If the driving block is part of a virtual subsystem, you can use the unity Gain block at the output of this subsystem/block to force the label of the testpoint to show up in the generated code. Testpoints on signals that are directly routed out of the virtual blocks can cause unexpected effects on the C API generation meaning that the test point specification might get propagated to the block that owns the memory.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Signal Routing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!