matlab embedded function (MATLAB R2008a)
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Walter Roberson
am 15 Mai 2012
Please do not open duplicate questions; it stresses and confuses the editors.
Kaustubha Govind
am 15 Mai 2012
Yes, if Mike's answer didn't resolve the issue, please continue the discussion on that same question.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Simulink Functions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!