フィルターのクリア

How can I load mat data in 'parsim' local workers ?

2 ビュー (過去 30 日間)
Roberto Tascioni
Roberto Tascioni 2022 年 1 月 19 日
コメント済み: Rahul Kumar 2022 年 4 月 8 日
Hi, all, I'm not an expert on parallel simulations so I explain here my problem:
I created a simulink project, it runs without problems, inside it there are many matlab user defined functions with "load" who takes data from the workspace previously generated using a preload function (command line in simulink executed before the simlation starts).
I'm trying to replicate it using the Parsim tool of matlab, but I get an error since the workers are still using another path and the preload is uneffective. How can I workaround this issue ? I put here also a possible solution, but I cannot apply it in my case without a pragmatic example.
thanks !
here is my code:
Geo_sweep = [1 2 3]; % three locations
numSims = length(Geo_sweep);
mdl1 = 'system_270621Hybrid6';
% open_system(mdl1)
for i = numSims:-1:1
in(i) = Simulink.SimulationInput(mdl1);
in(i) = setBlockParameter(in(i), [mdl1 '/wheather_sun data'], 'GeoSelector', num2str(Geo_sweep(i)));
end
%start parallel simulation
% setupFcn = @()addpath(pwd);
poolobj = parpool('local',3);
addAttachedFiles(poolobj,{'tutto.mat'});
setupFcn = @()evalin('base','load tutto.mat' );
% out_Hybrid = parsim(in,'ShowSimulationManager', 'on','ShowProgress','on','TransferBaseWorkspaceVariables','on','SetupFcn',setupFcn)
out_Hybrid = parsim(in,'ShowSimulationManager', 'on','ShowProgress','on','SetupFcn',setupFcn)
  1 件のコメント
Rahul Kumar
Rahul Kumar 2022 年 4 月 8 日
Can you provide some more details? Is the setupFcn throwing an error? It would be good to paste the exact text of the error message.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by