PMSM DRIVE EXAMPLE: where are the model's variables located?

조회 수: 5 (최근 30일)
Stefano
Stefano 2025년 10월 21일
댓글: Chuguang Pan 2025년 10월 23일
Hello,
I'm playing with R2025b demo license and I'm trying to understand PMSM Drive Example in simscape electrical.
The .m file reports just a command line:
set_param(find_system('PMSMDrive','FindAll', 'on','type','annotation','Tag','ModelFeatures'),'Interpreter','off')
One time I run the model it works and in the workspace a list of variables appear.
But where those variables are located? I don't see any configuration files or similar. I'm trying to see if a configuration Musk is present for each block, but nothing.
Thanks in advanced for the support
Stefano

답변 (1개)

Chuguang Pan
Chuguang Pan 2025년 10월 21일
@Stefano. The variables appearing in the base workspace is calculated from the PreloadFcn callback function in the PMSM model. You can use get_param function to obtain the content of PreloadFcn.
openExample('simscapeelectrical/PMSMDriveExample')
get_param(bdroot,"PreloadFcn")
  댓글 수: 2
Stefano
Stefano 2025년 10월 21일
Thanks @Chuguang Pan, but how can I set/modify these parameter in PreloadFcn?
I mean, if I create a model from scratch generally I created also an associated .m file in which define the parameters. I'm expecting a mask or something similar directly in the blocks or somewhere in the model.
Could you suggest me something to read/see that explain how to dwell with PreloadFcn callback function?
Thanks in advanced for your support
Stefano
Chuguang Pan
Chuguang Pan 2025년 10월 23일 7:11
@Stefano. If you want to load associated parameters of model before opening the model, you can write a .m file which includes parameter initialization setting statements. Then , you can call this .m file from the PreloadFcn property of model. In addition, you can organize your code files as a MATLAB Project for better management, and set the matlab.project.Project.StartupFiles of your project as the parameters initialization file. The StartupFiles will run first before loading model.

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

카테고리

Help CenterFile Exchange에서 Magnetic Elements에 대해 자세히 알아보기

제품


릴리스

R2025b

Community Treasure Hunt

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

Start Hunting!

Translated by