From b7ad14f0136ca0483e2db44c10e93325ca2aeac2 Mon Sep 17 00:00:00 2001 From: Luc-Sol Date: Tue, 30 Jun 2026 18:14:04 +0200 Subject: [PATCH 1/3] Bugfix + Change to custom TripTracker in CompanyUI - Fixed a bug where additional vehicles did not get the custom triptrackers because the map_createdCustomTripWeeklyConfiguration was queried with the vehicle instead of vehicleType. - To align with the engine & Java convention of weeks starting in Sunday I have changed the matrix_vehicleTripsConfigurationButtons. Note: Because the engine implementation of the ActivityTracker still has the old convention of weeks starting on mondays there is now an offset in the rows. This offset can be removed after the ActivityTracker is refactored. --- _alp/Agents/UI_company/Code/Functions.java | 13 +++-- _alp/Agents/UI_company/Variables.xml | 64 +++++++++++----------- 2 files changed, 40 insertions(+), 37 deletions(-) diff --git a/_alp/Agents/UI_company/Code/Functions.java b/_alp/Agents/UI_company/Code/Functions.java index d23e59c4..b263bea3 100644 --- a/_alp/Agents/UI_company/Code/Functions.java +++ b/_alp/Agents/UI_company/Code/Functions.java @@ -1978,10 +1978,10 @@ boolean f_createCustomTripConfiguration(OL_VehicleType vehicleType) double f_addNewInstanceOfCustomTripTrackerToAdditionalVehicle(I_Vehicle vehicle) {/*ALCODESTART::1780312282022*/ //Check if this vehicle should get a custom triptracker -if(map_createdCustomTripWeeklyConfiguration.get(p_gridConnection.p_uid) != null && map_createdCustomTripWeeklyConfiguration.get(p_gridConnection.p_uid).get(vehicle) != null){ +if(map_createdCustomTripWeeklyConfiguration.get(p_gridConnection.p_uid) != null && map_createdCustomTripWeeklyConfiguration.get(p_gridConnection.p_uid).get(vehicle.getVehicleType()) != null){ //Get the records for the custom triptracker - List customTripRecords = map_createdCustomTripWeeklyConfiguration.get(p_gridConnection.p_uid).get(vehicle); - + List customTripRecords = map_createdCustomTripWeeklyConfiguration.get(p_gridConnection.p_uid).get(vehicle.getVehicleType()); + J_TimeVariables timeVariables = zero_Interface.energyModel.p_timeVariables; J_TimeParameters timeParameters = zero_Interface.energyModel.p_timeParameters; @@ -2083,7 +2083,9 @@ boolean[][] f_getTripBooleanMatrix() for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { - Color fillColor = matrix_vehicleTripsConfigurationButtons[i][j].getFillColor(); + int rowIndex = (i+1)%7; // Sunday is on row 0 of the matrix, but the Activity Tracker starts on mondays. + + Color fillColor = matrix_vehicleTripsConfigurationButtons[rowIndex][j].getFillColor(); if (fillColor.equals(p_configureVehicleTripsOnColor)) { booleanMatrix[i][j] = true; } @@ -2144,7 +2146,8 @@ boolean[][] f_getTripBooleanMatrix() else{ c_activeVehicleConfigurationDays.remove(day); //Set color of entire row to off, if turned off. - for(ShapeRectangle rectangle : matrix_vehicleTripsConfigurationButtons[J_TimeParameters.getDayIndexFromDay(day)]){ + int dayIndex = J_TimeParameters.getDayIndexFromDay(day) % 7; // Sunday is day 7, but has index 0 in matrix + for(ShapeRectangle rectangle : matrix_vehicleTripsConfigurationButtons[dayIndex]){ rectangle.setFillColor(p_configureVehicleTripsOffColor); } } diff --git a/_alp/Agents/UI_company/Variables.xml b/_alp/Agents/UI_company/Variables.xml index f3d0d3f2..09350671 100644 --- a/_alp/Agents/UI_company/Variables.xml +++ b/_alp/Agents/UI_company/Variables.xml @@ -1417,7 +1417,33 @@ false From 8330a6ee3113b6cb74f855b9a50b5c8327fef503 Mon Sep 17 00:00:00 2001 From: Luc-Sol Date: Tue, 14 Jul 2026 14:50:05 +0200 Subject: [PATCH 2/3] some debugging plots added some debugging buttons/plots, must be removed before this branch is merged into main --- _alp/Agents/Zero_Interface/Code/Events.java | 2 + .../Agents/Zero_Interface/Code/Functions.java | 47 +++++ _alp/Agents/Zero_Interface/Code/Functions.xml | 16 ++ .../Zero_Interface/Levels/Level.level.xml | 197 ++++++++++++++++++ _alp/Agents/Zero_Interface/Variables.xml | 22 ++ 5 files changed, 284 insertions(+) diff --git a/_alp/Agents/Zero_Interface/Code/Events.java b/_alp/Agents/Zero_Interface/Code/Events.java index 4000a6a3..7395f5ba 100644 --- a/_alp/Agents/Zero_Interface/Code/Events.java +++ b/_alp/Agents/Zero_Interface/Code/Events.java @@ -24,6 +24,8 @@ void e_calculateEnergyBalance() // Get the weather info f_getWeatherInfo(); + +if (b_forecastingDebugActive) f_forecastDebug(); /*ALCODEEND*/} void e_setStartView() diff --git a/_alp/Agents/Zero_Interface/Code/Functions.java b/_alp/Agents/Zero_Interface/Code/Functions.java index f6aee7fa..9201701e 100644 --- a/_alp/Agents/Zero_Interface/Code/Functions.java +++ b/_alp/Agents/Zero_Interface/Code/Functions.java @@ -3882,3 +3882,50 @@ else if (c_selectedFilterOptions.contains(OL_FilterOptionsGC.GRIDTOPOLOGY_SELECT uI_Results.f_updateResultsUI(c_selectedGridConnections.get(0)); /*ALCODEEND*/} +double f_forecastDebug() +{/*ALCODESTART::1784019094839*/ +if (energyModel.p_timeVariables.getTimeOfDay_h() % 24 != 0) { + return; +} + +GridConnection GC = c_selectedGridConnections.get(0); + +debug_chart.removeAll(); + +double startTime_h = energyModel.p_timeVariables.getT_h(); +double endTime_h = startTime_h + 24; + +// Fixed (can be negative) +double[] fixedLoad = GC.f_getFixedAssetForecast(startTime_h, endTime_h, OL_EnergyCarriers.ELECTRICITY, energyModel.p_timeParameters); +DataSet dsFixed = new DataSet(96); +for (int i = 0; i < 96; i++) { + double t = startTime_h + i * 0.25; + dsFixed.add(t, max(0, fixedLoad[i])); +} +debug_chart.addDataSet(dsFixed, "Fixed Asset Load", Color.BLUE); + +// Flex +Map, J_AssetTypeForecast> assetForecasts = GC.f_getForecast(startTime_h, endTime_h, energyModel.p_timeParameters); + +for (Class assetType : assetForecasts.keySet()) { + DataSet ds = new DataSet(96); + J_AssetTypeForecast assetForecast = assetForecasts.get(assetType); + if (assetForecast.load_kW() != null) { + Double[] load = assetForecast.load_kW().get(OL_EnergyCarriers.ELECTRICITY); + if (load != null) { + for (int i = 0; i < 96; i++) { + if (load[i] < 0 ) { + traceln("Negatieve waarde in Forecast"); + } + double t = startTime_h + i * 0.25; + ds.add(t, max(0.001, load[i])); + } + + debug_chart.addDataSet(ds, assetType.toString(), Color.RED); + } + } +} + + +/*ALCODEEND*/} + diff --git a/_alp/Agents/Zero_Interface/Code/Functions.xml b/_alp/Agents/Zero_Interface/Code/Functions.xml index fc67cf6f..087615a9 100644 --- a/_alp/Agents/Zero_Interface/Code/Functions.xml +++ b/_alp/Agents/Zero_Interface/Code/Functions.xml @@ -2754,4 +2754,20 @@ true + + VOID + double + 1784019094839 + + 1400 + -680 + + false + true + true + + diff --git a/_alp/Agents/Zero_Interface/Levels/Level.level.xml b/_alp/Agents/Zero_Interface/Levels/Level.level.xml index dc15993c..0379af18 100644 --- a/_alp/Agents/Zero_Interface/Levels/Level.level.xml +++ b/_alp/Agents/Zero_Interface/Levels/Level.level.xml @@ -8351,4 +8351,201 @@ else{ 52.51902183517265 6.169494834925871 + + 1784019094836 + + 1390 + -610 + + true + true + false + SHAPE_DRAW_2D3D + true + + 1784019094834 + true + 1784102400000 + + + HOUR + + + + HOUR + + + false + 700 + 460 + + + + 50 + 30 + 620 + 370 + -1 + -16777216 + -12566464 + + + SOUTH + -16777216 + 30 + + + DEFAULT + DEFAULT + -12566464 + + true + MOVEMENT_WITH_TIME + MODEL_TIME_UNIT + 24 + 100 + 1 + AUTO + MODEL_TIME_UNITS + + + false + 1784019219958 + + 1710 + -700 + + true + true + false + SHAPE_DRAW_2D3D + + false + -16777216 + true + b_forecastingDebugActive = !b_forecastingDebugActive; + + + + DEBUGGING + + + + false + 1784028539652 + + 1895 + -780 + + true + true + false + SHAPE_DRAW_2D3D + + false + -16777216 + true + GridConnection GC = c_selectedGridConnections.get(0); + +I_HeatingManagement heatingManagement = new J_HeatingManagementProfileHybridHeatPump(GC, energyModel.p_timeParameters, GC.f_getCurrentHeatingType()); +GC.f_setHeatingManagement(heatingManagement); + + + + HYBRID SIMPLE + + + + false + 1784028665098 + + 1895 + -740 + + true + true + false + SHAPE_DRAW_2D3D + + false + -16777216 + true + GridConnection GC = c_selectedGridConnections.get(0); + +I_HeatingManagement heatingManagement = new J_HeatingManagementPIcontrol(GC, energyModel.p_timeParameters, GC.f_getCurrentHeatingType()); +GC.f_setHeatingManagement(heatingManagement); + + + + PI CONTROL + + + + false + 1784028702655 + + 1895 + -700 + + true + true + false + SHAPE_DRAW_2D3D + + false + -16777216 + true + GridConnection GC = c_selectedGridConnections.get(0); + +I_HeatingManagement heatingManagement = new J_HeatingManagementPIcontrolHybridHeatpump(GC, energyModel.p_timeParameters, GC.f_getCurrentHeatingType()); +GC.f_setHeatingManagement(heatingManagement); + + + + HYBRID PI CONTROL + + + + false + 1784028714752 + + 1895 + -815 + + true + true + false + SHAPE_DRAW_2D3D + + false + -16777216 + true + GridConnection GC = c_selectedGridConnections.get(0); + +I_HeatingManagement heatingManagement = new J_HeatingManagementSimple(GC, energyModel.p_timeParameters, GC.f_getCurrentHeatingType()); +GC.f_setHeatingManagement(heatingManagement); + + + + SIMPLE HEATING + + diff --git a/_alp/Agents/Zero_Interface/Variables.xml b/_alp/Agents/Zero_Interface/Variables.xml index 7be6f945..92ecbf65 100644 --- a/_alp/Agents/Zero_Interface/Variables.xml +++ b/_alp/Agents/Zero_Interface/Variables.xml @@ -2161,6 +2161,28 @@ + + 1784019199639 + + 1400 + -720 + + false + true + true + + + + + + + 1715858732720 From 2108356e0cee47bd2d3563a14dbfb478762845c4 Mon Sep 17 00:00:00 2001 From: Luc-Sol Date: Thu, 16 Jul 2026 11:25:08 +0200 Subject: [PATCH 3/3] Revert "some debugging plots" This reverts commit 8330a6ee3113b6cb74f855b9a50b5c8327fef503. --- _alp/Agents/Zero_Interface/Code/Events.java | 2 - .../Agents/Zero_Interface/Code/Functions.java | 47 ----- _alp/Agents/Zero_Interface/Code/Functions.xml | 16 -- .../Zero_Interface/Levels/Level.level.xml | 197 ------------------ _alp/Agents/Zero_Interface/Variables.xml | 22 -- 5 files changed, 284 deletions(-) diff --git a/_alp/Agents/Zero_Interface/Code/Events.java b/_alp/Agents/Zero_Interface/Code/Events.java index 7395f5ba..4000a6a3 100644 --- a/_alp/Agents/Zero_Interface/Code/Events.java +++ b/_alp/Agents/Zero_Interface/Code/Events.java @@ -24,8 +24,6 @@ void e_calculateEnergyBalance() // Get the weather info f_getWeatherInfo(); - -if (b_forecastingDebugActive) f_forecastDebug(); /*ALCODEEND*/} void e_setStartView() diff --git a/_alp/Agents/Zero_Interface/Code/Functions.java b/_alp/Agents/Zero_Interface/Code/Functions.java index 9201701e..f6aee7fa 100644 --- a/_alp/Agents/Zero_Interface/Code/Functions.java +++ b/_alp/Agents/Zero_Interface/Code/Functions.java @@ -3882,50 +3882,3 @@ else if (c_selectedFilterOptions.contains(OL_FilterOptionsGC.GRIDTOPOLOGY_SELECT uI_Results.f_updateResultsUI(c_selectedGridConnections.get(0)); /*ALCODEEND*/} -double f_forecastDebug() -{/*ALCODESTART::1784019094839*/ -if (energyModel.p_timeVariables.getTimeOfDay_h() % 24 != 0) { - return; -} - -GridConnection GC = c_selectedGridConnections.get(0); - -debug_chart.removeAll(); - -double startTime_h = energyModel.p_timeVariables.getT_h(); -double endTime_h = startTime_h + 24; - -// Fixed (can be negative) -double[] fixedLoad = GC.f_getFixedAssetForecast(startTime_h, endTime_h, OL_EnergyCarriers.ELECTRICITY, energyModel.p_timeParameters); -DataSet dsFixed = new DataSet(96); -for (int i = 0; i < 96; i++) { - double t = startTime_h + i * 0.25; - dsFixed.add(t, max(0, fixedLoad[i])); -} -debug_chart.addDataSet(dsFixed, "Fixed Asset Load", Color.BLUE); - -// Flex -Map, J_AssetTypeForecast> assetForecasts = GC.f_getForecast(startTime_h, endTime_h, energyModel.p_timeParameters); - -for (Class assetType : assetForecasts.keySet()) { - DataSet ds = new DataSet(96); - J_AssetTypeForecast assetForecast = assetForecasts.get(assetType); - if (assetForecast.load_kW() != null) { - Double[] load = assetForecast.load_kW().get(OL_EnergyCarriers.ELECTRICITY); - if (load != null) { - for (int i = 0; i < 96; i++) { - if (load[i] < 0 ) { - traceln("Negatieve waarde in Forecast"); - } - double t = startTime_h + i * 0.25; - ds.add(t, max(0.001, load[i])); - } - - debug_chart.addDataSet(ds, assetType.toString(), Color.RED); - } - } -} - - -/*ALCODEEND*/} - diff --git a/_alp/Agents/Zero_Interface/Code/Functions.xml b/_alp/Agents/Zero_Interface/Code/Functions.xml index 087615a9..fc67cf6f 100644 --- a/_alp/Agents/Zero_Interface/Code/Functions.xml +++ b/_alp/Agents/Zero_Interface/Code/Functions.xml @@ -2754,20 +2754,4 @@ true - - VOID - double - 1784019094839 - - 1400 - -680 - - false - true - true - - diff --git a/_alp/Agents/Zero_Interface/Levels/Level.level.xml b/_alp/Agents/Zero_Interface/Levels/Level.level.xml index 0379af18..dc15993c 100644 --- a/_alp/Agents/Zero_Interface/Levels/Level.level.xml +++ b/_alp/Agents/Zero_Interface/Levels/Level.level.xml @@ -8351,201 +8351,4 @@ else{ 52.51902183517265 6.169494834925871 - - 1784019094836 - - 1390 - -610 - - true - true - false - SHAPE_DRAW_2D3D - true - - 1784019094834 - true - 1784102400000 - - - HOUR - - - - HOUR - - - false - 700 - 460 - - - - 50 - 30 - 620 - 370 - -1 - -16777216 - -12566464 - - - SOUTH - -16777216 - 30 - - - DEFAULT - DEFAULT - -12566464 - - true - MOVEMENT_WITH_TIME - MODEL_TIME_UNIT - 24 - 100 - 1 - AUTO - MODEL_TIME_UNITS - - - false - 1784019219958 - - 1710 - -700 - - true - true - false - SHAPE_DRAW_2D3D - - false - -16777216 - true - b_forecastingDebugActive = !b_forecastingDebugActive; - - - - DEBUGGING - - - - false - 1784028539652 - - 1895 - -780 - - true - true - false - SHAPE_DRAW_2D3D - - false - -16777216 - true - GridConnection GC = c_selectedGridConnections.get(0); - -I_HeatingManagement heatingManagement = new J_HeatingManagementProfileHybridHeatPump(GC, energyModel.p_timeParameters, GC.f_getCurrentHeatingType()); -GC.f_setHeatingManagement(heatingManagement); - - - - HYBRID SIMPLE - - - - false - 1784028665098 - - 1895 - -740 - - true - true - false - SHAPE_DRAW_2D3D - - false - -16777216 - true - GridConnection GC = c_selectedGridConnections.get(0); - -I_HeatingManagement heatingManagement = new J_HeatingManagementPIcontrol(GC, energyModel.p_timeParameters, GC.f_getCurrentHeatingType()); -GC.f_setHeatingManagement(heatingManagement); - - - - PI CONTROL - - - - false - 1784028702655 - - 1895 - -700 - - true - true - false - SHAPE_DRAW_2D3D - - false - -16777216 - true - GridConnection GC = c_selectedGridConnections.get(0); - -I_HeatingManagement heatingManagement = new J_HeatingManagementPIcontrolHybridHeatpump(GC, energyModel.p_timeParameters, GC.f_getCurrentHeatingType()); -GC.f_setHeatingManagement(heatingManagement); - - - - HYBRID PI CONTROL - - - - false - 1784028714752 - - 1895 - -815 - - true - true - false - SHAPE_DRAW_2D3D - - false - -16777216 - true - GridConnection GC = c_selectedGridConnections.get(0); - -I_HeatingManagement heatingManagement = new J_HeatingManagementSimple(GC, energyModel.p_timeParameters, GC.f_getCurrentHeatingType()); -GC.f_setHeatingManagement(heatingManagement); - - - - SIMPLE HEATING - - diff --git a/_alp/Agents/Zero_Interface/Variables.xml b/_alp/Agents/Zero_Interface/Variables.xml index 92ecbf65..7be6f945 100644 --- a/_alp/Agents/Zero_Interface/Variables.xml +++ b/_alp/Agents/Zero_Interface/Variables.xml @@ -2161,28 +2161,6 @@ - - 1784019199639 - - 1400 - -720 - - false - true - true - - - - - - - 1715858732720