How to avoid "Estimation Error" while using Parameter Estimation GUI along with Parallel Computing in Simulink?

5 views (last 30 days)
How do I avoid getting an Estimation Error dialog box when attempting to use the 4 cores of my computer to estimate the parameters of a Simulink model by using the Control and Estimation Tools Manager GUI?
The error happens 7-8 minutes after the first "Measured vs Simulated" plot is shown. The error message in the dialog box is the following:
Error stack:
findParametersWS.m at 39
assignin.m at 16
error.m at 16
numjacobian>LocalWrapError at 92
numjacobian>(parfor body) at 47
Failure in initial user-supplied objective function evaluation.
LSQNONLIN cannot continue.
The estimation works fine when using one core. Changing "Nonlinear least squares" to "Gradient Descent" just changes "LSQNONLIN" in the message. I also tried adding my current folder to the Model Path Dependencies in the Manager but it did not work.
My setup is as follows. The parameter estimation is for a single Simulink model. The simulation is in Accelerator mode. Before opening the Control and Estimation Tools Manager, I manually run a script to load the parameters to estimate. The model has under Callbacks-InitFcn two scripts for loading fixed parameters and signals (different from the inputs used by the Manager). The 3 scripts are in the same folder as the .mdl file. I manually open four labs with matlabpool and select parallel computing in the Manager. The error happens some time after the aforementioned plot is shown and no optimization iteration is performed.
I already looked in Internet for the error but I was unable to find useful information. I will really appreciate any information that can help me solve this problem.

Accepted Answer

Daniel
Daniel on 28 Dec 2012
I found the solution to this so I am going to answer my own question so other people who stumble with this might benefit from it.
When using parallel computing, the parameters to estimate must be loaded independently by each of the parallel workers or labs. Originally I was loading the parameters manually before the estimation so only one of the labs had access to them. The solution was to call the parameters script within PreLoadFcn in the Model callbacks.
Hope it helps someone.
  1 Comment
Giuseppe Naselli
Giuseppe Naselli on 22 Mar 2014
Edited: Giuseppe Naselli on 22 Mar 2014
Hi Daniel,
I had a problem similar to yours, but your solution did not work.
However, I found this thread to be very useful http://blogs.mathworks.com/seth/2008/12/25/initializing-parameters/
In particular, I used the solution provided by Farid (see first comment)
G

Sign in to comment.

More Answers (0)

Categories

Find more on Simulink Design Optimization in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!