diff --git a/_alp/Agents/UI_Tabs/EmbeddedObjects.xml b/_alp/Agents/UI_Tabs/EmbeddedObjects.xml
index 5c31394..16b4ac3 100644
--- a/_alp/Agents/UI_Tabs/EmbeddedObjects.xml
+++ b/_alp/Agents/UI_Tabs/EmbeddedObjects.xml
@@ -75,13 +75,13 @@
-
+
-
+
-
+
true
diff --git a/_alp/Agents/Zero_Interface/AOC.Zero_Interface.xml b/_alp/Agents/Zero_Interface/AOC.Zero_Interface.xml
index 11d49d4..e747af1 100644
--- a/_alp/Agents/Zero_Interface/AOC.Zero_Interface.xml
+++ b/_alp/Agents/Zero_Interface/AOC.Zero_Interface.xml
@@ -19,6 +19,9 @@ import java.time.DayOfWeek;
import java.time.Instant;
import java.text.SimpleDateFormat;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import java.awt.FontMetrics;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
//Possibility to turn of traceln
import java.io.OutputStream;
diff --git a/_alp/Agents/Zero_Interface/Code/Functions.java b/_alp/Agents/Zero_Interface/Code/Functions.java
index bcb7e43..e616632 100644
--- a/_alp/Agents/Zero_Interface/Code/Functions.java
+++ b/_alp/Agents/Zero_Interface/Code/Functions.java
@@ -375,6 +375,36 @@ else if(b.p_annotation != null){
//Set the button for going to the company UI (needs to be at the end of this function!)
f_setUIButton();
+//alle panden met meerdere adressen hebben op dit moment (16-7-24) dezelfde functie(s) voor ieder adres, dus dit is op dit moment zinloos
+//f_listFunctions();
+
+f_updateCustomGCSolarfarmSettings();
+f_updateCustomGCWindfarmSettings();
+f_updateCustomGCGridBatterySettings();
+
+boolean anyCustomSettingsOpen = false;
+if (!c_selectedGridConnections.isEmpty()) {
+ GridConnection selectedGC = c_selectedGridConnections.get(0);
+ if(selectedGC instanceof GCEnergyProduction){
+ if (v_clickedObjectType == OL_GISObjectType.SOLARFARM && c_customSolarfarmGCs.contains((GCEnergyProduction)selectedGC)) {
+ anyCustomSettingsOpen = true;
+ }
+ else if (v_clickedObjectType == OL_GISObjectType.WINDFARM && c_customWindfarmGCs.contains((GCEnergyProduction)selectedGC)) {
+ anyCustomSettingsOpen = true;
+ }
+ }
+ else if (selectedGC instanceof GCGridBattery){
+ if (v_clickedObjectType == OL_GISObjectType.BATTERY && c_customGridBatteryGCs.contains((GCGridBattery)selectedGC)) {
+ anyCustomSettingsOpen = true;
+ }
+ }
+}
+
+if (anyCustomSettingsOpen) {
+ uI_Tabs_presentation.setVisible(false);
+} else {
+ uI_Tabs_presentation.setVisible(true);
+}
/*ALCODEEND*/}
double f_deselectPreviousSelect()
@@ -423,6 +453,9 @@ else if (previousClickedObjectType == OL_GISObjectType.BUILDING ||
v_customEnergyCoop = null;
}
}
+
+// RESTORE tab visibility when closing/deselecting settings
+uI_Tabs_presentation.setVisible(true);
/*ALCODEEND*/}
double f_connectResultsUI()
@@ -1006,8 +1039,7 @@ GISRoute f_createGISLine(double[] GISCoords,OL_GISObjectType objectType)
f_filterGridLoops(toBeFilteredGC);
}
else{
-
- f_setForcedClickScreenText("Selecteer een lus");
+ f_setForcedClickScreenMessageText("Selecteer een lus");
if(!b_inEnergyHubSelectionMode){
f_setForcedClickScreenVisibility(true);
}
@@ -1029,7 +1061,7 @@ GISRoute f_createGISLine(double[] GISCoords,OL_GISObjectType objectType)
f_filterNeighborhoods(toBeFilteredGC);
}
else{
- f_setForcedClickScreenText("Selecteer een buurt");
+ f_setForcedClickScreenMessageText("Selecteer een buurt");
if(!b_inEnergyHubSelectionMode){
f_setForcedClickScreenVisibility(true);
}
@@ -1158,7 +1190,7 @@ else if(c_selectedFilterOptions.contains(selectedFilter)){ // Remove filter
}
if(gr_forceMapSelection.isVisible()){
- f_setForcedClickScreenText("");
+ f_setForcedClickScreenMessageText("");
if(!b_inEnergyHubSelectionMode){
f_setForcedClickScreenVisibility(false);
}
@@ -1353,7 +1385,7 @@ else if(c_selectedFilterOptions.contains(selectedFilter)){ // Remove filter
}
if(gr_forceMapSelection.isVisible()){
- f_setForcedClickScreenText("");
+ f_setForcedClickScreenMessageText("");
if(!b_inEnergyHubSelectionMode){
f_setForcedClickScreenVisibility(false);
}
@@ -1512,15 +1544,14 @@ else if(c_manualFilterDeselectedGC.contains(clickedGC)){
}
/*ALCODEEND*/}
-double f_setForcedClickScreenText(String forcedClickScreenText)
+double f_setForcedClickScreenMessageText(String forcedClickScreenMessageText)
{/*ALCODESTART::1742300624199*/
-t_forcedClickMessage.setText(forcedClickScreenText);
+t_forcedClickMessage.setText(forcedClickScreenMessageText);
+gr_ForceMapSelectionMessageText.setVisible(false);
-if(t_forcedClickMessage.getText().equals("")){
- gr_ForceMapSelectionText.setVisible(false);
-}
-else{
- gr_ForceMapSelectionText.setVisible(true);
+if(!t_forcedClickMessage.getText().equals("")){
+ f_adjustTextToFitRectangle(t_forcedClickMessage, rect_selectText, 25.0, 36);
+ gr_ForceMapSelectionMessageText.setVisible(true);
}
/*ALCODEEND*/}
@@ -2704,7 +2735,7 @@ else if (c_selectedFilterOptions.contains(OL_FilterOptionsGC.GRIDTOPOLOGY_SELECT
b_inEnergyHubMode = true;
b_inEnergyHubSelectionMode = true;
-f_setForcedClickScreenText("");
+f_setForcedClickScreenTextBoxes("Energie Hub Configurator", uI_EnergyHub.p_energyHubBackGroundColor, uI_EnergyHub.p_energyHubLineColor, "", new Color(255, 255, 255), new Color(0, 0, 0));
f_setForcedClickScreenVisibility(true);
cb_showFilterInterface.setSelected(true, true);
@@ -3027,7 +3058,7 @@ ShapeRadioButtonGroup f_getScenarioButtons()
b_inEnergyHubMode = false;
b_inEnergyHubSelectionMode = false;
-f_setForcedClickScreenText("");
+f_setForcedClickScreenTextBoxes("", new Color(255, 255, 255), new Color(0, 0, 0), "", new Color(255, 255, 255), new Color(0, 0, 0));
f_setForcedClickScreenVisibility(false);
cb_showFilterInterface.setSelected(false, true);
@@ -3837,6 +3868,16 @@ List f_getSelectedChartTypes_Energy()
else if(b_inManualFilterSelectionMode){
f_selectManualFilteredGC(clickx, clicky);
}
+else if (b_addCustomGC) {
+ if (!b_customGCPolygonCreated) {
+ f_addCustomGCLocationSelection(clickx, clicky);
+ } else {
+ f_addCustomGCTransformerSelection(clickx, clicky);
+ }
+}
+else if (b_removeCustomGC) {
+ f_removeCustomGCSelection(clickx,clicky);
+}
else{
if (uI_Tabs.pop_tabEHub.size() > 0 && uI_Tabs.pop_tabEHub.get(0).b_inCapacitySharingSelectionMode) {
uI_Tabs.pop_tabEHub.get(0).f_checkGISRegion(clickx, clicky);
@@ -3882,3 +3923,799 @@ else if (c_selectedFilterOptions.contains(OL_FilterOptionsGC.GRIDTOPOLOGY_SELECT
uI_Results.f_updateResultsUI(c_selectedGridConnections.get(0));
/*ALCODEEND*/}
+double f_addCustomSolarfarmGC(GridNode gn)
+{/*ALCODESTART::1777995108231*/
+String id = "Custom_Solarfarm_" + v_customSolarfarmGCCounter++;
+
+// 0. Get existic sliderGC owner
+ConnectionOwner owner = f_getSliderOwnerForCustomGC(OL_EnergyAssetType.PHOTOVOLTAIC);
+if(owner == null){
+ throw new RuntimeException("No owner made your custom EA type!");
+}
+
+// 1. Create the GCEnergyProduction agent
+GCEnergyProduction solarpark = energyModel.add_EnergyProductionSites();
+solarpark.set_p_gridConnectionID(id);
+solarpark.set_p_ownerID(owner.p_actorID);
+solarpark.set_p_owner(owner);
+solarpark.p_parentNodeElectricID = gn.p_gridNodeID;
+solarpark.p_isSliderGC = false; // This affects the slider range + setValue
+
+// 2. Create the GIS Object
+GIS_Object area = f_createAndLinkGISObject(solarpark, id, OL_GISObjectType.SOLARFARM, v_solarParkColor, v_solarParkLineColor);
+
+double area_ha = area.gisRegion.area() / 10000;
+double installedCapacity_kW = area_ha * energyModel.avgc_data.p_avgSolarFieldPower_kWppha;
+double maxContractedCapacity_kW = Math.ceil(installedCapacity_kW / 50.0) * 50.0;
+solarpark.v_liveConnectionMetaData.setCapacities_kW(0, maxContractedCapacity_kW, maxContractedCapacity_kW);
+solarpark.v_liveConnectionMetaData.setCapacitiesKnown(true, true, true);
+
+solarpark.v_liveAssetsMetaData.PVOrientation = OL_PVOrientation.SOUTH;
+
+// 3. Initialize GridConnection
+solarpark.f_initialize(energyModel.p_timeParameters);
+
+// 4. Create the energy asset
+J_EAProduction pvAsset = new J_EAProduction(solarpark, OL_EnergyAssetType.PHOTOVOLTAIC, "Custom PV", OL_EnergyCarriers.ELECTRICITY, installedCapacity_kW, energyModel.p_timeParameters, energyModel.pp_PVProduction35DegSouth_fr);
+
+// 6. Update collections, sliders and legend
+c_customSolarfarmGCs.add(solarpark);
+if (!c_modelActiveSpecialGISObjects.contains(area.p_GISObjectType)) {
+ c_modelActiveSpecialGISObjects.add(area.p_GISObjectType);
+}
+if (!uI_Tabs.pop_tabElectricity.isEmpty()) {
+ uI_Tabs.pop_tabElectricity.get(0).f_updateSliders_Electricity();
+}
+f_refreshLegend();
+
+// 7. Select the newly created asset immediately to update and set settings panel sliders
+ArrayList selectedList = new ArrayList<>();
+selectedList.add(area);
+f_selectBuilding(area, selectedList);
+
+traceln("Successfully added custom solarfarm");
+/*ALCODEEND*/}
+
+double f_removeCustomGC(GridConnection gc)
+{/*ALCODESTART::1777995108233*/
+gc.f_setActive(false, energyModel.p_timeVariables);
+
+// 1. Remove energy assets
+for(J_EA ea : new ArrayList<>(gc.c_energyAssets)) {
+ ea.removeEnergyAsset();
+}
+
+// 2. Remove GIS Object
+OL_GISObjectType removedGISType = null;
+for (GIS_Object obj : new ArrayList<>(gc.c_connectedGISObjects)) {
+ removedGISType = obj.p_GISObjectType;
+ obj.gisRegion.setVisible(false);
+ energyModel.remove_pop_GIS_Objects(obj);
+}
+
+// 3. Remove from collections
+energyModel.c_pausedGridConnections.remove(gc);
+if (gc instanceof GCEnergyProduction) {
+ energyModel.remove_EnergyProductionSites((GCEnergyProduction)gc);
+ if(c_customSolarfarmGCs.contains((GCEnergyProduction)gc)){
+ c_customSolarfarmGCs.remove(gc);
+ }
+ else if(c_customWindfarmGCs.contains((GCEnergyProduction)gc)){
+ c_customWindfarmGCs.remove(gc);
+ }
+} else if (gc instanceof GCGridBattery) {
+ energyModel.remove_GridBatteries((GCGridBattery)gc);
+ c_customGridBatteryGCs.remove((GCGridBattery)gc);
+}
+
+// 4. Refresh slider + legend to account for changes
+if (removedGISType != null) {
+ boolean typeExists = false;
+ // Verify if any assets of this type still exist in the simulation
+ for (GIS_Object obj : energyModel.pop_GIS_Objects) {
+ if (obj.p_GISObjectType == removedGISType && obj.gisRegion != null && obj.gisRegion.isVisible()) {
+ typeExists = true;
+ break;
+ }
+ }
+ if (!typeExists) {
+ c_modelActiveSpecialGISObjects.remove(removedGISType);
+ }
+}
+if (!uI_Tabs.pop_tabElectricity.isEmpty()) {
+ uI_Tabs.pop_tabElectricity.get(0).f_updateSliders_Electricity();
+}
+f_refreshLegend();
+/*ALCODEEND*/}
+
+double f_addCustomWindfarmGC(GridNode gn)
+{/*ALCODESTART::1777995108235*/
+String id = "Custom_Windfarm_" + v_customWindfarmGCCounter++;
+
+// 0. Get existic sliderGC owner
+ConnectionOwner owner = f_getSliderOwnerForCustomGC(OL_EnergyAssetType.WINDMILL);
+if(owner == null){
+ throw new RuntimeException("No owner made your custom EA type!");
+}
+
+// 1. Create the GCEnergyProduction agent
+GCEnergyProduction windpark = energyModel.add_EnergyProductionSites();
+windpark.set_p_gridConnectionID(id);
+windpark.set_p_ownerID(owner.p_actorID);
+windpark.set_p_owner(owner);
+windpark.p_parentNodeElectricID = gn.p_gridNodeID;
+windpark.p_isSliderGC = false; // This affects the slider range + setValue
+
+// 2. Set capacity
+double defaultCapacity_kW = 500;
+windpark.v_liveConnectionMetaData.setCapacities_kW(0, defaultCapacity_kW, defaultCapacity_kW);
+windpark.v_liveConnectionMetaData.setCapacitiesKnown(true, true, true);
+
+// 3. Initialize GridConnection
+windpark.f_initialize(energyModel.p_timeParameters);
+
+// 4. Create the Energy Asset
+J_EAProduction windAsset = new J_EAProduction(windpark, OL_EnergyAssetType.WINDMILL, "Custom Windpark", OL_EnergyCarriers.ELECTRICITY, defaultCapacity_kW, energyModel.p_timeParameters, energyModel.pp_windProduction_fr);
+
+// 5. Create the GIS Object
+GIS_Object area = f_createAndLinkGISObject(windpark, id, OL_GISObjectType.WINDFARM, v_windFarmColor, v_windFarmLineColor);
+
+// 6. Update collections, sliders and legend
+c_customWindfarmGCs.add(windpark);
+if (!c_modelActiveSpecialGISObjects.contains(area.p_GISObjectType)) {
+ c_modelActiveSpecialGISObjects.add(area.p_GISObjectType);
+}
+if (!uI_Tabs.pop_tabElectricity.isEmpty()) {
+ uI_Tabs.pop_tabElectricity.get(0).f_updateSliders_Electricity();
+}
+f_refreshLegend();
+
+// 7. Select the newly created asset immediately to update and set settings panel sliders
+ArrayList selectedList = new ArrayList<>();
+selectedList.add(area);
+f_selectBuilding(area, selectedList);
+
+traceln("Successfully added custom windfarm");
+/*ALCODEEND*/}
+
+double f_addCustomGridBatteryGC(GridNode gn)
+{/*ALCODESTART::1777995108237*/
+String id = "Custom_Grid_Battery_" + v_customGridBatteryGCCounter++;
+
+// 0. Get existic sliderGC owner
+ConnectionOwner owner = f_getSliderOwnerForCustomGC(OL_EnergyAssetType.STORAGE_ELECTRIC);
+if(owner == null){
+ throw new RuntimeException("No owner made your custom EA type!");
+}
+
+// 1. Create the GCGridBattery agent
+GCGridBattery battery = energyModel.add_GridBatteries();
+battery.set_p_gridConnectionID(id);
+battery.set_p_ownerID(owner.p_actorID);
+battery.set_p_owner(owner);
+battery.p_parentNodeElectricID = gn.p_gridNodeID;
+battery.p_isSliderGC = false; // This affects the slider range + setValue
+
+// 2. Set capacity
+double defaultCapacity_kW = 250;
+double defaultStorageCapacity_kWh = 2*defaultCapacity_kW;
+battery.v_liveConnectionMetaData.setCapacities_kW(defaultCapacity_kW, defaultCapacity_kW, defaultCapacity_kW);
+battery.v_liveConnectionMetaData.setCapacitiesKnown(true, true, true);
+
+// 3. Initialize GridConnection
+battery.f_initialize(energyModel.p_timeParameters);
+
+// 4. Create the energy asset + pick default operation mode management class
+J_EAStorageElectric batteryAsset = new J_EAStorageElectric(battery, defaultCapacity_kW, defaultStorageCapacity_kWh, 0.5, energyModel.p_timeParameters);
+I_BatteryManagement batteryAlgorithm = new J_BatteryManagementSelfConsumptionGridNode(battery, energyModel.p_timeParameters);
+battery.f_setBatteryManagement(batteryAlgorithm);
+
+// 5. Create GIS Object
+GIS_Object area = f_createAndLinkGISObject(battery, id, OL_GISObjectType.BATTERY, v_batteryColor, v_batteryLineColor);
+
+// 6. Update collections, sliders and legend
+c_customGridBatteryGCs.add(battery);
+if (!c_modelActiveSpecialGISObjects.contains(area.p_GISObjectType)) {
+ c_modelActiveSpecialGISObjects.add(area.p_GISObjectType);
+}
+if (!uI_Tabs.pop_tabElectricity.isEmpty()) {
+ uI_Tabs.pop_tabElectricity.get(0).f_updateSliders_Electricity();
+}
+f_refreshLegend();
+
+// 7. Select the newly created asset immediately to update and set settings panel sliders
+ArrayList selectedList = new ArrayList<>();
+selectedList.add(area);
+f_selectBuilding(area, selectedList);
+
+traceln("Successfully added custom grid battery");
+/*ALCODEEND*/}
+
+double f_updateCustomGCSolarfarmSettings()
+{/*ALCODESTART::1778162093872*/
+if (c_selectedGridConnections.isEmpty()) {
+ return;
+}
+
+GridConnection selectedGC = c_selectedGridConnections.get(0);
+if (!(selectedGC instanceof GCEnergyProduction) || !c_customSolarfarmGCs.contains(selectedGC)) {
+ return;
+}
+
+GCEnergyProduction gc = (GCEnergyProduction) selectedGC;
+J_EAProduction pvAsset = (J_EAProduction) gc.c_productionAssets.get(0);
+
+// Installed capacity per hectare
+double currentCapacity_kW = pvAsset.getCapacityElectric_kW();
+double area_m2 = gc.c_connectedGISObjects.get(0).gisRegion.area();
+double area_ha = area_m2 / 10000.0;
+double currentCapacity_kWpha = currentCapacity_kW / area_ha;
+
+sl_customGCSolarfarmInstalledCapacity_kWpha.setRange((int)(0.5*energyModel.avgc_data.p_avgSolarFieldPower_kWppha), (int)(2*energyModel.avgc_data.p_avgSolarFieldPower_kWppha));
+sl_customGCSolarfarmInstalledCapacity_kWpha.setValue(currentCapacity_kWpha, false);
+
+// PV Orientation
+J_ProfilePointer currentProfile = pvAsset.getProfilePointer();
+String currentOrientationLabel = "Zuid (15°)"; // Default
+if (currentProfile == energyModel.pp_PVProduction15DegEastWest_fr) {
+ currentOrientationLabel = "Oost/West (35°)";
+}
+cb_customGCSolarfarmPVOrientation.setValue(currentOrientationLabel, false);
+
+// Curtailment
+boolean hasCurtailment = gc.f_isAssetManagementActive(I_CurtailManagement.class);
+cb_customGCSolarfarmCurtailment.setSelected(hasCurtailment, false);
+
+// Contracted capacity limit
+double maxContractedCapacity_kW = Math.ceil(currentCapacity_kW / 50.0) * 50.0;
+
+sl_customGCSolarfarmContractedCapacity_kW.setRange(0, maxContractedCapacity_kW);
+sl_customGCSolarfarmContractedCapacity_kW.setValue(gc.v_liveConnectionMetaData.getContractedFeedinCapacity_kW(), false);
+
+/*ALCODEEND*/}
+
+double f_updateCustomGCWindfarmSettings()
+{/*ALCODESTART::1778241627082*/
+if (c_selectedGridConnections.isEmpty()) {
+ return;
+}
+
+GridConnection selectedGC = c_selectedGridConnections.get(0);
+if (!(selectedGC instanceof GCEnergyProduction) || !c_customWindfarmGCs.contains(selectedGC)) {
+ return;
+}
+
+GCEnergyProduction gc = (GCEnergyProduction) selectedGC;
+J_EAProduction windAsset = (J_EAProduction) gc.c_productionAssets.get(0);
+
+// Installed capacity
+double currentCapacity_MW = windAsset.getCapacityElectric_kW()/1000;
+
+sl_customGCWindfarmInstalledCapacity_MW.setRange(0.1, 10);
+sl_customGCWindfarmInstalledCapacity_MW.setValue(currentCapacity_MW, false); // false prevents triggering ActionCode
+
+// Curtailment
+boolean hasCurtailment = gc.f_isAssetManagementActive(I_CurtailManagement.class);
+cb_customGCWindfarmCurtailment.setSelected(hasCurtailment, false);
+
+// Contracted capacity limit
+sl_customGCWindfarmContractedCapacity_MW.setRange(0, currentCapacity_MW);
+sl_customGCWindfarmContractedCapacity_MW.setValue(gc.v_liveConnectionMetaData.getContractedFeedinCapacity_kW()/1000, false);
+/*ALCODEEND*/}
+
+double f_updateCustomGCGridBatterySettings()
+{/*ALCODESTART::1778281342673*/
+if (c_selectedGridConnections.isEmpty()) {
+ return;
+}
+
+GridConnection selectedGC = c_selectedGridConnections.get(0);
+if (!(selectedGC instanceof GCGridBattery) || !c_customGridBatteryGCs.contains(selectedGC)) {
+ return;
+}
+
+GCGridBattery gc = (GCGridBattery) selectedGC;
+J_EAStorageElectric batteryAsset = (J_EAStorageElectric)gc.c_storageAssets.get(0);
+
+// Installed capacity
+double currentCapacity_kWh = batteryAsset.getStorageCapacity_kWh();
+double currentCapacity_kW = batteryAsset.getCapacityElectric_kW();
+
+sl_customGCGridBatteryInstalledCapacity_kWh.setRange(100, 5000);
+sl_customGCGridBatteryInstalledCapacity_kWh.setValue(currentCapacity_kWh, false);
+
+sl_customGCGridBatteryInstalledCapacity_kW.setRange(50, 2500);
+sl_customGCGridBatteryInstalledCapacity_kW.setValue(currentCapacity_kW, false);
+
+// Battery management selection
+I_BatteryManagement currentBatteryManagement = gc.f_getBatteryManagement();
+String currentBMS_str = "Zelfverbruik"; // Default fallback
+
+if (currentBatteryManagement instanceof J_BatteryManagementSelfConsumptionGridNode) {
+ currentBMS_str = "Zelfverbruik";
+} else if (currentBatteryManagement instanceof J_BatteryManagementPeakShaving) {
+ currentBMS_str = "Peak shaving";
+} else if (currentBatteryManagement instanceof J_BatteryManagementPrice) {
+ currentBMS_str = "Prijssturing";
+}
+cb_customGCGridBatteryAlgorithm.setValue(currentBMS_str, false);
+/*ALCODEEND*/}
+
+ConnectionOwner f_getSliderOwnerForCustomGC(OL_EnergyAssetType eaType)
+{/*ALCODESTART::1778854379860*/
+if (!uI_Tabs.pop_tabElectricity.isEmpty()) {
+ tabElectricity tabElec = uI_Tabs.pop_tabElectricity.get(0);
+ for (GridConnection gc : tabElec.c_electricityTabEASliderGCs) {
+ if (eaType == OL_EnergyAssetType.PHOTOVOLTAIC || eaType == OL_EnergyAssetType.WINDMILL) {
+ if (gc instanceof GCEnergyProduction) {
+ for (J_EAProduction ea : ((GCEnergyProduction)gc).c_productionAssets) {
+ if (ea.getEAType() == eaType) {
+ return gc.p_owner;
+ }
+ }
+ }
+ } else if (eaType == OL_EnergyAssetType.STORAGE_ELECTRIC) {
+ if (gc instanceof GCGridBattery) {
+ return gc.p_owner;
+ }
+ }
+ }
+}
+return null;
+/*ALCODEEND*/}
+
+GIS_Object f_createAndLinkGISObject(GridConnection gc,String id,OL_GISObjectType gisType,Color fillColor,Color lineColor)
+{/*ALCODESTART::1778855159263*/
+GIS_Object area = energyModel.add_pop_GIS_Objects();
+area.p_id = id;
+area.p_GISObjectType = gisType;
+area.p_latitude = c_tempSavedCoordinates.get(0).getFirst();
+area.p_longitude = c_tempSavedCoordinates.get(0).getSecond();
+
+// 2. Generate coordinates (circular for windfarm, square for others) and assign to region
+double[] polyCoords;
+if (gisType == OL_GISObjectType.WINDFARM || gisType == OL_GISObjectType.BATTERY) {
+ double area_m2 = f_calculateGISObjectArea(gc, gisType);
+ if (gisType == OL_GISObjectType.WINDFARM) {
+ polyCoords = f_calculateCircleCoordinates(area.p_latitude, area.p_longitude, area_m2);
+ area.gisRegion = f_createGISObject(polyCoords);
+ } else if (gisType == OL_GISObjectType.BATTERY) {
+ polyCoords = f_calculateSquareCoordinates(area.p_latitude, area.p_longitude, area_m2);
+ area.gisRegion = f_createGISObject(polyCoords);
+ }
+} else {
+ polyCoords = f_calculateCustomPolygonCoordinates(c_tempSavedCoordinates);
+ area.gisRegion = f_createGISObject(polyCoords);
+}
+
+// 3. Add to collections
+area.c_containedGridConnections.add(gc);
+gc.c_connectedGISObjects.add(area);
+
+// 4. Apply styling
+area.set_p_defaultFillColor(fillColor);
+area.set_p_defaultLineColor(lineColor);
+area.set_p_defaultLineWidth(v_energyAssetLineWidth);
+f_styleAreas(area);
+
+return area;
+/*ALCODEEND*/}
+
+GIS_Object f_refreshLegend()
+{/*ALCODESTART::1778856248260*/
+// Hide the maximum possible special legend items before rebuilding to prevent UI overlap
+for (int i = 1; i <= 10; i++) {
+ try {
+ Pair legendShapes = f_getNextSpecialLegendShapes(i);
+ if (legendShapes != null && legendShapes.getFirst() != null && legendShapes.getSecond() != null) {
+ legendShapes.getFirst().setVisible(false);
+ legendShapes.getSecond().setVisible(false);
+ }
+ } catch (Exception e) {
+ break; // Stop if we run out of defined legend shapes in the UI
+ }
+}
+// Rebuild the legend using existing functionality
+f_initializeLegend();
+/*ALCODEEND*/}
+
+double f_calculateGISObjectArea(GridConnection gc,OL_GISObjectType gisType)
+{/*ALCODESTART::1778997814360*/
+/**
+ * Calculates the footprint area in square meters (m2) of a custom energy asset based on its capacity.
+ *
+ * - Solar farm: 1 hectare per 'p_avgSolarFieldPower_kWppha' kW
+ * - Wind farm: 1 hectare per 5 MW (5000 kW) capacity
+ * - Battery: 1 hectare per 100 MWh storage capacity (100 m2 per MWh)
+ */
+
+double area_m2 = 100.0; // Default fallback size
+if (gc instanceof GCEnergyProduction prodGC) {
+ if (gisType == OL_GISObjectType.SOLARFARM) {
+ double capacity_kW = 0.0;
+ for (J_EAProduction asset : prodGC.c_productionAssets) {
+ if (asset.getEAType() == OL_EnergyAssetType.PHOTOVOLTAIC) {
+ capacity_kW += asset.getCapacityElectric_kW();
+ }
+ }
+ double capacity_ha = capacity_kW / energyModel.avgc_data.p_avgSolarFieldPower_kWppha;
+ area_m2 = capacity_ha * 10000.0;
+ }
+ else if (gisType == OL_GISObjectType.WINDFARM) {
+ double defaultCapacity_kW = 500.0;
+ double defaultCapacity_ha = (defaultCapacity_kW / 1000.0) / 5.0; // 5 MW per hectare -> 0.1
+ area_m2 = defaultCapacity_ha * 10000.0;
+ }
+}
+else if (gc instanceof GCGridBattery batteryGC) {
+ if (gisType == OL_GISObjectType.BATTERY) {
+ double defaultCapacity_MWh = 500.0 / 1000.0;
+ double defaultCapacity_ha = defaultCapacity_MWh / 100.0; // 100 MWh per hectare -> 0.005 ha
+ area_m2 = defaultCapacity_ha * 10000.0;
+ }
+ }
+return area_m2;
+/*ALCODEEND*/}
+
+double[] f_calculateSquareCoordinates(double lat,double lon,double area_m2)
+{/*ALCODESTART::1778997955081*/
+/**
+ * Computes a list of double coordinates representing a perfectly square polygon centered
+ * at (lat, lon) with a physical area of 'area_m2' in square meters, correcting for local latitude "deformation".
+ */
+
+double side_m = Math.sqrt(area_m2);
+double halfSide_m = side_m / 2.0;
+
+// Earth conversion factors (approximate for localized areas)
+double metersPerDegLat = 111320.0;
+double metersPerDegLon = 111320.0 * Math.cos(Math.toRadians(lat));
+
+double offsetLat = halfSide_m / metersPerDegLat;
+double offsetLon = halfSide_m / metersPerDegLon;
+
+return new double[]{
+ lat + offsetLat, lon - offsetLon, // Top-left
+ lat + offsetLat, lon + offsetLon, // Top-right
+ lat - offsetLat, lon + offsetLon, // Bottom-right
+ lat - offsetLat, lon - offsetLon // Bottom-left
+};
+/*ALCODEEND*/}
+
+double[] f_calculateCircleCoordinates(double lat,double lon,double area_m2)
+{/*ALCODESTART::1781623122174*/
+// A circle's radius in meters from its area in m²: Area = pi * r^2 => r = sqrt(Area / pi)
+double radius_m = Math.sqrt(area_m2 / Math.PI);
+
+// Number of points (vertices) to approximate the circle
+int numPoints = 32;
+double[] polyCoords = new double[numPoints * 2];
+
+// Earth conversion factors (approximate for localized areas)
+double metersPerDegLat = 111320.0;
+double metersPerDegLon = 111320.0 * Math.cos(Math.toRadians(lat));
+
+for (int i = 0; i < numPoints; i++) {
+ double angle = 2.0 * Math.PI * i / numPoints;
+ double offsetLat = (radius_m * Math.sin(angle)) / metersPerDegLat;
+ double offsetLon = (radius_m * Math.cos(angle)) / metersPerDegLon;
+
+ polyCoords[2 * i] = lat + offsetLat;
+ polyCoords[2 * i + 1] = lon + offsetLon;
+}
+
+return polyCoords;
+/*ALCODEEND*/}
+
+double f_addCustomGCLocationSelection(double clickx,double clicky)
+{/*ALCODESTART::1781677700343*/
+// --- PHASE 1: Drawing Polygon Vertices ---
+
+// Add a vertex to the coordinates list
+Pair clickedCoord = new Pair<>(clickx, clicky);
+c_tempSavedCoordinates.add(clickedCoord);
+
+// Place a small square dot on the map representing this vertex
+c_tempSavedDots.add(f_drawTempCoordinateDot(clickx, clicky));
+
+if (v_addCustomGCType == OL_EnergyAssetType.WINDMILL || v_addCustomGCType == OL_EnergyAssetType.STORAGE_ELECTRIC){
+ b_customGCPolygonCreated = true;
+ f_setForcedClickScreenMessageText("Kies een trafo op de kaart");
+} else {
+ // Update instruction text
+ int minNbRequiredVertices = 3;
+ int currentNbOfSavedCoordinates = c_tempSavedCoordinates.size();
+ if(minNbRequiredVertices - currentNbOfSavedCoordinates > 1){
+ f_setForcedClickScreenMessageText("Teken je locatie op de kaart. Kies nog minimaal " + (minNbRequiredVertices - currentNbOfSavedCoordinates) + " hoekpunten.");
+ }
+ else if(minNbRequiredVertices - currentNbOfSavedCoordinates == 1){
+ f_setForcedClickScreenMessageText("Teken je locatie op de kaart. Kies nog minimaal " + (minNbRequiredVertices - currentNbOfSavedCoordinates) + " hoekpunt.");
+ } else {
+ if (previewGISRegion != null) {
+ previewGISRegion.remove();
+ }
+ double[] previewCoords = f_calculateCustomPolygonCoordinates(c_tempSavedCoordinates);
+ previewGISRegion = f_createGISObject(previewCoords);
+ previewGISRegion.setFillColor(new Color(255, 0, 0, 50)); // Semi-transparent red
+ previewGISRegion.setLineColor(Color.RED);
+ previewGISRegion.setLineWidth(1.0);
+ f_setForcedClickScreenMessageText("Huidig aantal hoekpunten: " + currentNbOfSavedCoordinates + ". Klik op 'Voltooien' om te bevestigen.");
+ }
+}
+
+f_deselectPreviousSelect();
+/*ALCODEEND*/}
+
+double f_addCustomGCTransformerSelection(double clickx,double clicky)
+{/*ALCODESTART::1781677735606*/
+// --- PHASE 2: Choose transformer to connect to ---
+GridNode clickedGN = null;
+for (GridNode GN : energyModel.pop_gridNodes) {
+ if (GN.gisRegion != null && GN.gisRegion.contains(clickx, clicky) && GN.gisRegion.isVisible()) {
+ clickedGN = GN;
+ break;
+ }
+}
+
+if (clickedGN != null) {
+ if (v_addCustomGCType == OL_EnergyAssetType.PHOTOVOLTAIC){
+ f_addCustomSolarfarmGC(clickedGN);
+ } else if (v_addCustomGCType == OL_EnergyAssetType.WINDMILL){
+ f_addCustomWindfarmGC(clickedGN);
+ } else if (v_addCustomGCType == OL_EnergyAssetType.STORAGE_ELECTRIC){
+ f_addCustomGridBatteryGC(clickedGN);
+ }
+ // Clean up coordinate temporary dots, state variables, lists
+ f_stopCustomGCCreation();
+
+ return;
+} else {
+ traceln("Please click on a valid transformer (GridNode).");
+ return;
+}
+/*ALCODEEND*/}
+
+double f_removeCustomGCSelection(double clickx,double clicky)
+{/*ALCODESTART::1781678055851*/
+// Group all GIS objects to check for the click
+List allGISObjects = new ArrayList<>();
+for(GIS_Building b : energyModel.pop_GIS_Buildings) {
+ allGISObjects.add(b);
+}
+for(GIS_Object object : energyModel.pop_GIS_Objects){
+ allGISObjects.add(object);
+}
+for (GIS_Object GISObject : allGISObjects) {
+ if (GISObject.gisRegion != null && GISObject.gisRegion.contains(clickx, clicky) && GISObject.gisRegion.isVisible()) {
+ if (GISObject.c_containedGridConnections.size() > 0) {
+ GridConnection gc = GISObject.c_containedGridConnections.get(0);
+
+ // Only allow deletion of specific energy asset types
+ if (gc instanceof GCEnergyProduction || gc instanceof GCGridBattery) {
+ f_removeCustomGC(gc);
+ b_removeCustomGC = false; // Reset mode after deletion
+ traceln("Removed the energy asset: " + gc.p_gridConnectionID);
+ return;
+ }
+ }
+ }
+}
+// If the user clicks elsewhere, cancel the deletion mode
+b_removeCustomGC = false;
+traceln("Deletion mode cancelled.");
+/*ALCODEEND*/}
+
+GISRegion f_drawTempCoordinateDot(double lat,double lon)
+{/*ALCODESTART::1781682728045*/
+//Draw a small dot (2m x 2m square = 4m²) on map at clicked coordinates
+double[] polyCoords = f_calculateSquareCoordinates(lat, lon, 25);
+
+GISRegion dot = f_createGISObject(polyCoords);
+dot.setFillColor(Color.RED);
+dot.setLineColor(Color.WHITE);
+dot.setLineWidth(1.0);
+
+return dot;
+/*ALCODEEND*/}
+
+double f_stopCustomGCCreation()
+{/*ALCODESTART::1781688506944*/
+// Clean up temporary dot markers, preview polygon, and coordinates list
+f_resetCustomGCCreation();
+
+// Reset state variables
+b_customGCPolygonCreated = false;
+b_addCustomGC = false;
+v_addCustomGCType = null;
+b_removeCustomGC = false;
+
+// Hide forced click screen, if needed
+f_setForcedClickScreenVisibility(false);
+f_setForcedClickScreenTextBoxes("", new Color(255, 255, 255), new Color(0, 0, 0), "", new Color(255, 255, 255), new Color(0, 0, 0));
+/*ALCODEEND*/}
+
+double[] f_calculateCustomPolygonCoordinates(List> coordinateList)
+{/*ALCODESTART::1781694164851*/
+int size = coordinateList.size();
+double[] polyCoords = new double[size * 2];
+for (int i = 0; i < size; i++) {
+ Pair p = coordinateList.get(i);
+ polyCoords[2 * i] = p.getFirst();
+ polyCoords[2 * i + 1] = p.getSecond();
+}
+return polyCoords;
+/*ALCODEEND*/}
+
+double f_setForcedClickScreenTitleText(String forcedClickScreenText)
+{/*ALCODESTART::1781861106301*/
+txt_forcedClickTitle.setText(forcedClickScreenText);
+gr_forcedClickTitleTxt.setVisible(false);
+
+if(!txt_forcedClickTitle.getText().equals("")){
+ f_adjustTextToFitRectangle(txt_forcedClickTitle, rect_forcedClickTitle, 25.0, 48);
+ gr_forcedClickTitleTxt.setVisible(true);
+}
+/*ALCODEEND*/}
+
+double f_setForcedClickScreenTitleBackgroundColor(Color fillColor,Color lineColor)
+{/*ALCODESTART::1781863042854*/
+rect_forcedClickTitle.setFillColor(fillColor);
+rect_forcedClickTitle.setLineColor(lineColor);
+/*ALCODEEND*/}
+
+double f_setForcedClickScreenTextBoxes(String titleText,Color titleBackgroundFillColor,Color titleBackgroundLineColor,String messageText,Color messageBackgroundFillColor,Color messageBackgroundLineColor)
+{/*ALCODESTART::1782123595562*/
+f_setForcedClickScreenTitleText(titleText);
+f_setForcedClickScreenTitleBackgroundColor(titleBackgroundFillColor, titleBackgroundLineColor);
+f_setForcedClickScreenMessageText(messageText);
+f_setForcedClickScreenMessageBackgroundColor(messageBackgroundFillColor, messageBackgroundLineColor);
+/*ALCODEEND*/}
+
+double f_setForcedClickScreenMessageBackgroundColor(Color fillColor,Color lineColor)
+{/*ALCODESTART::1782123808280*/
+rect_selectText.setFillColor(fillColor);
+rect_selectText.setLineColor(lineColor);
+/*ALCODEEND*/}
+
+double f_adjustTextToFitRectangle(ShapeText textShape,ShapeRectangle rectShape,double margin,int defaultFontSize)
+{/*ALCODESTART::1782206478165*/
+if (textShape == null || textShape.getText() == null || textShape.getText().isEmpty() || rectShape == null) {
+ return;
+}
+
+// Resetting of default fontsize to prevent overflow
+Font font = textShape.getFont();
+if (font != null) {
+ Font defaultFont = font.deriveFont((float) defaultFontSize);
+ textShape.setFont(defaultFont);
+}
+
+double rectWidth = rectShape.getWidth();
+double rectHeight = rectShape.getHeight();
+double rectX = rectShape.getX();
+double rectY = rectShape.getY();
+double targetWidth = rectWidth - 2 * margin;
+
+
+String text = textShape.getText();
+Font currentFont = textShape.getFont();
+BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
+Graphics2D g2d = img.createGraphics();
+try {
+ FontMetrics fm = g2d.getFontMetrics(currentFont);
+
+ // Find longest line of text (if ShapeText contains multiple sentences)
+ String[] lines = text.split("\n");
+ double maxLineWidth = 0;
+ for (String line : lines) {
+ double lineWidth = fm.stringWidth(line);
+ if (lineWidth > maxLineWidth) {
+ maxLineWidth = lineWidth;
+ }
+ }
+
+ // Scale down the font if it exceeds the maximum target width
+ if (maxLineWidth > targetWidth) {
+ double scaleFactor = targetWidth / maxLineWidth;
+ double newSizeDouble = defaultFontSize * scaleFactor;
+ float newSize = (float) Math.floor(newSizeDouble);
+
+ Font scaledFont = currentFont.deriveFont(newSize);
+ textShape.setFont(scaledFont);
+ fm = g2d.getFontMetrics(scaledFont);
+ }
+
+ double textHeight = lines.length * fm.getHeight();
+ double newY = rectY + 0.5*(rectHeight - textHeight);
+ textShape.setY(newY);
+
+} finally {
+ g2d.dispose();
+}
+/*ALCODEEND*/}
+
+double f_resetCustomGCCreation()
+{/*ALCODESTART::1782220715178*/
+// Clean up temporary dot markers
+for (GISRegion dot : c_tempSavedDots) {
+ if (dot != null) {
+ dot.remove();
+ }
+}
+c_tempSavedDots.clear();
+
+// Clean up preview polygon
+if (previewGISRegion != null) {
+ previewGISRegion.remove();
+ previewGISRegion = null;
+}
+
+// Clear coordinates list
+c_tempSavedCoordinates.clear();
+/*ALCODEEND*/}
+
+boolean f_checkCustomPolygonSelfIntersection()
+{/*ALCODESTART::1782222661974*/
+int n = c_tempSavedCoordinates.size();
+if (n < 4) {
+ return false; // A polygon with less than 4 vertices cannot self-intersect
+}
+// Helper class for robust geometric computations
+class GeoUtil {
+ // Checks if point q lies on line segment pr
+ boolean onSegment(double px, double py, double qx, double qy, double rx, double ry) {
+ return qx <= Math.max(px, rx) && qx >= Math.min(px, rx) &&
+ qy <= Math.max(py, ry) && qy >= Math.min(py, ry);
+ }
+ // Finds the orientation of ordered triplet (p, q, r).
+ // Returns:
+ // 0 -> p, q and r are collinear
+ // 1 -> Clockwise
+ // 2 -> Counterclockwise
+ int orientation(double px, double py, double qx, double qy, double rx, double ry) {
+ double val = (qy - py) * (rx - qx) - (qx - px) * (ry - qy);
+ if (Math.abs(val) < 1e-9) return 0; // Collinear within precision threshold
+ return (val > 0) ? 1 : 2;
+ }
+ // Checks if line segment p1q1 and p2q2 intersect
+ boolean doIntersect(double p1x, double p1y, double q1x, double q1y,
+ double p2x, double p2y, double q2x, double q2y) {
+ int o1 = orientation(p1x, p1y, q1x, q1y, p2x, p2y);
+ int o2 = orientation(p1x, p1y, q1x, q1y, q2x, q2y);
+ int o3 = orientation(p2x, p2y, q2x, q2y, p1x, p1y);
+ int o4 = orientation(p2x, p2y, q2x, q2y, q1x, q1y);
+ // General Case: Segments cross each other
+ if (o1 != o2 && o3 != o4) return true;
+ // Special Cases (Collinear segments overlapping)
+ if (o1 == 0 && onSegment(p1x, p1y, p2x, p2y, q1x, q1y)) return true;
+ if (o2 == 0 && onSegment(p1x, p1y, q2x, q2y, q1x, q1y)) return true;
+ if (o3 == 0 && onSegment(p2x, p2y, p1x, p1y, q2x, q2y)) return true;
+ if (o4 == 0 && onSegment(p2x, p2y, q1x, q1y, q2x, q2y)) return true;
+ return false;
+ }
+}
+
+GeoUtil geo = new GeoUtil();
+// Verify every pair of non-adjacent edges for intersection
+for (int i = 0; i < n; i++) {
+ double p1x = c_tempSavedCoordinates.get(i).getFirst();
+ double p1y = c_tempSavedCoordinates.get(i).getSecond();
+ double q1x = c_tempSavedCoordinates.get((i + 1) % n).getFirst();
+ double q1y = c_tempSavedCoordinates.get((i + 1) % n).getSecond();
+ for (int j = i + 2; j < n; j++) {
+ // Skip adjacent edges (they naturally touch at their common vertex)
+ if (i == 0 && j == n - 1) {
+ continue;
+ }
+ double p2x = c_tempSavedCoordinates.get(j).getFirst();
+ double p2y = c_tempSavedCoordinates.get(j).getSecond();
+ double q2x = c_tempSavedCoordinates.get((j + 1) % n).getFirst();
+ double q2y = c_tempSavedCoordinates.get((j + 1) % n).getSecond();
+ if (geo.doIntersect(p1x, p1y, q1x, q1y, p2x, p2y, q2x, q2y)) {
+ return true; // Self-intersection detected
+ }
+ }
+}
+return false; // Polygon is valid
+/*ALCODEEND*/}
+
diff --git a/_alp/Agents/Zero_Interface/Code/Functions.xml b/_alp/Agents/Zero_Interface/Code/Functions.xml
index fc67cf6..122c980 100644
--- a/_alp/Agents/Zero_Interface/Code/Functions.xml
+++ b/_alp/Agents/Zero_Interface/Code/Functions.xml
@@ -1118,9 +1118,9 @@
VOID
double
1742300624199
-
- 140
- -880
+
+ 160
+ -2240
@@ -1857,7 +1857,7 @@
1753445407428
140
- -860
+ -2320
+
+ VOID
+ double
+ 1777995108231
+
+ -520
+ 1460
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+ VOID
+ double
+ 1777995108233
+
+ -520
+ 1700
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+ VOID
+ double
+ 1777995108235
+
+ -520
+ 1480
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+ VOID
+ double
+ 1777995108237
+
+ -520
+ 1500
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+ VOID
+ double
+ 1778162093872
+
+ 1340
+ -2740
+
+ false
+ true
+ true
+
+
+
+ VOID
+ double
+ 1778241627082
+
+ 1340
+ -2720
+
+ false
+ true
+ true
+
+
+
+ VOID
+ double
+ 1778281342673
+
+ 1340
+ -2700
+
+ false
+ true
+ true
+
+
+
+ RETURNS_VALUE
+ ConnectionOwner
+ 1778854379860
+
+ -500
+ 1520
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+ RETURNS_VALUE
+ GIS_Object
+ 1778855159263
+
+ -520
+ 1540
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ VOID
+ GIS_Object
+ 1778856248260
+
+ 1540
+ 1550
+
+ false
+ true
+ true
+
+
+
+ RETURNS_VALUE
+ double
+ 1778997814360
+
+ -500
+ 1560
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+ RETURNS_VALUE
+ double[]
+ 1778997955081
+
+ -500
+ 1580
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ RETURNS_VALUE
+ double[]
+ 1781623122174
+
+ -500
+ 1600
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ VOID
+ double
+ 1781677700343
+
+ -540
+ 1320
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+ VOID
+ double
+ 1781677735606
+
+ -540
+ 1440
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+ VOID
+ double
+ 1781678055851
+
+ -540
+ 1680
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+ RETURNS_VALUE
+ GISRegion
+ 1781682728045
+
+ -520
+ 1400
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+ VOID
+ double
+ 1781688506944
+
+ -540
+ 1640
+
+ false
+ true
+ true
+
+
+
+ RETURNS_VALUE
+ double[]
+ 1781694164851
+
+ -500
+ 1620
+
+ false
+ true
+ true
+
+
+ >]]>
+
+
+
+
+ VOID
+ double
+ 1781861106301
+
+ 160
+ -2280
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+ VOID
+ double
+ 1781863042854
+
+ 160
+ -2260
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+ VOID
+ double
+ 1782123595562
+
+ 140
+ -2300
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ VOID
+ double
+ 1782123808280
+
+ 160
+ -2220
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+ VOID
+ double
+ 1782206478165
+
+ -540
+ 1730
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ VOID
+ double
+ 1782220715178
+
+ -520
+ 1660
+
+ false
+ true
+ true
+
+
+
+ RETURNS_VALUE
+ boolean
+ 1782222661974
+
+ -520
+ 1420
+
+ false
+ true
+ true
+
+
diff --git a/_alp/Agents/Zero_Interface/Levels/Level.level.xml b/_alp/Agents/Zero_Interface/Levels/Level.level.xml
index be478f5..5cd266c 100644
--- a/_alp/Agents/Zero_Interface/Levels/Level.level.xml
+++ b/_alp/Agents/Zero_Interface/Levels/Level.level.xml
@@ -2215,7 +2215,7 @@ else{
-1
-16777216
true
- !gr_ForceMapSelectionText.isVisible()
+ !gr_ForceMapSelectionMessageText.isVisible()
if(!cb_filterOptions.getValue().equals("-")){
f_setFilter(map_UINamesFilterOption.get(cb_filterOptions.getValue()));
@@ -2341,7 +2341,7 @@ if (c_manualFilterSelectedGC.isEmpty() && c_manualFilterDeselectedGC.isE
f_setFilter(OL_FilterOptionsGC.MANUAL_SELECTION);
}
-f_setForcedClickScreenText("");
+f_setForcedClickScreenMessageText("");
if(!b_inEnergyHubSelectionMode){
f_setForcedClickScreenVisibility(false);
}
@@ -2431,7 +2431,7 @@ traceln("Alle filters zijn verwijderd.");
c_manualFilterSelectedGC.clear();
c_manualFilterDeselectedGC.clear();
- f_setForcedClickScreenText("");
+ f_setForcedClickScreenMessageText("");
if(!b_inEnergyHubSelectionMode){
f_setForcedClickScreenVisibility(false);
}
@@ -2465,12 +2465,13 @@ traceln("Alle filters zijn verwijderd.");
false
-16777216
true
- user.GCAccessType == OL_UserGCAccessType.FULL && (!gr_ForceMapSelectionText.isVisible() || b_inManualFilterSelectionMode)
+ user.GCAccessType == OL_UserGCAccessType.FULL && (!gr_ForceMapSelectionMessageText.isVisible() || b_inManualFilterSelectionMode)
if(!b_inManualFilterSelectionMode){
b_inManualFilterSelectionMode = true;
- f_setForcedClickScreenText("(De)Selecteer gebouwen");
+ f_setForcedClickScreenMessageText("(De)Selecteer gebouwen");
if(!b_inEnergyHubSelectionMode){
+ f_setForcedClickScreenTitleText("");
f_setForcedClickScreenVisibility(true);
}
@@ -2481,7 +2482,7 @@ traceln("Alle filters zijn verwijderd.");
else{
b_inManualFilterSelectionMode = false;
- f_setForcedClickScreenText("");
+ f_setForcedClickScreenMessageText("");
if(!b_inEnergyHubSelectionMode){
f_setForcedClickScreenVisibility(false);
}
@@ -3689,7 +3690,7 @@ officia deserunt mollit anim id est laborum."]]>
1753446087501
-
+
-40
-320
- 1760015470898
-
- -60
- -190
+ 1760015470904
+
+ -820
+ 630
+
+
+
+ 1777996495548
+
+ 10
+ -240
+
+ 10
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ b_addCustomGC || b_removeCustomGC
+ false
+ 0
+ 0.0
+
- 1760015470904
-
+ 1777996495568
+
-820
630
@@ -4035,14 +4055,14 @@ officia deserunt mollit anim id est laborum."]]>
true
false
SHAPE_DRAW_2D
- f_cancelEnergyHubConfiguration();
+ f_stopCustomGCCreation();
false
0
0.0
- 1760015470906
-
+ 1777996495570
+
-90
-30
@@ -4068,8 +4088,8 @@ officia deserunt mollit anim id est laborum."]]>
10
- 1760015470908
-
+ 1777996495572
+
48
-10
@@ -4094,6 +4114,156 @@ officia deserunt mollit anim id est laborum."]]>
+
+ 1781530425858
+
+ -770
+ 550
+
+ 10
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ c_tempSavedCoordinates.size()>=3 && !b_customGCPolygonCreated
+ if (f_checkCustomPolygonSelfIntersection()) { //Custom drawn polygon is self-intersecting
+ f_resetCustomGCCreation();
+ f_setForcedClickScreenMessageText("De getekende lijnen mogen elkaar niet snijden! Begin opnieuw.");
+} else {
+ b_customGCPolygonCreated = true;
+ f_setForcedClickScreenMessageText("Kies een trafo op de kaart");
+}
+ false
+ 0
+ 0.0
+
+
+ 1781530425860
+
+ -140
+ -40
+
+ 10
+ 10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 10
+ 3
+ -16777216
+ null
+ SOLID
+ 275
+ 75
+ 0.0
+ -1
+ null
+ 10
+
+
+ 1781530425862
+
+ 0
+ -20
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+
+
+ 28
+
+
+ CENTER
+
+
+
+
+
+
+ 1760015470898
+
+ -50
+ -430
+
+ 10
+ 0
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+
+
+ 1760015470900
+
+ -500
+ -50
+
+ 10
+ 10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 10
+ 2
+ -16777216
+ null
+ SOLID
+ 1000
+ 90
+ 0.0
+ -1
+ null
+ 10
+
+
+ 1760015470902
+
+ 0
+ -35
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+ ]]>
+
+
+ 48
+
+
+ CENTER
+
@@ -8329,6 +8499,1262 @@ else{
LEFT
+
+ 1778088271551
+
+ 120
+ -2750
+
+ 10
+ 0
+
+ true
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 15
+ 630
+ v_clickedObjectType == OL_GISObjectType.SOLARFARM && !c_selectedGridConnections.isEmpty() && c_customSolarfarmGCs.contains((GCEnergyProduction)c_selectedGridConnections.get(0))
+ false
+ 0
+ 0.0
+
+
+ 1778088176151
+
+ 0
+ 0
+
+ 10
+ 10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 3
+
+ null
+ SOLID
+ 370
+ 350
+ 0.0
+ -32
+ null
+
+
+ 1778088438360
+
+ 20
+ 20
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+
+
+ 22
+
+
+ LEFT
+
+
+ 1778088565568
+
+ 20
+ 150
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+
+
+ 12
+
+
+ LEFT
+
+
+ 1778089224407
+
+ 245
+ 120
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+ c_selectedGridConnections.isEmpty() ? "" : (round((c_selectedGridConnections.get(0).c_connectedGISObjects.get(0).gisRegion.area() / 10000.0) * 10.0) / 10.0) + " ha"
+
+
+ 12
+
+
+ RIGHT
+
+
+ false
+ 1778089224409
+
+ 260
+ 85
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ true
+ double installedCapacity_kWpha = sl_customGCSolarfarmInstalledCapacity_kWpha.getValue();
+
+GCEnergyProduction gc = (GCEnergyProduction)c_selectedGridConnections.get(0);
+J_EAProduction pvAsset = (J_EAProduction)gc.c_productionAssets.get(0);
+
+// Calculate new installed capacity solarfarm and update text objects
+double area_m2 = gc.c_connectedGISObjects.get(0).gisRegion.area();
+double area_ha = area_m2 / 10000.0;
+double installedCapacity_kW = installedCapacity_kWpha * area_ha;
+
+traceln("installedCapacity_kW: " + installedCapacity_kW);
+
+// Calculate max contracted range to be the next multiple of 50 kW above installed capacity
+double maxContractedCapacity_kW = Math.ceil(installedCapacity_kW / 50.0) * 50.0;
+//if (maxContractedCapacity_kW == 0) maxContractedCapacity_kW = 50.0; // fallback to prevent 0 range
+traceln("maxContractedCapacity_kW: " + maxContractedCapacity_kW);
+//txt_customGCSolarfarmTotalSolarfarmArea_ha.setText(area_ha + " ha");
+//txt_customGCSolarfarmInstalledCapacity_kW.setText(installedCapacity_kW + " kW");
+
+// If needed, adjust the contracted capacity
+double contractedCapacity_kW = sl_customGCSolarfarmContractedCapacity_kW.getValue();
+traceln("contractedCapacity_kW: " + contractedCapacity_kW);
+if (contractedCapacity_kW > maxContractedCapacity_kW) {
+ contractedCapacity_kW = maxContractedCapacity_kW;
+ traceln("contractedCapacity_kW after: " + contractedCapacity_kW);
+ sl_customGCSolarfarmContractedCapacity_kW.setValue(contractedCapacity_kW, false);
+}
+// Dynamically clamp the range of the contracted capacity slider
+sl_customGCSolarfarmContractedCapacity_kW.setRange(0, maxContractedCapacity_kW);
+
+// Update backend
+pvAsset.setCapacityElectric_kW(installedCapacity_kW, gc);
+gc.v_liveConnectionMetaData.setCapacities_kW(0, maxContractedCapacity_kW, maxContractedCapacity_kW);
+
+// Update the active instance of tabElectricity sliders
+if (!uI_Tabs.pop_tabElectricity.isEmpty()) {
+ uI_Tabs.pop_tabElectricity.get(0).f_updateSliders_Electricity();
+}
+
+if (!b_runningMainInterfaceScenarios) f_setScenarioToCustom();
+f_resetSettings();
+
+
+ 0
+ HORIZONTAL
+ 100
+ false
+
+
+
+ 1778157224958
+
+ 20
+ 60
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+ c_selectedGridConnections.isEmpty() ? "" : "Naam: " + c_selectedGridConnections.get(0).p_gridConnectionID
+
+
+ 12
+
+
+ LEFT
+
+
+ 1778157755373
+
+ 245
+ 150
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+ c_selectedGridConnections.isEmpty() ? "" : (round(c_selectedGridConnections.get(0).c_productionAssets.get(0).getCapacityElectric_kW() * 10.0) / 10.0) + " kW"
+
+
+ 12
+
+
+ RIGHT
+
+
+ 1778157960511
+
+ 20
+ 240
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ cb_customGCSolarfarmCurtailment.isSelected()
+ false
+ 0
+ 0.0
+ -16777216
+
+
+
+ 12
+
+
+ LEFT
+
+
+ 1778158102891
+
+ 20
+ 210
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+
+
+ 12
+
+
+ LEFT
+
+
+ 1778158258122
+
+ 245
+ 240
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ cb_customGCSolarfarmCurtailment.isSelected()
+ false
+ 0
+ 0.0
+ -16777216
+
+ sl_customGCSolarfarmContractedCapacity_kW.getValue() + " kW"
+
+
+ 12
+
+
+ RIGHT
+
+
+ false
+ 1778158369195
+
+ 302
+ 202
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ -16777216
+ true
+ GCEnergyProduction gc = (GCEnergyProduction) c_selectedGridConnections.get(0);
+if (cb_customGCSolarfarmCurtailment.isSelected()) {
+ gc.f_setExternalAssetManagement(new J_CurtailManagementContractCapacity(gc, energyModel.p_timeParameters));
+} else {
+ gc.f_removeExternalAssetManagement(I_CurtailManagement.class);
+}
+
+if (!b_runningMainInterfaceScenarios) f_setScenarioToCustom();
+f_resetSettings();
+
+
+
+
+ false
+
+
+
+ false
+ 1778158173095
+
+ 260
+ 235
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ cb_customGCSolarfarmCurtailment.isSelected()
+ true
+ GCEnergyProduction gc = (GCEnergyProduction) c_selectedGridConnections.get(0);
+double physicalCapacity_kW = gc.v_liveConnectionMetaData.getPhysicalCapacity_kW();
+
+double contractedCapacity_kW = sl_customGCSolarfarmContractedCapacity_kW.getValue();
+
+if (contractedCapacity_kW > physicalCapacity_kW) {
+ contractedCapacity_kW = physicalCapacity_kW;
+ sl_customGCSolarfarmContractedCapacity_kW.setValue(contractedCapacity_kW, false);
+}
+
+gc.v_liveConnectionMetaData.setCapacities_kW(0, contractedCapacity_kW, physicalCapacity_kW);
+
+if (!b_runningMainInterfaceScenarios) f_setScenarioToCustom();
+f_resetSettings();
+
+
+ 0
+ HORIZONTAL
+ 50
+ false
+
+
+
+ 1781771512388
+
+ 20
+ 90
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+
+
+ 12
+
+
+ LEFT
+
+
+ 1781772075017
+
+ 20
+ 120
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+
+
+ 12
+
+
+ LEFT
+
+
+ 1781772181108
+
+ 245
+ 90
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+ (round(sl_customGCSolarfarmInstalledCapacity_kWpha.getValue() * 10.0) / 10.0) + " kW/ha"
+
+
+ 12
+
+
+ RIGHT
+
+
+ false
+ 1781878970701
+
+ 220
+ 180
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ -1
+ -16777216
+ true
+ GCEnergyProduction solarpark = (GCEnergyProduction) (c_selectedGridConnections.get(0));
+J_EAProduction pvAsset = (J_EAProduction) solarpark.c_productionAssets.get(0);
+J_ProfilePointer profile;
+OL_PVOrientation pvOrientation;
+
+switch(cb_customGCSolarfarmPVOrientation.getValue()){
+ case "Zuid (15°)":
+ profile = energyModel.pp_PVProduction35DegSouth_fr;
+ pvOrientation = OL_PVOrientation.SOUTH;
+ break;
+ case "Oost/West (35°)":
+ profile = energyModel.pp_PVProduction15DegEastWest_fr;
+ pvOrientation = OL_PVOrientation.EASTWEST;
+ break;
+ default:
+ return;
+}
+
+solarpark.v_liveAssetsMetaData.PVOrientation = pvOrientation;
+pvAsset.setProfilePointer(profile);
+
+if (!b_runningMainInterfaceScenarios) f_setScenarioToCustom();
+f_resetSettings();
+//f_updateUIResultsData();
+
+
+
+ false
+
+
+ false
+
+
+
+ 1781879229854
+
+ 20
+ 180
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+
+
+ 12
+
+
+ LEFT
+
+
+
+
+ 1778241988036
+
+ 520
+ -2750
+
+ 10
+ 0
+
+ true
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 15
+ 630
+ v_clickedObjectType == OL_GISObjectType.WINDFARM && !c_selectedGridConnections.isEmpty() && c_customWindfarmGCs.contains((GCEnergyProduction)c_selectedGridConnections.get(0))
+ false
+ 0
+ 0.0
+
+
+ 1778241988038
+
+ 0
+ 0
+
+ 10
+ 10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 3
+
+ null
+ SOLID
+ 370
+ 350
+ 0.0
+ -32
+ null
+
+
+ 1778241988040
+
+ 20
+ 20
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+
+
+ 22
+
+
+ LEFT
+
+
+ 1778241988042
+
+ 20
+ 90
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+
+
+ 12
+
+
+ LEFT
+
+
+ 1778241988044
+
+ 245
+ 90
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+ sl_customGCWindfarmInstalledCapacity_MW.getValue() + " MW"
+
+
+ 12
+
+
+ RIGHT
+
+
+ false
+ 1778241988046
+
+ 260
+ 85
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ true
+ double installedCapacity_MW = sl_customGCWindfarmInstalledCapacity_MW.getValue();
+
+GCEnergyProduction gc = (GCEnergyProduction)c_selectedGridConnections.get(0);
+J_EAProduction windAsset = (J_EAProduction)gc.c_productionAssets.get(0);
+
+// If needed, adjust the contracted capacity
+double contractedCapacity_MW = sl_customGCWindfarmContractedCapacity_MW.getValue();
+if (contractedCapacity_MW > installedCapacity_MW) {
+ contractedCapacity_MW = installedCapacity_MW;
+ sl_customGCWindfarmContractedCapacity_MW.setValue(contractedCapacity_MW, false);
+}
+// Dynamically clamp the range of the contracted capacity slider
+sl_customGCWindfarmContractedCapacity_MW.setRange(0, installedCapacity_MW);
+
+// Update backend
+windAsset.setCapacityElectric_kW(installedCapacity_MW*1000, gc);
+gc.v_liveConnectionMetaData.setCapacities_kW(0, contractedCapacity_MW*1000, installedCapacity_MW*1000);
+
+// Update the active instance of tabElectricity sliders
+if (!uI_Tabs.pop_tabElectricity.isEmpty()) {
+ uI_Tabs.pop_tabElectricity.get(0).f_updateSliders_Electricity();
+}
+
+if (!b_runningMainInterfaceScenarios) f_setScenarioToCustom();
+f_resetSettings();
+
+
+ 0
+ HORIZONTAL
+ 0.1
+ false
+
+
+
+ 1778241988050
+
+ 20
+ 60
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+ c_selectedGridConnections.isEmpty() ? "" : "Naam: " + c_selectedGridConnections.get(0).p_gridConnectionID
+
+
+ 12
+
+
+ LEFT
+
+
+ 1778241988056
+
+ 20
+ 150
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ cb_customGCWindfarmCurtailment.isSelected()
+ false
+ 0
+ 0.0
+ -16777216
+
+
+
+ 12
+
+
+ LEFT
+
+
+ 1778241988058
+
+ 20
+ 120
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+
+
+ 12
+
+
+ LEFT
+
+
+ 1778241988060
+
+ 245
+ 150
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ cb_customGCWindfarmCurtailment.isSelected()
+ false
+ 0
+ 0.0
+ -16777216
+
+ sl_customGCWindfarmContractedCapacity_MW.getValue() + " MW"
+
+
+ 12
+
+
+ RIGHT
+
+
+ false
+ 1778241988062
+
+ 302
+ 112
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ -16777216
+ true
+ GCEnergyProduction gc = (GCEnergyProduction) c_selectedGridConnections.get(0);
+if (cb_customGCWindfarmCurtailment.isSelected()) {
+ gc.f_setExternalAssetManagement(new J_CurtailManagementContractCapacity(gc, energyModel.p_timeParameters));
+} else {
+ gc.f_removeExternalAssetManagement(I_CurtailManagement.class);
+}
+
+if (!b_runningMainInterfaceScenarios) f_setScenarioToCustom();
+f_resetSettings();
+
+
+
+
+ false
+
+
+
+ false
+ 1778241988064
+
+ 260
+ 145
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ cb_customGCWindfarmCurtailment.isSelected()
+ true
+ double contractedCapacity_MW = sl_customGCWindfarmContractedCapacity_MW.getValue();
+
+// Update backend
+GCEnergyProduction gc = (GCEnergyProduction) c_selectedGridConnections.get(0);
+gc.v_liveConnectionMetaData.setCapacities_kW(0, contractedCapacity_MW*1000, gc.v_liveConnectionMetaData.getPhysicalCapacity_kW());
+
+if (!b_runningMainInterfaceScenarios) f_setScenarioToCustom();
+f_resetSettings();
+
+
+ 0
+ HORIZONTAL
+ 0.05
+ false
+
+
+
+
+
+ 1778278832476
+
+ 920
+ -2750
+
+ 10
+ 0
+
+ true
+ false
+ false
+ SHAPE_DRAW_2D3D
+ 15
+ 630
+ v_clickedObjectType == OL_GISObjectType.BATTERY && !c_selectedGridConnections.isEmpty() && c_customGridBatteryGCs.contains((GCGridBattery)c_selectedGridConnections.get(0))
+ false
+ 0
+ 0.0
+
+
+ 1778278832478
+
+ 0
+ 0
+
+ 10
+ 10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+ false
+ 0
+ 10
+ 3
+
+ null
+ SOLID
+ 370
+ 350
+ 0.0
+ -32
+ null
+
+
+ 1778278832480
+
+ 20
+ 20
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+
+
+ 22
+
+
+ LEFT
+
+
+ 1778278832482
+
+ 20
+ 90
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+
+
+ 12
+
+
+ LEFT
+
+
+ 1778278832484
+
+ 245
+ 90
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+ sl_customGCGridBatteryInstalledCapacity_kWh.getValue() + " kWh"
+
+
+ 12
+
+
+ RIGHT
+
+
+ false
+ 1778278832486
+
+ 260
+ 85
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ true
+ double installedCapacity_kWh = sl_customGCGridBatteryInstalledCapacity_kWh.getValue();
+double installedCapacity_kW = sl_customGCGridBatteryInstalledCapacity_kW.getValue();
+
+if(installedCapacity_kW > 0.5*installedCapacity_kWh){
+ installedCapacity_kW = 0.5*installedCapacity_kWh;
+ sl_customGCGridBatteryInstalledCapacity_kW.setValue(0.5*installedCapacity_kWh, false);
+}
+sl_customGCGridBatteryInstalledCapacity_kW.setRange(25, 0.5*installedCapacity_kWh);
+
+GCGridBattery gc = (GCGridBattery)c_selectedGridConnections.get(0);
+J_EAStorageElectric batteryAsset = (J_EAStorageElectric)gc.c_storageAssets.get(0);
+
+// Update backend
+batteryAsset.setStorageCapacity_kWh(installedCapacity_kWh, gc);
+batteryAsset.setCapacityElectric_kW(installedCapacity_kW);
+gc.v_liveConnectionMetaData.setCapacities_kW(installedCapacity_kW, installedCapacity_kW, installedCapacity_kW);
+
+// Update the active instance of tabElectricity sliders
+if (!uI_Tabs.pop_tabElectricity.isEmpty()) {
+ uI_Tabs.pop_tabElectricity.get(0).f_updateSliders_Electricity();
+}
+
+if (!b_runningMainInterfaceScenarios) f_setScenarioToCustom();
+f_resetSettings();
+
+
+ 0
+ HORIZONTAL
+ 50
+ false
+
+
+
+ 1778278832490
+
+ 20
+ 60
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+ c_selectedGridConnections.isEmpty() ? "" : "Naam: " + c_selectedGridConnections.get(0).p_gridConnectionID
+
+
+ 12
+
+
+ LEFT
+
+
+ 1778278832492
+
+ 245
+ 120
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+ sl_customGCGridBatteryInstalledCapacity_kW.getValue() + " kW"
+
+
+ 12
+
+
+ RIGHT
+
+
+ false
+ 1778278832494
+
+ 260
+ 115
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ true
+ double installedCapacity_kW = sl_customGCGridBatteryInstalledCapacity_kW.getValue();
+
+GCGridBattery gc = (GCGridBattery)c_selectedGridConnections.get(0);
+J_EAStorageElectric batteryAsset = (J_EAStorageElectric)gc.c_storageAssets.get(0);
+
+batteryAsset.setCapacityElectric_kW(installedCapacity_kW);
+gc.v_liveConnectionMetaData.setCapacities_kW(installedCapacity_kW, installedCapacity_kW, installedCapacity_kW);
+
+if (!b_runningMainInterfaceScenarios) f_setScenarioToCustom();
+f_resetSettings();
+
+
+ 0
+ HORIZONTAL
+ 25
+ false
+
+
+
+ 1778278832496
+
+ 20
+ 150
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+
+
+ 12
+
+
+ LEFT
+
+
+ 1778278946812
+
+ 20
+ 120
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+
+
+ 12
+
+
+ LEFT
+
+
+ false
+ 1778279933335
+
+ 220
+ 150
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ -1
+ -16777216
+ true
+ if (c_selectedGridConnections.isEmpty() || !(c_selectedGridConnections.get(0) instanceof GCGridBattery)) {
+ return;
+}
+GCGridBattery gc = (GCGridBattery)c_selectedGridConnections.get(0);
+GridNode gn = gc.p_parentNodeElectric;
+I_BatteryManagement batteryAlgorithm = null;
+
+switch(cb_customGCGridBatteryAlgorithm.getValue()){
+ case "Zelfverbruik":
+ batteryAlgorithm = new J_BatteryManagementSelfConsumptionGridNode(gc, energyModel.p_timeParameters);
+ break;
+ case "Peak shaving":
+ batteryAlgorithm = new J_BatteryManagementPeakShaving(gc, energyModel.p_timeParameters);
+ ((J_BatteryManagementPeakShaving)batteryAlgorithm).setTarget(gn);
+ break;
+ case "Prijssturing":
+ batteryAlgorithm = new J_BatteryManagementPrice(gc, energyModel.p_timeParameters);
+ break;
+}
+
+gc.f_setBatteryManagement(batteryAlgorithm);
+
+if (!b_runningMainInterfaceScenarios) f_setScenarioToCustom();
+f_resetSettings();
+
+
+
+ false
+
+
+
+ false
+
+
+
+
1722252542596
diff --git a/_alp/Agents/Zero_Interface/Variables.xml b/_alp/Agents/Zero_Interface/Variables.xml
index 7be6f94..36a07a1 100644
--- a/_alp/Agents/Zero_Interface/Variables.xml
+++ b/_alp/Agents/Zero_Interface/Variables.xml
@@ -1562,8 +1562,8 @@
1742298194173
- 140
- -840
+ 160
+ -2200
10
0
@@ -2117,6 +2117,72 @@
+
+ 1777995108245
+
+ -540
+ 1180
+
+ 10
+ 0
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+
+ 1777995108247
+
+ -540
+ 1120
+
+ 10
+ 0
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+
+ 1777995108249
+
+ -540
+ 1200
+
+ 10
+ 0
+
+ false
+ true
+ true
+
+
+
+
+
+
+
1778245388940
@@ -2139,6 +2205,50 @@
+
+ 1777995108253
+
+ -540
+ 1220
+
+ 10
+ 0
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+
+ 1777995108255
+
+ -540
+ 1160
+
+ 10
+ 0
+
+ false
+ true
+ true
+
+
+
+
+
+
+
1778245388942
@@ -2161,6 +2271,69 @@
+
+ 1781682558407
+
+ -540
+ 1100
+
+ 10
+ 0
+
+ false
+ true
+ true
+
+
+
+
+
+
+
+
+ 1781693560986
+
+ -520
+ 1380
+
+ 10
+ 0
+
+ false
+ true
+ true
+
+
+
+
+
+ 1782155106748
+
+ -540
+ 1140
+
+ 10
+ 0
+
+ false
+ true
+ true
+
+
+
+
+
+
+
1715858732720
@@ -3529,4 +3702,96 @@ OL_FilterOptionsGC.MANUAL_SELECTION, "Handmatige selectie"
String
+
+ 1777995108215
+
+ -540
+ 1250
+
+ 10
+ 0
+
+ false
+ true
+ true
+
+ ArrayList
+ GCEnergyProduction
+ String
+
+
+
+ 1777995108221
+
+ -540
+ 1270
+
+ 10
+ 0
+
+ false
+ true
+ true
+
+ ArrayList
+ GCEnergyProduction
+ String
+
+
+
+ 1777995108226
+
+ -540
+ 1290
+
+ 10
+ 0
+
+ false
+ true
+ true
+
+ ArrayList
+ GCGridBattery
+ String
+
+
+
+ 1781530600300
+
+
+ -520
+ 1340
+
+ 10
+ 0
+
+ false
+ true
+ true
+
+ ArrayList
+ Pair<Double,Double>
+ String
+
+
+
+ 1781678594369
+
+
+ -520
+ 1360
+
+ 10
+ 0
+
+ false
+ true
+ true
+
+ ArrayList
+ GISRegion
+ String
+
+
diff --git a/_alp/Agents/Zero_Loader/Code/Functions.java b/_alp/Agents/Zero_Loader/Code/Functions.java
index b6e01c0..08c78ed 100644
--- a/_alp/Agents/Zero_Loader/Code/Functions.java
+++ b/_alp/Agents/Zero_Loader/Code/Functions.java
@@ -722,16 +722,27 @@ else if(RegionCoords.startsWith("LineString")){
GISCoords[5]=GN.p_longitude + scaling_factor_gridnode*0.00001*2;
GISCoords[7]=GN.p_longitude + scaling_factor_gridnode*0.00001;
break;
- /*
case "CIRCLE":
- // if you want Circle coordinates -->
+ // if you want Circle coordinates -->
//x = r * cos(t) + a
//y = r * sin(t) + b
//t is an angle between 0 and 2π (more steps is more circle points, about 10-12 should suffice. --> adjust nb_GISCoords accordingly
// r is the radius: 0.000009 degrees in latitude is about 1 meter
// a and b are latitude and longitude
+ double rLat = scaling_factor_gridnode * 0.000001;
+ double rLon = rLat / Math.cos(Math.toRadians(GN.p_latitude)); // degrees longitude corrected
+ int nPoints = GISCoords.length / 2;
+
+ for (int i = 0; i < nPoints; i++) {
+
+ double angle = 2 * Math.PI * i / nPoints;
+ double lat = GN.p_latitude + rLat * Math.sin(angle);
+ double lon = GN.p_longitude + rLon * Math.cos(angle);
+
+ GISCoords[2*i] = lat;
+ GISCoords[2*i+1] = lon;
+ }
break;
- */
}
return GISCoords;
diff --git a/_alp/Agents/tabElectricity/Code/Functions.java b/_alp/Agents/tabElectricity/Code/Functions.java
index 6695cce..337392d 100644
--- a/_alp/Agents/tabElectricity/Code/Functions.java
+++ b/_alp/Agents/tabElectricity/Code/Functions.java
@@ -1,7 +1,6 @@
double f_setPVOnLand(double hectare,List gcListProduction)
{/*ALCODESTART::1722256117103*/
-// TODO: Change to work for multiple solar fields in one model.
-// to do so it should probably first calculate the total installed pv in all solar fields
+// Single solarfarm at GridNode T0
for ( GCEnergyProduction GCEP : gcListProduction) {
for(J_EAProduction j_ea : GCEP.c_productionAssets) {
if (j_ea.getEAType() == OL_EnergyAssetType.PHOTOVOLTAIC) {
@@ -90,9 +89,7 @@
double f_setWindTurbines(double AllocatedWindPower_MW,List gcListProduction)
{/*ALCODESTART::1722256248965*/
-// TODO: Change to work for multiple wind farms in one model.
-// to do so it should probably first calculate the total installed wind power in all wind farms
-
+// Single windfarm at GridNode T0
for ( GCEnergyProduction GCEP : gcListProduction) {
for(J_EAProduction j_ea : GCEP.c_productionAssets) {
if (j_ea.getEAType() == OL_EnergyAssetType.WINDMILL) {
@@ -140,18 +137,18 @@
zero_Interface.f_resetSettings();
/*ALCODEEND*/}
-double f_getCurrentPVOnLandAndWindturbineValues()
+double f_getInitialPVOnLandAndWindturbineValues()
{/*ALCODESTART::1745483988251*/
-p_currentPVOnLand_ha = 0;
-p_currentWindTurbines_MW = 0;
+p_initialPVOnLand_ha = 0;
+p_initialWindTurbines_MW = 0;
for(GCEnergyProduction GCProd : uI_Tabs.f_getAllSliderGridConnections_production()){
- if(!c_electricityTabEASliderGCs.contains(GCProd) && GCProd.v_isActive){
+ if(!c_electricityTabEASliderGCs.contains(GCProd) && !zero_Interface.c_customSolarfarmGCs.contains(GCProd) && !zero_Interface.c_customWindfarmGCs.contains(GCProd) && GCProd.v_isActive){
for(J_EAProduction ea : GCProd.c_productionAssets){
if(ea.getEAType() == OL_EnergyAssetType.PHOTOVOLTAIC){
- p_currentPVOnLand_ha += ea.getCapacityElectric_kW()/zero_Interface.energyModel.avgc_data.p_avgSolarFieldPower_kWppha;
+ p_initialPVOnLand_ha += ea.getCapacityElectric_kW()/zero_Interface.energyModel.avgc_data.p_avgSolarFieldPower_kWppha;
}
else if(ea.getEAType() == OL_EnergyAssetType.WINDMILL){
- p_currentWindTurbines_MW += ea.getCapacityElectric_kW()/1000;
+ p_initialWindTurbines_MW += ea.getCapacityElectric_kW()/1000;
}
}
}
@@ -560,18 +557,18 @@ else if(page == gr_electricitySliders_collective){
{/*ALCODESTART::1756302457919*/
c_electricityTabEASliderGCs.addAll(electricityTabEASliderGCs);
-f_getCurrentPVOnLandAndWindturbineValues();
-f_getCurrentGridBatterySize();
+f_getInitialPVOnLandAndWindturbineValues();
+f_getInitialGridBatterySize();
f_initializeElectricityPages();
/*ALCODEEND*/}
-double f_getCurrentGridBatterySize()
+double f_getInitialGridBatterySize()
{/*ALCODESTART::1765276703854*/
-p_currentTotalGridBatteryCapacity_MWh = 0;
+p_initialTotalGridBatteryCapacity_MWh = 0;
for(GCGridBattery GCBat : uI_Tabs.f_getAllSliderGridConnections_gridBatteries()){
- if(!c_electricityTabEASliderGCs.contains(GCBat) && GCBat.v_isActive){
- p_currentTotalGridBatteryCapacity_MWh += (GCBat.p_batteryAsset.getStorageCapacity_kWh()/1000.0);
+ if(!c_electricityTabEASliderGCs.contains(GCBat) && !zero_Interface.c_customGridBatteryGCs.contains(GCBat) && GCBat.v_isActive){
+ p_initialTotalGridBatteryCapacity_MWh += (GCBat.p_batteryAsset.getStorageCapacity_kWh()/1000.0);
}
}
/*ALCODEEND*/}
@@ -637,12 +634,12 @@ ShapeGroup f_updatePageIndicator()
List productionGridConnections = new ArrayList<>(uI_Tabs.f_getAllSliderGridConnections_production());
//Large scale EA production systems (PV/Wind on land)
-f_getCurrentPVOnLandAndWindturbineValues(); // Used for slider minimum: non adjustable GCProductions
+f_getInitialPVOnLandAndWindturbineValues(); // Used for slider minimum: non adjustable GCProductions
double totalPVOnLand_kW = 0; // Of movable slider GC
double totalWind_kW = 0; // Of movable slider GC
-for(GridConnection productionGC : c_electricityTabEASliderGCs){
+for(GridConnection productionGC : c_electricityTabEASliderGCs){ // Default slider solarfarm/windfarm collection
if(productionGC instanceof GCEnergyProduction && productionGC.v_isActive){
for(J_EAProduction productionEA : productionGC.c_productionAssets){
if(productionEA.getEAType() == OL_EnergyAssetType.PHOTOVOLTAIC){
@@ -656,25 +653,61 @@ else if(productionEA.getEAType() == OL_EnergyAssetType.WINDMILL){
}
}
}
-sl_largeScalePV_ha.setRange(0, 1000); // Needed to prevent anylogic range bug
-sl_largeScalePV_ha.setValue((totalPVOnLand_kW/zero_Interface.energyModel.avgc_data.p_avgSolarFieldPower_kWppha) + p_currentPVOnLand_ha, false);
-sl_largeScaleWind_MW.setRange(0, 1000); // Needed to prevent anylogic range bug
-sl_largeScaleWind_MW.setValue((totalWind_kW/1000) + p_currentWindTurbines_MW, false);
+
+double totalCustomPVOnLand_kW = 0;
+for(GCEnergyProduction customSF : zero_Interface.c_customSolarfarmGCs){
+ if(customSF.v_isActive){
+ for(J_EAProduction ea : customSF.c_productionAssets){
+ if(ea.getEAType() == OL_EnergyAssetType.PHOTOVOLTAIC){
+ totalCustomPVOnLand_kW += ea.getCapacityElectric_kW();
+ }
+ }
+ }
+}
+
+double totalCustomWind_kW = 0;
+for(GCEnergyProduction customWF : zero_Interface.c_customWindfarmGCs){
+ if(customWF.v_isActive){
+ for(J_EAProduction ea : customWF.c_productionAssets){
+ if(ea.getEAType() == OL_EnergyAssetType.WINDMILL){
+ totalCustomWind_kW += ea.getCapacityElectric_kW();
+ }
+ }
+ }
+}
+
+double minSliderPVOnLand_ha = p_initialPVOnLand_ha + totalCustomPVOnLand_kW/zero_Interface.energyModel.avgc_data.p_avgSolarFieldPower_kWppha;
+double maxSliderPVOnLand_ha = minSliderPVOnLand_ha + 50;
+sl_largeScalePV_ha.setRange(minSliderPVOnLand_ha, maxSliderPVOnLand_ha);
+sl_largeScalePV_ha.setValue((totalPVOnLand_kW/zero_Interface.energyModel.avgc_data.p_avgSolarFieldPower_kWppha) + minSliderPVOnLand_ha, false);
+
+double minSliderWind_MW = p_initialWindTurbines_MW + totalCustomWind_kW/1000;
+double maxSliderWind_MW = minSliderWind_MW + 100;
+sl_largeScaleWind_MW.setRange(minSliderWind_MW, maxSliderWind_MW);
+sl_largeScaleWind_MW.setValue((totalWind_kW/1000) + minSliderWind_MW, false);
//Grid batteries
-List sliderGridBatteryGridConnections = new ArrayList<>();
-for(GridConnection sliderGC : c_electricityTabEASliderGCs){
+f_getInitialGridBatterySize(); // Used for slider minimum: non adjustable GCGridBatteries
+
+double totalDefaultBatteryCapacity_kWh = 0;
+for(GridConnection sliderGC : c_electricityTabEASliderGCs){ // Default slider battery collection
if(sliderGC.v_isActive && sliderGC instanceof GCGridBattery sliderGridBattery){
- sliderGridBatteryGridConnections.add(sliderGridBattery);
+ totalDefaultBatteryCapacity_kWh += sliderGridBattery.p_batteryAsset.getStorageCapacity_kWh();
}
}
-double averageNeighbourhoodBatterySize_kWh = 0;
-for (GCGridBattery gc : sliderGridBatteryGridConnections) {
- averageNeighbourhoodBatterySize_kWh += gc.p_batteryAsset.getStorageCapacity_kWh()/sliderGridBatteryGridConnections.size();
+double totalCustomBatteryCapacity_kWh = 0;
+for(GridConnection customGB : zero_Interface.c_customGridBatteryGCs){
+ if(customGB.v_isActive && customGB.p_batteryAsset != null){
+ totalCustomBatteryCapacity_kWh += customGB.p_batteryAsset.getStorageCapacity_kWh();
+ }
}
-sl_gridBatteries_kWh.setValue(averageNeighbourhoodBatterySize_kWh, false);
+
+double minSliderGridBattery_kWh = p_initialTotalGridBatteryCapacity_MWh*1000 + totalCustomBatteryCapacity_kWh;
+double maxSliderGridBattery_kWh = minSliderGridBattery_kWh + 20000;
+sl_gridBatteries_kWh.setRange(minSliderGridBattery_kWh, maxSliderGridBattery_kWh);
+sl_gridBatteries_kWh.setValue(totalDefaultBatteryCapacity_kWh + minSliderGridBattery_kWh, false);
//Curtailment large scale PV and wind
boolean curtailment = true;
diff --git a/_alp/Agents/tabElectricity/Code/Functions.xml b/_alp/Agents/tabElectricity/Code/Functions.xml
index 50ab0e9..bee1648 100644
--- a/_alp/Agents/tabElectricity/Code/Functions.xml
+++ b/_alp/Agents/tabElectricity/Code/Functions.xml
@@ -105,7 +105,7 @@
VOID
double
1745483988251
-
+
30
1250
@@ -421,7 +421,7 @@
VOID
double
1765276703854
-
+
30
1320
diff --git a/_alp/Agents/tabElectricity/Levels/Level.level.xml b/_alp/Agents/tabElectricity/Levels/Level.level.xml
index 459ba8d..9ed9415 100644
--- a/_alp/Agents/tabElectricity/Levels/Level.level.xml
+++ b/_alp/Agents/tabElectricity/Levels/Level.level.xml
@@ -1636,7 +1636,7 @@ zero_Interface.f_setSelectedGNText();
1750063382243
260
- 115
+ 135
0
-10
@@ -1655,17 +1655,18 @@ for(GridConnection gc : c_electricityTabEASliderGCs){
}
}
-if(gcListGridBatteries.size() == 0){
- throw new IllegalStateException("Model does not contain any GCGridBattery agent");
+double totalCustomBatteryCapacity_kWh = 0;
+for(GCGridBattery customGB : zero_Interface.c_customGridBatteryGCs){
+ if(customGB.v_isActive && customGB.p_batteryAsset != null){
+ totalCustomBatteryCapacity_kWh += customGB.p_batteryAsset.getStorageCapacity_kWh();
+ }
}
-f_setGridBatteries(sl_gridBatteries_kWh.getValue(), gcListGridBatteries);
+f_setGridBatteries(sl_gridBatteries_kWh.getValue() - totalCustomBatteryCapacity_kWh - p_initialTotalGridBatteryCapacity_MWh*1000.0, gcListGridBatteries);
0
HORIZONTAL
- 0
- 1000
10
false
@@ -1674,7 +1675,7 @@ f_setGridBatteries(sl_gridBatteries_kWh.getValue(), gcListGridBatteries);1750063382245
20
- 120
+ 140
0
-10
@@ -1700,7 +1701,7 @@ f_setGridBatteries(sl_gridBatteries_kWh.getValue(), gcListGridBatteries);1750063382247
245
- 120
+ 140
0
-10
@@ -1727,7 +1728,7 @@ f_setGridBatteries(sl_gridBatteries_kWh.getValue(), gcListGridBatteries);1752232850473
165
- 118
+ 138
0
-10
@@ -1755,7 +1756,7 @@ f_setGridBatteries(sl_gridBatteries_kWh.getValue(), gcListGridBatteries);1770118893494
245
- 60
+ 80
0
-10
@@ -1769,7 +1770,7 @@ f_setGridBatteries(sl_gridBatteries_kWh.getValue(), gcListGridBatteries);0.0
-16777216
- sl_largeScalePV_ha.getValue() + " ha"
+ (round(sl_largeScalePV_ha.getValue() * 10.0) / 10.0) + " ha"
12
@@ -1782,7 +1783,7 @@ f_setGridBatteries(sl_gridBatteries_kWh.getValue(), gcListGridBatteries);1770118893505
260
- 55
+ 75
0
-10
@@ -1794,7 +1795,8 @@ f_setGridBatteries(sl_gridBatteries_kWh.getValue(), gcListGridBatteries);
false
true
- List<GCEnergyProduction> sliderPVFarmGCList = new ArrayList<>();
+ // 1. Construct list containing ONLY the default global solarfarms (excluding custom ones)
+List<GCEnergyProduction> sliderPVFarmGCList = new ArrayList<>();
for(GridConnection gc : c_electricityTabEASliderGCs){
if(gc instanceof GCEnergyProduction energyProductionSite){
for(J_EAProduction j_ea : energyProductionSite.c_productionAssets) {
@@ -1810,14 +1812,23 @@ if(sliderPVFarmGCList.size() == 0){
throw new IllegalStateException("Model does not contain any PVFarmSliderGC agent");
}
+// 2. Calculate sum of active custom solarfarms capacity
+double totalCustomPVOnLand_kW = 0;
+for(GCEnergyProduction customSF : zero_Interface.c_customSolarfarmGCs){
+ if(customSF.v_isActive){
+ for(J_EAProduction ea : customSF.c_productionAssets){
+ if(ea.getEAType() == OL_EnergyAssetType.PHOTOVOLTAIC){
+ totalCustomPVOnLand_kW += ea.getCapacityElectric_kW();
+ }
+ }
+ }
+}
-f_setPVOnLand(sl_largeScalePV_ha.getValue() - p_currentPVOnLand_ha, sliderPVFarmGCList);
+f_setPVOnLand(sl_largeScalePV_ha.getValue() - p_initialPVOnLand_ha - totalCustomPVOnLand_kW/zero_Interface.energyModel.avgc_data.p_avgSolarFieldPower_kWppha, sliderPVFarmGCList);
0
HORIZONTAL
- p_currentPVOnLand_ha
- p_currentPVOnLand_ha + 50
0.1
false
@@ -1826,7 +1837,7 @@ f_setPVOnLand(sl_largeScalePV_ha.getValue() - p_currentPVOnLand_ha, sliderPVFarm
1770118893516
20
- 60
+ 80
0
-10
@@ -1852,7 +1863,7 @@ f_setPVOnLand(sl_largeScalePV_ha.getValue() - p_currentPVOnLand_ha, sliderPVFarm
1770118893524
260
- 85
+ 105
0
-10
@@ -1864,7 +1875,8 @@ f_setPVOnLand(sl_largeScalePV_ha.getValue() - p_currentPVOnLand_ha, sliderPVFarm
false
true
- List<GCEnergyProduction> sliderWindFarmGCList = new ArrayList<>();
+ // 1. Construct list containing ONLY the default global windfarms (excluding custom ones)
+List<GCEnergyProduction> sliderWindFarmGCList = new ArrayList<>();
for(GridConnection gc : c_electricityTabEASliderGCs){
if(gc instanceof GCEnergyProduction energyProductionSite){
for(J_EAProduction j_ea : energyProductionSite.c_productionAssets) {
@@ -1880,13 +1892,23 @@ if(sliderWindFarmGCList.size() == 0){
throw new IllegalStateException("Model does not contain any sliderWindFarmGC agent");
}
-f_setWindTurbines( sl_largeScaleWind_MW.getValue() - p_currentWindTurbines_MW, sliderWindFarmGCList);
+// 2. Calculate sum of active custom solarfarms capacity
+double totalCustomWind_kW = 0;
+for(GCEnergyProduction customWF : zero_Interface.c_customWindfarmGCs){
+ if(customWF.v_isActive){
+ for(J_EAProduction ea : customWF.c_productionAssets){
+ if(ea.getEAType() == OL_EnergyAssetType.WINDMILL){
+ totalCustomWind_kW += ea.getCapacityElectric_kW();
+ }
+ }
+ }
+}
+
+f_setWindTurbines( sl_largeScaleWind_MW.getValue() - p_initialWindTurbines_MW - totalCustomWind_kW/1000, sliderWindFarmGCList);
0
HORIZONTAL
- p_currentWindTurbines_MW
- p_currentWindTurbines_MW + 10
0.1
false
@@ -1895,7 +1917,7 @@ f_setWindTurbines( sl_largeScaleWind_MW.getValue() - p_currentWindTurbines_MW, s
1770118893533
20
- 90
+ 110
0
-10
@@ -1920,7 +1942,7 @@ f_setWindTurbines( sl_largeScaleWind_MW.getValue() - p_currentWindTurbines_MW, s
1770118893541
245
- 90
+ 110
0
-10
@@ -1946,7 +1968,7 @@ f_setWindTurbines( sl_largeScaleWind_MW.getValue() - p_currentWindTurbines_MW, s
1770118893549
165
- 58
+ 78
0
-10
@@ -1973,7 +1995,7 @@ f_setWindTurbines( sl_largeScaleWind_MW.getValue() - p_currentWindTurbines_MW, s
1770118893567
165
- 88
+ 108
0
-10
@@ -2000,7 +2022,7 @@ f_setWindTurbines( sl_largeScaleWind_MW.getValue() - p_currentWindTurbines_MW, s
1777620991223
20
- 150
+ 170
0
-10
@@ -2026,7 +2048,7 @@ f_setWindTurbines( sl_largeScaleWind_MW.getValue() - p_currentWindTurbines_MW, s
1777620991268
302
- 142
+ 162
0
-10
@@ -2051,7 +2073,7 @@ f_setWindTurbines( sl_largeScaleWind_MW.getValue() - p_currentWindTurbines_MW, s
1777620991324
165
- 148
+ 168
0
-10
@@ -2074,6 +2096,217 @@ f_setWindTurbines( sl_largeScaleWind_MW.getValue() - p_currentWindTurbines_MW, s
false
+
+ 1777995324604
+
+ 20
+ 200
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+
+
+ 12
+
+
+ LEFT
+
+
+ false
+ 1777995277264
+
+ 20
+ 220
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ -16777216
+ true
+ zero_Interface.b_addCustomGC = true;
+zero_Interface.v_addCustomGCType = OL_EnergyAssetType.PHOTOVOLTAIC;
+zero_Interface.f_setForcedClickScreenTextBoxes("Energieassets toevoegen", new Color(255, 255, 255), new Color(0, 0, 0), "Teken je locatie op de kaart. Kies nog minimaal 3 hoekpunten.", new Color(255, 255, 255), new Color(0, 0, 0));
+zero_Interface.f_setForcedClickScreenVisibility(true);
+traceln("Adding solarfarm: Please click on the map to set the location.");
+
+
+
+ Zonnepark
+
+
+
+ false
+ 1777995277266
+
+ 20
+ 280
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ -16777216
+ true
+ zero_Interface.b_addCustomGC = true;
+zero_Interface.v_addCustomGCType = OL_EnergyAssetType.STORAGE_ELECTRIC;
+zero_Interface.f_setForcedClickScreenTextBoxes("Energieassets toevoegen", new Color(255, 255, 255), new Color(0, 0, 0), "Kies een locatie op de kaart", new Color(255, 255, 255), new Color(0, 0, 0));
+zero_Interface.f_setForcedClickScreenVisibility(true);
+traceln("Adding grid battery: Please click on the map to set the location.");
+
+
+
+ Buurtbatterij
+
+
+
+ false
+ 1777995277268
+
+ 20
+ 250
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ -16777216
+ true
+ zero_Interface.b_addCustomGC = true;
+zero_Interface.v_addCustomGCType = OL_EnergyAssetType.WINDMILL;
+zero_Interface.f_setForcedClickScreenTextBoxes("Energieassets toevoegen", new Color(255, 255, 255), new Color(0, 0, 0), "Kies een locatie op de kaart", new Color(255, 255, 255), new Color(0, 0, 0));
+zero_Interface.f_setForcedClickScreenVisibility(true);
+traceln("Adding windfarm: Please click on the map to set the location.");
+
+
+
+ Windpark
+
+
+
+ false
+ 1777995277270
+
+ 250
+ 220
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ -16777216
+ true
+ !zero_Interface.c_customSolarfarmGCs.isEmpty() || !zero_Interface.c_customWindfarmGCs.isEmpty() || !zero_Interface.c_customGridBatteryGCs.isEmpty()
+ if(!zero_Interface.c_customSolarfarmGCs.isEmpty() || !zero_Interface.c_customWindfarmGCs.isEmpty() || !zero_Interface.c_customGridBatteryGCs.isEmpty()) {
+ zero_Interface.b_removeCustomGC = true;
+ zero_Interface.f_setForcedClickScreenTextBoxes("Energieassets verwijderen", new Color(255, 255, 255), new Color(0, 0, 0), "Kies een energieasset op de kaart", new Color(255, 255, 255), new Color(0, 0, 0));
+ zero_Interface.f_setForcedClickScreenVisibility(true);
+ traceln("Click on the energy asset you want to remove.");
+} else {
+ throw new RuntimeException("There is no custom energy asset loaded in.");
+}
+
+
+
+ Verwijderen...
+
+
+
+ false
+ 1777995277272
+
+ 250
+ 250
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D3D
+
+ false
+ -16777216
+ true
+ !zero_Interface.c_customSolarfarmGCs.isEmpty() || !zero_Interface.c_customWindfarmGCs.isEmpty() || !zero_Interface.c_customGridBatteryGCs.isEmpty()
+ if(!zero_Interface.c_customSolarfarmGCs.isEmpty() || !zero_Interface.c_customWindfarmGCs.isEmpty() || !zero_Interface.c_customGridBatteryGCs.isEmpty()) {
+
+ while (!zero_Interface.c_customSolarfarmGCs.isEmpty()) {
+ zero_Interface.f_removeCustomGC(zero_Interface.c_customSolarfarmGCs.get(0));
+ }
+ while (!zero_Interface.c_customWindfarmGCs.isEmpty()) {
+ zero_Interface.f_removeCustomGC(zero_Interface.c_customWindfarmGCs.get(0));
+ }
+ while (!zero_Interface.c_customGridBatteryGCs.isEmpty()) {
+ zero_Interface.f_removeCustomGC(zero_Interface.c_customGridBatteryGCs.get(0));
+ }
+ traceln("Removed all custom EAs.");
+
+} else {
+ throw new RuntimeException("There is no custom energy asset loaded in.");
+}
+
+
+
+ Verwijder alles
+
+
+
+ 1778953362982
+
+ 20
+ 60
+
+ 0
+ -10
+
+ true
+ true
+ false
+ SHAPE_DRAW_2D
+ false
+ 0
+ 0.0
+ -16777216
+
+
+
+ 12
+
+
+ LEFT
+
diff --git a/_alp/Agents/tabElectricity/Variables.xml b/_alp/Agents/tabElectricity/Variables.xml
index cddb7cc..a1075a9 100644
--- a/_alp/Agents/tabElectricity/Variables.xml
+++ b/_alp/Agents/tabElectricity/Variables.xml
@@ -24,7 +24,7 @@
1745483322704
-
+
50
1270
@@ -52,7 +52,7 @@
1745483371462
-
+
50
1290
@@ -80,7 +80,7 @@
1765276731422
-
+
50
1340