SciLab oxygen saturation
by Arxleol on Friday 18.09.2009, under Programming, Scilab, tutorial
Here is small program I wrote about oxygen saturation of water in the pool. It is in fact really slow however it points what needs to be done in similar situations.
Though this program executes slowly if one would rewrite while loop in the for loop then program should execute faster however I haven’t tested it.
function [] = kisik(Qo,dt) //-------------------------- // Setup parameters //-------------------------- i=1; V=10; So(i)=0; t(i)=0; Ka=0.1; Sosat=8; dSo=0; //-------------------------- // The main time loop //-------------------------- while So<Sosat i=i+1; dSo=(Ka*Qo*(Sosat-So(i-1))*dt)/V; So(i)=So(i-1)+dSo; t(i)=t(i-1)+dt; end plot2d(t,So) endfunction
As you can see function takes two parameters. First one represents volume of water passing trough water pool. While second one dt is change in time interval.
Function will run until saturation level in water is same or larger then maximum saturation of oxygen in water. Formula that is user to calculate change in saturation, is second line in while loop.
Almost to forget after saturation levels are calculated graph is drawn of saturation levels on y-axis while on x-axis is time.
Sunday 04.10.2009 on 10:39
cool blog
Sunday 04.10.2009 on 16:06
pD19fn I bookmarked this link. Thank you for good job!
Monday 05.10.2009 on 03:53
Thanks guys.
Ax
Saturday 10.10.2009 on 18:05
Great. Now i can say thank you!,
Monday 12.10.2009 on 13:18
Excellent site. It was pleasant to me.,