Dynamic response of two tanks in series to a random feed flow rate  
Author's Data: Housam BINOUS
Department of Chemical Engineering
National Institute of Applied Sciences and Technology
Tunis, TUNISIA
Email: binoushousam@yahoo.com

Assume volumeric flowrate proportional to square root of tank height :  \(TraditionalForm\`q\_i\ \((t)\)\  = \ \(\(k\_i\)\(\ \)\(\@\(\(h\_\(\(i\)\(\ \)\)\)(t)\)\)\(\ \)\)\) where i=1, 2. Initially the two tanks are empty. Tank volume (Subscript[v, i])(t) = 
        (Subscript[A, i]) (Subscript[h, i ])(t) for i=1, 2.

Random feed flowrate

RandomRelist[x_List] := 
      Block[{n = x, p}, 
        Do[p = Random[Integer, {1, i}]; 
          n[[{p, i}]] = n[[{i, p}]], {i, Length[x]}]; n]

tt = RandomRelist[Range[100]]

q[t_] := (∑_(i = 1)^100)(tt[[i]]/
              100) (UnitStep[t - 10 (i - 1)] - 
              UnitStep[t - 10 i])

Plot[q[t],{t,0,200},PlotStyle->RGBColor[1,0,0],PlotRange->{0,1}]

Dynamic response of the two tanks

(Subscript[A, 1]) = 5; (Subscript[A, 2]) = 0.2; (Subscript[k, 1]) = 2; (Subscript[k, 2]) = 3;

sol1 = 
      NDSolve[{q[t] - (Subscript[k, 1]) (Sqrt[(Subscript[h, 1])])[t] == (Subscript[A, 1]) 
              D[(Subscript[h, 1])[t], {t, 
                  1}], 
(Subscript[k, 1]) (Sqrt[(Subscript[h, 1])])[t] - (Subscript[k, 2]) (Sqrt[(Subscript[h, 2])])[t] == (Subscript[A, 2]) D[(Subscript[h, 2])[t], {t, 1}], (Subscript[h, 1])[0] == 0, 
          (Subscript[h, 2])[0] == 0}, {(Subscript[h, 1])[t], (Subscript[h, 2])[t]}, {t, 0, 200}]

plt1 = 
      Plot[{q[t], 5 (Subscript[h, 2])[t] /. sol1, (Subscript[h, 1])[t] /. sol1}, {t, 0, 200}, 
        PlotStyle -> {RGBColor[1, 0, 0], RGBColor[0, 1, 0], 
            RGBColor[0, 0, 1]}, PlotRange -> All]