In case of oscillations almost all effected components are shown.

This commit is contained in:
hneemann 2017-06-15 13:56:52 +02:00
parent e52baade92
commit 29090d3b2c
2 changed files with 12 additions and 2 deletions

View File

@ -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.

View File

@ -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);
}