Bus Creator: Import signals list from bus object
조회 수: 4 (최근 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!