Working with the CPI-tyre block and parsim
1 回表示 (過去 30 日間)
古いコメントを表示
Hello everyone,
I would like to run a lot of vehicle dynamics simulations in simulink parallel. For that I wanted to use the function parsim. For the tyre model in the simulation I am using the CPI-tyre block from the TNO Delft-Tyre toolbox. For the tyre data a string with the name of the .tir file has to be included in the block. This does not create a problem when the model is just started by using the 'sim' function, it just looks in the current folder in the Matlab-Path. The name can even be modified by using '..\' to specify the location.
However when I try to start the simulation on the workers the tyre-file cannot be located by the block. I have already tried to add the file to the parallel pool with both 'addAttachedFiles' and by adding it manually in the cluster profil manager. I even tried to add the path in the cluster profil manager as well. All of those did not resolve the issue.
Does anybody here have an idea how I can load the .tir-files onto the workers, so that the block would recognise/find it?
Thank you in advance
0 件のコメント
回答 (1 件)
Rahul Kumar
2019 年 2 月 1 日
Hi Sönke,
Using addAttachedFiles to attach the file is the right approach. The file will be put in some temporary location and added to the path so that the parallel workers have access to it. Can the block use the file if it's on the MATLAB path but not in the current folder?
Here is another approach that you can try. I am assuming that the block can also accept an absolute path. If that's the case, I would use the PreSimFcn on the SimulationInput object to set the file path on the block parameter (after using addAttachedFiles to attach the file to the pool)
function simIn = preSimSetTLRFile(simIn, tlrFile)
fileLoc = which(tlrFile)
simIn = simIn.setBlockParameter('path/to/block', 'block_param_name', fileLoc);
end
simIn = Simulink.SimulationInput('my_model');
tlrFile = 'my_file.tlr';
addAttachedFiles(gcp, '/path/to/tlr/file')
% Set the PreSimFcn on SimulationInput
simIn.PreSimFcn = @(x) preSimSetTLR(x, tlrFile);
Please try it out and let me know if you run into any issues.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Run Multiple Simulations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!