I have a state space system array and I am defining the property SamplingGrid. How do I tell the Simulink LPV block which model to use?
As an example, consider this array of 8 state space systems with the corresponding 3 binary decision variables:
SS_Array(:,:,ii,1) = ss(ii,ii,ii,ii);
Decision1 = [0 0 0 0 1 1 1 1];
Decision2 = [0 0 1 1 0 0 1 1];
Decision3 = [0 1 0 1 0 1 0 1];
SS_Array.SamplingGrid = struct('Decision1',Decision1,...
'Decision2',Decision2,...
When I print SS_Array I get as expected SS_Array(:,:,1,1) assigned to [Decision1=0, Decision2=0, Decision3=0], SS_Array(:,:,2,1) assigned to [Decision1=0, Decision2=0, Decision3=1], etc until SS_Array(:,:,8,1) assigned to [Decision1=1, Decision2=1, Decision3=1].
I bring this to Simulink into an LPV block with the interpolation method "nearest" selected:
To tell the LPV block which model to use, I supply the values of the three decision variables to the input "par". This works for all decision variables being 0 or all decision variables being 1. But for cases in between, I get unexpected behavior: When I set Decision1=0, Decision2=0, Decision3=1, I get that the LPV block chooses SS_Array(:,:,5,1), which is the wrong model. (The right model would have been SS_Array(:,:,2,1) as shown above).
What am I missing? It seems that the LPV block expects the cheduling point parameters in a certain order. How do I know in which order to supply the decision variables? Should I supply the decision variables as name-value pair for the LPV block to work? How would I do that?
Tested with Matlab 2021a