diff --git a/_alp/Agents/ChartBalans/Code/Functions.java b/_alp/Agents/ChartBalans/Code/Functions.java index 6c291e9..b35fb0e 100644 --- a/_alp/Agents/ChartBalans/Code/Functions.java +++ b/_alp/Agents/ChartBalans/Code/Functions.java @@ -335,7 +335,7 @@ else if( radio_energyType.getValue() == 1){ if (dataObject.getRapidRunData().getTotalImport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem totalImport = new DataItem(); totalImport.setValue(dataObject.getRapidRunData().getTotalImport_MWh(EC)); - pl_consumptionChartBalanceTotal.addDataItem(totalImport, uI_Results.f_getName(EC) + " Import [MWh]", uI_Results.cm_consumptionColors.get(EC)); + pl_consumptionChartBalanceTotal.addDataItem(totalImport, uI_Results.f_getECName(EC) + " Import [MWh]", uI_Results.cm_consumptionColors.get(EC)); } } for (OL_EnergyCarriers EC : dataObject.getRapidRunData().activeProductionEnergyCarriers) { @@ -343,7 +343,7 @@ else if( radio_energyType.getValue() == 1){ if (dataObject.getRapidRunData().getTotalExport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem totalExport = new DataItem(); totalExport.setValue(dataObject.getRapidRunData().getTotalExport_MWh(EC)); - pl_productionChartBalanceTotal.addDataItem(totalExport, uI_Results.f_getName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_productionChartBalanceTotal.addDataItem(totalExport, uI_Results.f_getECName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); } } @@ -427,13 +427,13 @@ else if( radio_energyType.getValue() == 1){ if (dataObject.getRapidRunData().am_summerWeekBalanceAccumulators_kW.get(EC).getIntegralPos_MWh() > uI_Results.p_cutOff_MWh) { DataItem summerImport = new DataItem(); summerImport.setValue(dataObject.getRapidRunData().am_summerWeekBalanceAccumulators_kW.get(EC).getIntegralPos_MWh()); - pl_consumptionChartSummer.addDataItem(summerImport, uI_Results.f_getName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_consumptionChartSummer.addDataItem(summerImport, uI_Results.f_getECName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); } // Winter Consumption if (dataObject.getRapidRunData().am_winterWeekBalanceAccumulators_kW.get(EC).getIntegralPos_MWh() > uI_Results.p_cutOff_MWh) { DataItem winterImport = new DataItem(); winterImport.setValue(dataObject.getRapidRunData().am_winterWeekBalanceAccumulators_kW.get(EC).getIntegralPos_MWh()); - pl_consumptionChartWinter.addDataItem(winterImport, uI_Results.f_getName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_consumptionChartWinter.addDataItem(winterImport, uI_Results.f_getECName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); } } for (OL_EnergyCarriers EC : dataObject.getRapidRunData().activeProductionEnergyCarriers) { @@ -441,13 +441,13 @@ else if( radio_energyType.getValue() == 1){ if (-dataObject.getRapidRunData().am_summerWeekBalanceAccumulators_kW.get(EC).getIntegralNeg_MWh() > uI_Results.p_cutOff_MWh) { DataItem summerExport = new DataItem(); summerExport.setValue(-dataObject.getRapidRunData().am_summerWeekBalanceAccumulators_kW.get(EC).getIntegralNeg_MWh()); - pl_productionChartSummer.addDataItem(summerExport, uI_Results.f_getName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_productionChartSummer.addDataItem(summerExport, uI_Results.f_getECName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); } // Winter Production if (-dataObject.getRapidRunData().am_winterWeekBalanceAccumulators_kW.get(EC).getIntegralNeg_MWh() > uI_Results.p_cutOff_MWh) { DataItem winterExport = new DataItem(); winterExport.setValue(-dataObject.getRapidRunData().am_winterWeekBalanceAccumulators_kW.get(EC).getIntegralNeg_MWh()); - pl_productionChartWinter.addDataItem(winterExport, uI_Results.f_getName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_productionChartWinter.addDataItem(winterExport, uI_Results.f_getECName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); } } @@ -542,13 +542,13 @@ else if( radio_energyType.getValue() == 1){ if (dataObject.getRapidRunData().getWeekdayImport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem weekdayImport = new DataItem(); weekdayImport.setValue(dataObject.getRapidRunData().getWeekdayImport_MWh(EC)); - pl_consumptionChartWeekday.addDataItem(weekdayImport, uI_Results.f_getName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_consumptionChartWeekday.addDataItem(weekdayImport, uI_Results.f_getECName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); } // Weekend Consumption if (dataObject.getRapidRunData().getWeekendImport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem weekendImport = new DataItem(); weekendImport.setValue(dataObject.getRapidRunData().getWeekendImport_MWh(EC)); - pl_consumptionChartWeekend.addDataItem(weekendImport, uI_Results.f_getName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_consumptionChartWeekend.addDataItem(weekendImport, uI_Results.f_getECName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); } } for (OL_EnergyCarriers EC : dataObject.getRapidRunData().activeProductionEnergyCarriers) { @@ -556,13 +556,13 @@ else if( radio_energyType.getValue() == 1){ if (dataObject.getRapidRunData().getWeekdayExport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem weekdayExport = new DataItem(); weekdayExport.setValue(dataObject.getRapidRunData().getWeekdayExport_MWh(EC)); - pl_productionChartWeekday.addDataItem(weekdayExport, uI_Results.f_getName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_productionChartWeekday.addDataItem(weekdayExport, uI_Results.f_getECName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); } // Weekend Production if (dataObject.getRapidRunData().getWeekendExport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem weekendExport = new DataItem(); weekendExport.setValue(dataObject.getRapidRunData().getWeekendExport_MWh(EC)); - pl_productionChartWeekend.addDataItem(weekendExport, uI_Results.f_getName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_productionChartWeekend.addDataItem(weekendExport, uI_Results.f_getECName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); } } @@ -658,13 +658,13 @@ else if( radio_energyType.getValue() == 1){ if (dataObject.getRapidRunData().getDaytimeImport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem daytimeImport = new DataItem(); daytimeImport.setValue(dataObject.getRapidRunData().getDaytimeImport_MWh(EC)); - pl_consumptionChartDay.addDataItem(daytimeImport, uI_Results.f_getName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_consumptionChartDay.addDataItem(daytimeImport, uI_Results.f_getECName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); } // Nighttime Consumption if (dataObject.getRapidRunData().getNighttimeImport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem nighttimeImport = new DataItem(); nighttimeImport.setValue(dataObject.getRapidRunData().getNighttimeImport_MWh(EC)); - pl_consumptionChartNight.addDataItem(nighttimeImport, uI_Results.f_getName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_consumptionChartNight.addDataItem(nighttimeImport, uI_Results.f_getECName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); } } for (OL_EnergyCarriers EC : dataObject.getRapidRunData().activeProductionEnergyCarriers) { @@ -672,13 +672,13 @@ else if( radio_energyType.getValue() == 1){ if (dataObject.getRapidRunData().getDaytimeExport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem daytimeExport = new DataItem(); daytimeExport.setValue(dataObject.getRapidRunData().getDaytimeExport_MWh(EC)); - pl_productionChartDay.addDataItem(daytimeExport, uI_Results.f_getName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_productionChartDay.addDataItem(daytimeExport, uI_Results.f_getECName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); } // Nighttime Production if (dataObject.getRapidRunData().getNighttimeExport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem nighttimeExport = new DataItem(); nighttimeExport.setValue(dataObject.getRapidRunData().getNighttimeExport_MWh(EC)); - pl_productionChartNight.addDataItem(nighttimeExport, uI_Results.f_getName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_productionChartNight.addDataItem(nighttimeExport, uI_Results.f_getECName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); } } @@ -1102,13 +1102,13 @@ else if( radio_energyType.getValue() == 1){ if (dataObject.getRapidRunData().am_summerWeekBalanceAccumulators_kW.get(EC).getIntegralPos_MWh() > uI_Results.p_cutOff_MWh) { DataItem summerImport = new DataItem(); summerImport.setValue(dataObject.getRapidRunData().am_summerWeekBalanceAccumulators_kW.get(EC).getIntegralPos_MWh()); - pl_consumptionChartSummer.addDataItem(summerImport, uI_Results.f_getName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_consumptionChartSummer.addDataItem(summerImport, uI_Results.f_getECName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); } // Winter Consumption if (dataObject.getRapidRunData().am_winterWeekBalanceAccumulators_kW.get(EC).getIntegralPos_MWh() > uI_Results.p_cutOff_MWh) { DataItem winterImport = new DataItem(); winterImport.setValue(dataObject.getRapidRunData().am_winterWeekBalanceAccumulators_kW.get(EC).getIntegralPos_MWh()); - pl_consumptionChartWinter.addDataItem(winterImport, uI_Results.f_getName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_consumptionChartWinter.addDataItem(winterImport, uI_Results.f_getECName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); } } for (OL_EnergyCarriers EC : dataObject.getRapidRunData().activeProductionEnergyCarriers) { @@ -1116,13 +1116,13 @@ else if( radio_energyType.getValue() == 1){ if (-dataObject.getRapidRunData().am_summerWeekBalanceAccumulators_kW.get(EC).getIntegralNeg_MWh() > uI_Results.p_cutOff_MWh) { DataItem summerExport = new DataItem(); summerExport.setValue(-dataObject.getRapidRunData().am_summerWeekBalanceAccumulators_kW.get(EC).getIntegralNeg_MWh()); - pl_productionChartSummer.addDataItem(summerExport, uI_Results.f_getName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_productionChartSummer.addDataItem(summerExport, uI_Results.f_getECName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); } // Winter Production if (-dataObject.getRapidRunData().am_winterWeekBalanceAccumulators_kW.get(EC).getIntegralNeg_MWh() > uI_Results.p_cutOff_MWh) { DataItem winterExport = new DataItem(); winterExport.setValue(-dataObject.getRapidRunData().am_winterWeekBalanceAccumulators_kW.get(EC).getIntegralNeg_MWh()); - pl_productionChartWinter.addDataItem(winterExport, uI_Results.f_getName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_productionChartWinter.addDataItem(winterExport, uI_Results.f_getECName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); } } diff --git a/_alp/Agents/ChartBars/AOC.ChartBars.xml b/_alp/Agents/ChartBars/AOC.ChartBars.xml index 2250e25..433f406 100644 --- a/_alp/Agents/ChartBars/AOC.ChartBars.xml +++ b/_alp/Agents/ChartBars/AOC.ChartBars.xml @@ -2,6 +2,7 @@ 1762958101311 + 1755764711838 digital_twin_results diff --git a/_alp/Agents/ChartBars/Code/AdditionalClassCode.java b/_alp/Agents/ChartBars/Code/AdditionalClassCode.java new file mode 100644 index 0000000..f96cc34 --- /dev/null +++ b/_alp/Agents/ChartBars/Code/AdditionalClassCode.java @@ -0,0 +1,7 @@ +public ShapeButton getButton_monthlyDetails(){ + return button_monthlyDetails; +} + +public ShapeRadioButtonGroup getRadio_period(){ + return radio_period; +} \ No newline at end of file diff --git a/_alp/Agents/ChartBars/Code/Functions.java b/_alp/Agents/ChartBars/Code/Functions.java index acc8c53..3aae20a 100644 --- a/_alp/Agents/ChartBars/Code/Functions.java +++ b/_alp/Agents/ChartBars/Code/Functions.java @@ -459,13 +459,13 @@ else if( radio_energyType.getValue() == 2){ totalProduction_MWh += ECConsumption_MWh; DataItem heatProduction = new DataItem(); heatProduction.setValue(ECConsumption_MWh); - pl_productionChartBalanceTotal.addDataItem(heatProduction, uI_Results.f_getName(EC) + " [MWh]", uI_Results.cm_consumptionColors.get(EC)); + pl_productionChartBalanceTotal.addDataItem(heatProduction, uI_Results.f_getECName(EC) + " [MWh]", uI_Results.cm_consumptionColors.get(EC)); } if (losses_MWh > uI_Results.p_cutOff_MWh ) { totalConsumption_MWh += losses_MWh; DataItem ECLosses = new DataItem(); ECLosses.setValue(losses_MWh); - pl_consumptionChartBalanceTotal.addDataItem(ECLosses, uI_Results.f_getName(EC) + " verliezen [MWh]", uI_Results.cm_consumptionColors.get(EC)); + pl_consumptionChartBalanceTotal.addDataItem(ECLosses, uI_Results.f_getECName(EC) + " verliezen [MWh]", uI_Results.cm_consumptionColors.get(EC)); } } } @@ -604,13 +604,13 @@ else if( radio_energyType.getValue() == 2){ totalProductionSummer_MWh += ECConsumption_MWh; DataItem heatProduction = new DataItem(); heatProduction.setValue(ECConsumption_MWh); - pl_productionChartSummer.addDataItem(heatProduction, uI_Results.f_getName(EC) + " [MWh]", uI_Results.cm_consumptionColors.get(EC)); + pl_productionChartSummer.addDataItem(heatProduction, uI_Results.f_getECName(EC) + " [MWh]", uI_Results.cm_consumptionColors.get(EC)); } if (losses_MWh > uI_Results.p_cutOff_MWh ) { totalConsumptionSummer_MWh += losses_MWh; DataItem ECLosses = new DataItem(); ECLosses.setValue(losses_MWh); - pl_consumptionChartSummer.addDataItem(ECLosses, uI_Results.f_getName(EC) + " verliezen [MWh]", uI_Results.cm_consumptionColors.get(EC)); + pl_consumptionChartSummer.addDataItem(ECLosses, uI_Results.f_getECName(EC) + " verliezen [MWh]", uI_Results.cm_consumptionColors.get(EC)); } } } @@ -716,13 +716,13 @@ else if( radio_energyType.getValue() == 2){ totalProductionWinter_MWh += ECConsumption_MWh; DataItem heatProduction = new DataItem(); heatProduction.setValue(ECConsumption_MWh); - pl_productionChartWinter.addDataItem(heatProduction, uI_Results.f_getName(EC) + " [MWh]", uI_Results.cm_consumptionColors.get(EC)); + pl_productionChartWinter.addDataItem(heatProduction, uI_Results.f_getECName(EC) + " [MWh]", uI_Results.cm_consumptionColors.get(EC)); } if (losses_MWh > uI_Results.p_cutOff_MWh ) { totalConsumptionWinter_MWh += losses_MWh; DataItem ECLosses = new DataItem(); ECLosses.setValue(losses_MWh); - pl_consumptionChartWinter.addDataItem(ECLosses, uI_Results.f_getName(EC) + " verliezen [MWh]", uI_Results.cm_consumptionColors.get(EC)); + pl_consumptionChartWinter.addDataItem(ECLosses, uI_Results.f_getECName(EC) + " verliezen [MWh]", uI_Results.cm_consumptionColors.get(EC)); } } } @@ -891,25 +891,25 @@ else if( radio_energyType.getValue() == 2){ totalProductionDay_MWh += ECConsumptionDay_MWh; DataItem heatProductionDay = new DataItem(); heatProductionDay.setValue(ECConsumptionDay_MWh); - pl_productionChartDay.addDataItem(heatProductionDay, uI_Results.f_getName(EC) + " [MWh]", uI_Results.cm_consumptionColors.get(EC)); + pl_productionChartDay.addDataItem(heatProductionDay, uI_Results.f_getECName(EC) + " [MWh]", uI_Results.cm_consumptionColors.get(EC)); } if (lossesDay_MWh > uI_Results.p_cutOff_MWh ) { totalConsumptionDay_MWh += lossesDay_MWh; DataItem ECLossesDay = new DataItem(); ECLossesDay.setValue(lossesDay_MWh); - pl_consumptionChartDay.addDataItem(ECLossesDay, uI_Results.f_getName(EC) + " verliezen [MWh]", uI_Results.cm_consumptionColors.get(EC)); + pl_consumptionChartDay.addDataItem(ECLossesDay, uI_Results.f_getECName(EC) + " verliezen [MWh]", uI_Results.cm_consumptionColors.get(EC)); } if ( ECConsumptionNight_MWh > uI_Results.p_cutOff_MWh ) { totalProductionNight_MWh += ECConsumptionNight_MWh; DataItem heatProductionNight = new DataItem(); heatProductionNight.setValue(ECConsumptionNight_MWh); - pl_productionChartNight.addDataItem(heatProductionNight, uI_Results.f_getName(EC) + " [MWh]", uI_Results.cm_consumptionColors.get(EC)); + pl_productionChartNight.addDataItem(heatProductionNight, uI_Results.f_getECName(EC) + " [MWh]", uI_Results.cm_consumptionColors.get(EC)); } if (lossesNight_MWh > uI_Results.p_cutOff_MWh ) { totalConsumptionNight_MWh += lossesNight_MWh; DataItem ECLossesNight = new DataItem(); ECLossesNight.setValue(lossesNight_MWh); - pl_consumptionChartNight.addDataItem(ECLossesNight, uI_Results.f_getName(EC) + " verliezen [MWh]", uI_Results.cm_consumptionColors.get(EC)); + pl_consumptionChartNight.addDataItem(ECLossesNight, uI_Results.f_getECName(EC) + " verliezen [MWh]", uI_Results.cm_consumptionColors.get(EC)); } } } @@ -1123,25 +1123,25 @@ else if( radio_energyType.getValue() == 2){ totalProductionWeekend_MWh += ECConsumptionWeekend_MWh; DataItem heatProductionWeekend = new DataItem(); heatProductionWeekend.setValue(ECConsumptionWeekend_MWh); - pl_productionChartWeekend.addDataItem(heatProductionWeekend, uI_Results.f_getName(EC) + " [MWh]", uI_Results.cm_consumptionColors.get(EC)); + pl_productionChartWeekend.addDataItem(heatProductionWeekend, uI_Results.f_getECName(EC) + " [MWh]", uI_Results.cm_consumptionColors.get(EC)); } if (lossesWeekend_MWh > uI_Results.p_cutOff_MWh ) { totalConsumptionWeekend_MWh += lossesWeekend_MWh; DataItem ECLossesWeekend = new DataItem(); ECLossesWeekend.setValue(lossesWeekend_MWh); - pl_consumptionChartWeekend.addDataItem(ECLossesWeekend, uI_Results.f_getName(EC) + " verliezen [MWh]", uI_Results.cm_consumptionColors.get(EC)); + pl_consumptionChartWeekend.addDataItem(ECLossesWeekend, uI_Results.f_getECName(EC) + " verliezen [MWh]", uI_Results.cm_consumptionColors.get(EC)); } if ( ECConsumptionWeekday_MWh > uI_Results.p_cutOff_MWh ) { totalProductionWeekday_MWh += ECConsumptionWeekday_MWh; DataItem heatProductionWeekday = new DataItem(); heatProductionWeekday.setValue(ECConsumptionWeekday_MWh); - pl_productionChartWeekday.addDataItem(heatProductionWeekday, uI_Results.f_getName(EC) + " [MWh]", uI_Results.cm_consumptionColors.get(EC)); + pl_productionChartWeekday.addDataItem(heatProductionWeekday, uI_Results.f_getECName(EC) + " [MWh]", uI_Results.cm_consumptionColors.get(EC)); } if (lossesWeekday_MWh > uI_Results.p_cutOff_MWh ) { totalConsumptionWeekday_MWh += lossesWeekday_MWh; DataItem ECLossesWeekday = new DataItem(); ECLossesWeekday.setValue(lossesWeekday_MWh); - pl_consumptionChartWeekday.addDataItem(ECLossesWeekday, uI_Results.f_getName(EC) + " verliezen [MWh]", uI_Results.cm_consumptionColors.get(EC)); + pl_consumptionChartWeekday.addDataItem(ECLossesWeekday, uI_Results.f_getECName(EC) + " verliezen [MWh]", uI_Results.cm_consumptionColors.get(EC)); } } } @@ -1264,14 +1264,14 @@ else if( radio_energyType.getValue() == 2){ if (dataObject.getRapidRunData().getTotalImport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem totalImport = new DataItem(); totalImport.setValue(dataObject.getRapidRunData().getTotalImport_MWh(EC)); - pl_consumptionChartBalanceTotal.addDataItem(totalImport, uI_Results.f_getName(EC) + " Import [MWh]", uI_Results.cm_consumptionColors.get(EC)); + pl_consumptionChartBalanceTotal.addDataItem(totalImport, uI_Results.f_getECName(EC) + " Import [MWh]", uI_Results.cm_consumptionColors.get(EC)); } } for (OL_EnergyCarriers EC : dataObject.getRapidRunData().activeProductionEnergyCarriers) { if (dataObject.getRapidRunData().getTotalExport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem totalExport = new DataItem(); totalExport.setValue(dataObject.getRapidRunData().getTotalExport_MWh(EC)); - pl_productionChartBalanceTotal.addDataItem(totalExport, uI_Results.f_getName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_productionChartBalanceTotal.addDataItem(totalExport, uI_Results.f_getECName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); } } @@ -1300,24 +1300,24 @@ else if( radio_energyType.getValue() == 2){ if (dataObject.getRapidRunData().am_summerWeekBalanceAccumulators_kW.get(EC).getIntegralPos_MWh() > uI_Results.p_cutOff_MWh) { DataItem summerImport = new DataItem(); summerImport.setValue(dataObject.getRapidRunData().am_summerWeekBalanceAccumulators_kW.get(EC).getIntegralPos_MWh()); - pl_consumptionChartSummer.addDataItem(summerImport, uI_Results.f_getName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_consumptionChartSummer.addDataItem(summerImport, uI_Results.f_getECName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); } if (dataObject.getRapidRunData().am_winterWeekBalanceAccumulators_kW.get(EC).getIntegralPos_MWh() > uI_Results.p_cutOff_MWh) { DataItem winterImport = new DataItem(); winterImport.setValue(dataObject.getRapidRunData().am_winterWeekBalanceAccumulators_kW.get(EC).getIntegralPos_MWh()); - pl_consumptionChartWinter.addDataItem(winterImport, uI_Results.f_getName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_consumptionChartWinter.addDataItem(winterImport, uI_Results.f_getECName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); } } for (OL_EnergyCarriers EC : dataObject.getRapidRunData().activeProductionEnergyCarriers) { if (-dataObject.getRapidRunData().am_summerWeekBalanceAccumulators_kW.get(EC).getIntegralNeg_MWh() > uI_Results.p_cutOff_MWh) { DataItem summerExport = new DataItem(); summerExport.setValue(-dataObject.getRapidRunData().am_summerWeekBalanceAccumulators_kW.get(EC).getIntegralNeg_MWh()); - pl_productionChartSummer.addDataItem(summerExport, uI_Results.f_getName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_productionChartSummer.addDataItem(summerExport, uI_Results.f_getECName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); } if (-dataObject.getRapidRunData().am_winterWeekBalanceAccumulators_kW.get(EC).getIntegralNeg_MWh() > uI_Results.p_cutOff_MWh) { DataItem winterExport = new DataItem(); winterExport.setValue(-dataObject.getRapidRunData().am_winterWeekBalanceAccumulators_kW.get(EC).getIntegralNeg_MWh()); - pl_productionChartWinter.addDataItem(winterExport, uI_Results.f_getName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_productionChartWinter.addDataItem(winterExport, uI_Results.f_getECName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); } } @@ -1355,24 +1355,24 @@ else if( radio_energyType.getValue() == 2){ if (dataObject.getRapidRunData().getDaytimeImport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem daytimeImport = new DataItem(); daytimeImport.setValue(dataObject.getRapidRunData().getDaytimeImport_MWh(EC)); - pl_consumptionChartDay.addDataItem(daytimeImport, uI_Results.f_getName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_consumptionChartDay.addDataItem(daytimeImport, uI_Results.f_getECName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); } if (dataObject.getRapidRunData().getNighttimeImport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem nighttimeImport = new DataItem(); nighttimeImport.setValue(dataObject.getRapidRunData().getNighttimeImport_MWh(EC)); - pl_consumptionChartNight.addDataItem(nighttimeImport, uI_Results.f_getName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_consumptionChartNight.addDataItem(nighttimeImport, uI_Results.f_getECName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); } } for (OL_EnergyCarriers EC : dataObject.getRapidRunData().activeProductionEnergyCarriers) { if (dataObject.getRapidRunData().getDaytimeExport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem daytimeExport = new DataItem(); daytimeExport.setValue(dataObject.getRapidRunData().getDaytimeExport_MWh(EC)); - pl_productionChartDay.addDataItem(daytimeExport, uI_Results.f_getName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_productionChartDay.addDataItem(daytimeExport, uI_Results.f_getECName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); } if (dataObject.getRapidRunData().getNighttimeExport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem nighttimeExport = new DataItem(); nighttimeExport.setValue(dataObject.getRapidRunData().getNighttimeExport_MWh(EC)); - pl_productionChartNight.addDataItem(nighttimeExport, uI_Results.f_getName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_productionChartNight.addDataItem(nighttimeExport, uI_Results.f_getECName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); } } @@ -1411,24 +1411,24 @@ else if( radio_energyType.getValue() == 2){ if (dataObject.getRapidRunData().getWeekdayImport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem weekdayImport = new DataItem(); weekdayImport.setValue(dataObject.getRapidRunData().getWeekdayImport_MWh(EC)); - pl_consumptionChartWeekday.addDataItem(weekdayImport, uI_Results.f_getName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_consumptionChartWeekday.addDataItem(weekdayImport, uI_Results.f_getECName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); } if (dataObject.getRapidRunData().getWeekendImport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem weekendImport = new DataItem(); weekendImport.setValue(dataObject.getRapidRunData().getWeekendImport_MWh(EC)); - pl_consumptionChartWeekend.addDataItem(weekendImport, uI_Results.f_getName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_consumptionChartWeekend.addDataItem(weekendImport, uI_Results.f_getECName(EC) + " Import [MWh]", uI_Results.cm_productionColors.get(EC)); } } for (OL_EnergyCarriers EC : dataObject.getRapidRunData().activeProductionEnergyCarriers) { if (dataObject.getRapidRunData().getWeekdayExport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem weekdayExport = new DataItem(); weekdayExport.setValue(dataObject.getRapidRunData().getWeekdayExport_MWh(EC)); - pl_productionChartWeekday.addDataItem(weekdayExport, uI_Results.f_getName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_productionChartWeekday.addDataItem(weekdayExport, uI_Results.f_getECName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); } if (dataObject.getRapidRunData().getWeekendExport_MWh(EC) > uI_Results.p_cutOff_MWh) { DataItem weekendExport = new DataItem(); weekendExport.setValue(dataObject.getRapidRunData().getWeekendExport_MWh(EC)); - pl_productionChartWeekend.addDataItem(weekendExport, uI_Results.f_getName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); + pl_productionChartWeekend.addDataItem(weekendExport, uI_Results.f_getECName(EC) + " Export [MWh]", uI_Results.cm_productionColors.get(EC)); } } diff --git a/_alp/Agents/ChartBatteries/Code/Functions.java b/_alp/Agents/ChartBatteries/Code/Functions.java index f78b7ba..2111b7b 100644 --- a/_alp/Agents/ChartBatteries/Code/Functions.java +++ b/_alp/Agents/ChartBatteries/Code/Functions.java @@ -142,11 +142,11 @@ public void action() { Color deliveryCapacityColor = uI_Results.v_electricityCapacityColor_estimated; Color feedinCapacityColor = uI_Results.v_electricityCapacityColor_estimated; -if(dataObject.getLiveData().connectionMetaData.contractedDeliveryCapacityKnown){ +if(dataObject.getLiveData().connectionMetaData.getContractedDeliveryCapacityKnown()){ deliveryCapacityLabel = "Piek leveringscapaciteit"; deliveryCapacityColor = uI_Results.v_electricityCapacityColor_known; } -if(dataObject.getLiveData().connectionMetaData.contractedFeedinCapacityKnown){ +if(dataObject.getLiveData().connectionMetaData.getContractedFeedinCapacityKnown()){ feedinCapacityLabel = "Piek terugleveringscapaciteit"; feedinCapacityColor = uI_Results.v_electricityCapacityColor_known; } @@ -270,11 +270,11 @@ String f_getDateTimeFromHour(double peakTime_h) Color deliveryCapacityColor = uI_Results.v_electricityCapacityColor_estimated; Color feedinCapacityColor = uI_Results.v_electricityCapacityColor_estimated; -if(dataObject.getRapidRunData().connectionMetaData.contractedDeliveryCapacityKnown){ +if(dataObject.getRapidRunData().connectionMetaData.getContractedDeliveryCapacityKnown()){ deliveryCapacityLabel = "Piek leveringscapaciteit"; deliveryCapacityColor = uI_Results.v_electricityCapacityColor_known; } -if(dataObject.getRapidRunData().connectionMetaData.contractedFeedinCapacityKnown){ +if(dataObject.getRapidRunData().connectionMetaData.getContractedFeedinCapacityKnown()){ feedinCapacityLabel = "Piek terugleveringscapaciteit"; feedinCapacityColor = uI_Results.v_electricityCapacityColor_known; } diff --git a/_alp/Agents/ChartCAPEXAndOPEX/AOC.ChartCAPEXAndOPEX.xml b/_alp/Agents/ChartCAPEXAndOPEX/AOC.ChartCAPEXAndOPEX.xml new file mode 100644 index 0000000..1753a5c --- /dev/null +++ b/_alp/Agents/ChartCAPEXAndOPEX/AOC.ChartCAPEXAndOPEX.xml @@ -0,0 +1,167 @@ + + + 1772440739218 + + 1755764711838 + + + digital_twin_results + ChartArea + + false + + 1772440739223 + + + + + Generic parameter: + + ENTITY + 100 + false + 100 + true + + -4144960 + null + + true + true + false + + + MPS + + + + METER + + + + METER + + + + METER + + + + false + + + SECOND + + CONTINUOUS + 500 + 500 + 0 + 100 + 100 + MOORE + USER_DEF + USER_DEF + 2 + 50 + 0.95 + 10 + + + true + 1772440739217 + true + 1772524800000 + + + HOUR + + + + HOUR + + + + 1772440739221 + + 0 + -150 + false + false + false + SHAPE_DRAW_2D3D + 100 + 0 + BASED_ON_LENGTH + 10 + METER + 10 + true + + 1772440739224 + 1772440739219 + + + + + 1772440739219 + + 50 + -50 + + false + true + true + false + COLLECTION_OF_LINKS + true + Object + SOLID + 1 + -16777216 + UNDER_AGENTS + NONE + END + + + + + 1772440739304 + + 50 + -100 + + false + true + true + + digital_twin_results + UI_Results + + + + + + 1772440739224 + + 0 + 0 + + true + true + false + SHAPE_DRAW_2D3D + 0 + DIM_NON_CURRENT + + + + diff --git a/_alp/Agents/ChartCAPEXAndOPEX/Code/Functions.java b/_alp/Agents/ChartCAPEXAndOPEX/Code/Functions.java new file mode 100644 index 0000000..7709d32 --- /dev/null +++ b/_alp/Agents/ChartCAPEXAndOPEX/Code/Functions.java @@ -0,0 +1,275 @@ +double f_setChartCAPEXAndOPEX() +{/*ALCODESTART::1772471794038*/ +I_EnergyData data = uI_Results.f_getSelectedObjectData(); + +//Set selected object display +uI_Results.f_setSelectedObjectDisplay(230, 60, true); + +//Reset chart +f_resetChart(); + + +////Get the netload values +f_initializeAssetSelectionButtons(data); + +//Set the actual values of the chart (while trying to maintain the previous selected EC) +String currentSelectedAssetReadableName = v_selectedAsset.equals(p_totalName) ? p_totalName : uI_Results.f_getAssetName(OL_EnergyAssetType.valueOf(v_selectedAsset)); +if (Arrays.asList(cb_assetSelection.getItems()).contains(currentSelectedAssetReadableName)) { + cb_assetSelection.setValue(currentSelectedAssetReadableName, true); +} +else{ + cb_assetSelection.setValue(p_totalName, true); +} + +/*ALCODEEND*/} + +double f_resetChart() +{/*ALCODESTART::1772472111433*/ +//Previous values +t_previousEstimatedLifeTime.setText("-"); +t_previousCAPEXTotal.setText("-"); +t_previousCAPEXPerYear.setText("-"); +t_previousOPEXTotal.setText("-"); +t_previousOPEXPerYear.setText("-"); +t_previousCAPEXAndOPEXTotal.setText("-"); +t_previousCAPEXAndOPEXPerYear.setText("-"); + +/*ALCODEEND*/} + +double f_getTotalCAPEXAndOPEXCosts_eurpyr(J_RapidRunData rapidRunData) +{/*ALCODESTART::1774272795145*/ +double totalCAPEXAndOPEXCosts_eur = 0; + +//Initialize variables +double CAPEX_eurpyr = 0; +double OPEX_eurpyr = 0; + +//Get only the assets that should be included in calculation +List selectedAssetList = new ArrayList<>(rapidRunData.assetsMetaData.getActiveAssets()); +selectedAssetList.retainAll(c_includeAssetSelection); //Only keep 'included' asset types + +for(OL_EnergyAssetType assetType : selectedAssetList){ + //Get economicAVGC values + double assetExpectedLifeTime_yr = uI_Results.energyModel.avgc_data.economicAVGC.getAvgAssetLifeTime_yr(assetType); + double assetBaseCAPEX_eur = uI_Results.energyModel.avgc_data.economicAVGC.getAvgAssetBaseCAPEX_eur(assetType); + double assetBaseOPEX_eurpyr = uI_Results.energyModel.avgc_data.economicAVGC.getAvgAssetBaseOPEX_eurpyr(assetType); + double assetSizeDependentCAPEX_eurpkW = uI_Results.energyModel.avgc_data.economicAVGC.getAvgAssetSizeDependentCAPEX_eurpkW(assetType); + double assetSizeDependentOPEX_eurpkWpyr = uI_Results.energyModel.avgc_data.economicAVGC.getAvgAssetSizeDependentOPEX_eurpkWpyr(assetType); + + //Get Current number of assets and their total capacity + double numberOfAssets = rapidRunData.assetsMetaData.getNumberOfActiveAssets(assetType); + double assetCapacity_kW = rapidRunData.assetsMetaData.getActiveAssetCapacity_kW(assetType); + + if(numberOfAssets > 0){ + CAPEX_eurpyr += (assetCapacity_kW * assetSizeDependentCAPEX_eurpkW + numberOfAssets*assetBaseCAPEX_eur)/ assetExpectedLifeTime_yr; + OPEX_eurpyr += assetCapacity_kW * assetSizeDependentOPEX_eurpkWpyr + numberOfAssets*assetBaseOPEX_eurpyr; + } +} + +//Return values +return CAPEX_eurpyr + OPEX_eurpyr; +/*ALCODEEND*/} + +double f_initializeAssetSelectionButtons(I_EnergyData data) +{/*ALCODESTART::1774277754383*/ +//Get energy carrier options (also previous run EC that are not in current). +Set assets = new HashSet<>(); + +assets.addAll(data.getRapidRunData().assetsMetaData.getActiveAssets()); +if(data.getPreviousRapidRunData() != null){ + assets.addAll(data.getPreviousRapidRunData().assetsMetaData.getActiveAssets()); +} + +//Activate all check box buttons initially, and select the ones that are selected according to the c_includeAssetSelection +map_assetToCheckBox.values().forEach(cb -> cb.setEnabled(true)); +for(OL_EnergyAssetType EAType : c_includeAssetSelection){ // Set all current 'includedAssetSelection' to 'checked', without calling action. + map_assetToCheckBox.get(EAType).setSelected(true, false); +} + +//EA type is not present: disable and deselect the checkbox (without calling action). +for(OL_EnergyAssetType EAType : c_defaultOrderAssets){ + if(!assets.contains(EAType)){ + map_assetToCheckBox.get(EAType).setEnabled(false); + map_assetToCheckBox.get(EAType).setSelected(false, false); + } +} + +//Only keep 'included' asset types for the drop down menu +assets.retainAll(c_includeAssetSelection); + +//Order the list to always have the same order in the drop down menu +List orderedAssets = new ArrayList<>(); +for(OL_EnergyAssetType EAType : c_defaultOrderAssets){ + if(assets.contains(EAType)){ + orderedAssets.add(EAType); + } +} + +//Convert to the readable combobox options +String[] comboBoxOptions = new String[orderedAssets.size() + 1]; +int i = 0; +for(OL_EnergyAssetType EAType : orderedAssets){ + comboBoxOptions[i] = uI_Results.f_getAssetName(EAType); + i++; +} +comboBoxOptions[i] = p_totalName; + +cb_assetSelection.setItems(comboBoxOptions); + +/*ALCODEEND*/} + +double f_setChartCAPEXAndOPEXValues() +{/*ALCODESTART::1774278746224*/ +I_EnergyData data = uI_Results.f_getSelectedObjectData(); + +//Reset chart +f_resetChart(); + +//Initialize variables +double lifeTime_yr = 0; +double CAPEX_eurpyr = 0; +double OPEX_eurpyr = 0; +Double previousLifeTime_yr = null; +Double previousCAPEX_eurpyr = null; +Double previousOPEX_eurpyr = null; + + +//Get selected List +List selectedAssetList; +if(v_selectedAsset.equals(p_totalName)){ + selectedAssetList = new ArrayList<>(data.getRapidRunData().assetsMetaData.getActiveAssets()); + selectedAssetList.retainAll(c_includeAssetSelection); //Only keep 'included' asset types +} +else{ + selectedAssetList = new ArrayList<>(List.of(OL_EnergyAssetType.valueOf(v_selectedAsset))); +} + +for(OL_EnergyAssetType assetType : selectedAssetList){ + //Get economicAVGC values + double assetExpectedLifeTime_yr = uI_Results.energyModel.avgc_data.economicAVGC.getAvgAssetLifeTime_yr(assetType); + double assetBaseCAPEX_eur = uI_Results.energyModel.avgc_data.economicAVGC.getAvgAssetBaseCAPEX_eur(assetType); + double assetBaseOPEX_eurpyr = uI_Results.energyModel.avgc_data.economicAVGC.getAvgAssetBaseOPEX_eurpyr(assetType); + double assetSizeDependentCAPEX_eurpkW = uI_Results.energyModel.avgc_data.economicAVGC.getAvgAssetSizeDependentCAPEX_eurpkW(assetType); + double assetSizeDependentOPEX_eurpkWpyr = uI_Results.energyModel.avgc_data.economicAVGC.getAvgAssetSizeDependentOPEX_eurpkWpyr(assetType); + + //Get Current number of assets and their total capacity + double numberOfAssets = data.getRapidRunData().assetsMetaData.getNumberOfActiveAssets(assetType); + double assetCapacity_kW = data.getRapidRunData().assetsMetaData.getActiveAssetCapacity_kW(assetType); + + //Calculate the values + if(numberOfAssets > 0){ + lifeTime_yr = assetExpectedLifeTime_yr; + CAPEX_eurpyr += (assetCapacity_kW * assetSizeDependentCAPEX_eurpkW + numberOfAssets*assetBaseCAPEX_eur)/ assetExpectedLifeTime_yr; + OPEX_eurpyr += assetCapacity_kW * assetSizeDependentOPEX_eurpkWpyr + numberOfAssets*assetBaseOPEX_eurpyr; + } + + //Get previous values, if previous rapid is available + if(data.getPreviousRapidRunData() != null){ + if(previousCAPEX_eurpyr == null){ + previousLifeTime_yr = 0.0; + previousCAPEX_eurpyr = 0.0; + previousOPEX_eurpyr = 0.0; + } + //Get previous number of assets and their total capacity + double previousNumberOfAssets = data.getPreviousRapidRunData().assetsMetaData.getNumberOfActiveAssets(assetType); + double previousAssetCapacity_kW = data.getPreviousRapidRunData().assetsMetaData.getActiveAssetCapacity_kW(assetType); + + if(previousNumberOfAssets > 0){ + previousLifeTime_yr = assetExpectedLifeTime_yr; + previousCAPEX_eurpyr += (previousAssetCapacity_kW * assetSizeDependentCAPEX_eurpkW + previousNumberOfAssets*assetBaseCAPEX_eur) / assetExpectedLifeTime_yr; + previousOPEX_eurpyr += previousAssetCapacity_kW * assetSizeDependentOPEX_eurpkWpyr + previousNumberOfAssets*assetBaseOPEX_eurpyr; + } + } +} + +// For 'total' capex and opex (so multiple assets), the default life time is set to 20, so all calculations are done with the same length +if(v_selectedAsset.equals(p_totalName)){ + lifeTime_yr = 20; + if(data.getPreviousRapidRunData() != null){ + previousLifeTime_yr = 20.0; + } +} + +//Set KPIs in chart +f_setYearlyKPIs(lifeTime_yr, CAPEX_eurpyr, OPEX_eurpyr, previousLifeTime_yr, previousCAPEX_eurpyr, previousOPEX_eurpyr); + +/*ALCODEEND*/} + +double f_setYearlyKPIs(double lifeTime_yr,double CAPEX_eurpyr,double OPEX_eurpyr,Double previousLifeTime_yr,Double previousCAPEX_eurpyr,Double previousOPEX_eurpyr) +{/*ALCODESTART::1774279941226*/ +//Set new values text +DecimalFormat df = new DecimalFormat("#,##0.00"); + +double CAPEXLifeTimeTotal_eur = CAPEX_eurpyr * lifeTime_yr; +double OPEXLifeTimeTotal_eur = OPEX_eurpyr * lifeTime_yr; +double CAPEXAndOPEXLifeTimeTotal_eur = CAPEXLifeTimeTotal_eur + OPEXLifeTimeTotal_eur; +double CAPEXAndOPEX_eurpyr = CAPEX_eurpyr + OPEX_eurpyr; + +//Set chart texts +t_estimatedLifeTime.setText(roundToDecimal(lifeTime_yr, 2) + " jaar"); +t_CAPEXTotal.setText("€ " + df.format(CAPEXLifeTimeTotal_eur)); +t_CAPEXPerYear.setText("€ " + df.format(CAPEX_eurpyr)); +t_OPEXTotal.setText("€ " + df.format(OPEXLifeTimeTotal_eur)); +t_OPEXPerYear.setText("€ " + df.format(OPEX_eurpyr)); +t_CAPEXAndOPEXTotal.setText("€ " + df.format(CAPEXAndOPEXLifeTimeTotal_eur)); +t_CAPEXAndOPEXPerYear.setText("€ " + df.format(CAPEXAndOPEX_eurpyr)); + +//If previous values are known, set them as well +if(previousCAPEX_eurpyr != null){ + + double previousCAPEXLifeTimeTotal_eur = CAPEX_eurpyr * lifeTime_yr; + double previousOPEXLifeTimeTotal_eur = OPEX_eurpyr * lifeTime_yr; + double previousCAPEXAndOPEXLifeTimeTotal_eur = CAPEXLifeTimeTotal_eur + OPEXLifeTimeTotal_eur; + double previousCAPEXAndOPEX_eurpyr = CAPEX_eurpyr + OPEX_eurpyr; + + t_previousEstimatedLifeTime.setText(roundToDecimal(previousLifeTime_yr, 2) + " jaar"); + t_previousCAPEXTotal.setText("€ " + df.format(previousCAPEXLifeTimeTotal_eur)); + t_previousCAPEXPerYear.setText("€ " + df.format(previousCAPEX_eurpyr)); + t_previousOPEXTotal.setText("€ " + df.format(previousOPEXLifeTimeTotal_eur)); + t_previousOPEXPerYear.setText("€ " + df.format(previousOPEX_eurpyr)); + t_previousCAPEXAndOPEXTotal.setText("€ " + df.format(previousCAPEXAndOPEXLifeTimeTotal_eur)); + t_previousCAPEXAndOPEXPerYear.setText("€ " + df.format(previousCAPEXAndOPEX_eurpyr)); +} + /* + ////Set arrows + //Import + if(previousTotalImportCosts_eur > totalImportCosts_eur){ + arrow_down_green_import.setVisible(true); + } + else if(totalImportCosts_eur > previousTotalImportCosts_eur){ + arrow_up_red_import.setVisible(true); + } + else{ + line_import.setVisible(true); + } + + //Export + if(previousTotalExportRevenue_eur > totalExportRevenue_eur){ + arrow_down_red_export.setVisible(true); + } + else if(totalExportRevenue_eur > previousTotalExportRevenue_eur){ + arrow_up_green_export.setVisible(true); + } + else{ + line_export.setVisible(true); + } + + //Net + if(previousTotalNetElectricityCosts_eur > totalNetElectricityCosts_eur){ + arrow_down_green_netEnergy.setVisible(true); + } + else if(totalNetElectricityCosts_eur > previousTotalNetElectricityCosts_eur){ + arrow_up_red_netEnergy.setVisible(true); + } + else{ + line_total.setVisible(true); + } +} +else{ // No previous rapid data -> dont show previous values + //t_previousTotalImportCosts_eur.setText("-"); + //t_previousTotalExportRevenue_eur.setText("-"); + //t_previousTotalNetEnergyCosts_eur.setText("-"); +} +*/ +/*ALCODEEND*/} + diff --git a/_alp/Agents/ChartCAPEXAndOPEX/Code/Functions.xml b/_alp/Agents/ChartCAPEXAndOPEX/Code/Functions.xml new file mode 100644 index 0000000..cf9c13f --- /dev/null +++ b/_alp/Agents/ChartCAPEXAndOPEX/Code/Functions.xml @@ -0,0 +1,131 @@ + + + + VOID + double + 1772471794038 + + -350 + 320 + + false + true + true + + + + VOID + double + 1772472111433 + + -330 + 385 + + false + true + true + + + + RETURNS_VALUE + double + 1774272795145 + + -380 + 570 + + false + true + true + + + + + + + + VOID + double + 1774277754383 + + -330 + 340 + + false + true + true + + + + + + + + VOID + double + 1774278746224 + + -330 + 410 + + false + true + true + + + + VOID + double + 1774279941226 + + -320 + 440 + + false + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/_alp/Agents/ChartCAPEXAndOPEX/Levels/Level.level.xml b/_alp/Agents/ChartCAPEXAndOPEX/Levels/Level.level.xml new file mode 100644 index 0000000..a001b6a --- /dev/null +++ b/_alp/Agents/ChartCAPEXAndOPEX/Levels/Level.level.xml @@ -0,0 +1,1432 @@ + + + + 1772468475036 + + 0 + 0 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 10 + 1 + v_lineWidth + -1644806 + v_lineColor + null + SOLID + 460 + 50 + 0.0 + -657931 + null + + + 1772468475044 + + 230 + 10 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 26 + + + CENTER + + + 1772468475051 + + 340 + 10 + + true + true + false + SHAPE_DRAW_2D3D + uI_Results.f_setInfoText(i_chartCAPEXAndOPEX, uI_Results.v_infoText.chartCAPEXAndOPEX, i_chartCAPEXAndOPEX.getX(), i_chartCAPEXAndOPEX.getY()); + false + 0 + 30 + 30 + 0.0 + + + digital_twin_results + icon_i.png + + + false + + + 1774274933037 + + 230 + 140 + + true + true + false + SHAPE_DRAW_2D3D + gr_includeAssetSelection.setVisible(!gr_includeAssetSelection.isVisible()); + false + 0 + 0.0 + + + 1774274815595 + + -210 + -20 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 10 + 2 + -4144960 + null + SOLID + 420 + 40 + 0.0 + -1 + null + + + 1774274901790 + + 0 + -6 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 12 + + + CENTER + + + + + 1774279482488 + + 40 + 320 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + LEFT + + + 1774279520448 + + 40 + 450 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + LEFT + + + 1774279551846 + + 30 + 570 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 10 + 1 + -16777216 + null + SOLID + 1 + 0 + 1 + 0 + 400 + 0 + 0 + + + 1774279565069 + + 40 + 600 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + LEFT + + + 1774279577198 + + 40 + 670 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + LEFT + + + 1774279624285 + + 40 + 250 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + v_selectedAsset.equals(p_totalName) ? "Berekend voor levensduur van:" : "Verwachte levensduur:" + + + 20 + + + LEFT + + + 1774279703212 + + 40 + 510 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + LEFT + + + 1774279727414 + + 40 + 380 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + LEFT + + + 1774279745383 + + 420 + 250 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + RIGHT + + + 1774279770694 + + 420 + 320 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + RIGHT + + + 1774279770696 + + 420 + 450 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + RIGHT + + + 1774279770698 + + 420 + 600 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + RIGHT + + + 1774279770700 + + 420 + 670 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + RIGHT + + + 1774279770702 + + 420 + 510 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + RIGHT + + + 1774279770704 + + 420 + 380 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + RIGHT + + + 1774349289328 + + 419.5 + 279.5 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 16 + + + RIGHT + + + 1774349289330 + + 419.5 + 349.5 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 16 + + + RIGHT + + + 1774349289332 + + 419.5 + 479.5 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 16 + + + RIGHT + + + 1774349289334 + + 419.5 + 629.5 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 16 + + + RIGHT + + + 1774349289336 + + 419.5 + 699.5 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 16 + + + RIGHT + + + 1774349289338 + + 419.5 + 539.5 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 16 + + + RIGHT + + + 1774349289340 + + 419.5 + 409.5 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 16 + + + RIGHT + + + 1775484196004 + + 240 + 190 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 0.0 + + + 1774275052619 + + -170 + -10 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 18 + + + LEFT + + + false + 1774275817350 + + 10 + -10 + + true + true + false + SHAPE_DRAW_2D3D + + false + -1 + -16777216 + true + if(cb_assetSelection.getValue().equals(p_totalName)){ + v_selectedAsset = p_totalName; +} +else{ + for(OL_EnergyAssetType EAType : c_defaultOrderAssets){ + if(cb_assetSelection.getValue().equals(uI_Results.f_getAssetName(EAType))){ + v_selectedAsset = EAType.toString(); + } + } +} + +f_setChartCAPEXAndOPEXValues(); + + + + false + false + + + + + + 1774273793456 + + 800 + 230 + + true + false + false + SHAPE_DRAW_2D3D + 220 + 260 + false + 0 + 0.0 + + + 1774273147199 + + -200 + -140 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 10 + 2 + -16777216 + null + SOLID + 420 + 280 + 0.0 + -1 + null + + + false + 1774273189896 + + -140 + -40 + + true + true + false + SHAPE_DRAW_2D3D + + false + -16777216 + true + if(!cb_includeAssetBattery.isSelected()){ + c_includeAssetSelection.remove(OL_EnergyAssetType.STORAGE_ELECTRIC); +} +else{ + c_includeAssetSelection.add(OL_EnergyAssetType.STORAGE_ELECTRIC); +} + +f_setChartCAPEXAndOPEX(); + + + + Batterij + true + false + + + + 1774273234807 + + 10 + -120 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 16 + + + CENTER + + + 1774273298292 + + -120 + -70 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + LEFT + + + false + 1774273353293 + + 40 + -20 + + true + true + false + SHAPE_DRAW_2D3D + + false + -16777216 + true + if(!cb_includeAssetECar.isSelected()){ + c_includeAssetSelection.remove(OL_EnergyAssetType.ELECTRIC_VEHICLE); +} +else{ + c_includeAssetSelection.add(OL_EnergyAssetType.ELECTRIC_VEHICLE); +} + +f_setChartCAPEXAndOPEX(); + + + + Elektrische Auto's + true + false + + + + false + 1774273354856 + + 40 + 0 + + true + true + false + SHAPE_DRAW_2D3D + + false + -16777216 + true + if(!cb_includeAssetEVan.isSelected()){ + c_includeAssetSelection.remove(OL_EnergyAssetType.ELECTRIC_VAN); +} +else{ + c_includeAssetSelection.add(OL_EnergyAssetType.ELECTRIC_VAN); +} + +f_setChartCAPEXAndOPEX(); + + + + Elektrische busjes + true + false + + + + false + 1774273355972 + + 40 + 20 + + true + true + false + SHAPE_DRAW_2D3D + + false + -16777216 + true + if(!cb_includeAssetETruck.isSelected()){ + c_includeAssetSelection.remove(OL_EnergyAssetType.ELECTRIC_TRUCK); +} +else{ + c_includeAssetSelection.add(OL_EnergyAssetType.ELECTRIC_TRUCK); +} + +f_setChartCAPEXAndOPEX(); + + + + Elektrische Trucks + true + false + + + + false + 1774273356806 + + -140 + 0 + + true + true + false + SHAPE_DRAW_2D3D + + false + -16777216 + true + if(!cb_includeAssetHeatpump.isSelected()){ + c_includeAssetSelection.remove(OL_EnergyAssetType.HEAT_PUMP_AIR); +} +else{ + c_includeAssetSelection.add(OL_EnergyAssetType.HEAT_PUMP_AIR); +} + +f_setChartCAPEXAndOPEX(); + + + + Warmtepompen + true + false + + + + false + 1774273357454 + + 40 + -40 + + true + true + false + SHAPE_DRAW_2D3D + + false + -16777216 + true + if(!cb_includeAssetGasburner.isSelected()){ + c_includeAssetSelection.remove(OL_EnergyAssetType.GAS_BURNER); +} +else{ + c_includeAssetSelection.add(OL_EnergyAssetType.GAS_BURNER); +} + +f_setChartCAPEXAndOPEX(); + + + + Gasbranders + true + false + + + + false + 1774273358199 + + -140 + 60 + + true + true + false + SHAPE_DRAW_2D3D + + false + -16777216 + true + if(!cb_includeAssetElectrolyser.isSelected()){ + c_includeAssetSelection.remove(OL_EnergyAssetType.ELECTROLYSER); +} +else{ + c_includeAssetSelection.add(OL_EnergyAssetType.ELECTROLYSER); +} + +f_setChartCAPEXAndOPEX(); + + + + Waterstof Electrolyser + true + false + + + + false + 1774273358959 + + -140 + 80 + + true + true + false + SHAPE_DRAW_2D3D + + false + -16777216 + true + if(!cb_includeAssetDieselGenerator.isSelected()){ + c_includeAssetSelection.remove(OL_EnergyAssetType.DIESEL_GENERATOR); +} +else{ + c_includeAssetSelection.add(OL_EnergyAssetType.DIESEL_GENERATOR); +} + +f_setChartCAPEXAndOPEX(); + + + + Diesel generator + true + false + + + + false + 1774273359721 + + -140 + 100 + + true + true + false + SHAPE_DRAW_2D3D + + false + -16777216 + true + if(!cb_includeAssetGasGenerator.isSelected()){ + c_includeAssetSelection.remove(OL_EnergyAssetType.METHANE_GENERATOR); +} +else{ + c_includeAssetSelection.add(OL_EnergyAssetType.METHANE_GENERATOR); +} + +f_setChartCAPEXAndOPEX(); + + + + Gas generator + true + false + + + + false + 1774273528010 + + -140 + -20 + + true + true + false + SHAPE_DRAW_2D3D + + false + -16777216 + true + if(!cb_includeAssetPV.isSelected()){ + c_includeAssetSelection.remove(OL_EnergyAssetType.PHOTOVOLTAIC); +} +else{ + c_includeAssetSelection.add(OL_EnergyAssetType.PHOTOVOLTAIC); +} + +f_setChartCAPEXAndOPEX(); + + + + Zonnepanelen + true + false + + + + false + 1774273544465 + + -140 + 40 + + true + true + false + SHAPE_DRAW_2D3D + + false + -16777216 + true + if(!cb_includeAssetWindTurbine.isSelected()){ + c_includeAssetSelection.remove(OL_EnergyAssetType.WINDMILL); +} +else{ + c_includeAssetSelection.add(OL_EnergyAssetType.WINDMILL); +} + +f_setChartCAPEXAndOPEX(); + + + + Windturbine + true + false + + + + false + 1774273592097 + + 40 + 40 + + true + true + false + SHAPE_DRAW_2D3D + + false + -16777216 + true + if(!cb_includeAssetH2Truck.isSelected()){ + c_includeAssetSelection.remove(OL_EnergyAssetType.HYDROGEN_TRUCK); +} +else{ + c_includeAssetSelection.add(OL_EnergyAssetType.HYDROGEN_TRUCK); +} + +f_setChartCAPEXAndOPEX(); + + + + Waterstof Trucks + true + false + + + + false + 1774273949963 + + -140 + 20 + + true + true + false + SHAPE_DRAW_2D3D + + false + -16777216 + true + if(!cb_includeAssetPT.isSelected()){ + c_includeAssetSelection.remove(OL_EnergyAssetType.PHOTOTHERMAL); +} +else{ + c_includeAssetSelection.add(OL_EnergyAssetType.PHOTOTHERMAL); +} + +f_setChartCAPEXAndOPEX(); + + + + PT-panelen + true + false + + + + 1774277682326 + + 200 + -115 + + true + true + false + SHAPE_DRAW_2D3D + gr_includeAssetSelection.setVisible(false); + false + 0 + 0.0 + + + 1774277602566 + + -15 + -15 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 10 + 1 + -4144960 + null + SOLID + 25 + 25 + 0.0 + -1 + null + + + 1774277636688 + + -10 + 5 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 10 + 1 + -4144960 + null + SOLID + 1 + 0 + 1 + 0 + 15 + -15 + 0 + + + 1774277652088 + + 5 + 5 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 10 + 1 + -4144960 + null + SOLID + 1 + 0 + 1 + 0 + -15 + -15 + 0 + + + + + + diff --git a/_alp/Agents/ChartCAPEXAndOPEX/Variables.xml b/_alp/Agents/ChartCAPEXAndOPEX/Variables.xml new file mode 100644 index 0000000..8857f1d --- /dev/null +++ b/_alp/Agents/ChartCAPEXAndOPEX/Variables.xml @@ -0,0 +1,165 @@ + + + + 1774278680763 + + -320 + 530 + + false + true + true + + + + + + + + + 1774278474541 + + -320 + 490 + + false + true + true + + + NONE + false + + + + + 1774278474539 + TEXT_BOX + 0 + 100 + NO_DELIMETER + + + + + 1775483709934 + + 620 + 440 + + false + true + true + + ]]> + NONE + false + + + + + 1775483709932 + TEXT_BOX + 0 + 100 + NO_DELIMETER + + + + + 1774273657533 + + 620 + 400 + + false + true + true + + ArrayList + OL_EnergyAssetType + String + + + + + + + 1774277969332 + + -320 + 360 + + false + true + true + + ArrayList + OL_EnergyAssetType + String + + + + + + diff --git a/_alp/Agents/ChartCO2/AOC.ChartCO2.xml b/_alp/Agents/ChartCO2/AOC.ChartCO2.xml new file mode 100644 index 0000000..40f9160 --- /dev/null +++ b/_alp/Agents/ChartCO2/AOC.ChartCO2.xml @@ -0,0 +1,168 @@ + + + 1772440782731 + + 1755764711838 + + + digital_twin_results + ChartArea + + false + + 1772440782736 + + + + + Generic parameter: + + ENTITY + 100 + false + 100 + true + + -4144960 + null + + true + true + false + + + MPS + + + + METER + + + + METER + + + + METER + + + + false + + + SECOND + + CONTINUOUS + 500 + 500 + 0 + 100 + 100 + MOORE + USER_DEF + USER_DEF + 2 + 50 + 0.95 + 10 + + + true + 1772440782730 + true + 1772524800000 + + + HOUR + + + + HOUR + + + + 1772440782734 + + 0 + -150 + false + false + false + SHAPE_DRAW_2D3D + 100 + 0 + BASED_ON_LENGTH + 10 + METER + 10 + true + + 1772440782737 + 1772440782732 + + + + + 1772440782732 + + 50 + -50 + + false + true + true + false + COLLECTION_OF_LINKS + true + Object + SOLID + 1 + -16777216 + UNDER_AGENTS + NONE + END + + + + + 1772440782761 + + 50 + -100 + + false + true + true + + digital_twin_results + UI_Results + + + + + + 1772440782737 + + 0 + 0 + + true + true + false + SHAPE_DRAW_2D3D + 0 + DIM_NON_CURRENT + + + + diff --git a/_alp/Agents/ChartCO2/Code/Functions.java b/_alp/Agents/ChartCO2/Code/Functions.java new file mode 100644 index 0000000..dd0730e --- /dev/null +++ b/_alp/Agents/ChartCO2/Code/Functions.java @@ -0,0 +1,347 @@ +double f_setYearlyKPIs(Double totalCO2Emission_kg,Double previousTotalCO2Emission_kg) +{/*ALCODESTART::1772441389069*/ +//Set new values text +DecimalFormat df = new DecimalFormat("0.00"); + +t_totalCO2Emission_kg.setText(df.format(totalCO2Emission_kg/1000.0) + " ton"); + +if(previousTotalCO2Emission_kg != null){ + t_previousTotalCO2Emission_kg.setText(df.format(previousTotalCO2Emission_kg/1000.0) + " ton"); + + ////Set arrows + if(previousTotalCO2Emission_kg > totalCO2Emission_kg){ + arrow_down_green_CO2Emission.setVisible(true); + } + else if(totalCO2Emission_kg > previousTotalCO2Emission_kg){ + arrow_up_red_CO2Emission.setVisible(true); + } + else{ + line_CO2Emission.setVisible(true); + } +} +else{ // No previous rapid data -> dont show previous values + t_previousTotalCO2Emission_kg.setText("-"); +} +/*ALCODEEND*/} + +double f_styleBackground_override(Color backgroundColor,Color lineColor,Double lineWidth,LineStyle lineStyle) +{/*ALCODESTART::1772441389071*/ +//Function used to style the background of the graphs + +v_backgroundColor = v_backgroundColor_override; + +if(lineColor != null){ + v_lineColor = lineColor; +} + +if(lineWidth != null){ + v_lineWidth = lineWidth; +} +if(lineStyle != null){ + v_lineStyle = lineStyle; +} +/*ALCODEEND*/} + +double f_resetChart() +{/*ALCODESTART::1772441389073*/ +//Reset all arrow visibility +arrow_down_green_CO2Emission.setVisible(false); +arrow_up_red_CO2Emission.setVisible(false); +line_CO2Emission.setVisible(false); + +//Reset KPIS +t_totalCO2Emission_kg.setText("-"); +t_previousTotalCO2Emission_kg.setText("-"); + +//Clear monthly chart +bar_CO2EmissionMonthly.removeAll(); +gr_monthlyCO2EmissionCharts.setVisible(false); + +//Clear pie chart +pieChart_totalSubdivision.removeAll(); +gr_subChart_totalSubdivision.setVisible(false); +/*ALCODEEND*/} + +double f_setMonthlyChart(double[] monthlyCO2Emission_kg) +{/*ALCODESTART::1772441389081*/ +DataSet netCosts_eur = new DataSet(12); + +double maxChartValue_eur = 0; + +for (int i = 0; i < 12; i++) { + //Import cost + DataItem CO2Emission_kg = new DataItem(); + CO2Emission_kg.setValue(monthlyCO2Emission_kg[i]/1000.0); + bar_CO2EmissionMonthly.addDataItem(CO2Emission_kg, c_monthsOfTheYear.get(i), uI_Results.v_electricityDemandColor); + + maxChartValue_eur = max(maxChartValue_eur, monthlyCO2Emission_kg[i]/1000.0); +} + +//Set fixed scale +maxChartValue_eur *=1.2; +bar_CO2EmissionMonthly.setFixedScale(0, maxChartValue_eur); +gr_monthlyCO2EmissionCharts.setVisible(true); +/*ALCODEEND*/} + +double[] f_calculateMonthlyECCO2Emission_kg(double[] ECBalance_kW,double signalResolution_h,OL_EnergyCarriers EC) +{/*ALCODESTART::1772643915089*/ +double[] startHourPerMonth = uI_Results.energyModel.p_timeParameters.getMonthStartHours(); +double timeStep_h = uI_Results.energyModel.p_timeParameters.getTimeStep_h(); + +double energyCarrierCO2Emission_kg_p_kWh = uI_Results.energyModel.avgc_data.map_avgLifeCycleCO2EmissionOfEnergyCarrier_kgpkWh.get(EC); + +double[] monthlyElectricityImportCO2Emission_kg = new double[12]; + + +int hoursInYear = 8760; +double modelStartTime_h = uI_Results.energyModel.p_timeParameters.getRunStartTime_h(); +int currentMonth = 11; +for(int i = 0; i< 11;i++){ + if(startHourPerMonth[i+1]>= modelStartTime_h){ + currentMonth = i; + break; + } +} +for (int i = 0; i < ECBalance_kW.length; i++) { + if(currentMonth == 11){ + if ((i*signalResolution_h + modelStartTime_h) > hoursInYear){ + currentMonth = 0; + } + } + else if(startHourPerMonth[currentMonth+1] < (i*signalResolution_h + modelStartTime_h) % hoursInYear){ + currentMonth += 1; + } + + double currentECImport_kW = max(0, ECBalance_kW[i]); + if(currentECImport_kW == 0){ + continue; + } + + if(EC == OL_EnergyCarriers.ELECTRICITY){ + energyCarrierCO2Emission_kg_p_kWh = uI_Results.energyModel.pp_CO2EmissionFactorElectricityImport_kgpkWh.getValue((i*signalResolution_h + modelStartTime_h) % hoursInYear); + } + + double timestepCO2Emission_kg = energyCarrierCO2Emission_kg_p_kWh * currentECImport_kW * signalResolution_h; + + monthlyElectricityImportCO2Emission_kg[currentMonth] += timestepCO2Emission_kg; +} + +return monthlyElectricityImportCO2Emission_kg; +/*ALCODEEND*/} + +double f_setCustomCO2Map(Map> customCO2AdditionsMap) +{/*ALCODESTART::1774608778627*/ +map_customCO2Additions_kg = customCO2AdditionsMap; +/*ALCODEEND*/} + +double f_setChartCO2() +{/*ALCODESTART::1774618389588*/ +//Initialization of data object. +I_EnergyData data = uI_Results.f_getSelectedObjectData(); + +//Set selected object display +uI_Results.f_setSelectedObjectDisplay(230, 60, true); + +//Initialize the EnergyCarrier selection ComboBox +f_initializeECSelectionComboBox(data); + +//Set support chart defauls as monthly +v_selectedSupportChart = "Monthly"; + +//Set the actual values of the chart (while trying to maintain the previous selected EC) +String currentSelectedECReadableName = v_selectedEnergyCarrier.equals(p_totalName) ? p_totalName : uI_Results.f_getECName(OL_EnergyCarriers.valueOf(v_selectedEnergyCarrier)); +if (Arrays.asList(cb_energyCarrierSelection.getItems()).contains(currentSelectedECReadableName)) { + cb_energyCarrierSelection.setValue(currentSelectedECReadableName, true); +} +else{ + cb_energyCarrierSelection.setValue(uI_Results.f_getECName(OL_EnergyCarriers.ELECTRICITY), true); +} +/*ALCODEEND*/} + +double f_setChartCO2Values() +{/*ALCODESTART::1774618389602*/ +I_EnergyData data = uI_Results.f_getSelectedObjectData(); + +//Reset chart +f_resetChart(); + + +//Get selected List +List selectedECList; +if(v_selectedEnergyCarrier.equals(p_totalName)){ + if(uI_Results.v_selectedObjectScope == OL_ResultScope.GRIDNODE){ + selectedECList = new ArrayList<>(List.of(uI_Results.v_gridNode.p_energyCarrier)); + } + else{ + selectedECList = new ArrayList<>(data.getRapidRunData().activeConsumptionEnergyCarriers); + } +} +else{ + selectedECList = new ArrayList<>(List.of(OL_EnergyCarriers.valueOf(v_selectedEnergyCarrier))); +} + + +double[] monthlyCO2Emissions_kg = new double[12]; +Map map_monthlyCO2EmissionsPerEC_kg = new HashMap<>(); + +for(OL_EnergyCarriers EC : selectedECList){ + //Get the ECBalance values + double[] ECBalance_kW; + double signalResolution_h; + if(uI_Results.v_selectedObjectScope == OL_ResultScope.GRIDNODE){ + if(EC == OL_EnergyCarriers.ELECTRICITY){ + ECBalance_kW = uI_Results.v_gridNode.acc_annualElectricityBalance_kW.getTimeSeries_kW(); + signalResolution_h = uI_Results.v_gridNode.acc_annualElectricityBalance_kW.getSignalResolution_h(); + } + else{ //if(EC == OL_EnergyCarriers.HEAT){ + ECBalance_kW = uI_Results.v_gridNode.acc_annualHeatBalance_kW.getTimeSeries_kW(); + signalResolution_h = uI_Results.v_gridNode.acc_annualHeatBalance_kW.getSignalResolution_h(); + } + } + else{ + if(EC == OL_EnergyCarriers.HEAT && !data.getRapidRunData().assetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.districtHeatDelivery_kW)){ + continue; + } + ECBalance_kW = data.getRapidRunData().am_totalBalanceAccumulators_kW.get(EC).getTimeSeries_kW(); + signalResolution_h = data.getRapidRunData().am_totalBalanceAccumulators_kW.get(EC).getSignalResolution_h(); + } + + //Calculate values + double[] monthlyECCO2Emissions_kg = f_calculateMonthlyECCO2Emission_kg(ECBalance_kW, signalResolution_h, EC); + + //Save totals also per EC + map_monthlyCO2EmissionsPerEC_kg.put(EC, monthlyECCO2Emissions_kg); + + //Add values of this EC to the total + for(int i = 0; i < 12; i++){ + monthlyCO2Emissions_kg[i] += monthlyECCO2Emissions_kg[i]; + } +} + +//Calculate total CO2 emissions due EC import +double totalCO2Emissions_kg = ZeroMath.arraySum(monthlyCO2Emissions_kg); + + +//Add custom co2 additions +if(map_customCO2Additions_kg != null && map_customCO2Additions_kg.size()>0 && data instanceof EnergyModel){ + totalCO2Emissions_kg += sum(map_customCO2Additions_kg.values(), value -> max(0, value.getFirst().doubleValue())); +} + + +//Previous values +Double previoustotalCO2Emissions_kg = null; + +if(data.getPreviousRapidRunData() != null){ + //It is possible that previous rapid run has other set of EC than current rapid run, so list needs to be recreated. + List selectedECList_previousRapidRun =new ArrayList<>(); + if(v_selectedEnergyCarrier.equals("Totaal")){ + selectedECList_previousRapidRun.addAll(data.getPreviousRapidRunData().activeEnergyCarriers); + } + else if(data.getPreviousRapidRunData().activeEnergyCarriers.contains(selectedECList.get(0))){ + selectedECList_previousRapidRun = selectedECList; + } + //Initialize previous values with 0. (Even if selectedECList_previousRapidRun remains empty due to diff in EC between rapid runs this makes sense!) + previoustotalCO2Emissions_kg = 0.0; + + for(OL_EnergyCarriers EC : selectedECList_previousRapidRun){ + if(EC == OL_EnergyCarriers.HEAT && !data.getPreviousRapidRunData().assetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.districtHeatDelivery_kW)){ + continue; + } + + double[] previousECBalance_kW = data.getPreviousRapidRunData().am_totalBalanceAccumulators_kW.get(EC).getTimeSeries_kW(); + double previousSignalResolution_h = data.getPreviousRapidRunData().am_totalBalanceAccumulators_kW.get(EC).getSignalResolution_h(); + + double[] previousMonthlyECCO2Emissions_kg = f_calculateMonthlyECCO2Emission_kg(previousECBalance_kW, previousSignalResolution_h, EC); + + previoustotalCO2Emissions_kg += ZeroMath.arraySum(previousMonthlyECCO2Emissions_kg); + } + + //Add custom co2 additions previous run to previous total + if(map_customCO2Additions_previous_kg != null && map_customCO2Additions_previous_kg.size()>0 && data instanceof EnergyModel){ + previoustotalCO2Emissions_kg += sum(map_customCO2Additions_previous_kg.values(), value -> max(0, value.getFirst().doubleValue())); + } +} + +//Set yearly kpis +f_setYearlyKPIs(totalCO2Emissions_kg, previoustotalCO2Emissions_kg); + +//Set sub chart +if(uI_Results.energyModel.p_timeParameters.getRunDuration_h() >= 8760 && v_selectedSupportChart.equals("Monthly")){ + f_setMonthlyChart(monthlyCO2Emissions_kg); +} +else if(v_selectedEnergyCarrier.equals(p_totalName)){ + f_setPieChart(map_monthlyCO2EmissionsPerEC_kg, data); +} + +/*ALCODEEND*/} + +double f_initializeECSelectionComboBox(I_EnergyData data) +{/*ALCODESTART::1774618389606*/ +//Get energy carrier options (also previous run EC that are not in current). +Set energyCarriers = new HashSet<>(); +if(uI_Results.v_selectedObjectScope == OL_ResultScope.GRIDNODE){ + energyCarriers.add(uI_Results.v_gridNode.p_energyCarrier); +} +else{ + energyCarriers.addAll(data.getRapidRunData().activeConsumptionEnergyCarriers); + boolean hasHadDistrictHeating = data.getRapidRunData().assetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.districtHeatDelivery_kW); + + if(data.getPreviousRapidRunData() != null){ + energyCarriers.addAll(data.getPreviousRapidRunData().activeConsumptionEnergyCarriers); + if(!hasHadDistrictHeating){ + hasHadDistrictHeating = data.getPreviousRapidRunData().assetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.districtHeatDelivery_kW); + } + } + + if(energyCarriers.contains(OL_EnergyCarriers.HEAT) && !hasHadDistrictHeating){ + energyCarriers.remove(OL_EnergyCarriers.HEAT); + } +} + +//Order the list to always have the same order +List orderedEnergyCarriers = new ArrayList<>(); +for(OL_EnergyCarriers EC : c_defaultOrderEC){ + if(energyCarriers.contains(EC)){ + orderedEnergyCarriers.add(EC); + } +} + + +//Convert to the readable combobox options +String[] comboBoxOptions = new String[orderedEnergyCarriers.size() + 1]; +int i = 0; +for(OL_EnergyCarriers EC : orderedEnergyCarriers){ + comboBoxOptions[i] = uI_Results.f_getECName(EC); + i++; +} +comboBoxOptions[i] = p_totalName; + +cb_energyCarrierSelection.setItems(comboBoxOptions); + +/*ALCODEEND*/} + +double f_storePreviousCustomCO2AdditionsMap() +{/*ALCODESTART::1774623387767*/ +map_customCO2Additions_previous_kg = map_customCO2Additions_kg; +/*ALCODEEND*/} + +double f_setPieChart(Map map_totalCO2EmissionsPerEC_kg,I_EnergyData data) +{/*ALCODESTART::1774888957180*/ +for(OL_EnergyCarriers EC : map_totalCO2EmissionsPerEC_kg.keySet()){ + DataItem CO2Emission_ton = new DataItem(); + CO2Emission_ton.setValue(ZeroMath.arraySum(map_totalCO2EmissionsPerEC_kg.get(EC))/1000.0); + pieChart_totalSubdivision.addDataItem(CO2Emission_ton, uI_Results.f_getECName(EC), uI_Results.cm_consumptionColors.get(EC)); +} + +if(map_customCO2Additions_kg != null && data instanceof EnergyModel){ + for(String customEntry : map_customCO2Additions_kg.keySet()){ + DataItem CO2Emission_ton = new DataItem(); + CO2Emission_ton.setValue(map_customCO2Additions_kg.get(customEntry).getFirst()/1000.0); + pieChart_totalSubdivision.addDataItem(CO2Emission_ton, customEntry, map_customCO2Additions_kg.get(customEntry).getSecond()); + } +} + +v_selectedSupportChart = "Pie"; +gr_subChart_totalSubdivision.setVisible(true); +/*ALCODEEND*/} + diff --git a/_alp/Agents/ChartCO2/Code/Functions.xml b/_alp/Agents/ChartCO2/Code/Functions.xml new file mode 100644 index 0000000..172620d --- /dev/null +++ b/_alp/Agents/ChartCO2/Code/Functions.xml @@ -0,0 +1,235 @@ + + + + VOID + double + 1772441389069 + + -420 + 500 + + false + true + true + + + + + + + + + + + + VOID + double + 1772441389071 + + -270 + 60 + + false + true + true + + + + + + + + + + + + + + + + + + + + VOID + double + 1772441389073 + + -420 + 480 + + false + true + true + + + + VOID + double + 1772441389081 + + -420 + 520 + + false + true + true + + + + + + + + RETURNS_VALUE + double[] + 1772643915089 + + -420 + 610 + + false + true + true + + + + + + + + + + + + + + + + VOID + double + 1774608778627 + + -420 + 750 + + false + true + true + + + >]]> + + + + + VOID + double + 1774618389588 + + -440 + 400 + + false + true + true + + + + VOID + double + 1774618389602 + + -430 + 460 + + false + true + true + + + + VOID + double + 1774618389606 + + -430 + 420 + + false + true + true + + + + + + + + VOID + double + 1774623387767 + + -420 + 770 + + false + true + true + + + + VOID + double + 1774888957180 + + -420 + 570 + + false + true + true + + + ]]> + + + + + + + + diff --git a/_alp/Agents/ChartCO2/Levels/Level.level.xml b/_alp/Agents/ChartCO2/Levels/Level.level.xml new file mode 100644 index 0000000..b219c0a --- /dev/null +++ b/_alp/Agents/ChartCO2/Levels/Level.level.xml @@ -0,0 +1,1095 @@ + + + + 1772441388921 + + 0 + 0 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 10 + 1 + v_lineWidth + -1644806 + v_lineColor + null + SOLID + 460 + 50 + 0.0 + -657931 + null + + + 1772441388927 + + 235 + 10 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 26 + + + CENTER + + + 1772441388929 + + 360 + 10 + + true + true + false + SHAPE_DRAW_2D3D + uI_Results.f_setInfoText(i_chartCO2Emission, uI_Results.v_infoText.chartCO2, i_chartCO2Emission.getX(), i_chartCO2Emission.getY()); + false + 0 + 30 + 30 + 0.0 + + + digital_twin_results + icon_i.png + + + false + + + 1772441388931 + + 235 + 290 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 0.0 + + + 1772441388939 + + -95 + -33 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 0.0 + + + 1772441388941 + + -12 + -10 + + true + false + false + SHAPE_DRAW_2D3D + false + 0 + 23 + 18 + 0.0 + + + digital_twin_results + icon_arrow_up_red.png + + + false + + + 1772441388943 + + -12 + -10 + + true + false + false + SHAPE_DRAW_2D3D + false + 0 + 23 + 18 + 0.0 + + + digital_twin_results + icon_arrow_down_green.png + + + false + + + 1772441388945 + + -11 + -1 + + true + false + false + SHAPE_DRAW_2D3D + false + 0 + 10 + 2 + -4144960 + null + SOLID + 1 + 0 + 1 + 0 + 21 + 0 + 0 + + + + + 1772441388955 + + 0 + -50 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 24 + + + CENTER + + + 1772441388957 + + 0 + 30 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 16 + + + CENTER + + + 1772441388975 + + 0 + -100 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 22 + + + CENTER + + + 1772441809775 + + 0 + 0 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 16 + + + CENTER + + + + + 1772441388987 + + 225 + 520 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 0.0 + + + 1772441388989 + + 10 + -140 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 22 + + + CENTER + + + 1772441389005 + + -220 + -120 + + true + true + false + SHAPE_DRAW_2D3D + true + + 1772441389003 + true + 1769500800000 + + + HOUR + + + + HOUR + + + false + 440 + 280 + + + + 50 + 30 + 370 + 220 + -1 + -16777216 + -4144960 + + + SOUTH + -16777216 + 30 + + + DEFAULT + DEFAULT + -12566464 + + false + + 1772441388991 + 0 + -65536 + Title + + + 1772441388992 + 0 + -65536 + Title 1 + + + 1772441388993 + 0 + -65536 + Title 2 + + + 1772441388994 + 0 + -65536 + Title 3 + + + 1772441388995 + 0 + -65536 + Title 4 + + + 1772441388996 + 0 + -65536 + Title 5 + + + 1772441388997 + 0 + -65536 + Title 6 + + + 1772441388998 + 0 + -65536 + Title 7 + + + 1772441388999 + 0 + -65536 + Title 8 + + + 1772441389000 + 0 + -65536 + Title 9 + + + 1772441389001 + 0 + -65536 + Title 10 + + + 1772441389002 + 0 + -65536 + Title 11 + + 0 + 1 + AUTO + + UP + 0.75 + + + + 1772441389027 + + 15 + 140 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + + + 1772441389029 + + -169.19 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772441389031 + + -137.91 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772441389033 + + -107.584 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772441389035 + + -77.259 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772441389037 + + -45.954 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772441389039 + + -14.674 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772441389041 + + 15.651 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772441389043 + + 46.954 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772441389045 + + 77.259 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772441389047 + + 107.604 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772441389049 + + 138.91 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772441389051 + + 169.213 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + + + 1772441389053 + + -70 + 195 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 0.0 + + + 1772441389057 + + -100 + -30 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 10 + 1 + -16777216 + null + SOLID + 10 + 10 + 0.0 + -65536 + uI_Results.v_electricityDemandColor + null + + + 1772441389061 + + -80 + -30 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + LEFT + + + + + + + 1774620072613 + + 50 + 130 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 18 + + + LEFT + + + false + 1774620072617 + + 300 + 130 + + true + true + false + SHAPE_DRAW_2D3D + + false + -1 + -16777216 + true + if(cb_energyCarrierSelection.getValue().equals(p_totalName)){ + v_selectedEnergyCarrier = p_totalName; +} +else{ + for(OL_EnergyCarriers EC : c_defaultOrderEC){ + if(cb_energyCarrierSelection.getValue().equals(uI_Results.f_getECName(EC))){ + v_selectedEnergyCarrier = EC.toString(); + } + } +} + +f_setChartCO2Values(); + + + + + false + + + + + + + + false + + + + false + 1774889733278 + + 320 + 715 + + true + true + false + SHAPE_DRAW_2D3D + + false + -16777216 + v_selectedEnergyCarrier.equals(p_totalName) + true + uI_Results.energyModel.p_timeParameters.getRunDuration_h() >= 8760 + if(v_selectedSupportChart.equals("Monthly")){ + v_selectedSupportChart = "Pie"; +} +else{ + v_selectedSupportChart = "Monthly"; +} + +f_setChartCO2Values(); + + + + Totaal verdeling + v_selectedSupportChart.equals("Monthly") ? "Totaal verdeling" : "Maandelijkse verdeling" + + + + 1774890342444 + + 820 + 480 + + true + true + false + SHAPE_DRAW_2D3D + 235 + 540 + false + 0 + 0.0 + + + 1774623611036 + + -160 + -130 + + true + true + false + SHAPE_DRAW_2D3D + true + + 1774623611034 + true + 1774684800000 + + + HOUR + + + + HOUR + + + false + 320 + 284.444 + + + + 60 + 10 + 200 + 200 + + -12566464 + + + SOUTH + -16777216 + 60 + + + DEFAULT + DEFAULT + -12566464 + + true + + 1774623611552 + 0 + -8097537 + Title + + + 1774623611553 + 0 + -60269 + Title 1 + + + 1774623616571 + 0 + -29696 + Title 2 + + + 1774623618171 + 0 + -12799119 + Title 3 + + + + 1774890288060 + + 0 + -160 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 22 + + + CENTER + + + + diff --git a/_alp/Agents/ChartCO2/Variables.xml b/_alp/Agents/ChartCO2/Variables.xml new file mode 100644 index 0000000..e7bc654 --- /dev/null +++ b/_alp/Agents/ChartCO2/Variables.xml @@ -0,0 +1,209 @@ + + + + 1772441389087 + + -300 + 190 + + false + true + true + + + + + + + + + 1774618389614 + + -420 + 660 + + false + true + true + + + + + + + + + 1774889675019 + + -420 + 710 + + false + true + true + + + + + + + + + 1774608808294 + + -420 + 800 + + false + true + true + + >]]> + NONE + false + + 1774608808292 + TEXT_BOX + 0 + 100 + NO_DELIMETER + + + + + 1774618389618 + + -400 + 680 + + false + true + true + + + NONE + false + + + + + 1774618389616 + TEXT_BOX + 0 + 100 + NO_DELIMETER + + + + + 1774623004018 + + -420 + 830 + + false + true + true + + >]]> + NONE + false + + 1774623004016 + TEXT_BOX + 0 + 100 + NO_DELIMETER + + + + + 1774618389557 + + -410 + 440 + + false + true + true + + ArrayList + OL_EnergyCarriers + String + + + + + + + 1774621442864 + + -400 + 540 + + false + true + true + + ArrayList + String + String + + + + + + diff --git a/_alp/Agents/ChartConnectionCosts/AOC.ChartConnectionCosts.xml b/_alp/Agents/ChartConnectionCosts/AOC.ChartConnectionCosts.xml new file mode 100644 index 0000000..f968af2 --- /dev/null +++ b/_alp/Agents/ChartConnectionCosts/AOC.ChartConnectionCosts.xml @@ -0,0 +1,181 @@ + + + 1772440768543 + + 1755764711838 + + + digital_twin_results + ChartArea + + + false + + 1772440768548 + + + + + Generic parameter: + + ENTITY + 100 + false + 100 + true + + -4144960 + null + + true + true + false + + + MPS + + + + METER + + + + METER + + + + METER + + + + false + + + SECOND + + CONTINUOUS + 500 + 500 + 0 + 100 + 100 + MOORE + USER_DEF + USER_DEF + 2 + 50 + 0.95 + 10 + + + true + 1772440768542 + true + 1772524800000 + + + HOUR + + + + HOUR + + + + 1772440768546 + + 0 + -150 + false + false + false + SHAPE_DRAW_2D3D + 100 + 0 + BASED_ON_LENGTH + 10 + METER + 10 + true + + 1772440768549 + 1772440768544 + + + + + 1772440768544 + + 50 + -50 + + false + true + true + false + COLLECTION_OF_LINKS + true + Object + SOLID + 1 + -16777216 + UNDER_AGENTS + NONE + END + + + + + 1772440768577 + + 50 + -100 + + false + true + true + + digital_twin_results + UI_Results + + + + + + 1772440768549 + + 0 + 0 + + true + true + false + SHAPE_DRAW_2D3D + 0 + DIM_NON_CURRENT + + + + diff --git a/_alp/Agents/ChartConnectionCosts/Code/Functions.java b/_alp/Agents/ChartConnectionCosts/Code/Functions.java new file mode 100644 index 0000000..38bbd78 --- /dev/null +++ b/_alp/Agents/ChartConnectionCosts/Code/Functions.java @@ -0,0 +1,335 @@ +double f_setChartConnectionCosts() +{/*ALCODESTART::1772471760319*/ +I_EnergyData data = uI_Results.f_getSelectedObjectData(); + +//Set selected object display +uI_Results.f_setSelectedObjectDisplay(230, 60, true); + +//Reset chart +f_resetChart(); + + +////Get the netload values +double[] netLoad_kW; +double[] previousNetLoad_kW = null; +if(uI_Results.v_selectedObjectScope == OL_ResultScope.GRIDNODE){ + netLoad_kW = uI_Results.v_gridNode.acc_annualElectricityBalance_kW.getTimeSeries_kW(); +} +else{ + netLoad_kW = data.getRapidRunData().am_totalBalanceAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getTimeSeries_kW(); + if(data.getPreviousRapidRunData() != null){ + previousNetLoad_kW = data.getPreviousRapidRunData().am_totalBalanceAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getTimeSeries_kW(); + } +} + +//Set yearly chart +f_setYearlyKPIs(data, netLoad_kW, previousNetLoad_kW); + +//Set monthly chart +if(uI_Results.energyModel.p_timeParameters.getRunDuration_h() >= 8760){ + f_setMonthlyChart(data, netLoad_kW); +} +/*ALCODEEND*/} + +double f_resetChart() +{/*ALCODESTART::1772472093328*/ +c_orderedStackCharts.forEach(chart -> chart.removeAll()); +gr_monthlyConnectionCostCharts.setVisible(false); + +t_previousPhysicalConnectionCosts.setText("-"); +t_previousDefaultContractCosts.setText("-"); +t_previousEnergyTransportCosts.setText("-"); +t_previousPeakConsumptionCosts.setText("-"); +t_previousTotalConnectionCosts.setText("-"); +/*ALCODEEND*/} + +double[] f_calculateMonthlyPeakElectricityBalance_kW(double[] netLoad_kW) +{/*ALCODESTART::1773160205274*/ +double[] startHourPerMonth = uI_Results.energyModel.p_timeParameters.getMonthStartHours(); +double timeStep_h = uI_Results.energyModel.p_timeParameters.getTimeStep_h(); + +double[] monthlyPeakElectricityBalance_kW = new double[12]; + +int currentMonth = 0; + +for (int i = 0; i < netLoad_kW.length; i++) { + if(currentMonth != 11 && startHourPerMonth[currentMonth+1] < i*timeStep_h){ + currentMonth += 1; + } + monthlyPeakElectricityBalance_kW[currentMonth] = max(monthlyPeakElectricityBalance_kW[currentMonth], abs(netLoad_kW[i])); +} + +return monthlyPeakElectricityBalance_kW; +/*ALCODEEND*/} + +double[] f_calculateMonthlyPeakElectricityDelivery_kW(double[] netLoad_kW) +{/*ALCODESTART::1773160205294*/ +double[] startHourPerMonth = uI_Results.energyModel.p_timeParameters.getMonthStartHours(); +double timeStep_h = uI_Results.energyModel.p_timeParameters.getTimeStep_h(); + +double[] monthlyPeakElectricityDelivery_kW = new double[12]; + +int currentMonth = 0; + +for (int i = 0; i < netLoad_kW.length; i++) { + if(currentMonth != 11 && startHourPerMonth[currentMonth+1] < i*timeStep_h){ + currentMonth += 1; + } + monthlyPeakElectricityDelivery_kW[currentMonth] = max(monthlyPeakElectricityDelivery_kW[currentMonth], netLoad_kW[i]); +} + +return monthlyPeakElectricityDelivery_kW; + +/*ALCODEEND*/} + +double[] f_calculateMonthlyPeakElectricityFeedin_kW(double[] netLoad_kW) +{/*ALCODESTART::1773160205312*/ +double[] startHourPerMonth = uI_Results.energyModel.p_timeParameters.getMonthStartHours(); +double timeStep_h = uI_Results.energyModel.p_timeParameters.getTimeStep_h(); + +double[] monthlyPeakElectricityFeedin_kW = new double[12]; + +int currentMonth = 0; + +for (int i = 0; i < netLoad_kW.length; i++) { + if(currentMonth != 11 && startHourPerMonth[currentMonth+1] < i*timeStep_h){ + currentMonth += 1; + } + monthlyPeakElectricityFeedin_kW[currentMonth] = max(monthlyPeakElectricityFeedin_kW[currentMonth], -netLoad_kW[i]); +} + +return monthlyPeakElectricityFeedin_kW; +/*ALCODEEND*/} + +double[] f_calculateMonthlyTotalElectricityTransport_kWh(double[] netLoad_kW) +{/*ALCODESTART::1773160925451*/ +double[] startHourPerMonth = uI_Results.energyModel.p_timeParameters.getMonthStartHours(); +double timeStep_h = uI_Results.energyModel.p_timeParameters.getTimeStep_h(); + +double[] monthlyTotalElectricityTransport_kWh = new double[12]; + +int currentMonth = 0; + +for (int i = 0; i < netLoad_kW.length; i++) { + if(currentMonth != 11 && startHourPerMonth[currentMonth+1] < i*timeStep_h){ + currentMonth += 1; + } + monthlyTotalElectricityTransport_kWh[currentMonth] += abs(netLoad_kW[i]) * timeStep_h; +} + +return monthlyTotalElectricityTransport_kWh; +/*ALCODEEND*/} + +double[] f_calculateMonthlyElectricityDelivery_kWh(double[] netLoad_kW) +{/*ALCODESTART::1773160925453*/ +double[] startHourPerMonth = uI_Results.energyModel.p_timeParameters.getMonthStartHours(); +double timeStep_h = uI_Results.energyModel.p_timeParameters.getTimeStep_h(); + +double[] monthlyElectricityDelivery_kWh = new double[12]; + +int currentMonth = 0; + +for (int i = 0; i < netLoad_kW.length; i++) { + if(currentMonth != 11 && startHourPerMonth[currentMonth+1] < i*timeStep_h){ + currentMonth += 1; + } + monthlyElectricityDelivery_kWh[currentMonth] += max(0, netLoad_kW[i]) * timeStep_h; +} + +return monthlyElectricityDelivery_kWh; + +/*ALCODEEND*/} + +double[] f_calculateMonthlyElectricityFeedin_kWh(double[] netLoad_kW) +{/*ALCODESTART::1773160925455*/ +double[] startHourPerMonth = uI_Results.energyModel.p_timeParameters.getMonthStartHours(); +double timeStep_h = uI_Results.energyModel.p_timeParameters.getTimeStep_h(); + +double[] monthlyElectricityFeedin_kWh = new double[12]; + +int currentMonth = 0; + +for (int i = 0; i < netLoad_kW.length; i++) { + if(currentMonth != 11 && startHourPerMonth[currentMonth+1] < i*timeStep_h){ + currentMonth += 1; + } + monthlyElectricityFeedin_kWh[currentMonth] += max(0, -netLoad_kW[i]) * timeStep_h; +} + +return monthlyElectricityFeedin_kWh; +/*ALCODEEND*/} + +double f_setMonthlyChart(I_EnergyData data,double[] netLoad_kW) +{/*ALCODESTART::1773161385166*/ +DataSet netCosts_eur = new DataSet(12); + +double maxChartValue_eur = 0; +I_GridOperatorTariffs gridOperatorTariffs = uI_Results.energyModel.avgc_data.economicAVGC.getGridOperatorTariffs(); + +//Get monthly values +double monthlyPhysicalConnectionCosts_eur = f_calculatePhysicalConnectionCosts_eurpyr(data.getRapidRunData().connectionMetaData)/12.0; +double monthlyContractConnectionCosts_eur = f_calculateContractConnectionCosts_eurpyr(data.getRapidRunData().connectionMetaData)/12.0; + +double[] monthlyTotalElectricityTransport_kWh = f_calculateMonthlyElectricityDelivery_kWh(netLoad_kW); +double[] monthlyPeakLoad_kW = f_calculateMonthlyPeakElectricityDelivery_kW(netLoad_kW); +double[] monthlyTransportCosts_eur = new double[12]; +double[] monthlyPeakCosts_eur = new double[12]; +for(int i = 0; i<12 ; i++){ + monthlyTransportCosts_eur[i] = gridOperatorTariffs.getTransportCost_eur(data.getRapidRunData().connectionMetaData, monthlyTotalElectricityTransport_kWh[i]); + monthlyPeakCosts_eur[i] = gridOperatorTariffs.getMonthlyPeakCost_eur(data.getRapidRunData().connectionMetaData, monthlyPeakLoad_kW[i]); +} + +for (int i = 0; i < 12; i++) { + StackChart chart_monthlyConnectionCosts = c_orderedStackCharts.get(i); + + //Physical connection cost + DataItem physicalConnectionCosts_eur = new DataItem(); + physicalConnectionCosts_eur.setValue(monthlyPhysicalConnectionCosts_eur); + chart_monthlyConnectionCosts.addDataItem(physicalConnectionCosts_eur, "Fysieke aansluitings kosten", color_physicalConnectionCosts); + + //Contract connection cost + DataItem contractConnectionCosts_eur = new DataItem(); + contractConnectionCosts_eur.setValue(monthlyContractConnectionCosts_eur); + chart_monthlyConnectionCosts.addDataItem(contractConnectionCosts_eur, "Vaste contract kosten", color_contractConnectionCosts); + + //Transport cost + DataItem transportCosts_eur = new DataItem(); + transportCosts_eur.setValue(monthlyTransportCosts_eur[i]); + chart_monthlyConnectionCosts.addDataItem(transportCosts_eur, "Transport kosten", color_transportConnectionCosts); + + //Peak costs + DataItem peakCosts_eur = new DataItem(); + peakCosts_eur.setValue(monthlyPeakCosts_eur[i]); + chart_monthlyConnectionCosts.addDataItem(peakCosts_eur, "Maandelijkse piek kosten", color_monthlyPeakConnectionCosts); + + //Determine max value of the bars + maxChartValue_eur = max(maxChartValue_eur, + monthlyPhysicalConnectionCosts_eur + + monthlyContractConnectionCosts_eur + + monthlyTransportCosts_eur[i] + + monthlyPeakCosts_eur[i] + ); +} + +//Set fixed scale +maxChartValue_eur *=1.2; +for (int i = 0; i < 12; i++) { + c_orderedStackCharts.get(i).setFixedScale(maxChartValue_eur); +} +chart_layout.setFixedScale(maxChartValue_eur); + +gr_monthlyConnectionCostCharts.setVisible(true); +/*ALCODEEND*/} + +double f_setYearlyKPIs(I_EnergyData data,double[] netLoad_kW,double[] previousNetLoad_kW) +{/*ALCODESTART::1773161419537*/ +//Set new values text +DecimalFormat df = new DecimalFormat("#,##0.00"); + +double physicalConnectionCosts_eur = f_calculatePhysicalConnectionCosts_eurpyr(data.getRapidRunData().connectionMetaData); +double contractConnectionCosts_eur = f_calculateContractConnectionCosts_eurpyr(data.getRapidRunData().connectionMetaData); +double totalTransportCosts_eur = f_calculateTotalTransportCosts_eur(data.getRapidRunData().connectionMetaData, netLoad_kW); +double totalPeakCosts_eur = f_calculateTotalPeakCosts_eur(data.getRapidRunData().connectionMetaData, netLoad_kW); +double totalConnectionCosts_eur = physicalConnectionCosts_eur + contractConnectionCosts_eur + + totalTransportCosts_eur + totalPeakCosts_eur; + + + +t_physicalConnectionCosts.setText("€ " + df.format(roundToInt(physicalConnectionCosts_eur))); +t_defaultContractCosts.setText("€ " + df.format(roundToInt(contractConnectionCosts_eur))); +t_energyTransportCosts.setText("€ " + df.format(roundToInt(totalTransportCosts_eur))); +t_peakConsumptionCosts.setText("€ " + df.format(roundToInt(totalPeakCosts_eur))); +t_totalConnectionCosts.setText("€ " + df.format(roundToInt(totalConnectionCosts_eur))); + + +if(previousNetLoad_kW != null){ + + double previousPhysicalConnectionCosts_eur = f_calculatePhysicalConnectionCosts_eurpyr(data.getPreviousRapidRunData().connectionMetaData); + double previousContractConnectionCosts_eur = f_calculateContractConnectionCosts_eurpyr(data.getPreviousRapidRunData().connectionMetaData); + double previousTotalTransportCosts_eur = f_calculateTotalTransportCosts_eur(data.getPreviousRapidRunData().connectionMetaData, previousNetLoad_kW); + double previousTotalPeakCosts_eur = f_calculateTotalPeakCosts_eur(data.getPreviousRapidRunData().connectionMetaData, previousNetLoad_kW); + double previousTotalConnectionCosts_eur = previousPhysicalConnectionCosts_eur + previousContractConnectionCosts_eur + + previousTotalTransportCosts_eur + previousTotalPeakCosts_eur; + + + t_previousPhysicalConnectionCosts.setText("€ " + df.format(roundToInt(previousPhysicalConnectionCosts_eur))); + t_previousDefaultContractCosts.setText("€ " + df.format(roundToInt(previousContractConnectionCosts_eur))); + t_previousEnergyTransportCosts.setText("€ " + df.format(roundToInt(previousTotalTransportCosts_eur))); + t_previousPeakConsumptionCosts.setText("€ " + df.format(roundToInt(previousTotalPeakCosts_eur))); + t_previousTotalConnectionCosts.setText("€ " + df.format(roundToInt(previousTotalConnectionCosts_eur))); + + + /* + ////Set arrows + //Import + if(previousTotalImportCosts_eur > totalImportCosts_eur){ + arrow_down_green_import.setVisible(true); + } + else if(totalImportCosts_eur > previousTotalImportCosts_eur){ + arrow_up_red_import.setVisible(true); + } + else{ + line_import.setVisible(true); + } + + //Export + if(previousTotalExportRevenue_eur > totalExportRevenue_eur){ + arrow_down_red_export.setVisible(true); + } + else if(totalExportRevenue_eur > previousTotalExportRevenue_eur){ + arrow_up_green_export.setVisible(true); + } + else{ + line_export.setVisible(true); + } + + //Net + if(previousTotalNetElectricityCosts_eur > totalNetElectricityCosts_eur){ + arrow_down_green_netElectricity.setVisible(true); + } + else if(totalNetElectricityCosts_eur > previousTotalNetElectricityCosts_eur){ + arrow_up_red_netElectricity.setVisible(true); + } + else{ + line_total.setVisible(true); + } + */ +} +else{ // No previous rapid data -> dont show previous values + //t_previousTotalImportCosts_eur.setText("-"); + //t_previousTotalExportRevenue_eur.setText("-"); + //t_previousTotalNetElectricityCosts_eur.setText("-"); +} + +/*ALCODEEND*/} + +double f_calculatePhysicalConnectionCosts_eurpyr(J_ConnectionMetaData connectionMetaData) +{/*ALCODESTART::1773162212251*/ +return uI_Results.energyModel.avgc_data.economicAVGC.getGridOperatorTariffs().getPhysicalCapacityCost_eurpyr(connectionMetaData); +/*ALCODEEND*/} + +double f_calculateContractConnectionCosts_eurpyr(J_ConnectionMetaData connectionMetaData) +{/*ALCODESTART::1773162241728*/ +return uI_Results.energyModel.avgc_data.economicAVGC.getGridOperatorTariffs().getContractCapacityCost_eurpyr(connectionMetaData); +/*ALCODEEND*/} + +double f_calculateTotalTransportCosts_eur(J_ConnectionMetaData connectionMetaData,double[] netLoad_kW) +{/*ALCODESTART::1773162256135*/ +double yearlyTransportedElectricity_kWh = ZeroMath.arraySum(f_calculateMonthlyElectricityDelivery_kWh(netLoad_kW)); +return uI_Results.energyModel.avgc_data.economicAVGC.getGridOperatorTariffs().getTransportCost_eur(connectionMetaData, yearlyTransportedElectricity_kWh); +/*ALCODEEND*/} + +double f_calculateTotalPeakCosts_eur(J_ConnectionMetaData connectionMetaData,double[] netLoad_kW) +{/*ALCODESTART::1773162293336*/ +double yearTotalMonthlyPeakLoad_kW = ZeroMath.arraySum(f_calculateMonthlyPeakElectricityDelivery_kW(netLoad_kW)); +return uI_Results.energyModel.avgc_data.economicAVGC.getGridOperatorTariffs().getMonthlyPeakCost_eur(connectionMetaData, yearTotalMonthlyPeakLoad_kW); +/*ALCODEEND*/} + +double f_calculateTotalConnectionCosts_eurpyr(J_ConnectionMetaData connectionMetaData,double[] yearlyNetLoad_kW) +{/*ALCODESTART::1773219333056*/ +return f_calculatePhysicalConnectionCosts_eurpyr(connectionMetaData)+ + f_calculateContractConnectionCosts_eurpyr(connectionMetaData)+ + f_calculateTotalTransportCosts_eur(connectionMetaData, yearlyNetLoad_kW)+ + f_calculateTotalPeakCosts_eur(connectionMetaData, yearlyNetLoad_kW); +/*ALCODEEND*/} + diff --git a/_alp/Agents/ChartConnectionCosts/Code/Functions.xml b/_alp/Agents/ChartConnectionCosts/Code/Functions.xml new file mode 100644 index 0000000..61df4d5 --- /dev/null +++ b/_alp/Agents/ChartConnectionCosts/Code/Functions.xml @@ -0,0 +1,323 @@ + + + + VOID + double + 1772471760319 + + -400 + 250 + + false + true + true + + + + VOID + double + 1772472093328 + + -380 + 270 + + false + true + true + + + + RETURNS_VALUE + double[] + 1773160205274 + + true + -400 + 550 + + false + true + true + + + + + + + + RETURNS_VALUE + double[] + 1773160205294 + + -400 + 510 + + false + true + true + + + + + + + + RETURNS_VALUE + double[] + 1773160205312 + + true + -400 + 530 + + false + true + true + + + + + + + + RETURNS_VALUE + double[] + 1773160925451 + + true + -400 + 620 + + false + true + true + + + + + + + + RETURNS_VALUE + double[] + 1773160925453 + + -400 + 580 + + false + true + true + + + + + + + + RETURNS_VALUE + double[] + 1773160925455 + + true + -400 + 600 + + false + true + true + + + + + + + + VOID + double + 1773161385166 + + -380 + 310 + + false + true + true + + + + + + + + + + + + VOID + double + 1773161419537 + + -380 + 290 + + false + true + true + + + + + + + + + + + + + + + + RETURNS_VALUE + double + 1773162212251 + + -400 + 390 + + false + true + true + + + + + + + + RETURNS_VALUE + double + 1773162241728 + + -400 + 410 + + false + true + true + + + + + + + + RETURNS_VALUE + double + 1773162256135 + + -400 + 430 + + false + true + true + + + + + + + + + + + + RETURNS_VALUE + double + 1773162293336 + + -400 + 450 + + false + true + true + + + + + + + + + + + + RETURNS_VALUE + double + 1773219333056 + + -400 + 470 + + false + true + true + + + + + + + + + + + diff --git a/_alp/Agents/ChartConnectionCosts/Levels/Level.level.xml b/_alp/Agents/ChartConnectionCosts/Levels/Level.level.xml new file mode 100644 index 0000000..b7b345d --- /dev/null +++ b/_alp/Agents/ChartConnectionCosts/Levels/Level.level.xml @@ -0,0 +1,2150 @@ + + + + 1772468491270 + + 0 + 0 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 10 + 1 + v_lineWidth + -1644806 + v_lineColor + null + SOLID + 460 + 50 + 0.0 + -657931 + null + + + 1772468491272 + + 235 + 10 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 26 + + + CENTER + + + 1772468491276 + + 364 + 12 + + true + true + false + SHAPE_DRAW_2D3D + uI_Results.f_setInfoText(i_chartConnectionCosts, uI_Results.v_infoText.chartConnectionCosts, i_chartConnectionCosts.getX(), i_chartConnectionCosts.getY()); + false + 0 + 30 + 30 + 0.0 + + + digital_twin_results + icon_i.png + + + false + + + 1772616729397 + + 60 + 340 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + LEFT + + + 1772616819180 + + 60 + 270 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + LEFT + + + 1772616857305 + + 60 + 220 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + LEFT + + + 1772616885218 + + 60 + 120 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + LEFT + + + 1772616946531 + + 60 + 170 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + LEFT + + + 1772617105751 + + 50 + 320 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 10 + 2 + -4144960 + null + SOLID + 1 + 0 + 1 + 0 + 360 + 0 + 0 + + + 1772617184418 + + 230 + 540 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 0.0 + + + 1772617184420 + + 0 + -130 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 22 + + + CENTER + + + 1772617184438 + + 10 + 140 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + + + 1772617184440 + + -169.19 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772617184442 + + -137.91 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772617184444 + + -107.584 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772617184446 + + -77.259 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772617184448 + + -45.954 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772617184450 + + -14.674 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772617184452 + + 15.651 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772617184454 + + 46.954 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772617184456 + + 77.259 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772617184458 + + 107.604 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772617184460 + + 138.91 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + 1772617184462 + + 169.213 + -4.311 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + CENTER + + + + + 1772617184464 + + -70 + 195 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 0.0 + + + 1772617184466 + + -90 + -25 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 10 + 1 + + null + SOLID + 10 + 10 + 0.0 + -65536 + color_physicalConnectionCosts + null + + + 1772617184468 + + -70 + -25 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + LEFT + + + 1773762981248 + + -90 + -5 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 10 + 1 + + null + SOLID + 10 + 10 + 0.0 + -65536 + color_contractConnectionCosts + null + + + 1773762981255 + + -70 + -5 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + LEFT + + + 1773762981261 + + 120 + -25 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 10 + 1 + + null + SOLID + 10 + 10 + 0.0 + -65536 + color_transportConnectionCosts + null + + + 1773762981268 + + 140 + -25 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + LEFT + + + 1773762981275 + + 120 + -5 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 10 + 1 + + null + SOLID + 10 + 10 + 0.0 + -65536 + color_monthlyPeakConnectionCosts + null + + + 1773762981281 + + 140 + -5 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 10 + + + LEFT + + + + + 1773762881746 + + -160 + 30 + + true + true + false + SHAPE_DRAW_2D3D + false + 0 + 0.0 + + + 1773762881750 + + -50 + -140 + + true + true + false + SHAPE_DRAW_2D3D + true + + 1773762881748 + true + 1773216000000 + + + HOUR + + + + HOUR + + + false + 430 + 300 + + + + 40 + 30 + 360 + 210 + -1 + -16777216 + + + + SOUTH + -16777216 + 30 + + + DEFAULT + DEFAULT + -12566464 + + true + 1 + AUTO + + UP + 0.8 + + + + 1773762881758 + + -55 + -135 + + true + true + false + SHAPE_DRAW_2D3D + true + + 1773762881756 + true + 1773216000000 + + + HOUR + + + + HOUR + + + false + 110 + 265 + + + + 50 + 30 + 20 + 205 + -1 + + -12566464 + + + SOUTH + -16777216 + 30 + + + DEFAULT + NONE + -12566464 + + false + + 1773762881752 + 0 + -8097537 + Title + + + 1773762881753 + 0 + -60269 + Title 1 + + + 1773762881754 + 0 + -29696 + Title 2 + + + 1773762881755 + 0 + -12799119 + Title 3 + + 1 + AUTO + + UP + 0.8 + + + + 1773762881766 + + 35 + -135 + + true + true + false + SHAPE_DRAW_2D3D + true + + 1773762881764 + true + 1773216000000 + + + HOUR + + + + HOUR + + + false + 110 + 265 + + + + 50 + 30 + 20 + 205 + -1 + + + + + SOUTH + -16777216 + 30 + + + DEFAULT + NONE + + + false + + 1773762881760 + 0 + -8097537 + Title + + + 1773762881761 + 0 + -60269 + Title 1 + + + 1773762881762 + 0 + -29696 + Title 2 + + + 1773762881763 + 0 + -12799119 + Title 3 + + 1 + AUTO + + UP + 0.8 + + + + 1773762881774 + + 125 + -135 + + true + true + false + SHAPE_DRAW_2D3D + true + + 1773762881772 + true + 1773216000000 + + + HOUR + + + + HOUR + + + false + 110 + 265 + + + + 50 + 30 + 20 + 205 + -1 + + + + + SOUTH + -16777216 + 30 + + + DEFAULT + NONE + + + false + + 1773762881768 + 0 + -8097537 + Title + + + 1773762881769 + 0 + -60269 + Title 1 + + + 1773762881770 + 0 + -29696 + Title 2 + + + 1773762881771 + 0 + -12799119 + Title 3 + + 1 + AUTO + + UP + 0.8 + + + + 1773762881782 + + 185 + -135 + + true + true + false + SHAPE_DRAW_2D3D + true + + 1773762881780 + true + 1773216000000 + + + HOUR + + + + HOUR + + + false + 110 + 265 + + + + 50 + 30 + 20 + 205 + -1 + + + + + SOUTH + -16777216 + 30 + + + DEFAULT + NONE + + + false + + 1773762881776 + 0 + -8097537 + Title + + + 1773762881777 + 0 + -60269 + Title 1 + + + 1773762881778 + 0 + -29696 + Title 2 + + + 1773762881779 + 0 + -12799119 + Title 3 + + 1 + AUTO + + UP + 0.8 + + + + 1773762881790 + + 275 + -135 + + true + true + false + SHAPE_DRAW_2D3D + true + + 1773762881788 + true + 1773216000000 + + + HOUR + + + + HOUR + + + false + 110 + 265 + + + + 50 + 30 + 20 + 205 + -1 + + + + + SOUTH + -16777216 + 30 + + + DEFAULT + NONE + + + false + + 1773762881784 + 0 + -8097537 + Title + + + 1773762881785 + 0 + -60269 + Title 1 + + + 1773762881786 + 0 + -29696 + Title 2 + + + 1773762881787 + 0 + -12799119 + Title 3 + + 1 + AUTO + + UP + 0.8 + + + + 1773762881798 + + 245 + -135 + + true + true + false + SHAPE_DRAW_2D3D + true + + 1773762881796 + true + 1773216000000 + + + HOUR + + + + HOUR + + + false + 110 + 265 + + + + 50 + 30 + 20 + 205 + -1 + + + + + SOUTH + -16777216 + 30 + + + DEFAULT + NONE + + + false + + 1773762881792 + 0 + -8097537 + Title + + + 1773762881793 + 0 + -60269 + Title 1 + + + 1773762881794 + 0 + -29696 + Title 2 + + + 1773762881795 + 0 + -12799119 + Title 3 + + 1 + AUTO + + UP + 0.8 + + + + 1773762881806 + + 155 + -135 + + true + true + false + SHAPE_DRAW_2D3D + true + + 1773762881804 + true + 1773216000000 + + + HOUR + + + + HOUR + + + false + 110 + 265 + + + + 50 + 30 + 20 + 205 + -1 + + + + + SOUTH + -16777216 + 30 + + + DEFAULT + NONE + + + false + + 1773762881800 + 0 + -8097537 + Title + + + 1773762881801 + 0 + -60269 + Title 1 + + + 1773762881802 + 0 + -29696 + Title 2 + + + 1773762881803 + 0 + -12799119 + Title 3 + + 1 + AUTO + + UP + 0.8 + + + + 1773762881814 + + 95 + -135 + + true + true + false + SHAPE_DRAW_2D3D + true + + 1773762881812 + true + 1773216000000 + + + HOUR + + + + HOUR + + + false + 110 + 265 + + + + 50 + 30 + 20 + 205 + -1 + + + + + SOUTH + -16777216 + 30 + + + DEFAULT + NONE + + + false + + 1773762881808 + 0 + -8097537 + Title + + + 1773762881809 + 0 + -60269 + Title 1 + + + 1773762881810 + 0 + -29696 + Title 2 + + + 1773762881811 + 0 + -12799119 + Title 3 + + 1 + AUTO + + UP + 0.8 + + + + 1773762881822 + + 65 + -135 + + true + true + false + SHAPE_DRAW_2D3D + true + + 1773762881820 + true + 1773216000000 + + + HOUR + + + + HOUR + + + false + 110 + 265 + + + + 50 + 30 + 20 + 205 + -1 + + + + + SOUTH + -16777216 + 30 + + + DEFAULT + NONE + + + false + + 1773762881816 + 0 + -8097537 + Title + + + 1773762881817 + 0 + -60269 + Title 1 + + + 1773762881818 + 0 + -29696 + Title 2 + + + 1773762881819 + 0 + -12799119 + Title 3 + + 1 + AUTO + + UP + 0.8 + + + + 1773762881830 + + 5 + -135 + + true + true + false + SHAPE_DRAW_2D3D + true + + 1773762881828 + true + 1773216000000 + + + HOUR + + + + HOUR + + + false + 110 + 265 + + + + 50 + 30 + 20 + 205 + -1 + + + + + SOUTH + -16777216 + 30 + + + DEFAULT + NONE + + + false + + 1773762881824 + 0 + -8097537 + Title + + + 1773762881825 + 0 + -60269 + Title 1 + + + 1773762881826 + 0 + -29696 + Title 2 + + + 1773762881827 + 0 + -12799119 + Title 3 + + 1 + AUTO + + UP + 0.8 + + + + 1773762881838 + + -25 + -135 + + true + true + false + SHAPE_DRAW_2D3D + true + + 1773762881836 + true + 1773216000000 + + + HOUR + + + + HOUR + + + false + 110 + 265 + + + + 50 + 30 + 20 + 205 + -1 + + + + + SOUTH + -16777216 + 30 + + + DEFAULT + NONE + + + false + + 1773762881832 + 0 + -8097537 + Title + + + 1773762881833 + 0 + -60269 + Title 1 + + + 1773762881834 + 0 + -29696 + Title 2 + + + 1773762881835 + 0 + -12799119 + Title 3 + + 1 + AUTO + + UP + 0.8 + + + + 1773762881846 + + 215 + -135 + + true + true + false + SHAPE_DRAW_2D3D + true + + 1773762881844 + true + 1773216000000 + + + HOUR + + + + HOUR + + + false + 110 + 265 + + + + 50 + 30 + 20 + 205 + -1 + + + + + SOUTH + -16777216 + 30 + + + DEFAULT + NONE + + + false + + 1773762881840 + 0 + -8097537 + Title + + + 1773762881841 + 0 + -60269 + Title 1 + + + 1773762881842 + 0 + -29696 + Title 2 + + + 1773762881843 + 0 + -12799119 + Title 3 + + 1 + AUTO + + UP + 0.8 + + + + + + + + 1772618115445 + + 320 + 120 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + LEFT + + + 1772618138373 + + 320 + 170 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + LEFT + + + 1772618148343 + + 320 + 220 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + LEFT + + + 1772618157626 + + 320 + 270 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + LEFT + + + 1772618167838 + + 320 + 340 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 20 + + + LEFT + + + 1773836906880 + + 325 + 145 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 14 + + + LEFT + + + 1773836938793 + + 325 + 195 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 14 + + + LEFT + + + 1773836956223 + + 325 + 245 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 14 + + + LEFT + + + 1773836977624 + + 325 + 295 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 14 + + + LEFT + + + 1773836998115 + + 320 + 365 + + true + true + false + SHAPE_DRAW_2D + false + 0 + 0.0 + -16777216 + + + + 14 + + + LEFT + + diff --git a/_alp/Agents/ChartEconomicKPIs/Variables.xml b/_alp/Agents/ChartConnectionCosts/Variables.xml similarity index 59% rename from _alp/Agents/ChartEconomicKPIs/Variables.xml rename to _alp/Agents/ChartConnectionCosts/Variables.xml index c1692f0..232d436 100644 --- a/_alp/Agents/ChartEconomicKPIs/Variables.xml +++ b/_alp/Agents/ChartConnectionCosts/Variables.xml @@ -1,10 +1,10 @@ - 1726834339918 - - -300 - 190 + 1773762641839 + + -400 + 740 - 1769431784429 - - - -390 - 650 + 1773762667224 + + -400 + 760 - 1769441396968 - - -390 - 690 + 1773762668244 + + -400 + 780 - 1769441532541 - - -390 - 710 + 1773762669272 + + -400 + 800 + + 1773163912398 + + -400 + 360 + + false + true + true + + ArrayList + StackChart + String + + diff --git a/_alp/Agents/ChartEconomicKPIs/Code/Functions.java b/_alp/Agents/ChartEconomicKPIs/Code/Functions.java deleted file mode 100644 index beada0d..0000000 --- a/_alp/Agents/ChartEconomicKPIs/Code/Functions.java +++ /dev/null @@ -1,313 +0,0 @@ -double f_setChartEconomicKPIs() -{/*ALCODESTART::1726830495435*/ -I_EnergyData data = uI_Results.f_getSelectedObjectData(); - -//Set selected object display -uI_Results.f_setSelectedObjectDisplay(230, 60, true); - -//Reset chart -f_resetChart(); - - -////Get the netload values -double[] netLoad_kW; -double[] previousNetLoad_kW = null; -if(uI_Results.v_selectedObjectScope == OL_ResultScope.GRIDNODE){ - netLoad_kW = uI_Results.v_gridNode.acc_annualElectricityBalance_kW.getTimeSeries_kW(); -} -else{ - netLoad_kW = data.getRapidRunData().am_totalBalanceAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getTimeSeries_kW(); - if(data.getPreviousRapidRunData() != null){ - previousNetLoad_kW = data.getPreviousRapidRunData().am_totalBalanceAccumulators_kW.get(OL_EnergyCarriers.ELECTRICITY).getTimeSeries_kW(); - } -} - -////Calculate the values - -//Current values -double[] monthlyElectricityImportCosts_eur = f_calculateMonthlyElectricityImportCosts_eur(netLoad_kW); -double[] monthlyElectricityExportRevenue_eur = f_calculateMonthlyElectricityExportRevenue_eur(netLoad_kW); -double[] monthlyNetElectricityCosts_eur = f_calculateMonthlyNetElectricityCosts_eur(monthlyElectricityImportCosts_eur, monthlyElectricityExportRevenue_eur); - -double totalImportCosts_eur = ZeroMath.arraySum(monthlyElectricityImportCosts_eur); -double totalExportRevenue_eur = ZeroMath.arraySum(monthlyElectricityExportRevenue_eur); -double totalNetElectricityCosts_eur = ZeroMath.arraySum(monthlyNetElectricityCosts_eur); - -//Previous values -Double previousTotalImportCosts_eur = null; -Double previousTotalExportRevenue_eur = null; -Double previousTotalNetElectricityCosts_eur = null; - -if(previousNetLoad_kW != null){ - double[] previousMonthlyElectricityImportCosts_eur = f_calculateMonthlyElectricityImportCosts_eur(previousNetLoad_kW); - double[] previousMonthlyElectricityExportRevenue_eur = f_calculateMonthlyElectricityExportRevenue_eur(previousNetLoad_kW); - double[] previousMonthlyNetElectricityCosts_eur = f_calculateMonthlyNetElectricityCosts_eur(previousMonthlyElectricityImportCosts_eur, previousMonthlyElectricityExportRevenue_eur); - - previousTotalImportCosts_eur = ZeroMath.arraySum(previousMonthlyElectricityImportCosts_eur); - previousTotalExportRevenue_eur = ZeroMath.arraySum(previousMonthlyElectricityExportRevenue_eur); - previousTotalNetElectricityCosts_eur = ZeroMath.arraySum(previousMonthlyNetElectricityCosts_eur); -} - - -//Set yearly kpis -f_setYearlyKPIs(totalImportCosts_eur, totalExportRevenue_eur, totalNetElectricityCosts_eur, previousTotalImportCosts_eur, previousTotalExportRevenue_eur, previousTotalNetElectricityCosts_eur); - -//Set monthly chart -f_setMonthlyChart(monthlyElectricityImportCosts_eur, monthlyElectricityExportRevenue_eur, monthlyNetElectricityCosts_eur); - - -/*ALCODEEND*/} - -double f_setYearlyKPIs(double totalImportCosts_eur,double totalExportRevenue_eur,double totalNetElectricityCosts_eur,Double previousTotalImportCosts_eur,Double previousTotalExportRevenue_eur,Double previousTotalNetElectricityCosts_eur) -{/*ALCODESTART::1726830499836*/ -//Set new values text -DecimalFormat df = new DecimalFormat("#,###"); -DecimalFormat df_r = new DecimalFormat("#.#"); -DecimalFormat df_2decimal = new DecimalFormat("0.00"); - -t_totalImportCosts_eur.setText("€ " + df.format(roundToInt(totalImportCosts_eur))); -t_totalExportRevenue_eur.setText("€ " + df.format(roundToInt(totalExportRevenue_eur))); -t_totalNetElectricityCosts_eur.setText("€ " + df.format(roundToInt(totalNetElectricityCosts_eur))); - -if(previousTotalImportCosts_eur != null){ - t_previousTotalImportCosts_eur.setText("€ " + df.format(roundToInt(previousTotalImportCosts_eur))); - t_previousTotalExportRevenue_eur.setText("€ " + df.format(roundToInt(previousTotalExportRevenue_eur))); - t_previousTotalNetElectricityCosts_eur.setText("€ " + df.format(roundToInt(previousTotalNetElectricityCosts_eur))); - - ////Set arrows - //Import - if(previousTotalImportCosts_eur > totalImportCosts_eur){ - arrow_down_green_import.setVisible(true); - } - else if(totalImportCosts_eur > previousTotalImportCosts_eur){ - arrow_up_red_import.setVisible(true); - } - else{ - line_import.setVisible(true); - } - - //Export - if(previousTotalExportRevenue_eur > totalExportRevenue_eur){ - arrow_down_red_export.setVisible(true); - } - else if(totalExportRevenue_eur > previousTotalExportRevenue_eur){ - arrow_up_green_export.setVisible(true); - } - else{ - line_export.setVisible(true); - } - - //Net - if(previousTotalNetElectricityCosts_eur > totalNetElectricityCosts_eur){ - arrow_down_green_netElectricity.setVisible(true); - } - else if(totalNetElectricityCosts_eur > previousTotalNetElectricityCosts_eur){ - arrow_up_red_netElectricity.setVisible(true); - } - else{ - line_total.setVisible(true); - } -} -else{ // No previous rapid data -> dont show previous values - t_previousTotalImportCosts_eur.setText("-"); - t_previousTotalExportRevenue_eur.setText("-"); - t_previousTotalNetElectricityCosts_eur.setText("-"); -} -/*ALCODEEND*/} - -double f_styleBackground_override(Color backgroundColor,Color lineColor,Double lineWidth,LineStyle lineStyle) -{/*ALCODESTART::1726834752079*/ -//Function used to style the background of the graphs - -v_backgroundColor = v_backgroundColor_override; - -if(lineColor != null){ - v_lineColor = lineColor; -} - -if(lineWidth != null){ - v_lineWidth = lineWidth; -} -if(lineStyle != null){ - v_lineStyle = lineStyle; -} -/*ALCODEEND*/} - -double f_resetChart() -{/*ALCODESTART::1727107912139*/ -//Reset all arrow visibility -arrow_down_green_import.setVisible(false); -arrow_up_green_export.setVisible(false); -arrow_down_green_netElectricity.setVisible(false); -arrow_up_red_import.setVisible(false); -arrow_down_red_export.setVisible(false); -arrow_up_red_netElectricity.setVisible(false); -line_total.setVisible(false); -line_import.setVisible(false); -line_export.setVisible(false); - -//Clear monthly chart -bar_importElectricityCostsMonthly.removeAll(); -bar_exportElectricityRevenueMonthly.removeAll(); -plot_netElectricityCostsMonthly.removeAll(); -/*ALCODEEND*/} - -double f_calculateCapacityCosts_eur(double[] netLoad_kW) -{/*ALCODESTART::1755868971285*/ -double costsCapacityRate_euro = 0; - -GridNode GN_T0 = findFirst(uI_Results.energyModel.pop_gridNodes, p -> p.p_gridNodeID.equals("T0")); -double contractedCapacity_kW = GN_T0.p_capacity_kW; -double VAT_fr = 0.21; -double annualConnectionRate_euro_p_yr = 5351; -double annualFixedTransportRate_euro_p_yr = 2760; -double annualContractCapacityRate_euro_p_kW_yr = 42.10; -double monthlyPeakPowerRate_euro_p_kW_month = 4.48; - -double[] monthlyPeakDemand_kW = f_calculateMonthlyPeakDemand_kW(netLoad_kW); - -costsCapacityRate_euro = (1+VAT_fr)*(annualConnectionRate_euro_p_yr + annualFixedTransportRate_euro_p_yr + annualContractCapacityRate_euro_p_kW_yr * contractedCapacity_kW + monthlyPeakPowerRate_euro_p_kW_month * Arrays.stream(monthlyPeakDemand_kW).sum()); - -return costsCapacityRate_euro; -/*ALCODEEND*/} - -double[] f_calculateMonthlyPeakDemand_kW(double[] netLoad_kW) -{/*ALCODESTART::1755869067049*/ -double[] monthlyPeakDemand_kW = new double[12]; -int[] daysInMonth = {31,28,31,30,31,30,31,31,30,31,30,31}; -int sampleCounter = 0; - -for(int month=0; month < daysInMonth.length; month++) { - - double maxLoad_kW = 0; - - int samplesInMonth = daysInMonth[month] * 96; - int startMonthIndex = sampleCounter; - int endMonthIndex = sampleCounter + samplesInMonth; - - for (int i = startMonthIndex; i < endMonthIndex && i < netLoad_kW.length; i++) { - double absLoad_kW = Math.abs(netLoad_kW[i]); - if (absLoad_kW > maxLoad_kW) { - maxLoad_kW = absLoad_kW; - } - } - monthlyPeakDemand_kW[month] = maxLoad_kW; - sampleCounter += samplesInMonth; -} - -return monthlyPeakDemand_kW; -/*ALCODEEND*/} - -double[] f_calculateMonthlyNetElectricityCosts_eur(double[] monthlyElectricityImportCosts_euro,double[] monthlyElectricityExportRevenue_euro) -{/*ALCODESTART::1755869113668*/ -if(monthlyElectricityImportCosts_euro.length != monthlyElectricityExportRevenue_euro.length){ - throw new RuntimeException("Trying to calculate the net electricity cost per month for a monthly import and export array that is not the same size!"); -} - -double[] monthlyNetElectricityCost_euro = new double[monthlyElectricityImportCosts_euro.length]; - -for (int i = 0; i < monthlyElectricityImportCosts_euro.length; i++) { - monthlyNetElectricityCost_euro[i] = monthlyElectricityImportCosts_euro[i] - monthlyElectricityExportRevenue_euro[i]; -} - -return monthlyNetElectricityCost_euro; -/*ALCODEEND*/} - -double f_setMonthlyChart(double[] monthlyElectricityImportCosts_eur,double[] monthlyElectricityExportRevenue_eur,double[] monthlyNetElectricityCosts_eur) -{/*ALCODESTART::1769429961370*/ -DataSet netCosts_eur = new DataSet(12); - -double maxChartValue_eur = 0; - -for (int i = 0; i < 12; i++) { - //Import cost - DataItem importCosts_eur = new DataItem(); - importCosts_eur.setValue(monthlyElectricityImportCosts_eur[i]); - bar_importElectricityCostsMonthly.addDataItem(importCosts_eur, "", uI_Results.v_electricityDemandColor); - - //Export revenue - DataItem exportRevenue_eur = new DataItem(); - exportRevenue_eur.setValue(monthlyElectricityExportRevenue_eur[i]); - bar_exportElectricityRevenueMonthly.addDataItem(exportRevenue_eur, "", uI_Results.v_electricitySupplyColor); - - //Net balance - netCosts_eur.add(i+1, monthlyNetElectricityCosts_eur[i]); - - //Determine max value of the bars - maxChartValue_eur = max(maxChartValue_eur, max(monthlyElectricityImportCosts_eur[i], monthlyElectricityExportRevenue_eur[i])); -} - -//Net costs -plot_netElectricityCostsMonthly.addDataSet(netCosts_eur, "", v_netElectricityCostColor, true, Chart.InterpolationType.INTERPOLATION_LINEAR, v_netElectricityCostLineWidth, Chart.PointStyle.POINT_CIRCLE); - -//Set fixed scale -maxChartValue_eur *=1.2; -bar_importElectricityCostsMonthly.setFixedScale(0, maxChartValue_eur); -bar_exportElectricityRevenueMonthly.setFixedScale(0, maxChartValue_eur); -plot_netElectricityCostsMonthly.setFixedVerticalScale(-maxChartValue_eur, maxChartValue_eur); -plot_netElectricityCostsMonthly.setFixedHorizontalScale(0.5, 12.5); - - - -/*ALCODEEND*/} - -double[] f_calculateMonthlyElectricityImportCosts_eur(double[] netLoad_kW) -{/*ALCODESTART::1769430055658*/ -int[] startHourPerMonth = startHourPerMonthTemporary; -double timeStep_h = uI_Results.energyModel.p_timeParameters.getTimeStep_h(); - - -double VAT_fr = 0.21; -double EnergyTaxes_eur_p_kwh = 0.03868; - -double[] monthlyElectricityImportCosts_euro = new double[12]; - -int currentMonth = 0; - - -for (int i = 0; i < netLoad_kW.length; i++) { - if(currentMonth != 11 && startHourPerMonth[currentMonth+1] < i*timeStep_h){ - currentMonth += 1; - } - - double currentElectricityPriceCharge_eurpkWh = - uI_Results.energyModel.pp_dayAheadElectricityPricing_eurpMWh - .getAllValues()[ - (int) Math.floor(i * timeStep_h) - ] / 1000.0; - - double timestepCost = - (1 + VAT_fr) * - (currentElectricityPriceCharge_eurpkWh + EnergyTaxes_eur_p_kwh) * - max(0, netLoad_kW[i]) * - timeStep_h; - - monthlyElectricityImportCosts_euro[currentMonth] += timestepCost; -} - -return monthlyElectricityImportCosts_euro; - -/*ALCODEEND*/} - -double[] f_calculateMonthlyElectricityExportRevenue_eur(double[] netLoad_kW) -{/*ALCODESTART::1769432836265*/ -int[] startHourPerMonth = startHourPerMonthTemporary; -double timeStep_h = uI_Results.energyModel.p_timeParameters.getTimeStep_h(); - -double[] monthlyElectricityExportRevenue_euro = new double[12]; - -int currentMonth = 0; - -for (int i = 0; i < netLoad_kW.length; i++) { - if(currentMonth != 11 && startHourPerMonth[currentMonth+1] < i*timeStep_h){ - currentMonth += 1; - } - double currentElectricityPriceCharge_eurpkWh = uI_Results.energyModel.pp_dayAheadElectricityPricing_eurpMWh.getAllValues()[(int) Math.floor(i*timeStep_h)] / 1000; - double timestepExportRevenue_euro = currentElectricityPriceCharge_eurpkWh * max(0,-netLoad_kW[i]) * timeStep_h; - - monthlyElectricityExportRevenue_euro[currentMonth] += timestepExportRevenue_euro; -} - -return monthlyElectricityExportRevenue_euro; -/*ALCODEEND*/} - diff --git a/_alp/Agents/ChartEconomicKPIs/AOC.ChartEconomicKPIs.xml b/_alp/Agents/ChartEnergyCosts/AOC.ChartEnergyCosts.xml similarity index 99% rename from _alp/Agents/ChartEconomicKPIs/AOC.ChartEconomicKPIs.xml rename to _alp/Agents/ChartEnergyCosts/AOC.ChartEnergyCosts.xml index 839dbdb..779f21f 100644 --- a/_alp/Agents/ChartEconomicKPIs/AOC.ChartEconomicKPIs.xml +++ b/_alp/Agents/ChartEnergyCosts/AOC.ChartEnergyCosts.xml @@ -1,7 +1,7 @@ 1726820490242 - + 1755764711838 totalImportCosts_eur){ + arrow_down_green_import.setVisible(true); + } + else if(totalImportCosts_eur > previousTotalImportCosts_eur){ + arrow_up_red_import.setVisible(true); + } + else{ + line_import.setVisible(true); + } + + //Export + if(previousTotalExportRevenue_eur > totalExportRevenue_eur){ + arrow_down_red_export.setVisible(true); + } + else if(totalExportRevenue_eur > previousTotalExportRevenue_eur){ + arrow_up_green_export.setVisible(true); + } + else{ + line_export.setVisible(true); + } + + //Net + if(previousTotalNetElectricityCosts_eur > totalNetElectricityCosts_eur){ + arrow_down_green_netEnergy.setVisible(true); + } + else if(totalNetElectricityCosts_eur > previousTotalNetElectricityCosts_eur){ + arrow_up_red_netEnergy.setVisible(true); + } + else{ + line_total.setVisible(true); + } +} +else{ // No previous rapid data -> dont show previous values + t_previousTotalImportCosts_eur.setText("-"); + t_previousTotalExportRevenue_eur.setText("-"); + t_previousTotalNetEnergyCosts_eur.setText("-"); +} +/*ALCODEEND*/} + +double f_styleBackground_override(Color backgroundColor,Color lineColor,Double lineWidth,LineStyle lineStyle) +{/*ALCODESTART::1726834752079*/ +//Function used to style the background of the graphs + +v_backgroundColor = v_backgroundColor_override; + +if(lineColor != null){ + v_lineColor = lineColor; +} + +if(lineWidth != null){ + v_lineWidth = lineWidth; +} +if(lineStyle != null){ + v_lineStyle = lineStyle; +} +/*ALCODEEND*/} + +double f_resetChart() +{/*ALCODESTART::1727107912139*/ +//Reset all arrow visibility +arrow_down_green_import.setVisible(false); +arrow_up_green_export.setVisible(false); +arrow_down_green_netEnergy.setVisible(false); +arrow_up_red_import.setVisible(false); +arrow_down_red_export.setVisible(false); +arrow_up_red_netEnergy.setVisible(false); +line_total.setVisible(false); +line_import.setVisible(false); +line_export.setVisible(false); + +//Clear monthly chart +bar_importEnergyCostsMonthly.removeAll(); +bar_exportEnergyRevenueMonthly.removeAll(); +plot_netEnergyCostsMonthly.removeAll(); +gr_monthlyECCostCharts.setVisible(false); +/*ALCODEEND*/} + +double f_setMonthlyChart(double[] monthlyElectricityImportCosts_eur,double[] monthlyElectricityExportRevenue_eur,double[] monthlyNetElectricityCosts_eur) +{/*ALCODESTART::1769429961370*/ +DataSet netCosts_eur = new DataSet(12); +int nDecimalDigits = 2; +double maxChartValue_eur = 0; + +for (int i = 0; i < 12; i++) { + //Import cost + DataItem importCosts_eur = new DataItem(); + importCosts_eur.setValue(roundToDecimal(monthlyElectricityImportCosts_eur[i], nDecimalDigits)); + bar_importEnergyCostsMonthly.addDataItem(importCosts_eur, "", uI_Results.v_electricityDemandColor); + + //Export revenue + DataItem exportRevenue_eur = new DataItem(); + exportRevenue_eur.setValue(roundToDecimal(monthlyElectricityExportRevenue_eur[i], nDecimalDigits)); + bar_exportEnergyRevenueMonthly.addDataItem(exportRevenue_eur, "", uI_Results.v_electricitySupplyColor); + + //Net balance + netCosts_eur.add(i+1, roundToDecimal(monthlyNetElectricityCosts_eur[i], nDecimalDigits)); + + //Determine max value of the bars + maxChartValue_eur = max(maxChartValue_eur, max(monthlyElectricityImportCosts_eur[i], monthlyElectricityExportRevenue_eur[i])); +} + +//Net costs +plot_netEnergyCostsMonthly.addDataSet(netCosts_eur, "", v_netECCostColor, true, Chart.InterpolationType.INTERPOLATION_LINEAR, v_netECCostLineWidth, Chart.PointStyle.POINT_CIRCLE); + +//Set fixed scale +maxChartValue_eur *=1.2; +maxChartValue_eur +=1; //To prevent [0 0] axis errors if EC is not active. +bar_importEnergyCostsMonthly.setFixedScale(0, maxChartValue_eur); +bar_exportEnergyRevenueMonthly.setFixedScale(0, maxChartValue_eur); +plot_netEnergyCostsMonthly.setFixedVerticalScale(-maxChartValue_eur, maxChartValue_eur); +plot_netEnergyCostsMonthly.setFixedHorizontalScale(0.5, 12.5); + +gr_monthlyECCostCharts.setVisible(true); + +/*ALCODEEND*/} + +double[] f_calculateMonthlyEnergyImportCosts_eur(double[] ECBalance_kW,double signalResolution_h,OL_EnergyCarriers EC) +{/*ALCODESTART::1774021264167*/ +double[] startHourPerMonth = uI_Results.energyModel.p_timeParameters.getMonthStartHours(); +double timeStep_h = uI_Results.energyModel.p_timeParameters.getTimeStep_h(); + +double energyCarrierCost_eur_p_kWh = uI_Results.energyModel.avgc_data.economicAVGC.getAvgCostOfEnergyCarrier_eurpkWh(EC); +double[] values_dayAheadElectricityPricing_eurpMWh = uI_Results.energyModel.pp_dayAheadElectricityPricing_eurpMWh.getAllValues(); +double energyTaxes_eur_p_kwh = uI_Results.energyModel.avgc_data.economicAVGC.getEnergyTaxesECImport_eurpkWh(EC, ZeroMath.arraySumPos(ECBalance_kW)*signalResolution_h); +double VAT_fr = uI_Results.energyModel.avgc_data.economicAVGC.getVAT_energy_fr(); + + +double[] monthlyECImportCosts_euro = new double[12]; + +int hoursInYear = 8760; +double modelStartTime_h = uI_Results.energyModel.p_timeParameters.getRunStartTime_h(); +int currentMonth = 11; +for(int i = 0; i< 11;i++){ + if(startHourPerMonth[i+1]>= modelStartTime_h){ + currentMonth = i; + break; + } +} + +for (int i = 0; i < ECBalance_kW.length; i++) { + if(currentMonth == 11){ + if ((i*signalResolution_h + modelStartTime_h) > hoursInYear){ + currentMonth = 0; + } + } + else if(startHourPerMonth[currentMonth+1] < (i*signalResolution_h + modelStartTime_h) % hoursInYear){ + currentMonth += 1; + } + + double currentECImport_kW = max(0, ECBalance_kW[i]); + if(currentECImport_kW == 0){ + continue; + } + + + if(EC == OL_EnergyCarriers.ELECTRICITY){ + energyCarrierCost_eur_p_kWh = uI_Results.energyModel.pp_dayAheadElectricityPricing_eurpMWh.getValue((i*signalResolution_h + modelStartTime_h) % hoursInYear)/1000.0; + } + + monthlyECImportCosts_euro[currentMonth] += (1 + VAT_fr)*((energyCarrierCost_eur_p_kWh + energyTaxes_eur_p_kwh) * currentECImport_kW * signalResolution_h); +} + +return monthlyECImportCosts_euro; + +/*ALCODEEND*/} + +double[] f_calculateMonthlyEnergyExportRevenue_eur(double[] ECBalance_kW,double signalResolution_h,OL_EnergyCarriers EC) +{/*ALCODESTART::1774023398668*/ +double[] startHourPerMonth = uI_Results.energyModel.p_timeParameters.getMonthStartHours(); +double timeStep_h = uI_Results.energyModel.p_timeParameters.getTimeStep_h(); + +double energyCarrierCost_eur_p_kWh = uI_Results.energyModel.avgc_data.economicAVGC.getAvgCostOfEnergyCarrier_eurpkWh(EC); +double[] values_dayAheadElectricityPricing_eurpMWh = uI_Results.energyModel.pp_dayAheadElectricityPricing_eurpMWh.getAllValues(); + +double[] monthlyECExportRevenue_euro = new double[12]; + + +int hoursInYear = 8760; +double modelStartTime_h = uI_Results.energyModel.p_timeParameters.getRunStartTime_h(); +int currentMonth = 11; +for(int i = 0; i< 11;i++){ + if(startHourPerMonth[i+1]>= modelStartTime_h){ + currentMonth = i; + break; + } +} +for (int i = 0; i < ECBalance_kW.length; i++) { + if(currentMonth == 11){ + if ((i*signalResolution_h + modelStartTime_h) > hoursInYear){ + currentMonth = 0; + } + } + else if(startHourPerMonth[currentMonth+1] < (i*signalResolution_h + modelStartTime_h) % hoursInYear){ + currentMonth += 1; + } + + double currentECExport_kW = max(0, -ECBalance_kW[i]); + if(currentECExport_kW == 0){ + continue; + } + + if(EC == OL_EnergyCarriers.ELECTRICITY){ + energyCarrierCost_eur_p_kWh = uI_Results.energyModel.pp_dayAheadElectricityPricing_eurpMWh.getValue((i*signalResolution_h + modelStartTime_h) % hoursInYear)/1000.0; + } + + monthlyECExportRevenue_euro[currentMonth] += energyCarrierCost_eur_p_kWh * currentECExport_kW * signalResolution_h; +} + +return monthlyECExportRevenue_euro; + +/*ALCODEEND*/} + +double[] f_calculateMonthlyNetEnergyCosts_eur(double[] monthlyECImportCosts_euro,double[] monthlyECExportRevenue_euro) +{/*ALCODESTART::1774023455637*/ +if(monthlyECImportCosts_euro.length != monthlyECExportRevenue_euro.length){ + throw new RuntimeException("Trying to calculate the net energy cost per month for a monthly import and export array that is not the same size!"); +} + +double[] monthlyNetEnergyCost_euro = new double[monthlyECImportCosts_euro.length]; + +for (int i = 0; i < monthlyECImportCosts_euro.length; i++) { + monthlyNetEnergyCost_euro[i] = monthlyECImportCosts_euro[i] - monthlyECExportRevenue_euro[i]; +} + +return monthlyNetEnergyCost_euro; + +/*ALCODEEND*/} + +double f_setChartEnergyCostsValues() +{/*ALCODESTART::1774259541182*/ +I_EnergyData data = uI_Results.f_getSelectedObjectData(); + +//Reset chart +f_resetChart(); + + +//Get selected List +List selectedECList; +if(v_selectedEnergyCarrier.equals(p_totalName)){ + if(uI_Results.v_selectedObjectScope == OL_ResultScope.GRIDNODE){ + selectedECList = new ArrayList<>(List.of(uI_Results.v_gridNode.p_energyCarrier)); + } + else{ + selectedECList = new ArrayList<>(data.getRapidRunData().activeEnergyCarriers); + } +} +else{ + selectedECList = new ArrayList<>(List.of(OL_EnergyCarriers.valueOf(v_selectedEnergyCarrier))); +} + + +double[] monthlyImportCosts_eur = new double[12]; +double[] monthlyExportRevenue_eur = new double[12]; + +for(OL_EnergyCarriers EC : selectedECList){ + //Get the ECBalance values + double[] ECBalance_kW; + double signalResolution_h; + if(uI_Results.v_selectedObjectScope == OL_ResultScope.GRIDNODE){ + if(EC == OL_EnergyCarriers.ELECTRICITY){ + ECBalance_kW = uI_Results.v_gridNode.acc_annualElectricityBalance_kW.getTimeSeries_kW(); + signalResolution_h = uI_Results.v_gridNode.acc_annualElectricityBalance_kW.getSignalResolution_h(); + } + else{ //if(EC == OL_EnergyCarriers.HEAT){ + ECBalance_kW = uI_Results.v_gridNode.acc_annualHeatBalance_kW.getTimeSeries_kW(); + signalResolution_h = uI_Results.v_gridNode.acc_annualHeatBalance_kW.getSignalResolution_h(); + } + } + else{ + if(EC == OL_EnergyCarriers.HEAT && !data.getRapidRunData().assetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.districtHeatDelivery_kW)){ + continue; + } + ECBalance_kW = data.getRapidRunData().am_totalBalanceAccumulators_kW.get(EC).getTimeSeries_kW(); + signalResolution_h = data.getRapidRunData().am_totalBalanceAccumulators_kW.get(EC).getSignalResolution_h(); + } + + //Calculate values + double[] monthlyECImportCosts_eur = f_calculateMonthlyEnergyImportCosts_eur(ECBalance_kW, signalResolution_h, EC); + double[] monthlyECExportRevenue_eur = f_calculateMonthlyEnergyExportRevenue_eur(ECBalance_kW, signalResolution_h, EC); + + //Add values of this EC to the total + for(int i = 0; i < 12; i++){ + monthlyImportCosts_eur[i] += monthlyECImportCosts_eur[i]; + monthlyExportRevenue_eur[i] += monthlyECExportRevenue_eur[i]; + } +} + +double[] monthlyNetCosts_eur = f_calculateMonthlyNetEnergyCosts_eur(monthlyImportCosts_eur, monthlyExportRevenue_eur); + +double totalImportCosts_eur = ZeroMath.arraySum(monthlyImportCosts_eur); +double totalExportRevenue_eur = ZeroMath.arraySum(monthlyExportRevenue_eur); +double totalNetCosts_eur = ZeroMath.arraySum(monthlyNetCosts_eur); + + +//Previous values +Double previousTotalImportCosts_eur = null; +Double previousTotalExportRevenue_eur = null; +Double previousTotalNetCosts_eur = null; + +if(data.getPreviousRapidRunData() != null){ + //It is possible that previous rapid run has other set of EC than current rapid run, so list needs to be recreated. + List selectedECList_previousRapidRun =new ArrayList<>(); + if(v_selectedEnergyCarrier.equals("Totaal")){ + selectedECList_previousRapidRun.addAll(data.getPreviousRapidRunData().activeEnergyCarriers); + } + else if(data.getPreviousRapidRunData().activeEnergyCarriers.contains(selectedECList.get(0))){ + selectedECList_previousRapidRun = selectedECList; + } + //Initialize previous values with 0. (Even if selectedECList_previousRapidRun remains empty due to diff in EC between rapid runs this makes sense!) + previousTotalImportCosts_eur = 0.0; + previousTotalExportRevenue_eur = 0.0; + previousTotalNetCosts_eur = 0.0; + + for(OL_EnergyCarriers EC : selectedECList_previousRapidRun){ + if(EC == OL_EnergyCarriers.HEAT && !data.getPreviousRapidRunData().assetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.districtHeatDelivery_kW)){ + continue; + } + + double[] previousECBalance_kW = data.getPreviousRapidRunData().am_totalBalanceAccumulators_kW.get(EC).getTimeSeries_kW(); + double previousSignalResolution_h = data.getPreviousRapidRunData().am_totalBalanceAccumulators_kW.get(EC).getSignalResolution_h(); + + double[] previousMonthlyECImportCosts_eur = f_calculateMonthlyEnergyImportCosts_eur(previousECBalance_kW, previousSignalResolution_h, EC); + double[] previousMonthlyECExportRevenue_eur = f_calculateMonthlyEnergyExportRevenue_eur(previousECBalance_kW, previousSignalResolution_h, EC); + double[] previousMonthlyNetECCosts_eur = f_calculateMonthlyNetEnergyCosts_eur(previousMonthlyECImportCosts_eur, previousMonthlyECExportRevenue_eur); + + + previousTotalImportCosts_eur += ZeroMath.arraySum(previousMonthlyECImportCosts_eur); + previousTotalExportRevenue_eur += ZeroMath.arraySum(previousMonthlyECExportRevenue_eur); + previousTotalNetCosts_eur += ZeroMath.arraySum(previousMonthlyNetECCosts_eur); + } +} + + +//Set yearly kpis +f_setYearlyKPIs(totalImportCosts_eur, totalExportRevenue_eur, totalNetCosts_eur, previousTotalImportCosts_eur, previousTotalExportRevenue_eur, previousTotalNetCosts_eur); + +//Set monthly chart +if(uI_Results.energyModel.p_timeParameters.getRunDuration_h() >= 8760){ + f_setMonthlyChart(monthlyImportCosts_eur, monthlyExportRevenue_eur, monthlyNetCosts_eur); +} + +/*ALCODEEND*/} + +double f_getTotalEnergyCosts_eurpyr(J_RapidRunData rapidRunData) +{/*ALCODESTART::1774263422526*/ +double[] monthlyImportCosts_eur = new double[12]; +double[] monthlyExportRevenue_eur = new double[12]; + +for(OL_EnergyCarriers EC : rapidRunData.activeEnergyCarriers){ + if(EC == OL_EnergyCarriers.HEAT && !rapidRunData.assetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.districtHeatDelivery_kW)){ + continue; + } + //Get the ECBalance values + double[] ECBalance_kW; + double signalResolution_h; + ECBalance_kW = rapidRunData.am_totalBalanceAccumulators_kW.get(EC).getTimeSeries_kW(); + signalResolution_h = rapidRunData.am_totalBalanceAccumulators_kW.get(EC).getSignalResolution_h(); + + //Current values + double[] monthlyECImportCosts_eur = f_calculateMonthlyEnergyImportCosts_eur(ECBalance_kW, signalResolution_h, EC); + double[] monthlyECExportRevenue_eur = f_calculateMonthlyEnergyExportRevenue_eur(ECBalance_kW, signalResolution_h, EC); + + //Add values of this EC to the total + for(int i = 0; i < 12; i++){ + monthlyImportCosts_eur[i] += monthlyECImportCosts_eur[i]; + monthlyExportRevenue_eur[i] += monthlyECExportRevenue_eur[i]; + } +} + +double[] monthlyNetCosts_eur = f_calculateMonthlyNetEnergyCosts_eur(monthlyImportCosts_eur, monthlyExportRevenue_eur); + +double totalNetCosts_eur = ZeroMath.arraySum(monthlyNetCosts_eur); + +return totalNetCosts_eur; +/*ALCODEEND*/} + +double f_initializeECSelectionComboBox(I_EnergyData data) +{/*ALCODESTART::1774276016703*/ +//Get energy carrier options (also previous run EC that are not in current). +Set energyCarriers = new HashSet<>(); +if(uI_Results.v_selectedObjectScope == OL_ResultScope.GRIDNODE){ + energyCarriers.add(uI_Results.v_gridNode.p_energyCarrier); +} +else{ + energyCarriers.addAll(data.getRapidRunData().activeEnergyCarriers); + boolean hasHadDistrictHeating = data.getRapidRunData().assetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.districtHeatDelivery_kW); + + if(data.getPreviousRapidRunData() != null){ + energyCarriers.addAll(data.getPreviousRapidRunData().activeEnergyCarriers); + if(!hasHadDistrictHeating){ + hasHadDistrictHeating = data.getPreviousRapidRunData().assetsMetaData.activeAssetFlows.contains(OL_AssetFlowCategories.districtHeatDelivery_kW); + } + } + + if(energyCarriers.contains(OL_EnergyCarriers.HEAT) && !hasHadDistrictHeating){ + energyCarriers.remove(OL_EnergyCarriers.HEAT); + } +} + +//Order the list to always have the same order +List orderedEnergyCarriers = new ArrayList<>(); +for(OL_EnergyCarriers EC : c_defaultOrderEC){ + if(energyCarriers.contains(EC)){ + orderedEnergyCarriers.add(EC); + } +} + + +//Convert to the readable combobox options +String[] comboBoxOptions = new String[orderedEnergyCarriers.size() + 1]; +int i = 0; +for(OL_EnergyCarriers EC : orderedEnergyCarriers){ + comboBoxOptions[i] = uI_Results.f_getECName(EC); + i++; +} +comboBoxOptions[i] = p_totalName; + +cb_energyCarrierSelection.setItems(comboBoxOptions); + +/*ALCODEEND*/} + diff --git a/_alp/Agents/ChartEconomicKPIs/Code/Functions.xml b/_alp/Agents/ChartEnergyCosts/Code/Functions.xml similarity index 75% rename from _alp/Agents/ChartEconomicKPIs/Code/Functions.xml rename to _alp/Agents/ChartEnergyCosts/Code/Functions.xml index a97bb52..5792918 100644 --- a/_alp/Agents/ChartEconomicKPIs/Code/Functions.xml +++ b/_alp/Agents/ChartEnergyCosts/Code/Functions.xml @@ -4,9 +4,9 @@ VOID double 1726830495435 - + -410 - 420 + 400