|
@@ -20,6 +20,10 @@ public class SimulationManager {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * calculates the flow of the edges and the supply for objects
|
|
|
|
+ * @param x
|
|
|
|
+ */
|
|
public void calculateStateForTimeStep(int x){
|
|
public void calculateStateForTimeStep(int x){
|
|
searchForSubNets();
|
|
searchForSubNets();
|
|
for(subNet singleSubNet: subNets){
|
|
for(subNet singleSubNet: subNets){
|
|
@@ -28,7 +32,28 @@ public class SimulationManager {
|
|
for(CpsEdge e: singleSubNet.getEdges()){
|
|
for(CpsEdge e: singleSubNet.getEdges()){
|
|
e.setFlow(production);
|
|
e.setFlow(production);
|
|
}
|
|
}
|
|
|
|
+ for(HolonObject hl: singleSubNet.getObjects()){
|
|
|
|
+ boolean end = false;
|
|
|
|
+ int i = 0;
|
|
|
|
+ while(!end){
|
|
|
|
+ CpsEdge edge = hl.getConnectedTo().get(i);
|
|
|
|
+ if(edge.getState()){
|
|
|
|
+ if(hl.getCurrentEnergyAtTimeStep(x) + edge.getFlow() >= 0 ){
|
|
|
|
+ hl.setSupplied(true);
|
|
|
|
+ }else{
|
|
|
|
+ hl.setSupplied(false);
|
|
|
|
+ }
|
|
|
|
+ end = true;
|
|
|
|
+ }else{
|
|
|
|
+ i++;
|
|
|
|
+ if(i == singleSubNet.getObjects().size()){
|
|
|
|
+ end = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|