필터 지우기
필터 지우기

Advice and ideas to "get"/"collect" the units at the ports of the Simscape blocks

조회 수: 1 (최근 30일)
Abdullah
Abdullah 2023년 10월 18일
답변: Githin George 2023년 10월 26일
Dear fellows:
I am trying to develop a MATLAB program where the the units at the ports (signal ports, not the physical ones since there domain can be detected) of Simscape blocks can be picked up automatically based on the handle of the block. One block under question is Fuel Cell/ Electrical Simscape.
I have tried a few thing but nothing seems to work. One thing I tried was using:
get_param(handle, 'CompiledPortUnits') but this command only gives correct results for the Simulink block and does not give the the units at the ports but only returns the handles.
Another option is each block has the units stored as parameters (image 2) and I can access from but the problem their is that each paramater name then will be unique for other blocks.

답변 (1개)

Githin George
Githin George 2023년 10월 26일
Hello,
My understanding is that you are trying to see the value of ‘units’ at the ports of various Simscape blocks, specifically for ‘Fuel Cell’ block in Simscape Electrical.
One way to access the ‘units’ property is from the properties of Simulink ‘mask’ for the corresponding block.
The following code shows how to obtain the ‘unit’ for a selected ‘Inertia’ block from its Mask.
% gcb returns the full block path name of the current block in the current system.
p = Simulink.Mask.get(gcb);
param = p.getParameter('inertia_unit');
param.Value
For different blocks, the mask parameters will differ therefore you have to check them for each block. You can view the mask by selecting a block and using the ‘ctrl+M’ shortcut.
I also suggest that you refer to the following example, where they have used ‘Fuel Cell’ block. Note that one input is in Thermal Domain and 4 inputs are Physical Signals.
In the above example it might be convenient to obtain ‘units’ from the mask of ‘PS-Constant’ block or ‘PS-Saturation’ block instead of getting it from the ‘Fuel Cell’ block.
I hope this helps.
PS:

카테고리

Help CenterFile Exchange에서 Electrical Sensors에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by