- https://www.mathworks.com/help/simulink/slref/parallel-simulations-using-parsim-test-case-sweep.html
Perform simulation testing using Simulink Test, enable parallel computing, and the calculation results are being overwritten.
조회 수: 11 (최근 30일)
이전 댓글 표시
Hello, I am using Simulink Test for testing and using signal logging to record the data of signals inside a ForEach module. At the same time, I enabled parallel computation to speed up the simulation. However, when I check the observed data in the output results of Simulink Test, they are inconsistent with the data under serial computation. Moreover, under serial computation, the results of two iterations are different, while under parallel computation, the results of two iterations are the same. It seems that the last iteration when I enabled parallel computation is overwriting the previous computation results. Is there a way to resolve this?
댓글 수: 0
답변 (1개)
Broy
21분 전
I understand you are using Simulink Test with parallel computing to speed up simulations involving a ForEach subsystem, but you are finding that the logged results are identical across iterations, whereas they correctly vary in serial mode.
This issue typically occurs because parallel workers use a static copy of the base workspace. If your test script updates variables in the workspace for each iteration, the parallel workers do not see these updates and simulate the model using the same initial values every time.
To fix this, you must explicitly define parameters for each iteration using Simulink.SimulationInput objects.
Here is a useful Documentation link explaining the usage of SimulinkInput objects:
I hope this is helpful.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Outputs에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!