mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-28 07:28:20 -04:00
In case of oscillations almost all effected components are shown.
This commit is contained in:
parent
e52baade92
commit
29090d3b2c
@ -1,7 +1,7 @@
|
||||
Release Notes
|
||||
|
||||
planned as v0.13
|
||||
- unbuffered circular dependencies are detected during circuit analysis
|
||||
- In case of oscillations almost all effected components are shown.
|
||||
|
||||
v0.12.1, released on 05. Jun 2016
|
||||
- added a fuse to simulate a PROM or PAL.
|
||||
|
@ -42,6 +42,7 @@ public class Model implements Iterable<Node> {
|
||||
* Maximal number of calculation loops before oscillating behaviour is detected
|
||||
*/
|
||||
public static final int MAX_LOOP_COUNTER = 1000;
|
||||
private static final int COLLECTING_LOOP_COUNTER = MAX_LOOP_COUNTER + 100;
|
||||
|
||||
private final ArrayList<Clock> clocks;
|
||||
private final ArrayList<Break> breaks;
|
||||
@ -58,6 +59,7 @@ public class Model implements Iterable<Node> {
|
||||
private int version;
|
||||
private boolean isInitialized = false;
|
||||
private WindowPosManager windowPosManager;
|
||||
private HashSet<Node> oscillatingNodes;
|
||||
|
||||
/**
|
||||
* Creates a new model
|
||||
@ -192,7 +194,15 @@ public class Model implements Iterable<Node> {
|
||||
if (needsUpdate()) {
|
||||
while (needsUpdate()) {
|
||||
if (counter++ > MAX_LOOP_COUNTER) {
|
||||
throw new NodeException(Lang.get("err_seemsToOscillate")).addNodes(nodesToUpdateNext);
|
||||
if (oscillatingNodes == null)
|
||||
oscillatingNodes = new HashSet<>();
|
||||
if (counter > COLLECTING_LOOP_COUNTER) {
|
||||
NodeException seemsToOscillate = new NodeException(Lang.get("err_seemsToOscillate")).addNodes(oscillatingNodes);
|
||||
oscillatingNodes = null;
|
||||
throw seemsToOscillate;
|
||||
} else {
|
||||
oscillatingNodes.addAll(nodesToUpdateNext);
|
||||
}
|
||||
}
|
||||
doMicroStep(noise);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user