I recently had a conversation with a client about how they instantiated constants for their model. Thier approach was to group common parameters together into a structure. What I pictured was something like this
In this instance, we have a small structure, one layer deep with 4 elements. This would be enough information to perform the calculations required to transform a throttle sensor voltage into a throttle position.
However, what they showed me was something quite different. In their instance, they had a hierarchical structure that was, in some places, 7 layers deep. The single structure contained not only all the parameters required for a single component but for multiple models.
The deep…
This
- Where is my data: the first problem with large data structure is finding the data. Even the most logically organized structure
- Waste of space: deep structures inevitably end up with unused data.
- Repeated data: Going along with the “where is y data” is the “repeated data. People will add the same data to multiple locations.
- Customization: with a large data structure you have to configure the whole data structure as one.
Finding balance
The
- Ability to easy find parameters
- Ability to customize on a parameter by parameter basis
- Only used parameters are in the generated code
There are some disadvantages, related to how the parameters are stored in files; a single structure can be stored easily in a single structure. With multiple parameters, a storage format needs to be determined. Standard approaches include
- Use of MATLAB files
- Use of .mat files
- Use of Simulink Data Dictionary
- Use of an external data base
Any of these approaches can be used to organize the data.

