mirror of
https://github.com/pfalstad/circuitjs1.git
synced 2026-03-23 08:46:56 +01:00
preserve old node voltages when re-analyzing
This commit is contained in:
@@ -502,8 +502,16 @@ public abstract class CircuitElm implements Editable {
|
||||
// number of internal nodes (nodes not visible in UI that are needed for implementation)
|
||||
int getInternalNodeCount() { return 0; }
|
||||
|
||||
// notify this element that its pth node is n. This value n can be passed to stampMatrix()
|
||||
void setNode(int p, CircuitNode n) { nodes[p] = n; }
|
||||
// notify this element that its pth node is n. This object n can be passed to stampMatrix()
|
||||
void setNode(int p, CircuitNode n) {
|
||||
double v = 0;
|
||||
if (nodes[p] != null)
|
||||
v = nodes[p].volts;
|
||||
nodes[p] = n;
|
||||
// preserve old node voltages
|
||||
n.volts = v;
|
||||
n.high = (v > 2.5);
|
||||
}
|
||||
|
||||
// notify this element that its nth voltage source is v. This value v can be passed to stampVoltageSource(), etc and will be passed back in calls to setCurrent()
|
||||
void setVoltageSource(int n, VoltageSource v) {
|
||||
|
||||
Reference in New Issue
Block a user