update current labeling to match AA's expectations
This commit is contained in:
24
js/cktsim.js
24
js/cktsim.js
@@ -323,7 +323,7 @@ cktsim = (function() {
|
||||
|
||||
// Standard to do a dc analysis before transient
|
||||
// Otherwise, do the setup also done in dc.
|
||||
//no_dc = true;
|
||||
no_dc = true;
|
||||
if ((this.diddc == false) && (no_dc == false)) this.dc();
|
||||
else {
|
||||
// Allocate matrices and vectors.
|
||||
@@ -394,9 +394,10 @@ cktsim = (function() {
|
||||
this.oldc[i] = this.c[i];
|
||||
}
|
||||
|
||||
var step_index = -2; // Start with two pseudo-Euler steps
|
||||
|
||||
var beta0,beta1;
|
||||
while (this.time <= tstop) {
|
||||
// Start with two pseudo-Euler steps, maximum 50000 steps
|
||||
for(var step_index = -3; step_index < 50000; step_index++) {
|
||||
// Save the just computed solution, and move back q and c.
|
||||
for (var i = this.N - 1; i >= 0; --i) {
|
||||
if (step_index >= 0)
|
||||
@@ -437,9 +438,6 @@ cktsim = (function() {
|
||||
beta1 = 0.5;
|
||||
}
|
||||
|
||||
// Keep track of step index.
|
||||
step_index += 1;
|
||||
|
||||
// For trap rule, turn off current avging for algebraic eqns
|
||||
for (var i = this.N - 1; i >= 0; --i) {
|
||||
this.beta0[i] = beta0 + this.ar[i]*beta1;
|
||||
@@ -1301,8 +1299,8 @@ cktsim = (function() {
|
||||
// MNA stamp for independent voltage source
|
||||
ckt.add_to_Gl(this.branch,this.npos,1.0);
|
||||
ckt.add_to_Gl(this.branch,this.nneg,-1.0);
|
||||
ckt.add_to_Gl(this.npos,this.branch,-1.0);
|
||||
ckt.add_to_Gl(this.nneg,this.branch,1.0);
|
||||
ckt.add_to_Gl(this.npos,this.branch,1.0);
|
||||
ckt.add_to_Gl(this.nneg,this.branch,-1.0);
|
||||
}
|
||||
|
||||
// Source voltage added to b.
|
||||
@@ -1486,8 +1484,8 @@ cktsim = (function() {
|
||||
// MNA stamp for inductor linear part
|
||||
// L on diag of C because L di/dt = v(n1) - v(n2)
|
||||
ckt.add_to_Gl(this.n1,this.branch,1);
|
||||
ckt.add_to_Gl(this.branch,this.n1,-1);
|
||||
ckt.add_to_Gl(this.n2,this.branch,-1);
|
||||
ckt.add_to_Gl(this.branch,this.n1,-1);
|
||||
ckt.add_to_Gl(this.branch,this.n2,1);
|
||||
ckt.add_to_C(this.branch,this.branch,this.value)
|
||||
}
|
||||
@@ -1529,10 +1527,10 @@ cktsim = (function() {
|
||||
var invA = 1.0/this.gain;
|
||||
ckt.add_to_Gl(this.no,this.branch,1);
|
||||
ckt.add_to_Gl(this.ng,this.branch,-1);
|
||||
ckt.add_to_Gl(this.branch,this.no,-invA);
|
||||
ckt.add_to_Gl(this.branch,this.ng,invA);
|
||||
ckt.add_to_Gl(this.branch,this.np,1);
|
||||
ckt.add_to_Gl(this.branch,this.nn,-1);
|
||||
ckt.add_to_Gl(this.branch,this.no,invA);
|
||||
ckt.add_to_Gl(this.branch,this.ng,-invA);
|
||||
ckt.add_to_Gl(this.branch,this.np,-1);
|
||||
ckt.add_to_Gl(this.branch,this.nn,1);
|
||||
}
|
||||
|
||||
Opamp.prototype.load_dc = function(ckt,soln,rhs) {
|
||||
|
||||
@@ -71,7 +71,7 @@ schematic = (function() {
|
||||
annotation_style = 'rgb(255,64,64)'; // color for diagram annotations
|
||||
|
||||
property_size = 5; // point size for Component property text
|
||||
annotation_size = 7; // point size for diagram annotations
|
||||
annotation_size = 6; // point size for diagram annotations
|
||||
|
||||
// list of all the defined parts
|
||||
parts_map = {
|
||||
@@ -282,13 +282,11 @@ schematic = (function() {
|
||||
tr = document.createElement('tr');
|
||||
table.appendChild(tr);
|
||||
td = document.createElement('td');
|
||||
td.style.left = '0';
|
||||
td.style.top = '0';
|
||||
tr.appendChild(td);
|
||||
var wrapper = document.createElement('div');
|
||||
td.appendChild(wrapper);
|
||||
wrapper.style.position = 'relative'; // so we can position subwindows
|
||||
wrapper.appendChild(this.canvas);
|
||||
td.appendChild(wrapper);
|
||||
td = document.createElement('td');
|
||||
td.style.verticalAlign = 'top';
|
||||
tr.appendChild(td);
|
||||
@@ -3192,7 +3190,7 @@ schematic = (function() {
|
||||
function OpAmp(x,y,rotation,name,A) {
|
||||
Component.call(this,'o',x,y,rotation);
|
||||
this.properties['name'] = name;
|
||||
this.properties['A'] = A ? A : '300000';
|
||||
this.properties['A'] = A ? A : '30000';
|
||||
this.add_connection(0,0); // +
|
||||
this.add_connection(0,16); // -
|
||||
this.add_connection(48,8); // output
|
||||
@@ -3274,9 +3272,9 @@ schematic = (function() {
|
||||
//this.draw_line(c,3,20,0,28);
|
||||
} else if (this.type == 'i') { // current source
|
||||
// draw arrow: pos to neg
|
||||
this.draw_line(c,0,16,0,32);
|
||||
this.draw_line(c,-3,24,0,32);
|
||||
this.draw_line(c,3,24,0,32);
|
||||
this.draw_line(c,0,15,0,32);
|
||||
this.draw_line(c,-3,26,0,32);
|
||||
this.draw_line(c,3,26,0,32);
|
||||
}
|
||||
|
||||
if (this.properties['name'])
|
||||
@@ -3442,14 +3440,16 @@ schematic = (function() {
|
||||
var v = vmap[label];
|
||||
if (v != undefined) {
|
||||
// first draw some solid blocks in the background
|
||||
c.globalAlpha = 0.85;
|
||||
this.draw_text(c,'\u2588\u2588\u2588',0,24,4,annotation_size,element_style);
|
||||
c.globalAlpha = 0.5;
|
||||
this.draw_text(c,'\u2588\u2588\u2588',-8,8,4,annotation_size,element_style);
|
||||
c.globalAlpha = 1.0;
|
||||
|
||||
// display the node voltage at this connection point
|
||||
// display the element current
|
||||
var i = engineering_notation(v,2) + 'A';
|
||||
this.draw_text(c,i,0,24,4,annotation_size,annotation_style);
|
||||
|
||||
this.draw_text(c,i,-3,5,5,annotation_size,annotation_style);
|
||||
// draw arrow for current
|
||||
this.draw_line(c,-3,4,0,8);
|
||||
this.draw_line(c,3,4,0,8);
|
||||
// only display each current once
|
||||
delete vmap[label];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user