Ticket #145: testnew.mso

File testnew.mso, 1.5 KB (added by Antonio Carlos Brandao de Araujo, 12 years ago)
Line 
1FlowSheet test
2
3        PARAMETERS
4        u(3) as Real;
5       
6        SET
7        u = [2,4,-1];
8
9        VARIABLES
10        x(4) as Real;
11
12        EQUATIONS
13        diff(x(1)) = x(1) + x(2) + min(u);
14        diff(x(2)) = x(2) + x(3) + max(x);
15        diff(x(3)) = x(1) + x(3) + max([0, min([u,x])]);
16        diff(x(4)*x(3)) = 2*x(2)*x(4) - min([x, max(u)]);
17
18        OPTIONS
19        Dynamic = false;
20
21end
22
23
24FlowSheet newtest
25
26        PARAMETERS
27        v0p as Real (Default = 250); # Maximum settling velocity (m.d^-1)
28        v0  as Real (Default = 474); # Maximum Vesilind settling velocity (m.d^-1)
29        rh  as Real (Default = 0.000576); # Hindered zone settling parameter (m3.(g SS)^-1)
30        rp  as Real (Default = 0.002860); # Flocculant zone settling parameter (m3.(g SS)^-1)
31        fns as Real (Default = 0.002860); # Non-settleable fraction (dimensionless)
32        Xt  as Real (Default = 3000); # Threshold concentration for settler (g.m^-3)
33        fr  as Real (Default = 4/3); # Coefficient for TSS calculation
34
35        VARIABLES
36        XD(nlayer) as Real (Lower = 0);
37        vs(nlayer) as Real (Lower = 0);
38        Js(nlayer) as Real (Lower = 0);
39        Jclar(nlayer) as Real (Lower = 0);
40
41        EQUATIONS
42        Xf = 2665.3;
43        for i in [1:nlayer]
44                #vs(i) = max([0, min([v0p, v0*(exp(-rh*(XD(i) - fns*Xf)) - exp(-rp*(XD(i) - fns*Xf)))])]);
45                aux1(i) = v0*(exp(-rh*(XD(i) - fns*Xf)) - exp(-rp*(XD(i) - fns*Xf)));
46                aux2(i) = min([v0p, aux1(i)]);
47                vs(i)   = max([0, aux2(i)]);
48        end
49        Js = vs*XD;
50        Jclar([1:flayer]) = 2;
51        for i in [flayer+1:nlayer]
52                if XD(i-1) > 3000 then
53                        Jclar(i) = min([Js(i), Js(i-1)]);
54                else
55                        Jclar(i) = Js(i);
56                end
57        end
58
59
60end