|
Sorry, i forgot the "end" after the if-else-construction. But this is not the problem. It doesn't work anyway
"sdfs sfdf" <ofeus18@yahoo.de> wrote in message <hc6l8j$4k0$1@fred.mathworks.com>...
> Hello,
>
> i have an s-function to which the parameter "L" is handed over. The beginning of the s-function looks like this :
> Code:
> function [sys,x0,str,ts] = Kinetik_aerob(t,x,u,flag,V_l,c_X_0,A,L)
>
> switch flag,
>
> case 0,
> [sys,x0,str,ts]=mdlInitializeSizes(V_l,c_X_0,A,L);
>
> case 3,
> sys=mdlOutputs(t,x,u,V_l,c_X_0,A,L);
>
> case {1, 2, 4, 9},% unexpected flags
>
> otherwise
> error(['Unhandled flag = ',num2str(flag)]);
>
> end
> %
> function [sys,x0,str,ts]=mdlInitializeSizes(V_l,c_X_0,A,L)
>
> sizes = simsizes;
>
> sizes.NumContStates = 0;
> sizes.NumDiscStates = 0;
> sizes.NumOutputs = 7;
> sizes.NumInputs = 6;
> sizes.DirFeedthrough = 1;
> sizes.NumSampleTimes = 1;
>
> sys = simsizes(sizes);
> %
> x0 = [];
> str = [];
> ts = [0 0];
> %
>
>
> function sys=mdlOutputs(t,x,u,V_l,c_X_0,A,L)
>
> %Einlesen
> c_X = u(1); %[g/l] Biomassekonzentration
> PFD = u(2); %[?E/m?s] PFD(PAR)
> E = u(3); %[MJ]
> Ab = u(4); %[g/l]
> Temp = u(5); %[?K]
> Gh = u(6); %[W/m^2]
>
>
>
> %Now the part with which i have problems. The if-else-construction:
> if L==1
> PFD = PFD*( (-0.9184 * c_X) / (0.1447 + c_X) + 1.002 );
>
> elseif L==3
> PFD = PFD* ( (-0.9714 * c_X) / (0.04037 + c_X) + 1 );
>
>
> It seems as if the s-function cannot handle this if-construction or the if-construction doesn't recognize the parameter "L". If i calculate "PFD" without the if-construction it works. What is wrong? Please help me ;-)
>
> Thank you
> bye
|