Get linked requirement info of a simulink block programmatically
44 ビュー (過去 30 日間)
古いコメントを表示
I have test harnesses and requirements linked with some blocks in that harnesses. I want to get the linked requirement-block info programmatically. The two approaches are appreciated. Whether one of them is scanning requirements in editor and get the info of each requirement and linked model/subsystem/block pair. The second way is scan a test harness for every block and get each block linked with a requirement. Is this possible to do with coding so I can do it for bigger sets of requirements and test harnesses.
採用された回答
Sarah
2025 年 2 月 13 日 14:23
Both approaches (going by all requirements, or going by all blocks) are possible to code.
To scan by looping over requirements, first you need to get the Requirement Set object(s) associated with the Requirement Set or Sets you want to get information for. This can be done by opening them programatically to begin with, with the slreq.open command. Or if you want to get all open requirement sets that you can see in the editor, use slreq.find. Once you have a Requirement Set object, you can use the "find" method on the slreq.ReqSet object to find all Requirements. You can then loop through those slreq.Requirement objects, looking at the information in each requirement and its links (the inLinks method is likely the most important for you, and then the link objects it provides will let you determine information about the block or other object that links to the requirement).
If you would prefer to start from the blocks, use the find_system API to get a list of blocks, and then you can use slreq.outLinks to get the links associated with that block. Those links will then allow you to get the slreq.Requirement object that they link to.
0 件のコメント
その他の回答 (1 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!