<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Axino.net &#187; Scilab</title>
	<atom:link href="http://www.axino.net/tag/scilab/feed" rel="self" type="application/rss+xml" />
	<link>http://www.axino.net</link>
	<description>The other side of atom.</description>
	<lastBuildDate>Sat, 14 Aug 2010 23:11:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>SciLab toxic pool simulator</title>
		<link>http://www.axino.net/programming/2009/09/scilab</link>
		<comments>http://www.axino.net/programming/2009/09/scilab#comments</comments>
		<pubDate>Sat, 19 Sep 2009 12:22:14 +0000</pubDate>
		<dc:creator>Arxleol</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Scilab]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[programs]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.axino.net/?p=458</guid>
		<description><![CDATA[This SciLab program (function) is solving or rather simulating flow of acid matter trough drainage pools&#8230;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 [...]]]></description>
			<content:encoded><![CDATA[<p>This SciLab program (function) is solving or rather simulating flow of acid matter trough drainage pools&#8230;<span id="more-458"></span>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.</p>

<div class="wp_syntax"><div class="code"><pre class="scilab" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> <span style="color: #009900;">&#91;</span>izhod<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> pools<span style="color: #009900;">&#40;</span>b1<span style="color: #339933;">,</span>b2<span style="color: #339933;">,</span>dt<span style="color: #339933;">,</span>tmax<span style="color: #009900;">&#41;</span>
<span style="color: #666666; font-style: italic;">//--------------------------</span>
<span style="color: #666666; font-style: italic;">// Setup parameters</span>
<span style="color: #666666; font-style: italic;">//--------------------------</span>
<span style="color: #666666; font-style: italic;">//vh in grams/m3</span>
vh<span style="color: #339933;">=</span><span style="color: #cc66cc;">30</span>
Qin<span style="color: #339933;">=</span><span style="color: #cc66cc;">0.1</span><span style="color: #339933;">;</span>
Qr<span style="color: #339933;">=</span><span style="color: #cc66cc;">0.5</span><span style="color: #339933;">*</span>Qin<span style="color: #339933;">;</span>
K<span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0.2</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">24</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">60</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">60</span><span style="color: #339933;">;</span>
t<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
B1fill<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
Kb1<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
Kb2<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
B2fill<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
izhod<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//--------------------------</span>
<span style="color: #666666; font-style: italic;">// The main time loop</span>
<span style="color: #666666; font-style: italic;">//--------------------------</span>
<span style="color: #b1b100;">while</span> tb1 <span style="color: #000066;">then</span>
tmp<span style="color: #339933;">=</span>B1fill<span style="color: #339933;">-</span>b1<span style="color: #339933;">;</span>
B1fill<span style="color: #339933;">=</span>b1<span style="color: #339933;">;</span>
Kb1<span style="color: #339933;">=</span>Kb1<span style="color: #339933;">-</span>tmp<span style="color: #339933;">*</span>vh<span style="color: #339933;">;</span>
<span style="color: #b1b100;">end</span>
B2fill<span style="color: #339933;">=</span>B2fill<span style="color: #339933;">+</span>Qr<span style="color: #339933;">*</span>dt<span style="color: #339933;">;</span>
tmp<span style="color: #339933;">=</span>Qr<span style="color: #339933;">*</span>dt<span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span>Kb1<span style="color: #339933;">/</span>B1fill<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Kb1<span style="color: #339933;">=</span>Kb1<span style="color: #339933;">-</span>tmp<span style="color: #339933;">;</span>
Kb2<span style="color: #339933;">=</span>Kb2<span style="color: #339933;">+</span>tmp<span style="color: #339933;">;</span>
B1fill<span style="color: #339933;">=</span>B1fill<span style="color: #339933;">-</span>Qr<span style="color: #339933;">*</span>dt<span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> B2fill<span style="color: #339933;">-</span>Qin<span style="color: #339933;">*</span>dt<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;=</span>b2 <span style="color: #000066;">then</span>
B2fill<span style="color: #339933;">=</span>B2fill<span style="color: #339933;">-</span>Qin<span style="color: #339933;">*</span>dt<span style="color: #339933;">;</span>
tmp<span style="color: #339933;">=</span>Qin<span style="color: #339933;">*</span>dt<span style="color: #339933;">;</span>
Kb2<span style="color: #339933;">=</span>Kb2<span style="color: #339933;">-</span>tmp<span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span>Kb2<span style="color: #339933;">/</span>B2fill<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
izhod<span style="color: #339933;">=</span>tmp<span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span>Kb2<span style="color: #339933;">/</span>B2fill<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">end</span>
Kb1<span style="color: #339933;">=</span>Kb1<span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span>Kb1<span style="color: #339933;">*</span>K<span style="color: #339933;">*</span>dt<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 Kb2<span style="color: #339933;">=</span>Kb2<span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span>Kb2<span style="color: #339933;">*</span>K<span style="color: #339933;">*</span>dt<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">end</span>
<span style="color: #000000; font-weight: bold;">endfunction</span></pre></div></div>

<p>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.</p>
<p>In case that you would like to have faster execution you should rewrite <strong>while time loop</strong> into<strong> for time loop</strong>.<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://www.axino.net/tutorial/2009/09/scilab-oxygen-saturation" rel="bookmark" title="Friday 18.09.2009">SciLab oxygen saturation</a></li>
<li><a href="http://www.axino.net/tutorial/2010/07/javascript-challenge-15-nag-a-ram" rel="bookmark" title="Sunday 04.07.2010">JavaScript Challenge 15 :: nag a ram</a></li>
<li><a href="http://www.axino.net/operating-systems/windows/2010/01/desktop-shortcuts-tips" rel="bookmark" title="Monday 25.01.2010">Desktop shortcuts tips</a></li>
<li><a href="http://www.axino.net/scribing/2009/10/future-of-kingsagex-project-and-plea-for-help" rel="bookmark" title="Saturday 03.10.2009">Future of kingsageX project and plea for help</a></li>
<li><a href="http://www.axino.net/tutorial/2009/11/addind-content-in-jtable" rel="bookmark" title="Tuesday 03.11.2009">Addind content in JTable</a></li>
</ul>
<p><!-- Similar Posts took 5.441 ms --></p>
 <img src="http://www.axino.net/wordpress/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=458" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.axino.net/programming/2009/09/scilab/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SciLab oxygen saturation</title>
		<link>http://www.axino.net/tutorial/2009/09/scilab-oxygen-saturation</link>
		<comments>http://www.axino.net/tutorial/2009/09/scilab-oxygen-saturation#comments</comments>
		<pubDate>Fri, 18 Sep 2009 11:52:54 +0000</pubDate>
		<dc:creator>Arxleol</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Scilab]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[programs]]></category>

		<guid isPermaLink="false">http://www.axino.net/?p=453</guid>
		<description><![CDATA[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&#8217;t tested [...]]]></description>
			<content:encoded><![CDATA[<p>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.</p>
<p><span id="more-453"></span>Though this program executes slowly if one would rewrite <strong>while loop</strong> in the <strong>for loop</strong> then program should execute faster however I haven&#8217;t tested it.</p>

<div class="wp_syntax"><div class="code"><pre class="scilab" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> kisik<span style="color: #009900;">&#40;</span>Qo<span style="color: #339933;">,</span>dt<span style="color: #009900;">&#41;</span>
<span style="color: #666666; font-style: italic;">//--------------------------</span>
<span style="color: #666666; font-style: italic;">// Setup parameters</span>
<span style="color: #666666; font-style: italic;">//--------------------------</span>
i<span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
V<span style="color: #339933;">=</span><span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span>
So<span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
t<span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
Ka<span style="color: #339933;">=</span><span style="color: #cc66cc;">0.1</span><span style="color: #339933;">;</span>
Sosat<span style="color: #339933;">=</span><span style="color: #cc66cc;">8</span><span style="color: #339933;">;</span>
dSo<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//--------------------------</span>
<span style="color: #666666; font-style: italic;">// The main time loop</span>
<span style="color: #666666; font-style: italic;">//--------------------------</span>
<span style="color: #b1b100;">while</span> So<span style="color: #339933;">&lt;</span>Sosat
i<span style="color: #339933;">=</span>i<span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
dSo<span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span>Ka<span style="color: #339933;">*</span>Qo<span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span>Sosat<span style="color: #339933;">-</span>So<span style="color: #009900;">&#40;</span>i<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>dt<span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span>V<span style="color: #339933;">;</span>
So<span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">=</span>So<span style="color: #009900;">&#40;</span>i<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span>dSo<span style="color: #339933;">;</span>
t<span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">=</span>t<span style="color: #009900;">&#40;</span>i<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span>dt<span style="color: #339933;">;</span>
<span style="color: #b1b100;">end</span>
<span style="color: #000066;">plot2d</span><span style="color: #009900;">&#40;</span>t<span style="color: #339933;">,</span>So<span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">endfunction</span></pre></div></div>

<p>As you can see function takes two parameters. First one represents volume of water passing trough water pool. While second one <strong>dt</strong> is change in time interval.</p>
<p>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.</p>
<p>Almost to forget after saturation levels are calculated graph is drawn of saturation levels on y-axis while on x-axis is time.<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://www.axino.net/programming/2009/09/scilab" rel="bookmark" title="Saturday 19.09.2009">SciLab toxic pool simulator</a></li>
<li><a href="http://www.axino.net/tutorial/2009/06/how-to-obtain-get-parameters-from-url-with-javascript" rel="bookmark" title="Tuesday 09.06.2009">How to obtain get parameters from URL with javascript</a></li>
<li><a href="http://www.axino.net/tutorials" rel="bookmark" title="Wednesday 07.01.2009">Tutorials</a></li>
<li><a href="http://www.axino.net/tutorial/2009/12/hackthissite-org-extbasic-4-finda-fake-2" rel="bookmark" title="Sunday 27.12.2009">hackthissite.org extbasic 4 :: Finda Fake 2</a></li>
<li><a href="http://www.axino.net/tutorial/2009/10/javascript-settimeout-in-greasemonkey" rel="bookmark" title="Sunday 25.10.2009">javascript setTimeout() in greasemonkey</a></li>
</ul>
<p><!-- Similar Posts took 4.975 ms --></p>
 <img src="http://www.axino.net/wordpress/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=453" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.axino.net/tutorial/2009/09/scilab-oxygen-saturation/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
