|
@@ -228,7 +228,7 @@ public class DecoratedNetwork {
|
|
float energyNeeded = hObject.getEnergyNeededFromConsumingElementsWithFlex(Iteration, flexManager);
|
|
float energyNeeded = hObject.getEnergyNeededFromConsumingElementsWithFlex(Iteration, flexManager);
|
|
float energySelfProducing = hObject.getEnergySelfProducingFromProducingElementsWithFlex(Iteration, flexManager);
|
|
float energySelfProducing = hObject.getEnergySelfProducingFromProducingElementsWithFlex(Iteration, flexManager);
|
|
if(energyNeeded < energySelfProducing) {
|
|
if(energyNeeded < energySelfProducing) {
|
|
- Supplier sup = new Supplier(hObject, energySelfProducing - energyNeeded);
|
|
|
|
|
|
+ Supplier sup = new Supplier(hObject, energySelfProducing - energyNeeded, energyNeeded);
|
|
supplierList.add(sup);
|
|
supplierList.add(sup);
|
|
} else if (energyNeeded > energySelfProducing) {
|
|
} else if (energyNeeded > energySelfProducing) {
|
|
Consumer con = new Consumer(hObject);
|
|
Consumer con = new Consumer(hObject);
|
|
@@ -301,4 +301,66 @@ public class DecoratedNetwork {
|
|
public int getAmountOfPassiv() {
|
|
public int getAmountOfPassiv() {
|
|
return passivNoEnergyList.size();
|
|
return passivNoEnergyList.size();
|
|
}
|
|
}
|
|
|
|
+ public int getAmountOfHolonObjects() {
|
|
|
|
+ return getAmountOfConsumer() + getAmountOfSupplier() + getAmountOfPassiv();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public float getTotalConsumption() {
|
|
|
|
+ float energy = consumerList.stream().map(con -> con.getEnergyFromConsumingElemnets()).reduce(0.f, Float::sum) + consumerSelfSuppliedList.stream().map(con -> con.getEnergyFromConsumingElemnets()).reduce(0.f, Float::sum);
|
|
|
|
+ energy += supplierList.stream().map(sup -> sup.getEnergySelfConsuming()).reduce(0.f, Float::sum);
|
|
|
|
+ return energy;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public float getAverageConsumptionInNetworkForHolonObject(){
|
|
|
|
+ return getTotalConsumption() / (float)getAmountOfHolonObjects();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public float getTotalProduction() {
|
|
|
|
+ float energy = consumerList.stream().map(con -> con.getEnergySelfSupplied()).reduce(0.f, Float::sum) + consumerSelfSuppliedList.stream().map(con -> con.getEnergySelfSupplied()).reduce(0.f, Float::sum);
|
|
|
|
+ energy += supplierList.stream().map(sup -> sup.getEnergyProducing()).reduce(0.f, Float::sum);
|
|
|
|
+ return energy;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public float getAverageProductionInNetworkForHolonObject() {
|
|
|
|
+ return getTotalProduction() / (float) getAmountOfHolonObjects();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * returns the Varianz in Poduction
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public float getVarianzInProductionInNetworkForHolonObjects() {
|
|
|
|
+ float average = getAverageProductionInNetworkForHolonObject();
|
|
|
|
+ float sum = consumerList.stream().map(con -> sqared(con.getEnergySelfSupplied() - average)).reduce(0.f, Float::sum)
|
|
|
|
+ + consumerSelfSuppliedList.stream().map(con -> sqared(con.getEnergySelfSupplied() - average)).reduce(0.f, Float::sum)
|
|
|
|
+ + supplierList.stream().map(sup -> sqared(sup.getEnergyProducing() - average)).reduce(0.f, Float::sum);
|
|
|
|
+ return sum / (float) getAmountOfHolonObjects();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public float getDispersionInProductionInNetworkForHolonObjects() {
|
|
|
|
+ return (float)Math.sqrt(getVarianzInProductionInNetworkForHolonObjects());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public float getVarianzInConsumptionInNetworkForHolonObjects() {
|
|
|
|
+ float average = getAverageConsumptionInNetworkForHolonObject();
|
|
|
|
+ float sum = consumerList.stream().map(con -> sqared(con.getEnergyFromConsumingElemnets() - average)).reduce(0.f, Float::sum)
|
|
|
|
+ + consumerSelfSuppliedList.stream().map(con -> sqared(con.getEnergyFromConsumingElemnets() - average)).reduce(0.f, Float::sum)
|
|
|
|
+ + supplierList.stream().map(sup -> sqared(sup.getEnergySelfConsuming() - average)).reduce(0.f, Float::sum);
|
|
|
|
+ return sum / (float) getAmountOfHolonObjects();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public float getDispersionInConsumptionInNetworkForHolonObjects() {
|
|
|
|
+ return (float)Math.sqrt(getVarianzInProductionInNetworkForHolonObjects());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //Help Function
|
|
|
|
+ private float sqared(float input) {
|
|
|
|
+ return (float) Math.pow(input, 2);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|