|
@@ -38,9 +38,9 @@ public class SimulationManager {
|
|
ResetConnections(singleSubNet.getObjects().get(0), new ArrayList<Integer>(), new ArrayList<CpsEdge>());
|
|
ResetConnections(singleSubNet.getObjects().get(0), new ArrayList<Integer>(), new ArrayList<CpsEdge>());
|
|
}
|
|
}
|
|
for(subNet singleSubNet: subNets){
|
|
for(subNet singleSubNet: subNets){
|
|
- float production = calculateEnergy("prod", singleSubNet, x);
|
|
|
|
- float consumption = calculateEnergy("cons", singleSubNet, x);
|
|
|
|
- float minConsumption = calculateMinimumEnergy( singleSubNet, x);
|
|
|
|
|
|
+ float production = calculateEnergy("prod", singleSubNet, timeStep);
|
|
|
|
+ float consumption = calculateEnergy("cons", singleSubNet, timeStep);
|
|
|
|
+ float minConsumption = calculateMinimumEnergy( singleSubNet, timeStep);
|
|
setFlow(singleSubNet);
|
|
setFlow(singleSubNet);
|
|
for(HolonObject hl: singleSubNet.getObjects()){
|
|
for(HolonObject hl: singleSubNet.getObjects()){
|
|
if(!(hl.getState() == 0) && !(hl.getState() == 3)){
|
|
if(!(hl.getState() == 0) && !(hl.getState() == 3)){
|
|
@@ -51,21 +51,25 @@ public class SimulationManager {
|
|
if((production + consumption) >= 0){
|
|
if((production + consumption) >= 0){
|
|
hl.setState(2);
|
|
hl.setState(2);
|
|
}
|
|
}
|
|
- if((production + consumption) < 0){
|
|
|
|
|
|
+ if((production + consumption) < 0 ){
|
|
if((production + minConsumption) >= 0){
|
|
if((production + minConsumption) >= 0){
|
|
hl.setState(4);
|
|
hl.setState(4);
|
|
- }else{
|
|
|
|
|
|
+ }else if(hl.checkIfPartiallySupplied(timeStep)){
|
|
|
|
+ hl.setState(4);
|
|
|
|
+ }else {
|
|
hl.setState(1);
|
|
hl.setState(1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- hl.setState(1);
|
|
|
|
|
|
+ hl.setState(1);
|
|
|
|
+ }
|
|
|
|
+ if(hl.checkIfPartiallySupplied(timeStep) && !(hl.getState() == 2)){
|
|
|
|
+ hl.setState(4);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //printNet();
|
|
|
|
canvas.repaint();
|
|
canvas.repaint();
|
|
}
|
|
}
|
|
|
|
|