|
@@ -262,7 +262,7 @@ public class SimulationManager {
|
|
{
|
|
{
|
|
if(hO.checkIfPartiallySupplied(x))continue;
|
|
if(hO.checkIfPartiallySupplied(x))continue;
|
|
if(hO.getCurrentEnergyAtTimeStep(x) > 0)continue;
|
|
if(hO.getCurrentEnergyAtTimeStep(x) > 0)continue;
|
|
- float minEnergy = -hO.getMinEnergy(x); //Energy from getMinEnergy is negative -> convert to positive
|
|
|
|
|
|
+ float minEnergy = -hO.getMinEnergyNecessaryAtTimestep(x); //Energy from getMinEnergy is negative -> convert to positive
|
|
if(minEnergy <= currentProduction)
|
|
if(minEnergy <= currentProduction)
|
|
{
|
|
{
|
|
hO.setCurrentSupply(minEnergy);
|
|
hO.setCurrentSupply(minEnergy);
|
|
@@ -318,7 +318,7 @@ public class SimulationManager {
|
|
hO.setState(HolonObject.SUPPLIED);
|
|
hO.setState(HolonObject.SUPPLIED);
|
|
}else if (currentSupply < neededEnergy)
|
|
}else if (currentSupply < neededEnergy)
|
|
{
|
|
{
|
|
- float minEnergy = -hO.getMinEnergy(x);
|
|
|
|
|
|
+ float minEnergy = -hO.getMinEnergyNecessaryAtTimestep(x);
|
|
if(currentSupply >= minEnergy || hO.getSelfMadeEnergy(x) >= minEnergy )
|
|
if(currentSupply >= minEnergy || hO.getSelfMadeEnergy(x) >= minEnergy )
|
|
{
|
|
{
|
|
hO.setState(HolonObject.PARTIALLY_SUPPLIED);
|
|
hO.setState(HolonObject.PARTIALLY_SUPPLIED);
|
|
@@ -384,7 +384,7 @@ public class SimulationManager {
|
|
} else if (energyPerHolonObject == -neededEnergy) {
|
|
} else if (energyPerHolonObject == -neededEnergy) {
|
|
hl.setState(HolonObject.SUPPLIED);
|
|
hl.setState(HolonObject.SUPPLIED);
|
|
} else if (energyPerHolonObject >= -hl
|
|
} else if (energyPerHolonObject >= -hl
|
|
- .getMinEnergy(x)) {
|
|
|
|
|
|
+ .getMinEnergyNecessaryAtTimestep(x)) {
|
|
hl.setState(HolonObject.PARTIALLY_SUPPLIED);
|
|
hl.setState(HolonObject.PARTIALLY_SUPPLIED);
|
|
} else {
|
|
} else {
|
|
hl.setState(HolonObject.NOT_SUPPLIED);
|
|
hl.setState(HolonObject.NOT_SUPPLIED);
|
|
@@ -404,7 +404,7 @@ public class SimulationManager {
|
|
.getCurrentEnergyAtTimeStep(x));
|
|
.getCurrentEnergyAtTimeStep(x));
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- float minEnergy = hl.getMinEnergy(x);
|
|
|
|
|
|
+ float minEnergy = hl.getMinEnergyNecessaryAtTimestep(x);
|
|
if (hl.checkIfPartiallySupplied(timeStep)) {
|
|
if (hl.checkIfPartiallySupplied(timeStep)) {
|
|
hl.setState(HolonObject.PARTIALLY_SUPPLIED);
|
|
hl.setState(HolonObject.PARTIALLY_SUPPLIED);
|
|
currentProduction += minEnergy;
|
|
currentProduction += minEnergy;
|
|
@@ -420,7 +420,7 @@ public class SimulationManager {
|
|
currentProduction += minEnergy;
|
|
currentProduction += minEnergy;
|
|
hl.setCurrentSupply(-minEnergy);
|
|
hl.setCurrentSupply(-minEnergy);
|
|
partiallySuppliedList.add(hl);
|
|
partiallySuppliedList.add(hl);
|
|
- } else if (-hl.getMinEnergy(x) <= currentProduction) {
|
|
|
|
|
|
+ } else if (-hl.getMinEnergyNecessaryAtTimestep(x) <= currentProduction) {
|
|
hl.setState(HolonObject.PARTIALLY_SUPPLIED);
|
|
hl.setState(HolonObject.PARTIALLY_SUPPLIED);
|
|
currentProduction += minEnergy;
|
|
currentProduction += minEnergy;
|
|
hl.setCurrentSupply(-minEnergy);
|
|
hl.setCurrentSupply(-minEnergy);
|
|
@@ -459,7 +459,7 @@ public class SimulationManager {
|
|
*/
|
|
*/
|
|
partiallySuppliedList.sort(new EnergyMinToMaxComparator(x));
|
|
partiallySuppliedList.sort(new EnergyMinToMaxComparator(x));
|
|
for (HolonObject hl : partiallySuppliedList) {
|
|
for (HolonObject hl : partiallySuppliedList) {
|
|
- float minEnergy = hl.getMinEnergy(x);
|
|
|
|
|
|
+ float minEnergy = hl.getMinEnergyNecessaryAtTimestep(x);
|
|
currentProduction -= minEnergy;
|
|
currentProduction -= minEnergy;
|
|
/*
|
|
/*
|
|
* if possible, supply fully
|
|
* if possible, supply fully
|
|
@@ -784,7 +784,7 @@ public class SimulationManager {
|
|
* Integer
|
|
* Integer
|
|
* @return The Energy
|
|
* @return The Energy
|
|
*/
|
|
*/
|
|
- private float calculateEnergyWithoutFlexDevices(String type, SubNet sN,
|
|
|
|
|
|
+ public float calculateEnergyWithoutFlexDevices(String type, SubNet sN,
|
|
int x) {
|
|
int x) {
|
|
float energy = 0;
|
|
float energy = 0;
|
|
for (HolonObject hl : sN.getObjects()) {
|
|
for (HolonObject hl : sN.getObjects()) {
|
|
@@ -822,7 +822,7 @@ public class SimulationManager {
|
|
* Integer
|
|
* Integer
|
|
* @return The Energy
|
|
* @return The Energy
|
|
*/
|
|
*/
|
|
- private float calculateEnergyWithFlexDevices(String type, SubNet sN, int x) {
|
|
|
|
|
|
+ public float calculateEnergyWithFlexDevices(String type, SubNet sN, int x) {
|
|
float energy = 0;
|
|
float energy = 0;
|
|
for (HolonObject hl : sN.getObjects()) {
|
|
for (HolonObject hl : sN.getObjects()) {
|
|
float currentEnergy = hl.getCurrentEnergyAtTimeStep(x);
|
|
float currentEnergy = hl.getCurrentEnergyAtTimeStep(x);
|