Fmincon with UseParrallel option + Simulink model with variant control in rapid accelerator mode
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi all,
I've got a Simulink model with variant control, which I call (using "sim" command) from an optimisation script. The optimisation uses the fmincon function and I am setting the "UseParrallel" option to true. Moreover, the "sim" command uses the rapid accelerator mode option. I get the error below:
>> Optimisation
### Building the rapid accelerator target for model: FMCPAMG_R00_MOD
### Successfully built the rapid accelerator target for model: FMCPAMG_R00_MOD
Starting parallel pool (parpool) using the 'local' profile ...
connected to 6 workers.
IdleTimeout has been reached.
Parallel pool using the 'local' profile is shutting down.
### Build procedure for model: 'FMCPAMG_R00_MOD' aborted due to an error.
### Build procedure for model: 'FMCPAMG_R00_MOD' aborted due to an error.
### Build procedure for model: 'FMCPAMG_R00_MOD' aborted due to an error.
Error using build_rapid_accel_target
Unable to build a standalone executable to simulate the model 'FMCPAMG_R00_MOD' in rapid accelerator mode.
Error in sl (line 15)
[varargout{1:nargout}]=feval(varargin{:});
Error in Optimise/objFun (line 47)
WSdata = sim(OPT_INPUT.model_name, 'SimulationMode', 'rapid',...
Error in finDiffEvalAndChkErr
Error in parfinitedifferences
Error in parfinitedifferences
Error in nlconst (line 347)
parfinitedifferences(XOUT,lb,ub,f, ...
Error in fmincon (line 751)
nlconst(funfcn,X,l,u,full(A),B,full(Aeq),Beq,confcn,options,defaultopt, ...
Error in Optimise (line 32)
[x,fval] = fmincon(@objFun,OPT_INPUT.x0,A,b,Aeq,beq,lb,ub,@conFun,options);
Error in Optimisation (line 80)
[x,fval] = Optimise(OPT_INPUT);
Caused by:
Error using tlc_c (line 176)
Error due to multiple causes.
Error using tlc_c (line 176)
Variant control 'ctrl_mode == 1' used by block 'FMCPAMG_R00_MOD/Control/Control Subsystem' should return a logical
value.
Error using tlc_c (line 176)
Undefined function or variable 'ctrl_mode'.
Error using tlc_c (line 176)
Variable 'ctrl_mode' does not exist.
Error using tlc_c (line 176)
Variant control 'ctrl_mode == 3' used by block 'FMCPAMG_R00_MOD/Control/Control Subsystem' should return a logical
value.
Error using tlc_c (line 176)
Undefined function or variable 'ctrl_mode'.
Error using tlc_c (line 176)
Variable 'ctrl_mode' does not exist.
Error using tlc_c (line 176)
Variant control 'ctrl_mode == 2' used by block 'FMCPAMG_R00_MOD/Control/Control Subsystem' should return a logical
value.
Error using tlc_c (line 176)
Undefined function or variable 'ctrl_mode'.
Error using tlc_c (line 176)
Variable 'ctrl_mode' does not exist.
Things work well when I set UseParallel to false. Any idea(s) on how I can move forward?
Ps: Here is my sim command:
WSdata = sim(OPT_INPUT.model_name, 'SimulationMode', 'rapid',...
'InlineParams', 'on',...
'SolverType', 'Fixed-step',...
'Solver', 'ode3',...
'FixedStep', num2str(OPT_INPUT.sim_step),...
'StopTime', num2str(OPT_INPUT.sim_stop_time),...
'SaveFormat', 'StructureWithTime');
0 comentarios
Respuestas (1)
Divya Yerraguntla
el 26 de Sept. de 2019
Hi Eyefujirin,
Try having a look at a similar question : https://www.mathworks.com/matlabcentral/answers/124066-problem-using-optimoptions-with-fmincon-for-parallel-computing?s_tid=answers_rc1-1_p1_Topic#answer_131676
Hope it helps!
1 comentario
Ver también
Categorías
Más información sobre Manual Performance Optimization en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!