|
@@ -278,15 +278,17 @@ public class SimulationManager {
|
|
|
//supplyFullytillEnd ... because its cant be fully supplied
|
|
|
for(HolonObject hO : singleSubNet.getObjects())
|
|
|
{
|
|
|
- float neededEnergy = -hO.getCurrentEnergyAtTimeStep(x);
|
|
|
- if(neededEnergy < 0)continue; //Producer
|
|
|
+
|
|
|
+ float actualSupplyEnergy = hO.getCurrentSupply();
|
|
|
+ float neededEnergy = -hO.getCurrentEnergyAtTimeStep(x) - actualSupplyEnergy;
|
|
|
+ if(neededEnergy <= 0)continue; //Producer or No EnergyNeeded
|
|
|
if(neededEnergy <= currentProduction)
|
|
|
{
|
|
|
- hO.setCurrentSupply(neededEnergy+hO.getCurrentSupply());
|
|
|
+ hO.setCurrentSupply(neededEnergy+actualSupplyEnergy);
|
|
|
currentProduction -= neededEnergy;
|
|
|
}else
|
|
|
{
|
|
|
- hO.setCurrentSupply(currentProduction+hO.getCurrentSupply());
|
|
|
+ hO.setCurrentSupply(currentProduction+actualSupplyEnergy);
|
|
|
currentProduction = 0;
|
|
|
break;
|
|
|
}
|