Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 17 additions & 75 deletions _alp/Agents/Zero_Interface/Code/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,52 +97,23 @@
}
}

//Check if click was on Building, if yes, select grid building
for ( GIS_Building b : energyModel.pop_GIS_Buildings ){
if( b.gisRegion != null && b.gisRegion.contains(clickx, clicky) ){
if (b.gisRegion.isVisible()) { //only allow us to click on visible objects
if (b.c_containedGridConnections.size() > 0 ) { // only allow buildings with gridconnections
if(f_checkIfGCsAreAccesible(b.c_containedGridConnections)){
buildingsConnectedToSelectedBuildingsList = b.c_containedGridConnections.get(0).c_connectedGISObjects; // Find buildings powered by the same GC as the clicked building
f_selectBuilding(b, buildingsConnectedToSelectedBuildingsList);
}
else{
f_selectEnergyModel();
}
return;
}
}
}
}

//Check if click was on remaining objects such as chargers, solarfields, parcels: if yes, select object
for ( GIS_Object GISobject : energyModel.pop_GIS_Objects ){
if( GISobject.gisRegion != null && GISobject.gisRegion.contains(clickx, clicky) ) {
if (GISobject.gisRegion.isVisible()) { //only allow us to click on visible objects
if (GISobject.c_containedGridConnections.size() > 0 ) { // only allow objects with gridconnections
if(f_checkIfGCsAreAccesible(GISobject.c_containedGridConnections)){
// Find buildings powered by the same GC as the clicked object
buildingsConnectedToSelectedBuildingsList = GISobject.c_containedGridConnections.get(0).c_connectedGISObjects;

//Find the (first) connected GC in the object
GridConnection selectedGC = GISobject.c_containedGridConnections.get(0);

//Set the selected GIS object type
v_clickedObjectType = GISobject.p_GISObjectType;
c_selectedObjects.add(GISobject);

//Set the correct interface view for each object type
switch(v_clickedObjectType){

case CHARGER:
f_selectCharger((GCPublicCharger)selectedGC, GISobject );
break;

default:
buildingsConnectedToSelectedBuildingsList = GISobject.c_containedGridConnections.get(0).c_connectedGISObjects; // Find buildings powered by the same GC as the clicked building
f_selectBuilding(GISobject, buildingsConnectedToSelectedBuildingsList);
break;
}
//Group all buildings with gisobjects in one array for a single loop (Fastest way to convert pop to list is writing out the loop)
List<GIS_Object> 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);
}

//Check if click was on Building or GISObject such as chargers, solarfields, windfarm, if yes: Select.
for ( GIS_Object GISObject : allGISObjects ){
if( GISObject.gisRegion != null && GISObject.gisRegion.contains(clickx, clicky) ) {
if (GISObject.gisRegion.isVisible()) { //only allow us to click on visible objects
if (GISObject.c_containedGridConnections.size() > 0 ) { // only allow objects with gridconnections
if(f_checkIfGCsAreAccesible(GISObject.c_containedGridConnections)){
buildingsConnectedToSelectedBuildingsList = GISObject.c_containedGridConnections.get(0).c_connectedGISObjects; // Find buildings powered by the same GC as the clicked object
f_selectBuilding(GISObject, buildingsConnectedToSelectedBuildingsList);
}
else{
f_selectEnergyModel();
Expand Down Expand Up @@ -348,10 +319,6 @@
v_clickedObjectText = GN.p_nodeType + "-station, " + Integer.toString( ((int)GN.p_capacity_kW) ) + " kW (ingeschat), ID: " + GN.p_gridNodeID + ", aansluitingen: " + GN.f_getConnectedGridConnections().size() + ", Type station: " + GN.p_description;
}

v_clickedObjectAdress = "";
v_clickedObjectDetails = "Type station:\t" + GN.p_description;


// Color the GridNode
GN.gisRegion.setFillColor( v_selectionColor );
GN.gisRegion.setLineColor( orange );
Expand Down Expand Up @@ -452,8 +419,6 @@ else if(b.p_annotation != null){
if(v_previousClickedObjectType != null){
// Update for results_ui when deselecting objects to show entire area again as default option
v_clickedObjectText = "None";
v_clickedObjectAdress = "";
v_clickedObjectDetails = "";
v_clickedObjectType = null;
button_goToUI.setVisible(false);
gr_multipleBuildingInfo.setVisible(false);
Expand Down Expand Up @@ -774,29 +739,6 @@ public void write(int b) {
}
/*ALCODEEND*/}

double f_selectCharger(GCPublicCharger charger,GIS_Object objectGIS)
{/*ALCODESTART::1718552624959*/
objectGIS.gisRegion.setFillColor( v_selectionColor );
objectGIS.gisRegion.setLineColor( orange );

//set info text
v_clickedObjectText = ""; //charger.p_CPOName + " laadpunt, ";
if (charger.p_address == null || charger.p_address.getAddress() == null) {
v_clickedObjectAdress = "Onbekend adres";
}
else{
v_clickedObjectAdress = charger.p_address.getStreetName();
}
v_clickedObjectDetails = "No detaild info of charger available";

//v_clickedGridConnection = charger;
c_selectedGridConnections = new ArrayList<GridConnection>(Arrays.asList(charger));
uI_Results.f_updateResultsUI(c_selectedGridConnections.get(0));

//Set the UI button
f_setUIButton();
/*ALCODEEND*/}

double f_setColorsBasedOnGridTopology_objects(GIS_Object gis_area)
{/*ALCODESTART::1718566260603*/
if (gis_area.c_containedGridConnections.size() > 0) {
Expand Down
36 changes: 6 additions & 30 deletions _alp/Agents/Zero_Interface/Code/Functions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -482,30 +482,6 @@
<ShowLabel>true</ShowLabel>
<Body xmlns:al="http://anylogic.com"/>
</Function>
<Function AccessType="protected" StaticFunction="false">
<ReturnModificator>VOID</ReturnModificator>
<ReturnType>double</ReturnType>
<Id>1718552624959</Id>
<Name><![CDATA[f_selectCharger]]></Name>
<X>70</X>
<Y>1140</Y>
<Label>
<X>10</X>
<Y>0</Y>
</Label>
<PublicFlag>false</PublicFlag>
<PresentationFlag>true</PresentationFlag>
<ShowLabel>true</ShowLabel>
<Parameter>
<Name><![CDATA[charger]]></Name>
<Type><![CDATA[GCPublicCharger]]></Type>
</Parameter>
<Parameter>
<Name><![CDATA[objectGIS]]></Name>
<Type><![CDATA[GIS_Object]]></Type>
</Parameter>
<Body xmlns:al="http://anylogic.com"/>
</Function>
<Function AccessType="default" StaticFunction="false">
<ReturnModificator>VOID</ReturnModificator>
<ReturnType>double</ReturnType>
Expand Down Expand Up @@ -548,7 +524,7 @@
<Id>1720793723819</Id>
<Name><![CDATA[f_updateUIResultsData]]></Name>
<X>80</X>
<Y>1160</Y>
<Y>1140</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand Down Expand Up @@ -620,7 +596,7 @@
<Id>1721049341787</Id>
<Name><![CDATA[f_listFunctions]]></Name>
<X>80</X>
<Y>1180</Y>
<Y>1160</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand All @@ -636,7 +612,7 @@
<Id>1725006890451</Id>
<Name><![CDATA[f_setUIButton]]></Name>
<X>80</X>
<Y>1200</Y>
<Y>1180</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand Down Expand Up @@ -1444,7 +1420,7 @@
<Id>1750261221085</Id>
<Name><![CDATA[f_setTrafoText]]></Name>
<X>50</X>
<Y>1700</Y>
<Y>1590</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand Down Expand Up @@ -1660,7 +1636,7 @@
<Id>1752836715726</Id>
<Name><![CDATA[f_clearSelectionAndSelectEnergyModel]]></Name>
<X>50</X>
<Y>1240</Y>
<Y>1220</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand Down Expand Up @@ -2583,7 +2559,7 @@
<Id>1764776636006</Id>
<Name><![CDATA[f_selectEnergyModel]]></Name>
<X>70</X>
<Y>1220</Y>
<Y>1200</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand Down
66 changes: 11 additions & 55 deletions _alp/Agents/Zero_Interface/Variables.xml
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@
<Id>1696863329269</Id>
<Name><![CDATA[v_gridConnectionInBuildingIndex]]></Name>
<X>50</X>
<Y>1560</Y>
<Y>1490</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand Down Expand Up @@ -309,7 +309,7 @@
<Id>1701879001472</Id>
<Name><![CDATA[v_clickedObjectText]]></Name>
<X>50</X>
<Y>1580</Y>
<Y>1510</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand All @@ -327,28 +327,6 @@
</InitialValue>
</Properties>
</Variable>
<Variable Class="PlainVariable">
<Id>1701879014361</Id>
<Name><![CDATA[v_clickedObjectAdress]]></Name>
<X>50</X>
<Y>1600</Y>
<Label>
<X>10</X>
<Y>0</Y>
</Label>
<PublicFlag>false</PublicFlag>
<PresentationFlag>true</PresentationFlag>
<ShowLabel>true</ShowLabel>
<Properties SaveInSnapshot="true"
Constant="false"
AccessType="public"
StaticVariable="false">
<Type><![CDATA[String]]></Type>
<InitialValue Class="CodeValue">
<Code><![CDATA[""]]></Code>
</InitialValue>
</Properties>
</Variable>
<Variable Class="PlainVariable">
<Id>1702041370471</Id>
<Name><![CDATA[v_simulationArea1Color]]></Name>
Expand Down Expand Up @@ -459,28 +437,6 @@
</InitialValue>
</Properties>
</Variable>
<Variable Class="PlainVariable">
<Id>1702046920293</Id>
<Name><![CDATA[v_clickedObjectDetails]]></Name>
<X>50</X>
<Y>1620</Y>
<Label>
<X>10</X>
<Y>0</Y>
</Label>
<PublicFlag>false</PublicFlag>
<PresentationFlag>true</PresentationFlag>
<ShowLabel>true</ShowLabel>
<Properties SaveInSnapshot="true"
Constant="false"
AccessType="public"
StaticVariable="false">
<Type><![CDATA[String]]></Type>
<InitialValue Class="CodeValue">
<Code><![CDATA[""]]></Code>
</InitialValue>
</Properties>
</Variable>
<Variable Class="PlainVariable">
<Id>1704450852556</Id>
<Name><![CDATA[v_solarParkColor]]></Name>
Expand Down Expand Up @@ -727,7 +683,7 @@
<Id>1705673181898</Id>
<Name><![CDATA[v_clickedGridNode]]></Name>
<X>50</X>
<Y>1460</Y>
<Y>1390</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand All @@ -746,7 +702,7 @@
<Id>1705673647104</Id>
<Name><![CDATA[v_previousClickedObjectType]]></Name>
<X>50</X>
<Y>1430</Y>
<Y>1360</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand All @@ -765,7 +721,7 @@
<Id>1705673714784</Id>
<Name><![CDATA[v_previousClickedGridNode]]></Name>
<X>50</X>
<Y>1480</Y>
<Y>1410</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand Down Expand Up @@ -893,7 +849,7 @@
<Id>1707918668189</Id>
<Name><![CDATA[v_clickedObjectType]]></Name>
<X>50</X>
<Y>1410</Y>
<Y>1340</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand Down Expand Up @@ -1582,7 +1538,7 @@
<Id>1725018118872</Id>
<Name><![CDATA[b_showCables]]></Name>
<X>50</X>
<Y>1660</Y>
<Y>1550</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand Down Expand Up @@ -1670,7 +1626,7 @@
<Id>1739980192808</Id>
<Name><![CDATA[v_customEnergyCoop]]></Name>
<X>50</X>
<Y>1370</Y>
<Y>1300</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand Down Expand Up @@ -3091,7 +3047,7 @@ OL_FilterOptionsGC.MANUAL_SELECTION, "Handmatige selectie"
<Id>1721302080638</Id>
<Name><![CDATA[c_selectedGridConnections]]></Name>
<X>50</X>
<Y>1340</Y>
<Y>1270</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand Down Expand Up @@ -3163,7 +3119,7 @@ OL_FilterOptionsGC.MANUAL_SELECTION, "Handmatige selectie"
<Id>1734512815255</Id>
<Name><![CDATA[c_previousSelectedObjects]]></Name>
<X>50</X>
<Y>1530</Y>
<Y>1460</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand All @@ -3181,7 +3137,7 @@ OL_FilterOptionsGC.MANUAL_SELECTION, "Handmatige selectie"
<Id>1734513139372</Id>
<Name><![CDATA[c_selectedObjects]]></Name>
<X>50</X>
<Y>1510</Y>
<Y>1440</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand Down
Loading