How can I link a Simulink library to a data dictionary?
23 views (last 30 days)
Show older comments
I currently have a model for which the inputs are defined in a data dictionary. Specifically the input bus structures are defined in the data dictionary.
I want to use a library within the model in a few locations to perform some repeated calculations. The input to the library will follow the same input bus structure defined in the data dictionary of the model.
Is there a method for me to link the library to the data dictionary, so I can create an input port and specify the type as with the Bus Object I already defined in the data dictionary, for exmaple "Bus: InputBusStructure"? This way, in the library I can just use bus selectors to access the signals I need.
However, I do not want to have a "canned" data dictionary as the solution mentions. Also, since I don't need to access constants, I'm not too sure if the proposed solution is necessary. Since I only want to have the input bus structure, in order for me to access the required signals through bus selectors, since these signal values are expected to be changing with time.
Please note that I have also looked at: Library-Based Code Generation for Reusable Library Subsystems - MATLAB & Simulink (mathworks.com)
However, I do not have a license for Simulink Coder. So a solution/workaround which does not use this product would be ideal.
0 Comments
Answers (1)
Benjamin Thompson
on 7 Feb 2022
Just like linking a data dictionary with a model, you go to Model Explorer, go to the External Data tab in the properties, and select or create a dictionary. But since a library never actually simulates its blocks, this does not help much. You will have one or more models that makes use of the library blocks, and those models should import all the data dictoinaries they need to do everything. Do work with your data dictionary busses, get them working in a model first, then move the subsystem blocks to a library for reuse in other model or in other spots in your model.
If you make changes to a library block that uses busses from a dictionary, verify those changes in a model first, perhaps by disabling the library link temporarily, then push that change to the library when you are satisfied with it.
0 Comments
See Also
Categories
Find more on Manage Design Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!