Bus Creator: Import signals list from bus object
5 ビュー (過去 30 日間)
古いコメントを表示
Hello everyone,
is there a way to import the signal list from a bus object into the Bus Creator block from a predefined Bus Object in a Data Dictionary?
I found the Bus Object Bus Creator in the file exhange (https://uk.mathworks.com/matlabcentral/fileexchange/50601-bus-object-bus-creator) wich does the trick for me, but unfortunately it cannot read bus objects from Data Dictionaries (fondamental feature).
I find this problem a huge missing in the simulink base libraries.
Without a feature like this bus objects become useless, programming becomes hard and mainance impossible if you have a huge control application with hundreds of subsytems/submodels with thousands of variables and hundreds of buses.
Marco.
0 件のコメント
回答 (1 件)
Aabha
2025 年 2 月 27 日
編集済み: Aabha
2025 年 2 月 27 日
I faced a similar difficulty, while reading bus objects from the data dictionary. However, there is a workaround to this problem, where data dictionary elements can be programmatically accessed and modified. The following code can be run in the MATLAB Command Window, to create a bus object in a data dictionary linked to a Simulink model and subsequently link its elements to a Bus Creator block.
dataDictionary = Simulink.data.dictionary.open('myDictionary.sldd');
section = getSection(dataDictionary, 'Design Data')
Assuming there is a Simulink bus object titled “myBus”, it can be linked to the dictionary as follows:
addEntry(section, 'MyBus', myBus);
busObj = getEntry(section,'MyBus')
busValue = getValue(busObj)
open_system('yourModel')
busCreator = add_block('simulink/Signal Routing/Bus Creator', 'yourModel/BusCreator');
set(busCreator, 'Inputs', num2str(length(busValue.Elements)));
This adds a bus creator block, where the signal list is imported from a bus object in the corresponding data dictionary.
I hope this helps.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Composite Interfaces についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!