|
@@ -4,11 +4,13 @@ import classes.*;
|
|
import classes.comparator.EnergyMinToMaxComparator;
|
|
import classes.comparator.EnergyMinToMaxComparator;
|
|
import classes.comparator.MinEnergyComparator;
|
|
import classes.comparator.MinEnergyComparator;
|
|
import classes.comparator.TotalEnergyComparator;
|
|
import classes.comparator.TotalEnergyComparator;
|
|
|
|
+import classes.comparator.WeakestBattery;
|
|
import ui.model.Model;
|
|
import ui.model.Model;
|
|
import ui.view.FlexiblePane;
|
|
import ui.view.FlexiblePane;
|
|
import ui.view.MyCanvas;
|
|
import ui.view.MyCanvas;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.Collections;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
|
|
|
import com.sun.xml.internal.ws.util.xml.XMLReaderComposite.State;
|
|
import com.sun.xml.internal.ws.util.xml.XMLReaderComposite.State;
|
|
@@ -80,25 +82,7 @@ public class SimulationManager {
|
|
|
|
|
|
float energySurplus = production + consumption;
|
|
float energySurplus = production + consumption;
|
|
|
|
|
|
-
|
|
+
|
|
- float getMaxInPut = 0;
|
|
|
|
- float getMaxOutPut = 0;
|
|
|
|
- for(HolonBattery hB : singleSubNet.getBatteries())
|
|
|
|
- {
|
|
|
|
- getMaxInPut += hB.getIN();
|
|
|
|
- getMaxOutPut += hB.getOUT();
|
|
|
|
- if(energySurplus < 0)
|
|
|
|
- hB.setState(HolonBattery.State.EMIT);
|
|
|
|
- else if (energySurplus > 0)
|
|
|
|
- hB.setState(HolonBattery.State.COLLECT);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- if(energySurplus < 0)
|
|
|
|
- energySurplus += getMaxOutPut;
|
|
|
|
- else if (energySurplus > 0)
|
|
|
|
- energySurplus -= getMaxInPut;
|
|
|
|
- System.out.println(energySurplus);
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -145,155 +129,310 @@ public class SimulationManager {
|
|
* energy each HolonObject receives in AlleEqualModus
|
|
* energy each HolonObject receives in AlleEqualModus
|
|
*/
|
|
*/
|
|
float energyPerHolonObject = 0;
|
|
float energyPerHolonObject = 0;
|
|
- if (model.getFairnessModel() == fairnessMininumDemandFirst) {
|
|
+ if(energySurplus >= 0)
|
|
-
|
|
+ {
|
|
- * supply Buildings with minimal Energy first, if conflicts
|
|
+
|
|
- * happen
|
|
+ for(HolonObject hO : singleSubNet.getObjects())
|
|
- */
|
|
+ {
|
|
- singleSubNet.getObjects().sort(new MinEnergyComparator(x));
|
|
+ float neededEnergy = hO.getCurrentEnergyAtTimeStep(x);
|
|
- } else if (model.getFairnessModel() == fairnessAllEqual) {
|
|
+ if(neededEnergy < 0)
|
|
-
|
|
+ {
|
|
- * give every building (just consumer) the same energy
|
|
+ hO.setCurrentSupply(-neededEnergy);
|
|
- */
|
|
+ currentProduction -= -neededEnergy;
|
|
- numberOfConsumers = singleSubNet
|
|
+ }
|
|
- .getObjects()
|
|
+ }
|
|
- .stream()
|
|
+
|
|
- .filter(hl -> (hl.getState() != HolonObject.NO_ENERGY
|
|
+ System.out.println("production: "+production + " consumption: "+ consumption);
|
|
- && hl.getState() != HolonObject.PRODUCER && hl
|
|
+ singleSubNet.getBatteries().sort(new WeakestBattery());
|
|
- .getConnectedTo().stream()
|
|
+ for(HolonBattery hB : singleSubNet.getBatteries())
|
|
- .filter(e -> (e.getFlow() > 0)).count() > 0))
|
|
+ {
|
|
- .count();
|
|
+ float energyToCollect = hB.getIN();
|
|
- if (numberOfConsumers != 0)
|
|
+ if(currentProduction >= energyToCollect)
|
|
- energyPerHolonObject = production / numberOfConsumers;
|
|
+ {
|
|
|
|
+
|
|
|
|
+ currentProduction -= energyToCollect;
|
|
|
|
+ }else
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ currentProduction = 0;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ System.out.println(hB.toString() + " currentProduction: "+ currentProduction);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ long nOConsumer = singleSubNet.getObjects().stream().filter(hl -> (hl.getCurrentEnergyAtTimeStep(x) < 0)).count();
|
|
|
|
+ if(nOConsumer != 0)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ float EnergyOverSupplyPerHolonObject = currentProduction / nOConsumer;
|
|
|
|
+ for(HolonObject hO : singleSubNet.getObjects())
|
|
|
|
+ {
|
|
|
|
+ float neededEnergy = hO.getCurrentEnergyAtTimeStep(x);
|
|
|
|
+ if(neededEnergy < 0)
|
|
|
|
+ {
|
|
|
|
+ hO.setCurrentSupply(hO.getCurrentSupply() + EnergyOverSupplyPerHolonObject);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ currentProduction = 0;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- for (HolonObject hl : singleSubNet.getObjects()) {
|
|
+ else
|
|
- hl.setCurrentSupply(0);
|
|
+ {
|
|
- if (hl.getState() != HolonObject.NO_ENERGY
|
|
+
|
|
- && hl.getState() != HolonObject.PRODUCER) {
|
|
+
|
|
- for (int i = 0; i < hl.getConnections().size(); i++) {
|
|
+ if(energySurplus + GetOutAllBatteries(singleSubNet.getBatteries()) >= 0)
|
|
- CpsEdge edge = hl.getConnectedTo().get(i);
|
|
+ {
|
|
- if (edge.isWorking()
|
|
+ singleSubNet.getBatteries().sort(new WeakestBattery());
|
|
- && edge.getFlow() > 0
|
|
+ Collections.reverse(singleSubNet.getBatteries());
|
|
- || edge.getCapacity() == CpsEdge.CAPACITY_INFINITE) {
|
|
+
|
|
-
|
|
+ for(HolonBattery hB : singleSubNet.getBatteries())
|
|
- if (model.getFairnessModel() == fairnessAllEqual) {
|
|
+ {
|
|
-
|
|
+ float neededEnergyFromBattery = currentProduction + consumption;
|
|
- float neededEnergy = hl
|
|
+ float maxEnergyAvailable = hB.getOUT();
|
|
- .getCurrentEnergyAtTimeStep(x);
|
|
+ if(maxEnergyAvailable >= -neededEnergyFromBattery)
|
|
- if (neededEnergy > 0) {
|
|
+ {
|
|
- hl.setState(HolonObject.PRODUCER);
|
|
+
|
|
- } else if (energyPerHolonObject > -neededEnergy) {
|
|
+ currentProduction += -neededEnergyFromBattery;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ currentProduction += maxEnergyAvailable;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ for(HolonObject hO : singleSubNet.getObjects())
|
|
|
|
+ {
|
|
|
|
+ float neededEnergy = hO.getCurrentEnergyAtTimeStep(x);
|
|
|
|
+ if(neededEnergy < 0)
|
|
|
|
+ {
|
|
|
|
+ hO.setCurrentSupply(-neededEnergy);
|
|
|
|
+ currentProduction -= -neededEnergy;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ for(HolonBattery hB : singleSubNet.getBatteries())
|
|
|
|
+ {
|
|
|
|
+ float maxEnergyAvailable = hB.getOUT();
|
|
|
|
+
|
|
|
|
+ currentProduction += maxEnergyAvailable;
|
|
|
|
+ }
|
|
|
|
+ calculation(x, singleSubNet, production, consumption, energySurplus, currentProduction,
|
|
|
|
+ partiallySuppliedList, notSuppliedList, energyPerHolonObject);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for(HolonObject hO : singleSubNet.getObjects())
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ float neededEnergy = hO.getCurrentEnergyAtTimeStep(x);
|
|
|
|
+ if(neededEnergy > 0)
|
|
|
|
+ {
|
|
|
|
+ hO.setState(HolonObject.PRODUCER);
|
|
|
|
+ }
|
|
|
|
+ else if(neededEnergy < 0)
|
|
|
|
+ {
|
|
|
|
+ float currentSupply = hO.getCurrentSupply();
|
|
|
|
+ if(currentSupply > -neededEnergy)
|
|
|
|
+ {
|
|
|
|
+ hO.setState(HolonObject.OVER_SUPPLIED);
|
|
|
|
+ }else if (currentSupply == -neededEnergy)
|
|
|
|
+ {
|
|
|
|
+ hO.setState(HolonObject.SUPPLIED);
|
|
|
|
+ }else if (currentSupply < -neededEnergy)
|
|
|
|
+ {
|
|
|
|
+ if(currentSupply >= hO.getMinEnergy(x))
|
|
|
|
+ {
|
|
|
|
+ hO.setState(HolonObject.PARTIALLY_SUPPLIED);
|
|
|
|
+ }else
|
|
|
|
+ {
|
|
|
|
+ hO.setState(HolonObject.NOT_SUPPLIED);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else if(neededEnergy == 0)
|
|
|
|
+ {
|
|
|
|
+ hO.setState(HolonObject.NO_ENERGY);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ canvas.repaint();
|
|
|
|
+ flexPane.recalculate();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void calculation(int x, SubNet singleSubNet, float production, float consumption, float energySurplus,
|
|
|
|
+ float currentProduction, ArrayList<HolonObject> partiallySuppliedList,
|
|
|
|
+ ArrayList<HolonObject> notSuppliedList, float energyPerHolonObject) {
|
|
|
|
+ long numberOfConsumers;
|
|
|
|
+ if (model.getFairnessModel() == fairnessMininumDemandFirst) {
|
|
|
|
+
|
|
|
|
+ * supply Buildings with minimal Energy first, if conflicts
|
|
|
|
+ * happen
|
|
|
|
+ */
|
|
|
|
+ singleSubNet.getObjects().sort(new MinEnergyComparator(x));
|
|
|
|
+ } else if (model.getFairnessModel() == fairnessAllEqual) {
|
|
|
|
+
|
|
|
|
+ * give every building (just consumer) the same energy
|
|
|
|
+ */
|
|
|
|
+ numberOfConsumers = singleSubNet
|
|
|
|
+ .getObjects()
|
|
|
|
+ .stream()
|
|
|
|
+ .filter(hl -> (hl.getState() != HolonObject.NO_ENERGY
|
|
|
|
+ && hl.getState() != HolonObject.PRODUCER && hl
|
|
|
|
+ .getConnectedTo().stream()
|
|
|
|
+ .filter(e -> (e.getFlow() > 0)).count() > 0))
|
|
|
|
+ .count();
|
|
|
|
+ if (numberOfConsumers != 0)
|
|
|
|
+ energyPerHolonObject = currentProduction / numberOfConsumers;
|
|
|
|
+ }
|
|
|
|
+ for (HolonObject hl : singleSubNet.getObjects()) {
|
|
|
|
+ hl.setCurrentSupply(0);
|
|
|
|
+ if (hl.getState() != HolonObject.NO_ENERGY
|
|
|
|
+ && hl.getState() != HolonObject.PRODUCER) {
|
|
|
|
+ for (int i = 0; i < hl.getConnections().size(); i++) {
|
|
|
|
+ CpsEdge edge = hl.getConnectedTo().get(i);
|
|
|
|
+ if (edge.isWorking()
|
|
|
|
+ && edge.getFlow() > 0
|
|
|
|
+ || edge.getCapacity() == CpsEdge.CAPACITY_INFINITE) {
|
|
|
|
+
|
|
|
|
+ if (model.getFairnessModel() == fairnessAllEqual) {
|
|
|
|
+
|
|
|
|
+ float neededEnergy = hl
|
|
|
|
+ .getCurrentEnergyAtTimeStep(x);
|
|
|
|
+ if (neededEnergy > 0) {
|
|
|
|
+ hl.setState(HolonObject.PRODUCER);
|
|
|
|
+ } else if (energyPerHolonObject > -neededEnergy) {
|
|
|
|
+ hl.setState(HolonObject.OVER_SUPPLIED);
|
|
|
|
+ } else if (energyPerHolonObject == -neededEnergy) {
|
|
|
|
+ hl.setState(HolonObject.SUPPLIED);
|
|
|
|
+ } else if (energyPerHolonObject >= -hl
|
|
|
|
+ .getMinEnergy(x)) {
|
|
|
|
+ hl.setState(HolonObject.PARTIALLY_SUPPLIED);
|
|
|
|
+ } else {
|
|
|
|
+ hl.setState(HolonObject.NOT_SUPPLIED);
|
|
|
|
+ }
|
|
|
|
+ hl.setCurrentSupply(energyPerHolonObject);
|
|
|
|
+ } else if (model.getFairnessModel() == fairnessMininumDemandFirst) {
|
|
|
|
+
|
|
|
|
+ if ((production + consumption) >= 0) {
|
|
|
|
+ if (energySurplus > 0) {
|
|
hl.setState(HolonObject.OVER_SUPPLIED);
|
|
hl.setState(HolonObject.OVER_SUPPLIED);
|
|
- } else if (energyPerHolonObject == -neededEnergy) {
|
|
+ hl.setCurrentSupply((-energySurplus
|
|
- hl.setState(HolonObject.SUPPLIED);
|
|
+ / consumption + 1)
|
|
- } else if (energyPerHolonObject >= -hl
|
|
+ * hl.getCurrentEnergyAtTimeStep(x));
|
|
- .getMinEnergy(x)) {
|
|
|
|
- hl.setState(HolonObject.PARTIALLY_SUPPLIED);
|
|
|
|
} else {
|
|
} else {
|
|
- hl.setState(HolonObject.NOT_SUPPLIED);
|
|
+ hl.setState(HolonObject.SUPPLIED);
|
|
|
|
+ hl.setCurrentSupply(-hl
|
|
|
|
+ .getCurrentEnergyAtTimeStep(x));
|
|
}
|
|
}
|
|
- hl.setCurrentSupply(energyPerHolonObject);
|
|
+ } else {
|
|
- } else if (model.getFairnessModel() == fairnessMininumDemandFirst) {
|
|
+ float minEnergy = hl.getMinEnergy(x);
|
|
-
|
|
+ if (hl.checkIfPartiallySupplied(timeStep)) {
|
|
- if ((production + consumption) >= 0) {
|
|
+ hl.setState(HolonObject.PARTIALLY_SUPPLIED);
|
|
- if (energySurplus > 0) {
|
|
+ currentProduction += minEnergy;
|
|
- hl.setState(HolonObject.OVER_SUPPLIED);
|
|
+ hl.setCurrentSupply(-minEnergy);
|
|
- hl.setCurrentSupply((-energySurplus
|
|
+ partiallySuppliedList.add(hl);
|
|
- / consumption + 1)
|
|
|
|
- * hl.getCurrentEnergyAtTimeStep(x));
|
|
|
|
- } else {
|
|
|
|
- hl.setState(HolonObject.SUPPLIED);
|
|
|
|
- hl.setCurrentSupply(-hl
|
|
|
|
- .getCurrentEnergyAtTimeStep(x));
|
|
|
|
- }
|
|
|
|
} else {
|
|
} else {
|
|
- float minEnergy = hl.getMinEnergy(x);
|
|
+
|
|
- if (hl.checkIfPartiallySupplied(timeStep)) {
|
|
+ * Case that only some HolonObjects can
|
|
|
|
+ * be supplied
|
|
|
|
+ */
|
|
|
|
+ if (-hl.getCurrentEnergyAtTimeStep(x) <= currentProduction) {
|
|
|
|
+ hl.setState(HolonObject.PARTIALLY_SUPPLIED);
|
|
|
|
+ currentProduction += minEnergy;
|
|
|
|
+ hl.setCurrentSupply(-minEnergy);
|
|
|
|
+ partiallySuppliedList.add(hl);
|
|
|
|
+ } else if (-hl.getMinEnergy(x) <= currentProduction) {
|
|
hl.setState(HolonObject.PARTIALLY_SUPPLIED);
|
|
hl.setState(HolonObject.PARTIALLY_SUPPLIED);
|
|
currentProduction += minEnergy;
|
|
currentProduction += minEnergy;
|
|
hl.setCurrentSupply(-minEnergy);
|
|
hl.setCurrentSupply(-minEnergy);
|
|
partiallySuppliedList.add(hl);
|
|
partiallySuppliedList.add(hl);
|
|
} else {
|
|
} else {
|
|
-
|
|
+ hl.setState(HolonObject.NOT_SUPPLIED);
|
|
- * Case that only some HolonObjects can
|
|
+ hl.setCurrentSupply(0.0f);
|
|
- * be supplied
|
|
+ notSuppliedList.add(hl);
|
|
- */
|
|
+
|
|
- if (-hl.getCurrentEnergyAtTimeStep(x) <= currentProduction) {
|
|
+
|
|
- hl.setState(HolonObject.PARTIALLY_SUPPLIED);
|
|
+
|
|
- currentProduction += minEnergy;
|
|
|
|
- hl.setCurrentSupply(-minEnergy);
|
|
|
|
- partiallySuppliedList.add(hl);
|
|
|
|
- } else if (-hl.getMinEnergy(x) <= currentProduction) {
|
|
|
|
- hl.setState(HolonObject.PARTIALLY_SUPPLIED);
|
|
|
|
- currentProduction += minEnergy;
|
|
|
|
- hl.setCurrentSupply(-minEnergy);
|
|
|
|
- partiallySuppliedList.add(hl);
|
|
|
|
- } else {
|
|
|
|
- hl.setState(HolonObject.NOT_SUPPLIED);
|
|
|
|
- hl.setCurrentSupply(0.0f);
|
|
|
|
- notSuppliedList.add(hl);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- hl.getCurrentEnergyAtTimeStep(x);
|
|
|
|
- break;
|
|
|
|
}
|
|
}
|
|
|
|
+ hl.getCurrentEnergyAtTimeStep(x);
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
-
|
|
+
|
|
- * check if some object cn self supply itself
|
|
+ * check if some object cn self supply itself
|
|
- */
|
|
+ */
|
|
- if (hl.checkIfPartiallySupplied(timeStep)
|
|
+ if (hl.checkIfPartiallySupplied(timeStep)
|
|
- && hl.getState() != HolonObject.SUPPLIED
|
|
+ && hl.getState() != HolonObject.SUPPLIED
|
|
- && hl.getState() != HolonObject.OVER_SUPPLIED) {
|
|
+ && hl.getState() != HolonObject.OVER_SUPPLIED) {
|
|
- hl.setState(HolonObject.PARTIALLY_SUPPLIED);
|
|
+ hl.setState(HolonObject.PARTIALLY_SUPPLIED);
|
|
- }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
- if (model.getFairnessModel() == fairnessMininumDemandFirst) {
|
|
+ if (model.getFairnessModel() == fairnessMininumDemandFirst) {
|
|
-
|
|
+
|
|
- * check if some partially supplied building might be fully
|
|
+ * check if some partially supplied building might be fully
|
|
- * supplied.
|
|
+ * supplied.
|
|
|
|
+ */
|
|
|
|
+ partiallySuppliedList.sort(new EnergyMinToMaxComparator(x));
|
|
|
|
+ for (HolonObject hl : partiallySuppliedList) {
|
|
|
|
+ float minEnergy = hl.getMinEnergy(x);
|
|
|
|
+ currentProduction -= minEnergy;
|
|
|
|
+
|
|
|
|
+ * if possible, supply fully
|
|
*/
|
|
*/
|
|
- partiallySuppliedList.sort(new EnergyMinToMaxComparator(x));
|
|
+ float currentEnergyAtTimeStep = hl
|
|
- for (HolonObject hl : partiallySuppliedList) {
|
|
+ .getCurrentEnergyAtTimeStep(x);
|
|
- float minEnergy = hl.getMinEnergy(x);
|
|
+ if (-currentEnergyAtTimeStep <= currentProduction) {
|
|
- currentProduction -= minEnergy;
|
|
+ hl.setState(HolonObject.SUPPLIED);
|
|
-
|
|
+ currentProduction += currentEnergyAtTimeStep;
|
|
- * if possible, supply fully
|
|
+ hl.setCurrentSupply(-currentEnergyAtTimeStep);
|
|
- */
|
|
+ hl.getCurrentEnergyAtTimeStep(x);
|
|
- float currentEnergyAtTimeStep = hl
|
|
+ } else {
|
|
- .getCurrentEnergyAtTimeStep(x);
|
|
+ currentProduction += minEnergy;
|
|
- if (-currentEnergyAtTimeStep <= currentProduction) {
|
|
+ notSuppliedList.add(hl);
|
|
- hl.setState(HolonObject.SUPPLIED);
|
|
|
|
- currentProduction += currentEnergyAtTimeStep;
|
|
|
|
- hl.setCurrentSupply(-currentEnergyAtTimeStep);
|
|
|
|
- hl.getCurrentEnergyAtTimeStep(x);
|
|
|
|
- } else {
|
|
|
|
- currentProduction += minEnergy;
|
|
|
|
- notSuppliedList.add(hl);
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
- if (!notSuppliedList.isEmpty() && currentProduction > 0) {
|
|
+ }
|
|
- float energyPerHolon = currentProduction
|
|
+ if (!notSuppliedList.isEmpty() && currentProduction > 0) {
|
|
- / notSuppliedList.size();
|
|
+ float energyPerHolon = currentProduction
|
|
- for (HolonObject hl : notSuppliedList) {
|
|
+ / notSuppliedList.size();
|
|
- hl.setCurrentSupply(hl.getCurrentSupply()
|
|
+ for (HolonObject hl : notSuppliedList) {
|
|
- + energyPerHolon);
|
|
+ hl.setCurrentSupply(hl.getCurrentSupply()
|
|
- hl.getCurrentEnergyAtTimeStep(x);
|
|
+ + energyPerHolon);
|
|
- }
|
|
+ hl.getCurrentEnergyAtTimeStep(x);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- canvas.repaint();
|
|
|
|
- flexPane.recalculate();
|
|
|
|
}
|
|
}
|
|
-
|
|
+
|
|
|
|
+ * add all battries.getOut() from a list of battries and return them
|
|
|
|
+ * @param aL a List of HolonBattries likely from subnet.getBatteries()
|
|
|
|
+ * @return
|
|
|
|
+ *
|
|
|
|
+ */
|
|
|
|
+ private float GetOutAllBatteries(ArrayList<HolonBattery> aL)
|
|
|
|
+ {
|
|
|
|
+ float OutEnergy = 0;
|
|
|
|
+ for(HolonBattery hB : aL)
|
|
|
|
+ {
|
|
|
|
+ OutEnergy += hB.getOUT();
|
|
|
|
+ }
|
|
|
|
+ return OutEnergy;
|
|
|
|
+ }
|
|
|
|
|
|
* search for all flexible devices in the network and turn them on, until
|
|
* search for all flexible devices in the network and turn them on, until
|
|
* energy surplus = 0 or all devices have been examined.
|
|
* energy surplus = 0 or all devices have been examined.
|