Simulation manager with initFcn

조회 수: 5 (최근 30일)
Peter
Peter 2025년 2월 19일
이동: Fangjun Jiang 2025년 2월 25일
I'd need to run multiple simulation runs with using Simulation Manager "Multiple Simulations". My simulik model uses InitFcn callback function to initializate the model via matlab m-script. There are params which needs to be change per multiple simulation runs.
As pictured, I'd need to Vd_hfi to be change per simulation runs, it s defined in "init_model" m-script and this variable is used in Simulink model block.
As of now I am not able to chne the params for different values per simulations runs....
Is it possible to achieve this and so how?

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2025년 2월 19일
'InitFcn' is executed before the simulation starts, that is probably the reason that your parameter values set in the multiple simulation are over-written.
Usually, you can move the function calls in 'InitFcn' to 'PreLoadFcn' or 'PostLoadFcn' if it is only to set up some parameter values. Then use Simulation Manager to set up all the parameter values that need to be different between each simulation.
  댓글 수: 16
Fangjun Jiang
Fangjun Jiang 2025년 2월 25일
Either remove these statements, or move the "init_model" to PreLoadFcn and set your own InitFcn.
Peter
Peter 2025년 2월 25일
이동: Fangjun Jiang 2025년 2월 25일
moving to PreLoadFcn does not work

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

카테고리

Help CenterFile Exchange에서 Verification, Validation, and Test에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by