0

I got a simulink model consisting 4 inputs, 6 outputs and 16 parameters with 4 different self-written controllers. I need to tune the parameters to find their optimized values. I tried to use parameter estimation and response optimization tools and the other options in the analysis menu but I couldnt reach my goal. tools starts to estimate but parameter's values remain same nothing changes. I thought it is because that tools usefull for single input and single output models. Anybody help?

lsn
  • 33
  • 10
  • No, they're not for single-input, single-output models, they should work. Without seeing your model and how you set up your parameter estimation/optimisation, it's impossible to tell what's going on. I suspect you probably didn't set up the estimation problem correctly. – am304 Jun 23 '15 at 08:00
  • You miss the point. You need to supply the actual Simulink model, m files, data, etc... everything so that the problem can be replicated. If the model is huge, you need to come up with a model as small as possible that can replicate the issue. – am304 Jun 23 '15 at 11:19
  • As I said, it's difficult to comment with seeing the model and replicating the issue. A common error people make however, is to have some sort of MATLAB script or callback that is run when initialising the model, which sets the various variables to parameterise the model. This can overwrite the variable value set by the parameter estimation, so that the variable in question never changes throughout the optimisation and the optimisation fails. You want to set the relevant data just once, and not for each iteration of the model. – am304 Jun 23 '15 at 12:07
  • You also want to minimise the number of variables to optimise to maximise the chances of the optimisation succeeding. – am304 Jun 23 '15 at 12:07
  • I represent my parameters in the constant blocks with a name and declare their value in initfcn in the model properties and I used matlab function block to create my own controller. – lsn Jun 23 '15 at 12:43
  • And there it is... That's exactly what I was talking about and the reason why your optimisation is failing. I'll write up an answer. – am304 Jun 23 '15 at 13:08

1 Answers1

0

From the discussion in the comments, it sounds as if you are defining your parameter values in the InitFcn model callback. That's fine when doing a normal simulation, but the problem is this callback gets executed during each model update and simulation. This means that when using something like Simulink Design Optimization, which iterates the model over and over again while trying to vary the parameter values, the values defined in the InitFcn callback overwrite for each iteration the values (for the same parameter(s)) that the optimisation is trying to set. This results in the parameter(s) never changing value during the optimisation and remaining constant, with the value defined in the model callback.

The correct way to approach this is to define the model parameters in the PreLoadFcn model callback instead:

PreLoadFcn

  • Before the model is loaded.
  • Defining a callback code for this parameter is useful for loading variables that the model uses.

[...]

For more details, see Model Callbacks in the documentation.

If it's something else that's causing the parameter estimation/optimisation to fail, you will need to share your model and associated files with us.

As a rule, to maximise the chances of the optimisation succeeding, you want to minimise the number of parameters to estimate simultaneously (doing a multi-stage estimation with a smaller number of parameters at each step can sometimes be a good compromise).

am304
  • 13,758
  • 2
  • 22
  • 40
  • You don't get it. Any variable / block parameter you define in the InitFcn callback will overwrite the parameter value set by the parameter estimation / optimisation. You need to move your MATLAB code to the PreLoadFcn instead, or your variables will never change. – am304 Jun 23 '15 at 17:17
  • That's my best guess anyhow without seeing the model, code and files – am304 Jun 23 '15 at 17:23
  • You need to close and open the model for the callback to execute. Once the values exist in the workspace and aren't overwritten at each iteration, it should work. As I said, it's difficult to answer these type of question without seeing the model and the files to replicate the issue. – am304 Jun 23 '15 at 17:33