3
votes

My Simulink model will contain (a lot of) n identical subsystems, each defined by about 30 different predetermined parameters. Currently every time I duplicate a subsystem I need to modify the properties of every single block, consequently a lof of work with error-proneness. So my idea is to store corresponding parameters in a vector as follows:

parametersA = (parameterA1 , parameterA2 , ... , parameterAn);
...
parametersZ = (parameterZ1 , parameterZ2 , ... , parameterZn);

The values in the block properties will then be defined as parametersA(2) for subsystem #2 and parametersA(n) for the n-th subsystem. Or imagine every subsystem contains a PID-controller and the proportional gain KP needs to be defined. So the first subsystem will call KP(1) and the n-th KP(n).

Hence my basic question is: how can I declare my index variable n within every subsystem, so every single block knows which element of the parameter vector to call?

An additional question would be: is it actually necessary at all to replicate my subsystems or could everything be done in one? Would that affect simulation time?

1

1 Answers

3
votes

Have you looked at masking your subsystem and parameterising it with just one structure in the mask (see Masking in the doc)? All the blocks underneath the mask would then be parameterised with fields of that structure. You could then have a cell array of structures that you use to parameterise each instance of the subsystem. In fact, the only parameter you may need for the mask is the index in the cell array, which is defined in your base workspace.