|
@@ -24,6 +24,7 @@ public class SimulationManager {
|
|
private ArrayList<AbstractCpsObject> objectsToHandle;
|
|
private ArrayList<AbstractCpsObject> objectsToHandle;
|
|
private ArrayList<CpsEdge> allConnections;
|
|
private ArrayList<CpsEdge> allConnections;
|
|
private ArrayList<SubNet> subNets;
|
|
private ArrayList<SubNet> subNets;
|
|
|
|
+ private ArrayList<CpsEdge> brokenEdges;
|
|
private MyCanvas canvas;
|
|
private MyCanvas canvas;
|
|
private int timeStep;
|
|
private int timeStep;
|
|
private HashMap<Integer, Float> tagTable = new HashMap<Integer, Float>();
|
|
private HashMap<Integer, Float> tagTable = new HashMap<Integer, Float>();
|
|
@@ -37,6 +38,7 @@ public class SimulationManager {
|
|
canvas = null;
|
|
canvas = null;
|
|
model = m;
|
|
model = m;
|
|
subNets = new ArrayList<SubNet>();
|
|
subNets = new ArrayList<SubNet>();
|
|
|
|
+ brokenEdges = new ArrayList<CpsEdge>();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -46,6 +48,7 @@ public class SimulationManager {
|
|
* current Iteration
|
|
* current Iteration
|
|
*/
|
|
*/
|
|
public void calculateStateForTimeStep(int x) {
|
|
public void calculateStateForTimeStep(int x) {
|
|
|
|
+ reset();
|
|
timeStep = x;
|
|
timeStep = x;
|
|
searchForSubNets();
|
|
searchForSubNets();
|
|
for (SubNet singleSubNet : subNets) {
|
|
for (SubNet singleSubNet : subNets) {
|
|
@@ -353,6 +356,7 @@ public class SimulationManager {
|
|
*/
|
|
*/
|
|
public void searchForSubNets() {
|
|
public void searchForSubNets() {
|
|
subNets = new ArrayList<SubNet>();
|
|
subNets = new ArrayList<SubNet>();
|
|
|
|
+ brokenEdges.clear();
|
|
boolean end = false;
|
|
boolean end = false;
|
|
int i = 0;
|
|
int i = 0;
|
|
AbstractCpsObject cps;
|
|
AbstractCpsObject cps;
|
|
@@ -423,6 +427,8 @@ public class SimulationManager {
|
|
edge.setConnected(2);
|
|
edge.setConnected(2);
|
|
checkForConnectedStates(a, (CpsUpperNode)b, edge);
|
|
checkForConnectedStates(a, (CpsUpperNode)b, edge);
|
|
}
|
|
}
|
|
|
|
+ }else{
|
|
|
|
+ brokenEdges.add(edge);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return sN;
|
|
return sN;
|
|
@@ -526,6 +532,23 @@ public class SimulationManager {
|
|
objectsToHandle = new ArrayList<AbstractCpsObject>();
|
|
objectsToHandle = new ArrayList<AbstractCpsObject>();
|
|
copyObjects(model.getObjectsOnCanvas());
|
|
copyObjects(model.getObjectsOnCanvas());
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Resets the State of all Edges
|
|
|
|
+ */
|
|
|
|
+ public void resetEdges(){
|
|
|
|
+ for(CpsEdge e: brokenEdges){
|
|
|
|
+ e.setState(true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Resets the State for the whole Simulation Model
|
|
|
|
+ */
|
|
|
|
+ public void resetSimulation(){
|
|
|
|
+ reset();
|
|
|
|
+ resetEdges();
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* Get all Subnets.
|
|
* Get all Subnets.
|