I am trying to create a "function" (subsystem I can call with varying inputs) within Simulink that can be copied and used over a very large amount of input cases. If I copied and pasted the subsystem block the number of times I need, the model would exceed the block limit of the Home License; there are a decent number of operations inside the subsystem (around 88 non-virtual blocks), but all of the cases I need to run use the exact same operations. The model itself is not complicated, so it seems silly that there wouldn't be a way to reuse the exact same operations for a bunch of different cases without triggering the block limit warning. Regardless, it would be horribly redundant and inefficient to have 30 instances of the same subsystem when the blocks inside all of them are identical and do the same task.
I've been searching extensively for a method of doing this, and it appears Simulink does have a few options, but very few examples of actually implementing them.
- Adding these operations as a MATLAB Function block would be the least ideal, given how much it would slow down the model (and the number of times it would need to be used/called). I'd much rather not need to use the MATLAB interpreter.
- I looked into masking the subsystem, but there is no clear information online about how deep Simulink actually looks to determine if the block limit has been exceeded. When you use the "length(find_system())" command in MATLAB to calculate a model's block count, you can specify to "Look Under Masks", which makes me think they do look under masks.
- Creating a library block appears to be another option, but I've never done this before and had the same concern about Simulink still looking underneath at all the blocks inside. Unless a library block is built using generated code from a set of blocks? I'm not yet clear on how creating a library works.
- I've tried making the subsystem an atomic unit, then checking "Reusable Function", which seems like it should do what I'm looking for, but the model block count did not change. Maybe I attempted this wrong.
- It looks like I could also convert the subsystem into another model, then reference this other model file each time I want to apply those operations to a set of inputs. How would this affect the block count since it is effectively a single other file getting called multiple times (no repeat blocks) and isn't in the same model to begin with? What about simulation speed?
Which of these would work best? Am I missing any options? There must be a way to do this; it seems like basic functionality (maybe I'm missing something really obvious that does exactly this). Thanks!