I typically use Simulink dictionaries to hold my Simulink parameters, but it seems that I need to have them in the workspace to be able to run a PLECS blockset simulation. I’d prefer not to mask my circuit with every variable. Is there a method I am missing to achieve this?
As you mentioned, Simulink Data Dictionaries are not compatible with PLECS models. I’m not particularly well versed in data dictionaries, so maybe you could provide an example of what exact you are trying to achieve?
With that said, the first approach that comes to mind is to use Matlab/Simulink commands to load the data sources and then access the data programmatically. Note that the data entries must be “Matlab variables” or converted to that format.
For example, in the Model Properties + Callbacks + InitFcn point to the appropriate data sources:
dictName = "TestDictionary.sldd";
sectionName = "Design Data";
dictObj = Simulink.data.dictionary.open(dictName);
secObj = dictObj.getSection(sectionName);
modelName = "boost_converter"
modelWorkspace = get_param(modelName,"ModelWorkspace");
And then refer to the variables by name, as shown below:
There are many variations on this idea, perhaps by creating your own getter functions to make think more straightforward.
