Axino.net

SciLab toxic pool simulator

by Arxleol on Saturday 19.09.2009, under Programming, Scilab

This SciLab program (function) is solving or rather simulating flow of acid matter trough drainage pools…It simulates entrance of toxic water in the number one pool and then flow trough it into another pool. After which pools fill until full capacity! After reaching full capacity spillover from second pool flows into river. This simulator calculates grams exiting trough spillover from second pool into river.

function [izhod] = pools(b1,b2,dt,tmax)
//--------------------------
// Setup parameters
//--------------------------
//vh in grams/m3
vh=30
Qin=0.1;
Qr=0.5*Qin;
K=((0.2/24)/60)/60;
t=0;
B1fill=0;
Kb1=0;
Kb2=0;
B2fill=0;
izhod=0;
//--------------------------
// The main time loop
//--------------------------
while tb1 then
tmp=B1fill-b1;
B1fill=b1;
Kb1=Kb1-tmp*vh;
end
B2fill=B2fill+Qr*dt;
tmp=Qr*dt*(Kb1/B1fill);
Kb1=Kb1-tmp;
Kb2=Kb2+tmp;
B1fill=B1fill-Qr*dt;
if B2fill-Qin*dt>=b2 then
B2fill=B2fill-Qin*dt;
tmp=Qin*dt;
Kb2=Kb2-tmp*(Kb2/B2fill);
izhod=tmp*(Kb2/B2fill);
end
Kb1=Kb1-(Kb1*K*dt);
 Kb2=Kb2-(Kb2*K*dt);
end
endfunction

Function takes parameters capacity of pools change in time interval and maximum time for following flow! Always make sure to input larger maximum time interval, so that flow has chance to stabilize. Otherwise results will not be correct.

In case that you would like to have faster execution you should rewrite while time loop into for time loop.

Similar Posts:

:, , ,
1 comment for this entry:
  1. Toxic pool simulator in java - Axino.net

    [...] Arxleol on Tuesday 22.09.2009, under Java, Programming This is same as previous post. The only difference is this one is written in Java in netbeans therefore has user interface more [...]

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Archives