DIYstompboxes.com

DIY Stompboxes => Building your own stompbox => Topic started by: mac on November 27, 2013, 10:04:39 AM

Title: Fooling with Ebers Moll model for germs :)
Post by: mac on November 27, 2013, 10:04:39 AM
Copy the code below, open note pad or word, paste it, save the doc as text, and change extension to "htm" or "html".
Open it on Chrome and play  :D

I used
ic = ico*exp(Vbe/n^2/Vt)
and
ic = hfe*ib + ico

<!DOCTYPE html>
<html>

<head>
<title>Simple Bias / Modified Ebers - Moll Model</title> 
</head>

<body bgcolor="#ddddcc">
<tt>
<h3><p align="center">
Simple Bias - Modified Ebers-Moll Model<br>
Newton-Rapshon Iteration<br>
mac
</p></h3>
<hr>

<h4><p align="left">Enter Data</p></h4>
<form>
rc  <input type="text" value="10"   size="10" id="xc"> K Ohms<br>
rb  <input type="text" value="2200" size="10" id="xb"> K Ohms<br>
hfe <input type="text" value="100"  size="10" id="beta"><br>
vcc <input type="text" value="9"    size="10" id="vc"> V<br>
ico <input type="text" value="3e-4" size="10" id="is"> A
<p align="left">
<button type="button" onclick="doMath()">Calculate</button>
<button type="reset">Reset</button>
</p>
</form>

<h4><p align="left"

id="results"><br><br><br><br><br><br><br><br><br></p></h4>

<p align="left"><img

src="http://upload.wikimedia.org/wikipedia/commons/7/79/Fixed_bias.PNG"></p>

</tt>
     
<script>

function doMath() {

var rc = 1000*parseFloat(xc.value);
var rb = 1000*parseFloat(xb.value);
var b = parseFloat(beta.value);
var vcc = parseFloat(vc.value);
var ico = parseFloat(is.value);
var ib1=0;
var ib2=0;
var n=2;
var vt=n*n*0.026;
var i=0;
var aux1=0;
var aux2=0;

do
{
i=i+1;
aux1=ib1*rb+vt*Math.log((b*ib1+ico)/ico)-vcc;
aux2=rb+b*vt*ico/(b*ib1+ico);
ib2=ib1-aux1/aux2;
ib1=ib2;
}
while (Math.abs(aux1/aux2)>1e-14);

str="Results"+"<br>";
str=str+"ic: "+String((b*ib2+ico)*1000)+" mA"+"<br>";
str=str+"ib: "+String(ib2*1000)+" mA"+"<br>";
str=str+"ie: "+String(((b+1)*ib2+ico)*1000)+" mA"+"<br>"+"<br>";
str=str+"Vc:  "+String(vcc-rc*(b*ib2+ico))+" V"+"<br>";
str=str+"Vbe: "+String(vt*Math.log(b*ib2/ico+1))+" V"+"<br>"+"<br>";
str=str+"iterations: "+String(i);

document.getElementById("results").innerHTML=str;
}
</script>
       
</body>     
</html>


OK, OK, LTSpice can do it... if you manage to figure out what variables to tweak to get a good germ model ;)

mac


Title: Re: Fooling with Ebers Moll model for germs :)
Post by: GibsonGM on November 27, 2013, 11:10:58 AM
Good deal, Mac!  Nice setup to play with :o)
Title: Re: Fooling with Ebers Moll model for germs :)
Post by: SISKO on November 28, 2013, 09:06:16 PM
Very good"!