DecoratedNetwork.java 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. package ui.model;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import java.util.stream.Collectors;
  5. import classes.HolonElement;
  6. import classes.HolonObject;
  7. import holeg.HolegGateway;
  8. import holeg.HolegPowerFlowContext;
  9. import ui.controller.FlexManager;
  10. import ui.model.DecoratedCable.CableState;
  11. import ui.model.DecoratedHolonObject.HolonObjectState;
  12. import ui.model.Model.FairnessModel;
  13. public class DecoratedNetwork {
  14. private ArrayList<Supplier> supplierList = new ArrayList<Supplier>();
  15. private ArrayList<Consumer> consumerList = new ArrayList<Consumer>();
  16. private ArrayList<Consumer> consumerSelfSuppliedList = new ArrayList<Consumer>();
  17. private ArrayList<Passiv> passivNoEnergyList = new ArrayList<Passiv>();
  18. private ArrayList<DecoratedCable> decoratedCableList = new ArrayList<DecoratedCable>();
  19. private int timestep;
  20. private Object lockObject = new Object();
  21. public DecoratedNetwork(HolegPowerFlowContext context, MinimumNetwork minimumNetwork, int Iteration, FairnessModel actualFairnessModel, FlexManager flexManager){
  22. this.timestep = Iteration;
  23. switch(actualFairnessModel) {
  24. case AllEqual:
  25. calculateAllEqualNetwork(minimumNetwork, Iteration, flexManager);
  26. break;
  27. case MininumDemandFirst:
  28. calculateMinimumDemandFirstNetwork(minimumNetwork, Iteration, flexManager);
  29. break;
  30. case PowerFlowAnalysis:
  31. HolegGateway.solve(context, minimumNetwork, Iteration, flexManager, this);
  32. break;
  33. }
  34. }
  35. public void clear() {
  36. supplierList.clear();
  37. consumerList.clear();
  38. consumerSelfSuppliedList.clear();
  39. passivNoEnergyList.clear();
  40. decoratedCableList.clear();
  41. }
  42. //Getter:
  43. public Object getLockObject() {
  44. return lockObject;
  45. }
  46. public ArrayList<Supplier> getSupplierList() {
  47. return supplierList;
  48. }
  49. public ArrayList<Consumer> getConsumerList() {
  50. return consumerList;
  51. }
  52. public ArrayList<Consumer> getConsumerSelfSuppliedList() {
  53. return consumerSelfSuppliedList;
  54. }
  55. public ArrayList<Passiv> getPassivNoEnergyList() {
  56. return passivNoEnergyList;
  57. }
  58. public ArrayList<DecoratedCable> getDecoratedCableList(){
  59. return decoratedCableList;
  60. }
  61. //Calculations:
  62. private void calculateMinimumDemandFirstNetwork(MinimumNetwork minimumNetwork, int Iteration, FlexManager flexManager) {
  63. categorize(minimumNetwork, Iteration, flexManager);
  64. //Sort SupplierList according to the EnergyToSupplyNetwork maximum first.
  65. //Sort ConsumerList according to the MinimumConsumingElementEnergy minimum first.
  66. supplierList.sort((Supplier lhs,Supplier rhs) -> -Float.compare(lhs.getEnergyToSupplyNetwork(), rhs.getEnergyToSupplyNetwork()));
  67. consumerList.sort((Consumer lhs,Consumer rhs) -> Float.compare(lhs.getMinimumConsumingElementEnergy() , rhs.getMinimumConsumingElementEnergy()));
  68. //consumerList.forEach((con) -> System.out.println(con.getMinimumConsumingElementEnergy()));
  69. //consumerList.forEach((con) -> System.out.println("AfterSorting" + con));
  70. float energyToSupplyInTheNetwork = supplierList.stream().map(supplier -> supplier.getEnergyToSupplyNetwork() - supplier.getEnergySupplied()).reduce( 0.0f, (a, b) -> a + b);
  71. decorateCable(minimumNetwork, energyToSupplyInTheNetwork);
  72. outerLoop:
  73. for(Consumer con : consumerList)
  74. {
  75. //gehe Supplier list durch wer ihn supplien kann.
  76. for(Supplier sup : supplierList) {
  77. float energyRdyToSupply = sup.getEnergyToSupplyNetwork() - sup.getEnergySupplied();
  78. if(energyRdyToSupply == 0.0f) continue;
  79. float energyNeededForMinimumConsumingElement=con.getMinimumConsumingElementEnergy()-con.getEnergyFromNetwork();
  80. if(energyNeededForMinimumConsumingElement>energyToSupplyInTheNetwork) {
  81. //Dont supply a minimumElement when you cant supply it fully
  82. break outerLoop;
  83. }
  84. if(energyRdyToSupply>=energyNeededForMinimumConsumingElement) {
  85. energyToSupplyInTheNetwork -= energyNeededForMinimumConsumingElement;
  86. supply(con, sup, energyNeededForMinimumConsumingElement);
  87. continue outerLoop;
  88. }else
  89. {
  90. energyToSupplyInTheNetwork -= energyRdyToSupply;
  91. supply(con, sup, energyRdyToSupply);
  92. }
  93. }
  94. //No more Energy in the network
  95. break;
  96. }
  97. //consumerList.forEach((con) -> System.out.println("AfterSuppliing MinimumDemand " + con));
  98. //Sort ConsumerList according to the EnergyNeeded to supply fully after minimum Demand First.
  99. consumerList.sort((Consumer lhs,Consumer rhs) -> Float.compare(lhs.getEnergyNeededFromNetwork()-lhs.getEnergyFromNetwork() , rhs.getEnergyNeededFromNetwork()-rhs.getEnergyFromNetwork() ));
  100. //Supply consumer fully
  101. outerLoop:
  102. for(Consumer con : consumerList)
  103. {
  104. //gehe Supplier list durch wer ihn supplien kann.
  105. for(Supplier sup : supplierList) {
  106. float energyRdyToSupply = sup.getEnergyToSupplyNetwork() - sup.getEnergySupplied();
  107. if(energyRdyToSupply == 0.0f) continue;
  108. float energyNeededForFullySupply = con.getEnergyNeededFromNetwork() - con.getEnergyFromNetwork();
  109. if(energyNeededForFullySupply == 0.0f) continue outerLoop;
  110. if(energyRdyToSupply>=energyNeededForFullySupply) {
  111. supply(con, sup, energyNeededForFullySupply);
  112. continue outerLoop;
  113. }else
  114. {
  115. supply(con, sup, energyRdyToSupply);
  116. }
  117. }
  118. //No more Energy in the network
  119. break;
  120. }
  121. //consumerList.forEach((con) -> System.out.println("AfterFullySuplieing" + con));
  122. //If Energy Left Supply all equal
  123. //Count EnergyLeft
  124. float energyLeft = supplierList.stream().map(supplier -> supplier.getEnergyToSupplyNetwork() - supplier.getEnergySupplied()).reduce( 0.0f, (a, b) -> a + b);
  125. //System.out.println("EnergyLeft: " + energyLeft);
  126. if(energyLeft > 0.0f && (consumerList.size() + consumerSelfSuppliedList.size() != 0))
  127. {
  128. float equalAmountOfEnergyToSupply = energyLeft / ((float)(consumerList.size() + consumerSelfSuppliedList.size()));
  129. outerLoop:
  130. for(Consumer con : consumerList)
  131. {
  132. //gehe Supplier list durch wer ihn supplien kann.
  133. for(Supplier sup : supplierList) {
  134. float energyRdyToSupply = sup.getEnergyToSupplyNetwork() - sup.getEnergySupplied();
  135. if(energyRdyToSupply == 0.0f) continue;
  136. float energyNeededToSupplyConsumerTheEqualAmount = equalAmountOfEnergyToSupply +con.getEnergyNeededFromNetwork()- con.getEnergyFromNetwork();
  137. if(energyRdyToSupply>=energyNeededToSupplyConsumerTheEqualAmount) {
  138. supply(con, sup, energyNeededToSupplyConsumerTheEqualAmount);
  139. continue outerLoop;
  140. }else
  141. {
  142. supply(con, sup, energyRdyToSupply);
  143. }
  144. }
  145. //No more Energy in the network
  146. break;
  147. }
  148. outerLoop:
  149. for(Consumer con : consumerSelfSuppliedList)
  150. {
  151. //gehe Supplier list durch wer ihn supplien kann.
  152. for(Supplier sup : supplierList) {
  153. float energyRdyToSupply = sup.getEnergyToSupplyNetwork() - sup.getEnergySupplied();
  154. if(energyRdyToSupply == 0.0f) continue;
  155. float energyNeededToSupplyConsumerTheEqualAmount = equalAmountOfEnergyToSupply +con.getEnergyNeededFromNetwork()- con.getEnergyFromNetwork();
  156. if(energyRdyToSupply>=energyNeededToSupplyConsumerTheEqualAmount) {
  157. supply(con, sup, energyNeededToSupplyConsumerTheEqualAmount);
  158. continue outerLoop;
  159. }else
  160. {
  161. supply(con, sup, energyRdyToSupply);
  162. }
  163. }
  164. //No more Energy in the network
  165. break;
  166. }
  167. }
  168. //consumerList.forEach((con) -> System.out.println("AfterOverSuppleiing" + con));
  169. //consumerSelfSuppliedList.forEach((con) -> System.out.println("AfterOverSuppleiing" + con));
  170. calculateStates();
  171. }
  172. private void decorateCable(MinimumNetwork minimumNetwork, float energyToSupplyInTheNetwork) {
  173. //DecoratedCables
  174. //Minimum demand first:
  175. for(IntermediateCableWithState edge: minimumNetwork.getEdgeList()) {
  176. decoratedCableList.add(new DecoratedCable(edge.getModel(), edge.getState(), (edge.getState() == CableState.Working) ? energyToSupplyInTheNetwork : 0.0f, 0));
  177. }
  178. }
  179. private void calculateAllEqualNetwork(MinimumNetwork minimumNetwork, int Iteration, FlexManager flexManager) {
  180. categorize(minimumNetwork, Iteration, flexManager);
  181. float energyToSupplyInTheNetwork = supplierList.stream().map(supplier -> supplier.getEnergyToSupplyNetwork() - supplier.getEnergySupplied()).reduce( 0.0f, (a, b) -> a + b);
  182. float energyForEachConsumer = (consumerList.size() != 0) ? energyToSupplyInTheNetwork / consumerList.size() : 0.0f;
  183. decorateCable(minimumNetwork, energyToSupplyInTheNetwork);
  184. //Supply consumer equal
  185. outerLoop:
  186. for(Consumer con : consumerList)
  187. {
  188. //gehe Supplier list durch wer ihn supplien kann.
  189. float energyNeededForEqualSupply = energyForEachConsumer;
  190. for(Supplier sup : supplierList) {
  191. float energyRdyToSupply = sup.getEnergyToSupplyNetwork() - sup.getEnergySupplied();
  192. if(energyRdyToSupply == 0.0f) continue;
  193. if(energyRdyToSupply>=energyNeededForEqualSupply) {
  194. supply(con, sup, energyNeededForEqualSupply);
  195. continue outerLoop;
  196. }else
  197. {
  198. supply(con, sup, energyRdyToSupply);
  199. energyNeededForEqualSupply -= energyRdyToSupply;
  200. }
  201. }
  202. //No more Energy in the network
  203. break;
  204. }
  205. calculateStates();
  206. }
  207. public void calculateStates() {
  208. //CalculateStates:
  209. supplierList.forEach(sup -> sup.setState(HolonObjectState.PRODUCER));
  210. passivNoEnergyList.forEach(sup -> sup.setState(HolonObjectState.NO_ENERGY));
  211. for(Consumer con : this.consumerList)
  212. {
  213. setConsumerState(con);
  214. }
  215. for(Consumer con : this.consumerSelfSuppliedList)
  216. {
  217. setConsumerState(con);
  218. }
  219. }
  220. private void categorize(MinimumNetwork minimumNetwork, int Iteration, FlexManager flexManager) {
  221. //Categorize
  222. for(HolonObject hObject: minimumNetwork.getHolonObjectList()) {
  223. float energyNeeded = hObject.getEnergyNeededFromConsumingElementsWithFlex(Iteration, flexManager);
  224. float energySelfProducing = hObject.getEnergySelfProducingFromProducingElementsWithFlex(Iteration, flexManager);
  225. if(energyNeeded < energySelfProducing) {
  226. Supplier sup = new Supplier(hObject, energySelfProducing - energyNeeded, energyNeeded, 0, 0, false);
  227. supplierList.add(sup);
  228. } else if (energyNeeded > energySelfProducing) {
  229. Consumer con = new Consumer(hObject, energyNeeded - energySelfProducing, 0, 0, 0,false);
  230. con.setMinimumConsumingElementEnergy(hObject.getMinimumConsumingElementEnergyWithFlex(Iteration, flexManager));
  231. con.setEnergyFromConsumingElemnets(hObject.getEnergyNeededFromConsumingElementsWithFlex(Iteration, flexManager));
  232. con.setEnergySelfSupplied(hObject.getEnergySelfProducingFromProducingElementsWithFlex(Iteration, flexManager));
  233. consumerList.add(con);
  234. }else if(energyNeeded == energySelfProducing) {
  235. if (energySelfProducing == 0.0f) {
  236. Passiv pas = new Passiv(hObject);
  237. passivNoEnergyList.add(pas);
  238. } else {
  239. Consumer con = new Consumer(hObject, 0.0f, 0, 0,0,false);
  240. con.setEnergyNeededFromNetwork(0.0f);
  241. con.setMinimumConsumingElementEnergy(hObject.getMinimumConsumingElementEnergyWithFlex(Iteration, flexManager));
  242. con.setEnergyFromConsumingElemnets(hObject.getEnergyNeededFromConsumingElementsWithFlex(Iteration, flexManager));
  243. con.setEnergySelfSupplied(hObject.getEnergySelfProducingFromProducingElementsWithFlex(Iteration, flexManager));
  244. consumerSelfSuppliedList.add(con);
  245. }
  246. }
  247. }
  248. }
  249. private void setConsumerState(Consumer con) {
  250. if(con.getEnergySelfSupplied() + con.getEnergyFromNetwork() > con.getEnergyFromConsumingElemnets()) {
  251. con.setState(HolonObjectState.OVER_SUPPLIED);
  252. }else if(con.getEnergySelfSupplied() + con.getEnergyFromNetwork() == con.getEnergyFromConsumingElemnets()) {
  253. con.setState(HolonObjectState.SUPPLIED);
  254. }else if(con.getEnergySelfSupplied() + con.getEnergyFromNetwork() >= con.getMinimumConsumingElementEnergy()) {
  255. con.setState(HolonObjectState.PARTIALLY_SUPPLIED);
  256. }else {
  257. con.setState(HolonObjectState.NOT_SUPPLIED);
  258. }
  259. }
  260. /**
  261. * No Checks.
  262. * @param con
  263. * @param sup
  264. * @param energy
  265. */
  266. private void supply(Consumer con, Supplier sup, float energy) {
  267. sup.getConsumerList().add(sup.new ConsumerListEntry(con , energy));
  268. sup.setEnergySupplied(sup.getEnergySupplied() + energy);
  269. con.getSupplierList().add(con.new SupplierListEntry(sup, energy));
  270. con.setEnergyFromNetwork(con.getEnergyFromNetwork() + energy);
  271. }
  272. public int getAmountOfActiveElements() {
  273. return supplierList.stream().map(object -> object.getModel().getNumberOfActiveElements()).reduce(0, Integer::sum)+
  274. consumerList.stream().map(object -> object.getModel().getNumberOfActiveElements()).reduce(0, Integer::sum)+
  275. consumerSelfSuppliedList.stream().map(object -> object.getModel().getNumberOfActiveElements()).reduce(0, Integer::sum);
  276. }
  277. public int getAmountOfElements() {
  278. return supplierList.stream().map(object -> object.getModel().getNumberOfElements()).reduce(0, Integer::sum)+
  279. consumerList.stream().map(object -> object.getModel().getNumberOfElements()).reduce(0, Integer::sum)+
  280. consumerSelfSuppliedList.stream().map(object -> object.getModel().getNumberOfElements()).reduce(0, Integer::sum);
  281. }
  282. public int getAmountOfConsumer() {
  283. return consumerList.size() + this.consumerSelfSuppliedList.size();
  284. }
  285. public int getAmountOfSupplier() {
  286. return supplierList.size();
  287. }
  288. public int getAmountOfConsumerWithState(HolonObjectState state) {
  289. return (int) (consumerList.stream().filter(con -> con.getState() == state).count() + consumerSelfSuppliedList.stream().filter(con -> con.getState() == state).count());
  290. }
  291. public int getAmountOfPassiv() {
  292. return passivNoEnergyList.size();
  293. }
  294. public int getAmountOfHolonObjects() {
  295. return getAmountOfConsumer() + getAmountOfSupplier() + getAmountOfPassiv();
  296. }
  297. public float getTotalConsumption() {
  298. float energy = consumerList.stream().map(con -> con.getEnergyFromConsumingElemnets()).reduce(0.f, Float::sum) + consumerSelfSuppliedList.stream().map(con -> con.getEnergyFromConsumingElemnets()).reduce(0.f, Float::sum);
  299. energy += supplierList.stream().map(sup -> sup.getEnergySelfConsuming()).reduce(0.f, Float::sum);
  300. return energy;
  301. }
  302. public float getAverageConsumptionInNetworkForHolonObject(){
  303. return getTotalConsumption() / (float)getAmountOfHolonObjects();
  304. }
  305. public float getTotalProduction() {
  306. float energy = consumerList.stream().map(con -> con.getEnergySelfSupplied()).reduce(0.f, Float::sum) + consumerSelfSuppliedList.stream().map(con -> con.getEnergySelfSupplied()).reduce(0.f, Float::sum);
  307. energy += supplierList.stream().map(sup -> sup.getEnergyProducing()).reduce(0.f, Float::sum);
  308. return energy;
  309. }
  310. public float getAverageProductionInNetworkForHolonObject() {
  311. return getTotalProduction() / (float) getAmountOfHolonObjects();
  312. }
  313. /**
  314. * returns the Varianz in Poduction
  315. * @return
  316. */
  317. public float getVarianzInProductionInNetworkForHolonObjects() {
  318. float average = getAverageProductionInNetworkForHolonObject();
  319. float sum = consumerList.stream().map(con -> squared(con.getEnergySelfSupplied() - average)).reduce(0.f, Float::sum)
  320. + consumerSelfSuppliedList.stream().map(con -> squared(con.getEnergySelfSupplied() - average)).reduce(0.f, Float::sum)
  321. + supplierList.stream().map(sup -> squared(sup.getEnergyProducing() - average)).reduce(0.f, Float::sum);
  322. return sum / (float) getAmountOfHolonObjects();
  323. }
  324. public float getDeviationInProductionInNetworkForHolonObjects() {
  325. return (float)Math.sqrt(getVarianzInProductionInNetworkForHolonObjects());
  326. }
  327. public float getVarianzInConsumptionInNetworkForHolonObjects() {
  328. float average = getAverageConsumptionInNetworkForHolonObject();
  329. float sum = consumerList.stream().map(con -> squared(con.getEnergyFromConsumingElemnets() - average)).reduce(0.f, Float::sum)
  330. + consumerSelfSuppliedList.stream().map(con -> squared(con.getEnergyFromConsumingElemnets() - average)).reduce(0.f, Float::sum)
  331. + supplierList.stream().map(sup -> squared(sup.getEnergySelfConsuming() - average)).reduce(0.f, Float::sum);
  332. return sum / (float) getAmountOfHolonObjects();
  333. }
  334. public float getDeviationInConsumptionInNetworkForHolonObjects() {
  335. return (float)Math.sqrt(getVarianzInConsumptionInNetworkForHolonObjects());
  336. }
  337. //HelperFunction
  338. /**
  339. *
  340. * @return a list of energy
  341. */
  342. public List<Float> getListOfEnergyThatIsOfferedByFlexibilitiesInThisNetwork() {
  343. List<HolonElement> eleList = consumerList.stream().flatMap(con-> con.getModel().getElements().stream()).collect(Collectors.toList());
  344. eleList.addAll(consumerSelfSuppliedList.stream().flatMap(con-> con.getModel().getElements().stream()).collect(Collectors.toList()));
  345. eleList.addAll(supplierList.stream().flatMap(con-> con.getModel().getElements().stream()).collect(Collectors.toList()));
  346. eleList.addAll(passivNoEnergyList.stream().flatMap(con-> con.getModel().getElements().stream()).collect(Collectors.toList()));
  347. return eleList.stream().filter(ele -> (ele.flexList.stream().anyMatch(flex -> flex.offered && flex.fulfillsConstrains())) ).map(ele -> -ele.getEnergyAtTimeStep(timestep) ).collect(Collectors.toList()) ;
  348. }
  349. public List<Float> getListOfEnergyInProductionThatIsOfferedByFlexibilitiesInThisNetwork(){
  350. return getListOfEnergyThatIsOfferedByFlexibilitiesInThisNetwork().stream().filter(value -> (value > 0.f)).collect(Collectors.toList());
  351. }
  352. public List<Float> getListOfEnergyInConsumptionThatIsOfferedByFlexibilitiesInThisNetwork(){
  353. return getListOfEnergyThatIsOfferedByFlexibilitiesInThisNetwork().stream().filter(value -> (value < 0.f)).map(value -> -value).collect(Collectors.toList());
  354. }
  355. public float getFlexibilityProductionCapacity() {
  356. return getListOfEnergyInProductionThatIsOfferedByFlexibilitiesInThisNetwork().stream().reduce(0.f, Float::sum);
  357. }
  358. public float getFlexibilityConsumptionCapacity() {
  359. return getListOfEnergyInConsumptionThatIsOfferedByFlexibilitiesInThisNetwork().stream().reduce(0.f, Float::sum);
  360. }
  361. public int getAmountOfProductionFlexibilities() {
  362. return getListOfEnergyInProductionThatIsOfferedByFlexibilitiesInThisNetwork().size();
  363. }
  364. public int getAmountOfConsumptionFlexibilities() {
  365. return getListOfEnergyInConsumptionThatIsOfferedByFlexibilitiesInThisNetwork().size();
  366. }
  367. public float getAverageFlexibilityProduction() {
  368. int amount = getAmountOfProductionFlexibilities();
  369. return (amount > 0)? getFlexibilityProductionCapacity() / (float)amount : 0.f;
  370. }
  371. public float getAverageFlexibilityConsumption() {
  372. int amount = getAmountOfConsumptionFlexibilities();
  373. return (amount > 0)? getFlexibilityConsumptionCapacity() / (float)amount : 0.f;
  374. }
  375. public float getVarianzInFlexibilitieConsumption() {
  376. float average = getAverageFlexibilityConsumption();
  377. float sum = getListOfEnergyInConsumptionThatIsOfferedByFlexibilitiesInThisNetwork().stream().map(energy -> squared(energy - average)).reduce(0.f, Float::sum);
  378. int amountOfFlexibilities = getAmountOfConsumptionFlexibilities();
  379. return (amountOfFlexibilities > 0)? sum / (float) amountOfFlexibilities : 0.f;
  380. }
  381. public float getVarianzInFlexibilitieProduction() {
  382. float average = getAverageFlexibilityProduction();
  383. float sum = getListOfEnergyInProductionThatIsOfferedByFlexibilitiesInThisNetwork().stream().map(energy -> squared(energy - average)).reduce(0.f, Float::sum);
  384. int amountOfFlexibilities = getAmountOfProductionFlexibilities();
  385. return (amountOfFlexibilities > 0)? sum / (float) amountOfFlexibilities : 0.f;
  386. }
  387. public float getDiviationInFlexibilityConsumption() {
  388. return (float) Math.sqrt(getVarianzInFlexibilitieConsumption());
  389. }
  390. public float getDiviationInFlexibilityProduction() {
  391. return (float) Math.sqrt(getVarianzInFlexibilitieProduction());
  392. }
  393. //Help Function
  394. private float squared(float input) {
  395. return (float) Math.pow(input, 2);
  396. }
  397. }