Is it possible to change the unit of reluctance block of MATLAB from m.file?

3 次查看(过去 30 天)
I am using a number of reluctance blocks for simulation and the values of the of that block are from workspace using the m.file. However, is there any way to change the unit as well? For example, the reluctance block requires values of length and area. The values are provided as 1m and 1m^2. I would like to change the length from 1m to 1cm. One way is the changing value 1 to 0.01 and keeping the unit to m. But I would like to keep the value as 1 and change the unit from m to cm. As the number of blocks are more, is there way to chnage the unit from the m.file? If so, how can I do that?

回答(1 个)

Paul
Paul 2023-5-22
编辑:Paul 2023-5-22
It appears this can be done via typical set_param commands. For example, I have a Reluctance block selected in my model:
set_param(gcb,'CSA_unit','cm^2') % change the unit of cross-sectional area to cm^2
To see all parameters for the block
get_param(gch,'ObjectParameters')
There may also be other ways to achieve this goal. Check out Physical Units in the Simscape documentation for more dicussion.

类别

Help CenterFile Exchange 中查找有关 Magnetic Elements 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by