<!doctype html public "-//W3C//DTD HTML 3.2//EN">

<html>
<head>
<title>FlowWizard</title>
<style>
<!--
td {font-family: verdana, arial; font-weight: normal; font-size: 10pt; color: #000000; text-decoration: none;}
b {font-family: verdana, arial; font-weight: bold; font-size: 10pt; color: #000000; text-decoration: none;}
body {font-family: verdana, arial; font-weight: normal; font-size: 10pt; color: #000000; text-decoration: none;}
-->
</style>

<script language="JavaScript">
<!--
  NS4 = document.layers;
  NS6 = document.getElementById;
  var opera;
  var action = 1;



  function change(name)
  {
     if (NS4)
       document.layers[name].visibility = ( document.layers[name].visibility=="show" ? "hide" : "show" );
     else if (NS6)
       document.getElementById(name).style.visibility = ( document.getElementById(name).style.visibility=="visible" ? "hidden" : "visible" );
     else
       document.all[name].style.visibility = ( document.all[name].style.visibility=="visible" ? "hidden" : "visible" );
  }


  function show(name)
  {
     if (action==1) return;
     if (NS4)
       document.layers[name].visibility = "show";
     else if (NS6)
       document.getElementById(name).style.visibility = "visible";
     else
       document.all[name].style.visibility = "visible";
  }


  function hideB(name)
  {
     if (action==1) return;
     if (NS4)
        {document.layers[name].visibility = "hide";}
     else if (NS6) {
       document.getElementById(name).style.visibility = "hidden";
	         document.getElementById(name).style.display = "none";
		}
     else
        {document.all[ name].style.visibility = "hidden";}
  }
  function showB(name)
  {
     if (action==1) return;
     if (NS4) {
       document.layers[name].visibility = "show";
     } else if (NS6) {
       document.getElementById(name).style.visibility = "visible";
      document.getElementById(name).style.display = "block";
     } else {
       document.all[name].style.visibility = "visible";
	  }
  }


  function hide(name)
  {
     if (action==1) return;
     if (NS4)
        {document.layers[name].visibility = "hide";}
     else if (NS6)
       document.getElementById(name).style.visibility = "hidden";
     else
        {document.all[ name].style.visibility = "hidden";}
  }


//-->
</script>
<SCRIPT type="text/javascript">
<!--
  function showSS() {
        if (NS4) {
                senform = document.layers['CalcSen'].document.turckcalc;
				}
        else {
                senform = document.turckcalc;
				}
  if ( senform.sensor.checked ) {
	show("SS");
	show("SS1");
	show("SS2");
	}
else {
	hide("SS");
	hide("SS1");
	hide("SS2");
}
 }
  
function fill() {
       if (NS4) {
                senform = document.layers['CalcSen'].document.turckcalc;
				}
        else {
                senform = document.turckcalc;
				}
switch (senform.EZ.selectedIndex) {
  case 1:
    senform.QD.value="6,2";
    break;
  case 2:
    senform.QD.value="8,8";
    break;
  case 3:
    senform.QD.value="12,5";
    break;
  case 4:
    senform.QD.value="16";
    break;
  case 5:
    senform.QD.value="21,6";
    break;
  case 6:
    senform.QD.value="27,2";
    break;
  case 7:
    senform.QD.value="35,9";
    break;
  case 8:
    senform.QD.value="41,8";
    break;
  case 9:
    senform.QD.value="53";
    break;
  case 10:
    senform.QD.value="68,8";
    break;
  case 11:
    senform.QD.value="80,8";
    break;
  case 12:
    senform.QD.value="105,3";
    break;
  case 13:
    senform.QD.value="130";
    break;
  case 14:
    senform.QD.value="155,4";
    break;
}
         
	senform.EZ.selectedIndex=0;
	//senform.EQD.selectedIndex=0
}

function fillSen() {
showB ("SS");
   if (NS4) {
			senform = document.layers['CalcSen'].document.turckcalc;
			}
	else {
			senform = document.turckcalc;
			}
	switch (senform.EETT.selectedIndex) {
	  case 0:
		senform.ETT.value="10";
		senform.EBB.value="8";
		senform.ENB.value="0";
		senform.ENH.value="0";
		senform.chDSS.checked=false;
		showB("SS1");
		showB("SS2");
		break;
	  case 1:
		senform.ETT.value="10";
		senform.EBB.value="20.8";
		senform.ENB.value="6";
		senform.ENH.value="9.5";
		senform.chDSS.checked=true;
		hideB("SS1");
		break;
	  case 2:
		senform.ETT.value="10";
		senform.EBB.value="15";
		senform.ENB.value="6.7";
		senform.ENH.value="20";
		senform.chDSS.checked=false;
		hideB("SS1");
		break;
	  case 3:
		senform.ETT.value="10";
		senform.EBB.value="18";
		senform.ENB.value="0";
		senform.ENH.value="0";
		senform.chDSS.checked=false;
		hideB("SS1");
		break;
	  case 4:
		senform.ETT.value="10";
		senform.EBB.value="20";
		senform.ENB.value="0";
		senform.ENH.value="0";
		senform.chDSS.checked=false;
		hideB("SS1");
		break;
	  case 5:
		senform.ETT.value="10";
		senform.EBB.value="20.8";
		senform.ENB.value="7.3";
		senform.ENH.value="16";
		senform.chDSS.checked=false;
		hideB("SS1");
	  case 6:
		senform.ETT.value="10";
		senform.EBB.value="20.8";
		senform.ENB.value="7.3";
		senform.ENH.value="19";
		senform.chDSS.checked=false;
		hideB("SS1");
		break;
	}
         
}
// window.name = "Berechnung";

// Einheiten auf m/sec umrechnen
function UmrechnenV(Wert, Einheit)
{
        if (Einheit == 0)        Wert = Wert/1000;                // l/sec
        if (Einheit == 1)        Wert = Wert/1000/60;             // l/min
        if (Einheit == 2)        Wert = Wert/1000/60/60;          // l/h
        if (Einheit == 4)        Wert = Wert/60;                  // m/min
        if (Einheit == 5)        Wert = Wert/60/60;               // m/h
        return Wert;
}
function Vfac(Einheit)
{
        if (Einheit == 0)        Wert = 1/1000;                // l/sec
        if (Einheit == 1)        Wert = 1/1000/60;             // l/min
        if (Einheit == 2)        Wert = 1/1000/60/60;          // l/h
        if (Einheit == 4)        Wert = 1/60;                  // m/min
        if (Einheit == 5)        Wert = 1/60/60;               // m/h
        return Wert;
}


// Einheiten auf m umrechnen
function UmrechnenD(Wert, Einheit)
{
        if (Einheit == 0)        Wert = Wert/1000;                // mm
        if (Einheit == 1)        Wert = Wert/100;                 // cm
        if (Einheit == 2)        Wert = Wert/10;                  // dm
        if (Einheit == 3)        Wert = Wert/1;                   // m
        return Wert;
}
function Dfac(Einheit)
{
        if (Einheit == 0)        Wert = 1/1000;                // mm
        if (Einheit == 1)        Wert = 1/100;                 // cm
        if (Einheit == 2)        Wert = 1/10;                  // dm
        if (Einheit == 3)        Wert = 1/1;                   // m
        return Wert;
}


// Einheiten auf m/sec umrechnen
function UmrechnenQ(Wert, Einheit)
{
        if (Einheit == 0)        Wert = Wert/100;                 // cm/sec
        if (Einheit == 1)        Wert = Wert/100/60;              // cm/min
        if (Einheit == 2)        Wert = Wert/100/60/60;           // cm/h
        if (Einheit == 3)        Wert = Wert/1;                  // m/s
        if (Einheit == 4)        Wert = Wert/60;                  // m/min
        if (Einheit == 5)        Wert = Wert/60/60;               // m/h
        if (Einheit == 6)        Wert = Wert/60/60*1000;          // km/h
        return Wert;
}
function Qfac(Einheit)
{
        if (Einheit == 0)        Wert = 1/100;                 // cm/sec
        if (Einheit == 1)        Wert = 1/100/60;              // cm/min
        if (Einheit == 2)        Wert = 1/100/60/60;           // cm/h
        if (Einheit == 3)        Wert = 1/1;           	// m/s
        if (Einheit == 4)        Wert = 1/60;                  // m/min
        if (Einheit == 5)        Wert = 1/60/60;               // m/h
        if (Einheit == 6)        Wert = 1/60/60*1000;          // km/h
        return Wert;
}


// Einheiten auf m umrechnen
function UmrechnenET(Wert, Einheit)
{
        if (Einheit == 0)        Wert = Wert/1000;                // mm
        if (Einheit == 1)        Wert = Wert/100;                 // cm
        if (Einheit == 2)        Wert = Wert/10;                  // dm
        if (Einheit == 3)        Wert = Wert/1;                   // m
        return Wert;
}


// Werteprfung
function check(box)
{
        box.value = box.value.replace(/,/,".");
        if (box.value <= 0 || isNaN(box.value) == true)
        {
                alert('Please enter a positiv numeric value.');
                return (false);
        }
}


function checkall(X,Y,Z,sensor)
{
        var status = 0;
        if ( !((X<=0) || isNaN(X)) )                status = status + 1;
        if ( !((Y<=0) || isNaN(Y)) )                status = status + 1;
        if ( !sensor.checked || (!((Z<=0) || isNaN(Z))) )                status = status + 1;
        return(status);
}


// Eintauchtiefe einblenden
function doit(n)
{
        if (action==1) return;

        if (NS4)
                sensor = eval('document.layers[\'Calc'+n+'\'].document.FCalc' + n + '.sensor' + n );
        else
                sensor = eval('document.FCalc' + n + '.sensor' + n );

        if ( sensor.checked )
        {
                show('CalcSen');
        }
}


// Warnung Eintauchtiefe
function Warnung(D,ET,ENH,sensor)
{	var enh;
	enh = ENH/1000;
        if ( sensor.checked && D <= enh)
        {
                alert('Attention!\nThe inside pipe diameter is too small for the sensor installation.\nPlease adjust the value.');
                return(false);
        }
        if ( sensor.checked && D > enh && D <= (enh+ET+0.003))
        {
                alert('Attenttion!\n The sensor has contact to the inner pipe-face.\nPlease adjust the value.');
                return(false);
        }
        if ( !sensor.checked )
        {
                if ((D <= 0.025) && (D > enh)) alert('Note:\nIn order to achieve more precise results for small diameters,\nthe sensor\'s depth of immersion should be calculated as well.');
                return(true);
        }
        if ( sensor.checked && (ET <= 0) )
        {
                if (D <= 0.025)  alert('Note:\nIn order to achieve more precise results for small diameters,\nthe sensor\'s depth of immersion should be calculated as well.');
                return(true);
        }
        return(true);
}


// Sensorflche ermitteln
function Sensor(ET,EB,ENB,ENH,sensor,DN)
{
        var As=0;
		var dn;
		if (DN)  {
			dn=2;
		}
		else {
			dn=1;
		}
        if ( sensor.checked )
                As = (ET * EB / 1000) + (ENB * ENH / 1000 / 1000 * dn);
        return(As);
}




// Berechnung
function Ergebnis(Nr,ErrMsg)
{

var V;        // Durchflussmenge
var D;        // Rohrdurchmesser
var Q;        // Strmungsgeschwindigkeit
var r;        // Radius
var A;        // Flche
var ET;       // Sensoreintauchtiefe
var As;       // Sensorflche
var EV;       // Einheit Durchflussmenge
var ED;       // Einheit Rohrdurchmesser
var EQ;       // Einheit Strmungsgeschwindigkeit
        if (NS4) {
                senform = document.layers['CalcSen'].document.turckcalc;
				}
        else {
                senform = document.turckcalc;
				}

         
       ET = UmrechnenET(senform.ETT.value,0);// senform.EETT.selectedIndex);
var inputform;
// CalcQ
if (Nr == 0)
{
       

        V = senform.QV.value.replace(/,/,".");
        D = senform.QD.value.replace(/,/,".");

        if (checkall(V,D,ET,senform.sensor) != 3)
        {
                if (ErrMsg) alert('Please enter a positiv numeric value.');
                return(false);
        }

        V = UmrechnenV(V, senform.EQV.selectedIndex);
        D = UmrechnenD(D, 0);//senform.EQD.selectedIndex);

        As = Sensor(ET,senform.EBB.value.replace(/,/,"."),senform.ENB.value.replace(/,/,"."),senform.ENH.value.replace(/,/,"."),senform.sensor,senform.chDSS.checked);
        if (! Warnung(D,ET,senform.ENH.value.replace(/,/,"."),senform.sensor)) return(false);

        // Rohrquerschnitt ermitteln
        r = D/2;
        A = (Math.PI*r*r)-As

        // Strmungsgeschwindigkeit berechnen
        Q = V/A;
		//alert(Q);
		Q = Q / Qfac(senform.EVQ.selectedIndex);;
		senform.VQ.value = Q.toPrecision(6);
}


// CalcV
if (Nr == 1)
{

        Q = senform.VQ.value.replace(/,/,".");
        D = senform.QD.value.replace(/,/,".");

        if (checkall(Q,D,ET,senform.sensor) != 3)
        {
                if (ErrMsg) alert('Please enter a positiv numeric value.');
                return(false);
        }

        Q = UmrechnenQ(Q, senform.EVQ.selectedIndex);
        D = UmrechnenD(D, 0);//senform.EQD.selectedIndex);

        As = Sensor(ET,senform.EBB.value.replace(/,/,"."),senform.ENB.value.replace(/,/,"."),senform.ENH.value.replace(/,/,"."),senform.sensor,senform.chDSS.checked);
        if (! Warnung(D,ET,senform.ENH.value.replace(/,/,"."),senform.sensor)) return(false);

        // Rohrquerschnitt ermitteln
        r = D/2;
        A = (Math.PI*r*r)-As

        // Durchflussmenge berechnen
        V = Q*A;
		V = V / Vfac(senform.EQV.selectedIndex);
		senform.QV.value= V.toPrecision(6);
}


// CalcD
if (Nr == 2)
{

        Q = senform.VQ.value.replace(/,/,".");
        V = senform.QV.value.replace(/,/,".");

        if (checkall(Q,V,ET,senform.sensor) != 3)
        {
                if (ErrMsg) alert('Please enter a positiv numeric value.');
                return(false);
        }

        Q = UmrechnenQ(Q, senform.EVQ.selectedIndex);
        V = UmrechnenV(V, senform.EQV.selectedIndex);

        As = Sensor(ET,senform.EBB.value.replace(/,/,"."),senform.ENB.value.replace(/,/,"."),senform.ENH.value.replace(/,/,"."),senform.sensor,senform.chDSS.checked);

        // Rohrquerschnitt ermitteln
        A = (V/Q)+As;

        // Durchmesser berechnen
        D = 2*Math.sqrt (A/Math.PI);
        if (D > 0.01 && ET >= (D-0.003))
        {
        alert('The inside pipe diameter is too small for the sensor installation.\nPlease adjust the value.');
        return(false);
        }
		D = D / Dfac(0);//senform.EQD.selectedIndex)
		senform.QD.value=D.toPrecision(6);
}
return false;
}



//-->
</SCRIPT>
</head>
<body bgcolor=#FFFFFF onLoad="action=0;">
<form name=turckcalc>
<b>Flow Wizard - Conversion of flow parameters inside closed flow systems</b>
<br><br>
<table border=0 cellspacing=0 cellpadding=2>
	<tr>
        <td colspan=2>
        <input type=button name=Berechnung1 value="Flow speed"  onClick="Ergebnis(0,true);" Style="width:205;"> 
		</td>
	</tr>
	<tr>
        <td><input type=text name="VQ" size=7 maxlength=7 ></td>
		<td><select name="EVQ" onClick="Ergebnis(0,false);" Style="width:135;"><option>cm/sec<option>cm/min<option>cm/h<option>m/sec<option>m/min<option>m/h<option>km/h</select></td>
	</tr>
	
	<tr>
		<td colspan=2>
		 <input type=button name=Berechnung2 value="Flow rate" onClick="Ergebnis(1,true);" Style="width:205;"> 
		</td>
	</tr>
	<tr>
        <td >
        <input type=text name="QV" size=7 maxlength=7 ></td><td><select name="EQV" onClick="Ergebnis(1,false);" Style="width:135;"><option selected>l/sec<option>l/min<option>l/h<option>m&sup3;/sec<option>m&sup3;/min<option>m&sup3;/h</select>
        </td>
	</tr>
	
	<tr>
		<td colspan=2>
		 <input type=button name=Berechnung3 value="Inside pipe diameter" onClick="Ergebnis(2,true);" Style="width:205;"> 
		</td>
	</tr>
	<tr>
		<td><input type=text name="QD" size=7 maxlength=7 > </td>
	<td> mm <select name="EZ" onClick="fill();" Style="width:110;"><option selected>Pipe thread
	<option>1/8"<option>1/4"<option>3/8"<option>1/2"<option>3/4"<option>1"<option>1 1/4"<option>1 1/2"<option>2"<option>2 1/2"<option>3"<option>4"<option>5"<option>6"
	</select>
	</td>
	</tr>	
	<tr><td colspan=3><hr/></td></tr>
    <tr valign=top>
        <td colspan=3> <input type=checkbox name="sensor" checked onClick="showSS();"> Include sensor</td>
	</tr>
	</table>
	<table id="SS" name="SS" border=0 width=250>

	<tr >
	<td  colspan=3>Sensor:</td>
	</tr>
	<tr >
		<td  colspan=3>
		<select name="EETT" Style="width:230;0" onClick="fillSen();"><option>Manually
		<option>Gas, FCS-G1/2-/A (double nib)<option>Gas, FCS-G1/2-/A (single nib)
		<option>Gas, FCS-M18<option>Gas, FCS-K20<option>Liquid, FCS-G1/2
		<option>Liquid, FCS-GL1/2</select>
		</td>
	</tr> 
	<table id="SS2" name="SS2" border=0 width=250>
	<tr>
		<td  width="140" >Immersion depth A</td><td>     <input type=text name="ETT" size=4 maxlength=4 value="12" onblur="check(this);" > mm</td>
	</tr>
	</table>
	<table id="SS1" name="SS1" border=0 width=250>
	<tr ID="T1" Name="T1">
		</td><td width="140">Sensor diameter B</td><td> <input type=text name="EBB" size=4 maxlength=4 value="10" onblur="check(this);" > mm</td>
	</tr>
	<tr ID="T2" Name="T2">
		<td width="140">Nib heigth C</td><td><input type=text name="ENH" size=4 maxlength=4 value="0"> mm</td>
	</tr>
	<tr ID="T3" Name="T3">
		<td width="140">Nib diameter D</td><td><input type=text name="ENB" size=4 maxlength=4 value="0"> mm</td>
	</tr>
	<tr ID="T4" Name="T4">
		<td colspan=3><input type=checkbox name="chDSS"> Double nib sensor</td>
	</tr>
	</table></td></tr>
	<tr><td colspan=3><img name="GIF" id="GIF" src="sensor.gif" ></td></tr>



</form>




<div id="Result" style="">
</div>

</body>
</html>