Skip to content
Open
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
113 changes: 66 additions & 47 deletions _alp/Agents/Zero_Loader/Code/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ else if(RegionCoords.startsWith("LineString")){
solarpark = energyModel.add_EnergyProductionSites();

solarpark.set_p_gridConnectionID( dataSolarfarm.gc_id() );

//Set Address
solarpark.p_address = new J_Address(dataSolarfarm.streetname(),
dataSolarfarm.house_number(),
Expand Down Expand Up @@ -304,7 +303,8 @@ else if(RegionCoords.startsWith("LineString")){
}
}
if(gridNodeProfileLoaderType != OL_GridNodeProfileLoaderType.INCLUDE_PV || gridNodeProfileLoaderType != OL_GridNodeProfileLoaderType.NET_LOAD){
f_addEnergyProduction(solarpark, OL_EnergyAssetType.PHOTOVOLTAIC, "Solar farm" , dataSolarfarm.capacity_electric_kw());
f_addPVProductionAsset(solarpark, "Solar farm" , dataSolarfarm.capacity_electric_kw(), dataSolarfarm.orientation());
//f_addEnergyProduction(solarpark, OL_EnergyAssetType.PHOTOVOLTAIC, "Solar farm" , dataSolarfarm.capacity_electric_kw());
}

//Set owner
Expand Down Expand Up @@ -611,7 +611,8 @@ else if(RegionCoords.startsWith("LineString")){
windfarm.v_isActive = dataWindfarm.initially_active();

//Create EA for the windturbine GC
f_addEnergyProduction(windfarm, OL_EnergyAssetType.WINDMILL, "Windmill onshore", dataWindfarm.capacity_electric_kw());
f_addWindProductionAsset(windfarm, "Windmill onshore", dataWindfarm.capacity_electric_kw());
//f_addEnergyProduction(windfarm, OL_EnergyAssetType.WINDMILL, "Windmill onshore", dataWindfarm.capacity_electric_kw());

//Set owner
ConnectionOwner owner;
Expand Down Expand Up @@ -1016,38 +1017,6 @@ GIS_Building f_createGISBuilding(Building_data buildingData,GridConnection paren
}
/*ALCODEEND*/}

double f_addEnergyProduction(GridConnection parentGC,OL_EnergyAssetType asset_type,String asset_name,double installedPower_kW)
{/*ALCODESTART::1726584205809*/
double assetCapacity_kW = 0;
J_TimeParameters timeParameters = energyModel.p_timeParameters;
J_ProfilePointer profilePointer = null;
OL_EnergyCarriers energyCarrier = OL_EnergyCarriers.ELECTRICITY;
switch (asset_type){

case PHOTOVOLTAIC:
energyCarrier = OL_EnergyCarriers.ELECTRICITY;
profilePointer = energyModel.pp_PVProduction35DegSouth_fr;
assetCapacity_kW = installedPower_kW;
break;

case WINDMILL:
energyCarrier = OL_EnergyCarriers.ELECTRICITY;
profilePointer=energyModel.pp_windProduction_fr;
assetCapacity_kW = installedPower_kW;
break;

case PHOTOTHERMAL: //NOT USED YET
energyCarrier = OL_EnergyCarriers.HEAT;
profilePointer = energyModel.pp_PVProduction35DegSouth_fr; // Voor nu om te testen! Misschien valt dit wel te gebruiken met bepaalde efficientie factor!
assetCapacity_kW = installedPower_kW;
break;
}

J_EAProduction production_asset = new J_EAProduction(parentGC, asset_type, asset_name, energyCarrier, assetCapacity_kW, timeParameters, profilePointer);


/*ALCODEEND*/}

GIS_Object f_createGISObject(String name,double latitude,double longitude,String polygon,OL_GISObjectType GISObjectType)
{/*ALCODESTART::1726584205811*/
GIS_Object area = energyModel.add_pop_GIS_Objects();
Expand Down Expand Up @@ -1529,7 +1498,8 @@ else if (vehicle_type == OL_EnergyAssetType.PETROLEUM_FUEL_VAN){
pv_installed_kwp = 0.0;
}
if(pv_installed_kwp != null && pv_installed_kwp > 0){
f_addEnergyProduction(companyGC, OL_EnergyAssetType.PHOTOVOLTAIC, "Rooftop Solar", pv_installed_kwp);
f_addPVProductionAsset(companyGC, "Rooftop Solar", pv_installed_kwp, OL_PVOrientation.SOUTH);
//f_addEnergyProduction(companyGC, OL_EnergyAssetType.PHOTOVOLTAIC, "Rooftop Solar", pv_installed_kwp);

current_scenario_list.setCurrentPV_kW(roundToInt(pv_installed_kwp));
future_scenario_list.setPlannedPV_kW(roundToInt(pv_installed_kwp));
Expand Down Expand Up @@ -2367,15 +2337,17 @@ else if(!settings.createCurrentElectricityEA()){//input boolean: Dont create cur
current_scenario_list.setCurrentPV_kW(gridConnection.getSupply().getPvInstalledKwp());
} else if (gridConnection.getSupply().getPvInstalledKwp() != null && gridConnection.getSupply().getPvInstalledKwp() > 0){
//gridConnection.getSupply().getPvOrientation(); // Wat doen we hier mee????? Nog niets!
f_addEnergyProduction(companyGC, OL_EnergyAssetType.PHOTOVOLTAIC, "Rooftop Solar", gridConnection.getSupply().getPvInstalledKwp());
f_addPVProductionAsset(companyGC, "Rooftop Solar", (double) gridConnection.getSupply().getPvInstalledKwp(), OL_PVOrientation.SOUTH); //NEEDS FIXING
//f_addEnergyProduction(companyGC, OL_EnergyAssetType.PHOTOVOLTAIC, "Rooftop Solar", gridConnection.getSupply().getPvInstalledKwp());

//add to scenario: current
current_scenario_list.setCurrentPV_kW(gridConnection.getSupply().getPvInstalledKwp());
//current_scenario_list.currentPV_orient = gridConnection.getSupply().getPvOrientation();
}
//Wind
if (gridConnection.getSupply().getWindInstalledKw() != null && gridConnection.getSupply().getWindInstalledKw() > 0){
f_addEnergyProduction(companyGC, OL_EnergyAssetType.WINDMILL, "Wind mill", gridConnection.getSupply().getWindInstalledKw());
f_addWindProductionAsset(companyGC, "Wind mill", gridConnection.getSupply().getWindInstalledKw());
//f_addEnergyProduction(companyGC, OL_EnergyAssetType.WINDMILL, "Wind mill", gridConnection.getSupply().getWindInstalledKw());

//add to scenario: current
current_scenario_list.setCurrentWind_kW(gridConnection.getSupply().getWindInstalledKw());
Expand Down Expand Up @@ -2981,6 +2953,8 @@ GridNode f_createHeatGridNode()
gridnode_id(gridNodeID).
initially_active(false).

orientation(OL_PVOrientation.SOUTH).

capacity_electric_kw(0.0).
connection_capacity_kw(0.0).
contracted_delivery_capacity_kw(0.0).
Expand Down Expand Up @@ -3143,8 +3117,8 @@ J_ProfilePointer f_createEngineProfile(String profileID,double[] arguments,doubl

//Create Weather engine profiles
energyModel.pp_ambientTemperature_degC = f_createEngineProfile("ambient_temperature_degC", a_arguments_hr, a_ambientTemperatureProfile_degC, OL_ProfileUnits.TEMPERATURE_DEGC);
energyModel.pp_PVProduction35DegSouth_fr = f_createEngineProfile("pv_production_south_fr", a_arguments_hr, a_PVProductionProfile35DegSouth_fr, OL_ProfileUnits.NORMALIZEDPOWER);
energyModel.pp_PVProduction15DegEastWest_fr = f_createEngineProfile("pv_production_eastwest_fr", a_arguments_hr, a_PVProductionProfile15DegEastWest_fr, OL_ProfileUnits.NORMALIZEDPOWER);
energyModel.pp_PVProduction35DegSouth_fr = f_createEngineProfile("pv_production_35degsouth_fr", a_arguments_hr, a_PVProductionProfile35DegSouth_fr, OL_ProfileUnits.NORMALIZEDPOWER);
energyModel.pp_PVProduction15DegEastWest_fr = f_createEngineProfile("pv_production_15degeastwest_fr", a_arguments_hr, a_PVProductionProfile15DegEastWest_fr, OL_ProfileUnits.NORMALIZEDPOWER);
energyModel.pp_windProduction_fr = f_createEngineProfile("wind_production_fr", a_arguments_hr, a_windProductionProfile_fr, OL_ProfileUnits.NORMALIZEDPOWER);

//Create Epex engine profile
Expand Down Expand Up @@ -3256,7 +3230,8 @@ else if (maxFeedin_kWh > 0 && !isPvPowerKnownAndPositive){
pvPower_kW = 2.5 * (maxFeedin_kWh/energyModel.p_timeParameters.getTimeStep_h()); // Estimation needed for pv power
traceln("PV Power has been estimated!");
f_createPreprocessedElectricityProfile_PV(GC_GridNode_profile, a_yearlyElectricityDelivery_kWh, a_yearlyElectricityFeedin_kWh, null, pvPower_kW, null);
f_addEnergyProduction(GC_GridNode_profile, OL_EnergyAssetType.PHOTOVOLTAIC, "Total current Solar on GridNode", pvPower_kW);
f_addPVProductionAsset(GC_GridNode_profile, "Total current Solar on GridNode", pvPower_kW, OL_PVOrientation.SOUTH);
//f_addEnergyProduction(GC_GridNode_profile, OL_EnergyAssetType.PHOTOVOLTAIC, "Total current Solar on GridNode", pvPower_kW);
}
else { //EXCLUDE_PV
throw new RuntimeException("Grid node profile contains feed-in but no PV power is found in Building_data for EXCLUDE_PV. This is not allowed.");
Expand All @@ -3268,7 +3243,8 @@ else if (maxFeedin_kWh > 0 && !isPvPowerKnownAndPositive){
}
f_createPreprocessedElectricityProfile_PV(GC_GridNode_profile, a_yearlyElectricityDelivery_kWh, a_yearlyElectricityFeedin_kWh, null, pvPower_kW, null);
if (gridnode.p_profileType == OL_GridNodeProfileLoaderType.INCLUDE_PV){
f_addEnergyProduction(GC_GridNode_profile, OL_EnergyAssetType.PHOTOVOLTAIC, "Total current Solar on GridNode", pvPower_kW);
f_addPVProductionAsset(GC_GridNode_profile, "Total current Solar on GridNode", pvPower_kW, OL_PVOrientation.SOUTH);
//f_addEnergyProduction(GC_GridNode_profile, OL_EnergyAssetType.PHOTOVOLTAIC, "Total current Solar on GridNode", pvPower_kW);
}
}
}
Expand Down Expand Up @@ -3569,7 +3545,7 @@ else if (houseBuildingData.insulation_label() != null) {
GCH.v_liveAssetsMetaData.PVPotential_kW = GCH.v_liveAssetsMetaData.initialPV_kW > 0 ? GCH.v_liveAssetsMetaData.initialPV_kW : houseBuildingData.pv_potential_kwp(); // To prevent sliders from changing outcomes

//Create and add EnergyAssets
f_addEnergyAssetsToHouses(GCH, houseBuildingData.electricity_consumption_kwhpa(), houseBuildingData.gas_consumption_m3pa(), houseBuildingData.heating_type(), houseBuildingData.cooking_type());
f_addEnergyAssetsToHouses(GCH, houseBuildingData.electricity_consumption_kwhpa(), houseBuildingData.gas_consumption_m3pa(), houseBuildingData.heating_type(), houseBuildingData.cooking_type(), houseBuildingData.pv_orientation());

i++;
}
Expand All @@ -3584,7 +3560,7 @@ else if (houseBuildingData.insulation_label() != null) {
//traceln("Total space heat demand houses input " + roundToDecimal(totalSpaceHeatDemand_kwhpa/1000000,3) + "GWh");
/*ALCODEEND*/}

double f_addEnergyAssetsToHouses(GCHouse house,Double electricityDemand_kwhpa,Double gasDemand_m3pa,OL_GridConnectionHeatingType heatingType,OL_HouseholdCookingMethod cookingType)
double f_addEnergyAssetsToHouses(GCHouse house,Double electricityDemand_kwhpa,Double gasDemand_m3pa,OL_GridConnectionHeatingType heatingType,OL_HouseholdCookingMethod cookingType,OL_PVOrientation pvOrientation)
{/*ALCODESTART::1749728889986*/
//Add generic electricity demand profile
GridNode gn = findFirst(energyModel.pop_gridNodes, x -> x.p_gridNodeID.equals( house.p_parentNodeElectricID));
Expand All @@ -3603,7 +3579,7 @@ else if (houseBuildingData.insulation_label() != null) {


//Add pv
f_addPVToHouses(house, gn);
f_addPVToHouses(house, gn, pvOrientation);

//Add cars
f_addCarsToHouses(house);
Expand Down Expand Up @@ -5216,7 +5192,7 @@ Double f_getGNTotalPV_kWp(GridNode GN)
return totalPVPower_kW;
/*ALCODEEND*/}

double f_addPVToHouses(GCHouse house,GridNode gn)
double f_addPVToHouses(GCHouse house,GridNode gn,OL_PVOrientation pvOrientation)
{/*ALCODESTART::1770037586816*/
double installedRooftopSolar_kW = house.v_liveAssetsMetaData.initialPV_kW != null ? house.v_liveAssetsMetaData.initialPV_kW : 0;

Expand All @@ -5225,7 +5201,50 @@ Double f_getGNTotalPV_kWp(GridNode GN)
}

if (installedRooftopSolar_kW > 0) {
f_addEnergyProduction(house, OL_EnergyAssetType.PHOTOVOLTAIC, "Residential Solar", installedRooftopSolar_kW );
f_addPVProductionAsset(house, "Residential Solar", installedRooftopSolar_kW, pvOrientation);
//f_addEnergyProduction(house, OL_EnergyAssetType.PHOTOVOLTAIC, "Residential Solar", installedRooftopSolar_kW);
}
/*ALCODEEND*/}

double f_addPVProductionAsset(GridConnection parentGC,String asset_name,double installedPower_kW,OL_PVOrientation pvOrientation)
{/*ALCODESTART::1773414911038*/
J_TimeParameters timeParameters = energyModel.p_timeParameters;
OL_EnergyCarriers energyCarrier = OL_EnergyCarriers.ELECTRICITY;
J_ProfilePointer profilePointer = f_getPVTProfilePointer(pvOrientation);

J_EAProduction production_asset = new J_EAProduction(parentGC, OL_EnergyAssetType.PHOTOVOLTAIC, asset_name, energyCarrier, installedPower_kW, timeParameters, profilePointer);
/*ALCODEEND*/}

J_ProfilePointer f_getPVTProfilePointer(OL_PVOrientation pvtOrientation)
{/*ALCODESTART::1773414911040*/
J_ProfilePointer profilePointer = null;

switch (pvtOrientation){
case EASTWEST:
profilePointer = energyModel.pp_PVProduction15DegEastWest_fr;
case SOUTH:
profilePointer = energyModel.pp_PVProduction35DegSouth_fr;
}

return profilePointer;
/*ALCODEEND*/}

double f_addWindProductionAsset(GridConnection parentGC,String asset_name,double installedPower_kW)
{/*ALCODESTART::1773414911042*/
J_TimeParameters timeParameters = energyModel.p_timeParameters;
OL_EnergyCarriers energyCarrier = OL_EnergyCarriers.ELECTRICITY;
J_ProfilePointer profilePointer = energyModel.pp_windProduction_fr;

J_EAProduction production_asset = new J_EAProduction(parentGC, OL_EnergyAssetType.WINDMILL, asset_name, energyCarrier, installedPower_kW, timeParameters, profilePointer);
/*ALCODEEND*/}

double f_addPTProductionAsset(GridConnection parentGC,String asset_name,double installedPower_kW,OL_PVOrientation ptOrientation)
{/*ALCODESTART::1773414911044*/
//CONCEPT VERSION
J_TimeParameters timeParameters = energyModel.p_timeParameters;
OL_EnergyCarriers energyCarrier = OL_EnergyCarriers.HEAT;
J_ProfilePointer profilePointer = f_getPVTProfilePointer(ptOrientation);

J_EAProduction production_asset = new J_EAProduction(parentGC, OL_EnergyAssetType.PHOTOVOLTAIC, asset_name, energyCarrier, installedPower_kW, timeParameters, profilePointer);
/*ALCODEEND*/}

Loading