필터 지우기
필터 지우기

How to use Simscape drop-down menu

조회 수: 5 (최근 30일)
Jack Cimorelli
Jack Cimorelli 2022년 7월 1일
편집: piyush 2022년 11월 8일
I am trying to implement a drop-down menu in a custom Simscape block. Other codes use "foundation.enum" as seen below: (ssc_fuel_cell)
num_ports = foundation.enum.num_ports.one; % Number of ports
% 1 - one
% 2 - two
% 3 - three
% 4 - four
However when I try:
model = foundation.enum.model.Adiabatic; % Thermodynamic model
% 1 - Adiabatic
% 0 - Isothermal
The error is:" 'foundation.enum.model.Adiabatic' is not defined in this scope. "
Any ideas on how to properly implement this?
  댓글 수: 1
piyush
piyush 2022년 11월 7일
Hi, were you able to fix this?

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

채택된 답변

piyush
piyush 2022년 11월 8일
편집: piyush 2022년 11월 8일
classdef thermo_model < int32
enumeration
isothermal (0)
adiabatic (1)
end
end
save this as thermo_model.m
in the simscape component
parameters
t_m = thermo_model.isothermal; % select from dropdown list
end
use t_m with the equations
% Conditional parameter
if t_m == thermo_model.isothermal % isothermal model
equations
%
end
else
equations % t_m == thermo_model.adiabatic % adiabatic model
%
end
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Gas Library에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by