MATLAB Answers

Referenced Data Dictionaries and Hierarchical Models

1 ビュー (過去 30 日間)
max.s 2020 年 10 月 9 日
回答済み: Fangjun Jiang 2020 年 10 月 9 日
I created a highly hierarchical model of many instances of referenced subsystems. Let's take this as an example
- Referenced Subsystem A - 1
-- PI Controller
- Referenced Subsystem A - 2
-- PI Controller
- Referenced Subsystem B
-- Referenced Subsystem A - 1
--- PI Controller
The model has tuning parameters (P & I Gains for the controllers) and design parameters (e.g. oscillator frequency). Perhaps, Simulink doesn't differentiate between these two, and that's fine. But I'd like to be able to quickly load (separately) sets of tuning parameters (agressive, weak) and design parameters (PurchaseOptionA, PurchaseOptionB).
Data dictionaries looks like the way to go and I read all of the documentation on "Manage Design Data" and "Configure Signals, States and Parameters", but I'm unclear on how I can wire up the nested PI control pameters to the top level. Let's say I use a data dictionary for each PI controller, then I'd have three structures of parameters like this?
A_Instance1.Ki = 1
A_Instance1.Kp = 2
A_Instance2.Ki = 3
A_Instance2.Kp = 2
B_Instance.A_Instance1.Ki = 0.5
B_instance.A_Instance1.Kp = 4
Is there no way I can just name the variables Kp and Ki in each dictionary and have the name auto deduced from the way the data dictionaries are linked? I have to put the full "path" into each referenced dictionary? What if I want to use those parameters in a different model with a different hierarchy? Is that possible without having to match the exact parameter naming?
Maybe I'm also getting the entire workflow wrong.

  0 件のコメント



Fangjun Jiang
Fangjun Jiang 2020 年 10 月 9 日
You are over-thinking and making it overly complicated. There is no hierarchy for parameters. Simply create Kp1, Kp2, Kp3 or better Kp(1), Kp(2), Kp(3) and use them at the proper Gain block. The parameters can be in base workspace, model workspace, or SLDD file, or multiple SLDD files. The name can'be be same (can't call all three Gains as Kp and hope to put them in different SLDD to distinguish them). It is possible that way if using model reference and each model has its own SLDD but it is not possible with subsystem reference.

  0 件のコメント


その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by