필터 지우기
필터 지우기

set a parameter in a contantblock during external simulation with a parfor loop.

조회 수: 1 (최근 30일)
Hi, I want to use sim to simulate an external model 200 times. This should go fast so I'm using parfor. The problem is that the number of the current simulation has to be implied in the model called MPC_model (in a constant block named iteration) every time the sim function is used. I tried several thinks like this:
matlabpool;
parfor i=1:200
iteration=int2str(i);
set_param('MPC_model/iteration','Value',iteration);
[t,x,y1,y2]=sim('MPC_model',[Main_Time; Main_Time+12*48]);
all_gatelevels=[all_gatelevels,y1];
schade=[schade,y2];
end
I usually get problems that the submodel can't find variables that are defined in the workspace of the main model. When I try slightly different things like adding 'SimulationMode', 'rapid' I get other errors (f.e. that there might only be 1 output).
Does anyone know how I can get this to work?

채택된 답변

Kaustubha Govind
Kaustubha Govind 2012년 12월 26일
Please read Run Parallel Simulations. In particular, the sections titled sim in parfor with Rapid Accelerator Mode and Resolving Workspace Access Issues may be of interest to you.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multicore Processor Targets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by