Skip to content
Closed
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
6 changes: 3 additions & 3 deletions _alp/Agents/UI_company/Code/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ else if (batteryAsset == null) {

double f_setPVSystem(GridConnection GC,double v_rooftopPV_kWp)
{/*ALCODESTART::1713954180112*/
if (GC.v_hasPV){
if (GC.v_liveAssetsMetaData.hasPV){
J_EAProduction pvAsset = findFirst(GC.c_productionAssets, p -> p.energyAssetType == OL_EnergyAssetType.PHOTOVOLTAIC );
if (v_rooftopPV_kWp == 0) {
pvAsset.removeEnergyAsset();;
Expand Down Expand Up @@ -1564,7 +1564,7 @@ else if(setAmountOfVehicles < local_HydrogenV_nb){ // Slider has decreased the a
double yearlyProductionHydrogen_kWh = 0;
double timestep_h = zero_Interface.energyModel.p_timeStep_h;
double outputTemperature_degC = 0;
parentGC.v_hasPV = true;
parentGC.v_liveAssetsMetaData.hasPV = true;

J_EAProduction production_asset = new J_EAProduction(parentGC, asset_type, asset_name, capacityElectric_kW , capacityHeat_kW, yearlyProductionMethane_kWh, yearlyProductionHydrogen_kWh, timestep_h, outputTemperature_degC, zero_Interface.energyModel.pp_PVProduction35DegSouth_fr);

Expand Down Expand Up @@ -1669,7 +1669,7 @@ else if(setAmountOfVehicles < local_HydrogenV_nb){ // Slider has decreased the a

//Find the current PV capacity
int PVCapacityCurrent = 0;
if (c_ownedGridConnections.get(v_currentSelectedGCnr).v_hasPV){
if (c_ownedGridConnections.get(v_currentSelectedGCnr).v_liveAssetsMetaData.hasPV){
J_EAProduction pvAsset = findFirst(c_ownedGridConnections.get(v_currentSelectedGCnr).c_productionAssets, p -> p.energyAssetType == OL_EnergyAssetType.PHOTOVOLTAIC );
PVCapacityCurrent = roundToInt(pvAsset.getCapacityElectric_kW());
}
Expand Down
4 changes: 3 additions & 1 deletion _alp/Agents/Zero_Interface/AOC.Zero_Interface.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import java.util.Dictionary.*;
import java.util.Hashtable.*;
import java.util.*;
import java.util.stream.Collectors;
import java.lang.Object;

import java.io.*;
import java.io.File;
Expand All @@ -40,7 +41,8 @@ import zero_engine.OL_EnergyCarriers;
import com.querydsl.core.types.dsl.TimeExpression;
import zero_engine.J_EAStorageElectric;
import zero_engine.J_EAConsumption;
import digital_twin_results.OL_ChartTypes;]]></Import>
import digital_twin_results.OL_ChartTypes;
import kotlin.Triple;]]></Import>
<Generic>false</Generic>
<GenericParameter>
<Id>1658477103138</Id>
Expand Down
102 changes: 46 additions & 56 deletions _alp/Agents/Zero_Interface/Code/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,14 @@ else if (v_previousClickedObjectType == OL_GISObjectType.BUILDING ||
v_connectionOwnerIndexNr = 0;

//Get the ghost vehicles for the transport slider tab
uI_Tabs.pop_tabMobility.get(0).f_calculateNumberOfGhostVehicles();

Triple<Integer, Integer, Integer> triple = uI_Tabs.pop_tabMobility.get(0).f_calculateNumberOfGhostVehicles( new ArrayList<GridConnection>(energyModel.UtilityConnections.findAll( x -> true)) );
uI_Tabs.pop_tabMobility.get(0).v_totalNumberOfGhostVehicle_Cars = triple.getFirst();
uI_Tabs.pop_tabMobility.get(0).v_totalNumberOfGhostVehicle_Vans = triple.getSecond();
uI_Tabs.pop_tabMobility.get(0).v_totalNumberOfGhostVehicle_Trucks = triple.getThird();
//Get the ghost heating systems
uI_Tabs.pop_tabHeating.get(0).f_calculateNumberOfGhostHeatingSystems();
Pair<Integer, Integer> pair = uI_Tabs.pop_tabHeating.get(0).f_calculateNumberOfGhostHeatingSystems( energyModel.UtilityConnections.findAll( x -> true) );
uI_Tabs.pop_tabHeating.get(0).v_totalNumberOfGhostHeatingSystems_ElectricHeatpumps = pair.getFirst();
uI_Tabs.pop_tabHeating.get(0).v_totalNumberOfGhostHeatingSystems_HybridHeatpumps = pair.getSecond();

/*ALCODEEND*/}

Expand Down Expand Up @@ -615,34 +619,27 @@ else if (v_previousClickedObjectType == OL_GISObjectType.BUILDING ||

double f_initialPVSystemsOrder()
{/*ALCODESTART::1714130288661*/
// First we make a copy of all the Uitility GridConnections
List<GridConnection> GCs = new ArrayList<>(energyModel.f_getGridConnections());
List<GridConnection> GCs_detailedCompanies = new ArrayList<>(energyModel.f_getGridConnections());
if( p_selectedProjectType == OL_ProjectType.RESIDENTIAL){
GCs = GCs.stream().filter(gc -> gc instanceof GCHouse).collect(Collectors.toList());
}
else {
GCs_detailedCompanies = GCs.stream().filter(gc -> gc instanceof GCUtility && gc.p_owner.p_detailedCompany).collect(Collectors.toList());
GCs = GCs.stream().filter(gc -> gc instanceof GCUtility && !gc.p_owner.p_detailedCompany).collect(Collectors.toList());
}
// Find all the GCs with PV at the start of the simulation
ArrayList<GridConnection> GCsWithPV = GCs.stream().filter(gc -> gc.v_hasPV).collect(Collectors.toCollection(ArrayList::new));
ArrayList<GridConnection> otherGCs = GCs.stream().filter(gc -> !gc.v_hasPV).collect(Collectors.toCollection(ArrayList::new));
//Collections.shuffle(otherGCs);
ArrayList<GridConnection> detailedCompanyGCsWithPV = GCs_detailedCompanies.stream().filter(gc -> gc.v_hasPV).collect(Collectors.toCollection(ArrayList::new));
ArrayList<GridConnection> datailedCompanyGCsnoPV = GCs_detailedCompanies.stream().filter(gc -> !gc.v_hasPV).collect(Collectors.toCollection(ArrayList::new));
List<GCHouse> houses = new ArrayList<GCHouse>(energyModel.Houses.findAll( x -> true));
List<GCHouse> housesWithoutPV = houses.stream().filter( gc -> !gc.v_liveAssetsMetaData.hasPV ).collect(Collectors.toList());
List<GCHouse> housesWithPV = new ArrayList<>(houses);
housesWithPV.removeAll(housesWithoutPV);

// We make sure that the GCs with PV at the start of the simulation are the last in the list
c_orderedPVSystemsHouses = new ArrayList<>(housesWithoutPV);
c_orderedPVSystemsHouses.addAll(housesWithPV);

//traceln("amount of GCs with PV at start: " + GCsWithPV.size());
//traceln("amount of other GCs at start: " + otherGCs.size());

if(c_companyUIs.size() == 0){
otherGCs.addAll(GCsWithPV);
}
List<GCUtility> companies = new ArrayList<GCUtility>(energyModel.UtilityConnections.findAll( x -> true));
List<GCUtility> companiesWithoutPV = companies.stream().filter( gc -> !gc.v_liveAssetsMetaData.hasPV ).collect(Collectors.toList());
List<GCUtility> companiesWithPV = companies.stream().filter( gc -> gc.v_liveAssetsMetaData.hasPV ).collect(Collectors.toList());
List<GCUtility> detailedCompaniesWithPV = companiesWithPV.stream().filter( gc -> gc.p_owner != null && gc.p_owner.p_detailedCompany ).collect(Collectors.toList());
List<GCUtility> genericCompaniesWithPV = new ArrayList<>(companiesWithPV);
genericCompaniesWithPV.removeAll(detailedCompaniesWithPV);

c_orderedPVSystemsCompanies = new ArrayList<>(companiesWithoutPV);
c_orderedPVSystemsCompanies.addAll(genericCompaniesWithPV);
c_orderedPVSystemsCompanies.addAll(detailedCompaniesWithPV);


c_orderedPVSystems = otherGCs;
c_orderedPVSystems.addAll(datailedCompanyGCsnoPV);
/*ALCODEEND*/}

double f_initialElectricVehiclesOrder()
Expand All @@ -667,27 +664,27 @@ else if (v_previousClickedObjectType == OL_GISObjectType.BUILDING ||

double f_initialHeatingSystemsOrder()
{/*ALCODESTART::1714131269202*/
// First we make a copy of all the GridConnections
List<GridConnection> companyList = new ArrayList<>(energyModel.f_getGridConnections());
companyList = companyList.stream().filter(gc -> gc instanceof GCUtility && gc.p_primaryHeatingAsset != null).collect(Collectors.toList());
List<GCHouse> houses = new ArrayList<GCHouse>(energyModel.Houses.findAll( x -> true));
List<GCHouse> housesWithoutHP = houses.stream().filter( gc -> gc.p_heatingType != OL_GridConnectionHeatingType.HEATPUMP_AIR ).collect(Collectors.toList());
List<GCHouse> housesWithHP = new ArrayList<>(houses);
housesWithHP.removeAll(housesWithoutHP);

// Find all the GCs with Heatpumps at the start of the simulation
ArrayList<GridConnection> GCsWithHP = companyList.stream().filter(gc -> gc.p_primaryHeatingAsset instanceof J_EAConversionHeatPump).collect(Collectors.toCollection(ArrayList::new));
ArrayList<GridConnection> otherGCs = companyList.stream().filter(gc -> !(gc.p_primaryHeatingAsset instanceof J_EAConversionHeatPump)).collect(Collectors.toCollection(ArrayList::new));
// We make sure that the GCs with Heatpumps at the start of the simulation are the last in the list (if there is no companyUI)
if(c_companyUIs.size() == 0){
otherGCs.addAll(GCsWithHP);
}
c_orderedHeatingSystemsCompanies = otherGCs;
c_orderedHeatingSystemsHouses = new ArrayList<>(housesWithoutHP);
c_orderedHeatingSystemsHouses.addAll(housesWithHP);


List<GCUtility> companies = new ArrayList<GCUtility>(energyModel.UtilityConnections.findAll( x -> true));
List<GCUtility> companiesWithoutHP = companies.stream().filter( gc -> gc.p_heatingType != OL_GridConnectionHeatingType.HEATPUMP_AIR ).collect(Collectors.toList());
List<GCUtility> companiesWithHP = companies.stream().filter( gc -> gc.p_heatingType == OL_GridConnectionHeatingType.HEATPUMP_AIR ).collect(Collectors.toList());
List<GCUtility> detailedCompaniesWithHP = companiesWithHP.stream().filter( gc -> gc.p_owner != null && gc.p_owner.p_detailedCompany ).collect(Collectors.toList());
List<GCUtility> genericCompaniesWithHP = new ArrayList<>(companiesWithHP);
genericCompaniesWithHP.removeAll(detailedCompaniesWithHP);

c_orderedHeatingSystemsCompanies = new ArrayList<>(companiesWithoutHP);
c_orderedHeatingSystemsCompanies.addAll(genericCompaniesWithHP);
c_orderedHeatingSystemsCompanies.addAll(detailedCompaniesWithHP);


// Doe same for houses
List<GridConnection> houseList = new ArrayList<>(energyModel.f_getGridConnections());
houseList = houseList.stream().filter(gc -> gc instanceof GCHouse).collect(Collectors.toList());
ArrayList<GridConnection> housesWithHP = houseList.stream().filter(gc -> gc.p_primaryHeatingAsset instanceof J_EAConversionHeatPump).collect(Collectors.toCollection(ArrayList::new));
ArrayList<GridConnection> otherHouses = houseList.stream().filter(gc -> !(gc.p_primaryHeatingAsset instanceof J_EAConversionHeatPump)).collect(Collectors.toCollection(ArrayList::new));
otherHouses.addAll(housesWithHP);
c_orderedHeatingSystemsHouses = otherHouses;
/*ALCODEEND*/}

double f_initalAssetOrdering()
Expand Down Expand Up @@ -726,7 +723,7 @@ else if (v_previousClickedObjectType == OL_GISObjectType.BUILDING ||
*/

if (gis_area.c_containedGridConnections.size() > 0) {
if (gis_area.c_containedGridConnections.get(0).v_hasPV) {
if (gis_area.c_containedGridConnections.get(0).v_liveAssetsMetaData.hasPV) {
if (gis_area.c_containedGridConnections.get(0).c_productionAssets.get(0).getCapacityElectric_kW() < 100){
gis_area.f_style(rect_smallProduction.getFillColor(), null, null, null);
}
Expand Down Expand Up @@ -846,7 +843,7 @@ public void write(int b) {
double f_setColorsBasedOnProductionHouseholds(GIS_Object gis_area)
{/*ALCODESTART::1718265697364*/
if (gis_area.c_containedGridConnections.size() > 0) {
if (gis_area.c_containedGridConnections.get(0).v_hasPV) {
if (gis_area.c_containedGridConnections.get(0).v_liveAssetsMetaData.hasPV) {
if (gis_area.c_containedGridConnections.get(0).c_productionAssets.get(0).getCapacityElectric_kW() < 5){
gis_area.f_style( rect_householdSmallProduction.getFillColor(), null, null, null );
}
Expand All @@ -865,15 +862,8 @@ public void write(int b) {
{/*ALCODESTART::1718288402102*/
// ATTENTION: If you have custom tabs it may be neccesary to override this function and add updates to your custom sliders!

if(c_companyUIs.size()>0){//Update ghost vehicles and heating systems present if there are companyUIs
uI_Tabs.pop_tabHeating.get(0).f_calculateNumberOfGhostHeatingSystems();
uI_Tabs.pop_tabMobility.get(0).f_calculateNumberOfGhostVehicles();
}



// PV SYSTEMS:
double PVsystems = count(energyModel.UtilityConnections, x->x.v_hasPV == true && x.v_isActive);
double PVsystems = count(energyModel.UtilityConnections, x->x.v_liveAssetsMetaData.hasPV == true && x.v_isActive);
int PV_pct = roundToInt(100 * PVsystems / count(energyModel.UtilityConnections, x->x.v_isActive));
uI_Tabs.pop_tabElectricity.get(0).getSliderRooftopPVCompanies_pct().setValue(PV_pct, false);

Expand Down Expand Up @@ -1687,7 +1677,7 @@ else if(c_selectedFilterOptions.contains(selectedFilter_OL)){ // Remove filter

double f_filterHasPV(ArrayList<GridConnection> toBeFilteredGC)
{/*ALCODESTART::1734448690487*/
c_selectedGridConnections = new ArrayList<>(findAll(toBeFilteredGC, GC -> GC.v_hasPV));
c_selectedGridConnections = new ArrayList<>(findAll(toBeFilteredGC, GC -> GC.v_liveAssetsMetaData.hasPV));

/*ALCODEEND*/}

Expand Down
44 changes: 31 additions & 13 deletions _alp/Agents/Zero_Interface/Variables.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2411,7 +2411,7 @@
<Id>1715178022675</Id>
<Name><![CDATA[c_orderedVehicles]]></Name>
<X>68</X>
<Y>-550</Y>
<Y>-535</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand All @@ -2429,7 +2429,7 @@
<Id>1715183417595</Id>
<Name><![CDATA[c_orderedHeatingSystemsCompanies]]></Name>
<X>68</X>
<Y>-525</Y>
<Y>-510</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand All @@ -2439,15 +2439,15 @@
<ShowLabel>true</ShowLabel>
<Properties SaveInSnapshot="true" AccessType="public" StaticVariable="false">
<CollectionClass>ArrayList</CollectionClass>
<ElementClass>GridConnection</ElementClass>
<ElementClass>GCUtility</ElementClass>
<ValueElementClass>String</ValueElementClass>
</Properties>
</Variable>
<Variable Class="CollectionVariable">
<Id>1715183423011</Id>
<Name><![CDATA[c_orderedPVSystems]]></Name>
<Name><![CDATA[c_orderedPVSystemsCompanies]]></Name>
<X>68</X>
<Y>-570</Y>
<Y>-575</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand All @@ -2457,15 +2457,15 @@
<ShowLabel>true</ShowLabel>
<Properties SaveInSnapshot="true" AccessType="public" StaticVariable="false">
<CollectionClass>ArrayList</CollectionClass>
<ElementClass>GridConnection</ElementClass>
<ElementClass>GCUtility</ElementClass>
<ValueElementClass>String</ValueElementClass>
</Properties>
</Variable>
<Variable Class="CollectionVariable">
<Id>1719176257019</Id>
<Name><![CDATA[c_orderedHeatingSystemsHouses]]></Name>
<X>68</X>
<Y>-505</Y>
<Y>-490</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand All @@ -2475,15 +2475,15 @@
<ShowLabel>true</ShowLabel>
<Properties SaveInSnapshot="true" AccessType="public" StaticVariable="false">
<CollectionClass>ArrayList</CollectionClass>
<ElementClass>GridConnection</ElementClass>
<ElementClass>GCHouse</ElementClass>
<ValueElementClass>String</ValueElementClass>
</Properties>
</Variable>
<Variable Class="CollectionVariable">
<Id>1720174179054</Id>
<Name><![CDATA[c_orderedHousesPrivateParking]]></Name>
<X>70</X>
<Y>-470</Y>
<Y>-455</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand All @@ -2501,7 +2501,7 @@
<Id>1720174197464</Id>
<Name><![CDATA[c_orderedHousesPublicParking]]></Name>
<X>70</X>
<Y>-450</Y>
<Y>-435</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand All @@ -2519,7 +2519,7 @@
<Id>1720376141906</Id>
<Name><![CDATA[c_activePublicChargers]]></Name>
<X>70</X>
<Y>-380</Y>
<Y>-365</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand All @@ -2537,7 +2537,7 @@
<Id>1720376165741</Id>
<Name><![CDATA[c_inactivePublicChargers]]></Name>
<X>70</X>
<Y>-360</Y>
<Y>-345</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand All @@ -2555,7 +2555,7 @@
<Id>1720376624239</Id>
<Name><![CDATA[c_fixedPublicChargers]]></Name>
<X>70</X>
<Y>-400</Y>
<Y>-385</Y>
<Label>
<X>10</X>
<Y>0</Y>
Expand Down Expand Up @@ -2805,4 +2805,22 @@
<ValueElementClass>String</ValueElementClass>
</Properties>
</Variable>
<Variable Class="CollectionVariable">
<Id>1747300275742</Id>
<Name><![CDATA[c_orderedPVSystemsHouses]]></Name>
<X>68</X>
<Y>-555</Y>
<Label>
<X>10</X>
<Y>0</Y>
</Label>
<PublicFlag>false</PublicFlag>
<PresentationFlag>true</PresentationFlag>
<ShowLabel>true</ShowLabel>
<Properties SaveInSnapshot="true" AccessType="public" StaticVariable="false">
<CollectionClass>ArrayList</CollectionClass>
<ElementClass>GCHouse</ElementClass>
<ValueElementClass>String</ValueElementClass>
</Properties>
</Variable>
</Variables>
Loading