MATLAB Answers

Referenced Data Dictionaries and Hierarchical Models

1 view (last 30 days)
max.s
max.s on 9 Oct 2020
Answered: Fangjun Jiang on 9 Oct 2020
I created a highly hierarchical model of many instances of referenced subsystems. Let's take this as an example
TopLevelModel
- 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 Comments

Sign in to comment.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 9 Oct 2020
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 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!