Using structures as input of the model with parallel computing

Hi everyone,
I'm currently using structure of constants as an input of simulink blocks in my model. The only way I was able to do that was using bus objects. The settings for my model are defined in file which I call in my main.
Here comes the problem : I'm trying to use the parallel computing toolbox. I get this error message when I try to load my model: The symbol 'HD_bus' resolved to a bus object in the model workspace; Bus objects should only be created in the base workspace
Is there any way to go around this particular issue
Cheers Alex

 채택된 답변

Kaustubha Govind
Kaustubha Govind 2012년 4월 13일

0 개 추천

I wonder if you could assign the Simulink.Bus object in the base workspace in the parfor loop, as discussed here: http://blogs.mathworks.com/seth/2010/10/17/parallel-computing-with-simulink-running-thousands-of-simulations/#11

댓글 수: 6

Hi Kaustubha,
Thanks for the reply and tip. I assigned the bus object in the parfor loop. I guess that solve my problem because I've got another error now but I guess that should be a new thread:
Error using parallel_function (line 589)
Error using targetman>throw_make_error (line 588)
(SLSF Diagnostic)
Error stack:
(No remote error stack)
Error in parfor_run (line 97)
parfor idx = 1:iterations
Strange that there is no error stack. Does everything work if you switch parfor with for?
Do you have Stateflow or (Embedded) MATLAB Function blocks in your model?
Yes that's right, I've got embedded matlab code in simulink blocks.
I've solved the problem by deleting the folder called 'slpj' (or similar can remember exactly), running the model alone once and then running with the parfor loop. Not sure why it solve my problem !
Blocks like (Embedded) MATLAB Function, Stateflow and Model Reference (in modes other than Normal) will try to generate code into the slprj folder in order to produce a MEX-file that is used for faster simulation. I'm guessing that suppressed "SLSF diagnostic" was about a stale splrj.
Btw, Guy's suggested solution might be safer to use if you happen to be changing non-tunable parameters within the parfor loop.

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Alexandre
Alexandre 2012년 4월 12일

0 개 추천

Thanks for the reply TAB. The problem is I think I have to define my properties in the model workspace as I am using parrallel computing with a parfor loop. If I let the bus in the base workspace matlab throw a transparency error. Anyone as an idea ? Cheers Alex
Alexandre
Alexandre 2012년 4월 13일

0 개 추천

Can anyone help on this topic ?
Guy Rouleau
Guy Rouleau 2012년 4월 16일

0 개 추천

I recommend using pctRunOnAll to initialize all the workers once before starting the for loop.
About your error, look at the doc page "Running Parallel Simulations":
and go to the subsection "A Model with Stateflow, MATLAB Function Block, or Model Block". There you will see an example showing how to run each worker in different tmp folder to avoid conflicts when models mus generate a mex-file.

카테고리

도움말 센터File Exchange에서 General Applications에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by