Using Bus in Simulink
조회 수: 3 (최근 30일)
이전 댓글 표시
The only thing I want to do is to load into Simulink a timetable or a struct that one of is filed is time, and the rest of the field are the signals.
I want each field to be a signal in Simulink according to the "time" field. The documantation is not clear at all, and I didnt find how to do this simple task.
In summery: I want to load a single timetable or a struct (not to create for each column/field a time serious) with From WorkSpace block, and to connect this block to bus selector in order to see thos signals.
It sound to me like a simple task but I didnt mange to find a document that show how to do it without create to each column/ filed a seprate time serious array.
답변 (2개)
Sara Nadeau
2023년 3월 27일
When you load external input data for a bus using most loading blocks, the bus produced in the model is nonvirtual. That means that the bus is not simply a group of signals but also a definition of the interface, including hierarchy, names, data types, and any other bus element attributes you define.
In order to load input data for a bus using the From Workspace block, you need to create a Simulink.Bus object that defines the data type for the loading block.
Each element in the bus is an independent element, so you do create the data for each element independently. Then, you create a structure in which the bus elements are arranged with the same hierarchy as the bus object definition, using the names of elements in the bus object as the names for the fields in the structure.
The Load Bus Data section of the doc page linked in the other answer shows an example of how to do this.
Loading input data for a bus can be a bit simpler when you use In Bus Element blocks instead of the From Workspace block. You can load data for a virtual bus, so you do not need to create the Simulink.Bus object. You do still need to create data for each element in the bus independently. Here's an example: Load Input Data for a Bus Using In Bus Element Blocks.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Sources에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!