필터 지우기
필터 지우기

matlab embedded function (MATLAB R2008a)

조회 수: 4 (최근 30일)
Ahmed Tolba
Ahmed Tolba 2012년 5월 15일
I have a simulink model with embedded MATLAB function which code is
function [t,p,h,hv,hl,v,v_v,vl,s,sv,sl,u,uv,ul,x] = fcn(t1,p1,h1,v1,s1,u1,x1)
%#eml
eml.extrinsic('XSteam');
t = zeros(1,1,'uint8');
p= zeros(1,1,'unit8');
h=zeros(1,1,'unit8');
hv=zeros(1,1,'unit8');
hl=zeros(1,1,'unit8');
v=zeros(1,1,'unit8');
v_v=zeros(1,1,'unit8');
vl=zeros(1,1,'unit8');
s=zeros(1,1,'unit8');
sv=zeros(1,1,'unit8');
sl=zeros(1,1,'unit8');
u=zeros(1,1,'unit8');
uv=zeros(1,1,'unit8');
ul=zeros(1,1,'unit8');
x=zeros(1,1,'unit8');
if ((t1==0)&& (h1==0)&& (v1==0)&& (s1==0)&& (u1==0)&&(x1==0));
t=XSteam('Tsat_p',p1);
p=0;
hv=XSteam('hV_p',p1);
hl=XSteam('hL_p',p1);
v_v=XSteam('vV_p',p1);
vl=XSteam('vL_p',p1);
sv=XSteam('sV_p',p1);
sl=XSteam('sL_p',p1);
uv=XSteam('uV_p',p1);
ul=XSteam('uL_p',p1);
h=0;
u=0;
s=0;v=0;x=0;
elseif ((p1==0)&&(h1==0)&&(v1==0)&&(s1==0)&&(u1==0)&&(x1==0));
p=XSteam('psat_T',t1);
hv=XSteam('hV_T',t1);
hl=XSteam('hL_T',t1);
v_v=XSteam('vV_T',t1);
vl=XSteam('vL_T',t1);
sv=XSteam('sV_T',t1);
sl=XSteam('sL_T',t1);
uv=XSteam('uV_T',t1);
ul=XSteam('uL_T',t1);
t=0;
h=0;u=0;s=0;v=0;
elseif ((h1==0)&&(v1==0)&&(s1==0)&&(u1==0)&&(x1==0));
h=XSteam('h_pT',p1,t1);
s=XSteam('s_pT',p1,t1);
v=XSteam('v_pT',p1,t1);
u=XSteam('u_pT',p1,t1);
p=0;ul=0;uv=0;sl=0;sv=0;v_v=0;vl=0;hv=0;hl=0;x=0;
t=0;
elseif ((t1==0)&&(h1==0)&&(v1==0)&&(u1==0)&&(x1==0));
x=XSteam('x_ps',p1,s1);
u=XSteam('u_ps',p1,s1);
v=XSteam('v_ps',p1,s1);
t=XSteam('T_ps',p1,s1);
p=0;
s=0;ul=0;uv=0;sl=0;sv=0;v_v=0;vl=0;hv=0;hl=0;
elseif ((t1==0)&&(v1==0)&&(s1==0)&&(u1==0)&&(x1==0))
t=XSteam('T_ph',p1,h1);
v=XSteam('v_ph',p1,h1);
s=XSteam('s_ph',p1,h1);
u=XSteam('u_ph',p1,h1);
x=XSteam('x_ph',p1,h1);
p=0;
h=0;ul=0;uv=0;sl=0;sv=0;v_v=0;vl=0;hv=0;hl=0;
elseif ((t1==0)&&(v1==0)&&(u1==0)&&(p1==0)&&(x1==0))
t=XSteam('T_hs',h1,s1);
p=XSteam('p_hs',h1,s1);
h=0;s=0;ul=0;uv=0;sl=0;sv=0;v_v=0;vl=0;hv=0;hl=0;x=0;
else
h=XSteam('h_px',p1,x1);
u=0;s=0;p=0;x=0;ul=0;uv=0;sl=0;sv=0;v_v=0;vl=0;hv=0;hl=0;
end
but when I run the model some errors display ""Sampled update was specified and no sample time was entered in chart Embedded MATLAB Function (#18)""
and ""Error reported by S-function 'sf_sfun' in 'steam/Embedded MATLAB Function/ SFunction ': Stateflow Suppress Error.""
  댓글 수: 2
Walter Roberson
Walter Roberson 2012년 5월 15일
Please do not open duplicate questions; it stresses and confuses the editors.
Kaustubha Govind
Kaustubha Govind 2012년 5월 15일
Yes, if Mike's answer didn't resolve the issue, please continue the discussion on that same question.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by