0
votes

I'm trying to parameterize one of my Simulink models, so that I will have a gain in the model whose value is equal to an element of a MATLAB workspace vector indexed by the model parameter. That is, I want to define a model argument WheelIndex and have a gain inside the model with a value AxelLoads(WheelIndex).

When I do it exactly as I've described above, I get "vector indices must be real and positive integers" error. When I change the model argument to AxelLoad(To be used directly in the gain component) and assign its value to be AxelLoads(1)(for the first wheel) I get:

Error in 'Overview/Wheel1'. Parameter '18000.0, 15000.0, 17000.0, 21000.0' setting: "18000.0, 15000.0, 17000.0, 21000.0" cannot be evaluated.

I've also tried importing the vector as a constant block into the model, and use a selector block parameterized by the WheelIndex argument to direct the right element to a multiplication block (thereby making an ugly gain block), but then Simulink complains that I'm trying to use a model argument to define an "un-tunable value".

I just want to somehow define the parameters in the MATLAB workspace to be used in each model instance, so that I can, say, calculate the total weight by adding the loads on each wheel. Simulink seems to block all workarounds I've been trying.

Thanks

2

2 Answers

1
votes

Could you use a lookup table to obtain AxelLoads vs. WheelIndex?

1
votes

The easiest way is if I just came over? :P

Perhaps this explaination of tunable parameters helps a little?