Modules

Main Module

building_energy_process.executeBuildingEnergySimulationProcess(processPayload: dict, startTime: str, endTime: str, buildingUse: str) dict[source]

Function to execute the Building Energy Simulation process.

Parameters:
  • processPayload (dict) –

    The dictionary with the process input payload:

    Example: see "input.json" file in the root directory.
    

  • startTime (str) – The start datetime, e.g., “2019-03-01T13:00:00”.

  • endTime (str) – The end datetime, e.g., “2019-03-02T13:00:00”.

  • buildingUse (str) – The archetype (building use). For example: “Offices”.

Returns:

dict

building_energy_process.executeModel(modelPayload: dict) dict[source]

Function to execute the Buildings Stock Energy Model.

Parameters:

modelPayload (dict) –

The dictionary with the Model input payload:

Example: see "input.json" file in the root directory.

Returns:

dict

building_energy_process.formatHourlyResults(dictHourlyResults: dict, archetypes: list) dict[source]

Function to format the Hourly results.

Parameters:
  • dictHourlyResults (dict) –

    The dictionary resulting from the Hourly results calculation. Example:

    "{
        "Apartment Block": DataFrame,
        "Single family- Terraced houses": DataFrame,
        "Hotels and Restaurants": DataFrame,
        "Health": DataFrame,
        "Education": DataFrame,
        "Offices": DataFrame,
        "Trade": DataFrame,
        "Other non-residential buildings": DataFrame,
        "Sport": DataFrame
    }"
    

  • archetypes (list) –

    The list of building uses. Example:

    "[
        "Apartment Block",
        "Single family- Terraced houses",
        "Hotels and Restaurants",
        "Health,
        "Education",
        "Offices",
        "Trade",
        "Other non-residential buildings",
        "Sport"
    ]"
    

Returns:

dict

building_energy_process.main()[source]

Main function.

Parameters:
  • sys.argv[0] (str) – The current file name, e.g., “building_energy_process.py”.

  • sys.argv[1] (str) – The process input data file path, e.g., “input.json”.

  • sys.argv[2] (str) – The start datetime, e.g., “2019-03-01T13:00:00”.

  • sys.argv[3] (str) – The end datetime, e.g., “2019-03-02T13:00:00”.

  • sys.argv[4] (str) – The archetype (building use), e.g., “Offices”.

Returns:

None

Model Module

building_stock_energy_model.model.s01LoadPreviousResult(nutsId: str) tuple[source]

Model Step 01: Load the previous result.

Parameters:

nutsId (str) – Identifier of NUTS2 region for which the analysis will be carried out.

Returns:

tuple

building_stock_energy_model.model.s02RetrieveTemperatures(nutsId: str, year: int) DataFrame[source]

Model Step 02: Retrieve temperatures.

Parameters:
  • nutsId (str) – Identifier of NUTS2 region for which the analysis will be carried out.

  • year (int) – The selected year.

Returns:

DataFrame

building_stock_energy_model.model.s03RetrieveRadiationValues(nutsId: str, year: int) DataFrame[source]

Model Step 03: Retrieve radiation values.

Parameters:
  • nutsId (str) – Identifier of NUTS2 region for which the analysis will be carried out.

  • year (int) – The selected year.

Returns:

DataFrame

building_stock_energy_model.model.s04LoadDatabase(nutsId: str, hddReduction: float, cddReduction: float) tuple[source]

Model Step 04: Load the database.

Parameters:
  • nutsId (str) – Identifier of NUTS2 region for which the analysis will be carried out.

  • hddReduction (float) – Reduction in heating degree days for future scenario.

  • cddReduction (float) – Reduction in cooling degree days for future scenarios.

Returns:

tuple

building_stock_energy_model.model.s05RetrieveSolarData(nutsId: str, year: int, listInputJsonSolar: list, dictDBBuildings: dict)[source]

Model Step 05: Retrieve radiation values.

Parameters:
  • nutsId (str) – Identifier of NUTS2 region for which the analysis will be carried out.

  • year (int) – The selected year.

  • listInputJsonSolar (list) –

    Data from the input.json file. Example:

    [
        {'building_use': 'Apartment Block', 'area_total': None, 'power': 195.826, 'capex': None},
        {'building_use': 'Single family- Terraced houses', ...},
        {'building_use': 'Offices', ...},
        {'building_use': 'Education', ...},
        {'building_use': 'Health', ...},
        {'building_use': 'Trade', ...},
        {'building_use': 'Hotels and Restaurants', ...},
        {'building_use': 'Other non-residential buildings', ...},
        {'building_use': 'Sport', ...}
    ]
    

  • dictDBBuildings (dict) –

    Data from the database file. Example:

    {
        'System': {'system_cost': 0.5, 'opex_pv': 15000, 'min_ghi_pv': 1000, 'land_use_pv': 100},
        'Apartment Block': {'tilt': 30, 'azimuth': 180, 'loss': 14, 'efficiency': 18,
            'tracking_porcentage': 0, 'use_factor': 100, 'distribution': [0.6, 0.2, 0.2]},
        'Single family- Terraced houses': {...},
        'Hotels and Restaurants': {...},
        'Health': {...},
        'Education': {...},
        'Offices': {...},
        'Sport': {.},
        'Trade': {.},
        'Other non-residential buildings': {...},
    }
    

Returns:

DataFrame

building_stock_energy_model.model.s06AddColumnsToMainDataFrame(dfCSV: DataFrame) DataFrame[source]

Model Step 06: Add columns to the main dataframe.

Parameters:

dfCSV (DataFrame) – The built input data DataFrame.

Returns:

DataFrame

building_stock_energy_model.model.s07AddInputDataToMainDataframe(dfCSV: DataFrame, dfDHW: DataFrame, dfYears: DataFrame, dfSectors: DataFrame, dfDwellings: DataFrame, nutsId: str, increaseResidentialBuiltArea: float, increaseServiceBuiltArea: float) DataFrame[source]

Model Step 07: Add the input data to the main DataFrame.

Parameters:
  • dfCSV (DataFrame) – The built input data DataFrame.

  • dfDHW – (DataFrame): The DataFrame corresponding to DHW.

  • dfYears (DataFrame) – The DataFrame corresponding to Years.

  • dfSectors (DataFrame) – The DataFrame corresponding to Sectors.

  • dfDwellings (DataFrame) – The DataFrame corresponding to Dwellings.

  • nutsId (str) – Identifier of NUTS2 region for which the analysis will be carried out.

  • increaseResidentialBuiltArea (float) – Reduction in heating degree days for future scenario.

  • increaseServiceBuiltArea (float) – Reduction in cooling degree days for future scenarios.

Returns:

DataFrame

building_stock_energy_model.model.s08AddActiveMeasures(dfCSV: DataFrame, dfReshhtes: DataFrame, dfSerhhtes: DataFrame, dfRThheff: DataFrame, nutsId: str, activeMeasures: list, activeMeasuresBaseline: list, archetypes: list) DataFrame[source]

Model Step 08: Add the active measures.

Parameters:
  • dfCSV (DataFrame) – The built input data DataFrame.

  • dfReshhtes (DataFrame) – The DataFrame corresponding to Residential.

  • dfSerhhtes (DataFrame) – The DataFrame corresponding to Service.

  • dfRThheff (DataFrame) – The DataFrame corresponding to RT.

  • nutsId – str -> Identifier of NUTS2 region for which the analysis will be carried out.

  • activeMeasures (list) –

    The list of active measures:

    Example: see "input.json" file in the root directory.
    

  • activeMeasuresBaseline (list) –

    The list of active measures corresponding to the baseline:

    Example: see "input.json" file in the root directory.
    

  • archetypes (list) –

    The list of building uses. Example:

    "[
        "Apartment Block",
        "Single family- Terraced houses",
        "Hotels and Restaurants",
        "Health",
        "Education",
        "Offices",
        "Trade",
        "Other non-residential buildings",
        "Sport"
    ]"
    

Returns:

DataFrame

building_stock_energy_model.model.s09AddPassiveMeasures(dfCSV: DataFrame, passiveMeasures: DataFrame) DataFrame[source]

Model Step 09: Add the passive measures.

Parameters:
  • dfCSV (DataFrame) – The built input data DataFrame.

  • passiveMeasures (list) –

    The list of passive measures:

    Example: see "input.json" file in the root directory.
    

Returns:

DataFrame

building_stock_energy_model.model.s10WriteUValuesAndInternalGains(dfCSV: DataFrame, dfDHW: DataFrame, dfUValues: DataFrame, dfRUValues: DataFrame, dfACH: DataFrame, nutsId: str) DataFrame[source]

Model Step 10: Write the U-Values and the Internal Gains.

Parameters:
  • dfCSV (DataFrame) – The built input data DataFrame.

  • dfDHW (DataFrame) – The DataFrame corresponding to DHW.

  • dfUValues (DataFrame) – The DataFrame corresponding to U-Values.

  • dfRUValues (DataFrame) – The DataFrame corresponding to Retroffitting U-Values.

  • dfACH (DataFrame) – The DataFrame corresponding to ACH.

  • nutsId (str) – Identifier of NUTS2 region for which the analysis will be carried out.

Returns:

DataFrame

building_stock_energy_model.model.s11AddCapexDataFrame(dfCSV: DataFrame, dfBesCapex: DataFrame) DataFrame[source]

Model Step 11: Add the CAPEX dataframe.

Parameters:
  • dfCSV (DataFrame) – The built input data DataFrame.

  • dfBesCapex (DataFrame) – The DataFrame corresponding to Capex.

Returns:

DataFrame

building_stock_energy_model.model.s12AddOpexDataFrame(dfCSV: DataFrame, dfBesOpex: DataFrame) DataFrame[source]

Model Step 12: Add the OPEX dataframe.

Parameters:
  • dfCSV (DataFrame) – The built input data DataFrame.

  • dfBesOpex (DataFrame) – The DataFrame corresponding to Opex.

Returns:

DataFrame

building_stock_energy_model.model.s13AddRetrofittingCostDataFrame(dfCSV: DataFrame, dfRetroCost: DataFrame) DataFrame[source]

Model Step 13: Add the Retrofitting Cost dataframe.

Parameters:
  • dfCSV (DataFrame) – The built input data DataFrame.

  • dfRetroCost (DataFrame) – The DataFrame corresponding to Retrofitting Cost.

Returns:

DataFrame

building_stock_energy_model.model.s14AddRenewableEnergySystemsDataFrame(dfCSV: DataFrame, dfRes: DataFrame) DataFrame[source]

Model Step 14: Add the Renewable Energy Systems dataframe.

Parameters:
  • dfCSV (DataFrame) – The built input data DataFrame.

  • dfRes (DataFrame) – The DataFrame corresponding to Renewable Energy Systems.

Returns:

DataFrame

building_stock_energy_model.model.s15AddCapacityDataFrame(dfCSV: DataFrame, dfCapacity: DataFrame, archetypes: list) DataFrame[source]

Model Step 15: Add the Capacity dataframe.

Parameters:
  • dfCSV (DataFrame) – The built input data DataFrame.

  • dfCapacity (DataFrame) – The DataFrame corresponding to Capacity.

  • archetypes (list) –

    The list of building uses. Example:

    "[
        "Apartment Block",
        "Single family- Terraced houses",
        "Hotels and Restaurants",
        "Health",
        "Education",
        "Offices",
        "Trade",
        "Other non-residential buildings",
        "Sport"
    ]"
    

Returns:

DataFrame

building_stock_energy_model.model.s16AddEquivalentPowerDataFrame(dfCSV: DataFrame) DataFrame[source]

Model Step 16: Add the Equivalent Power dataframe.

Parameters:

dfCSV (DataFrame) – The built input data DataFrame.

Returns:

DataFrame

building_stock_energy_model.model.s17CalculateCosts(dfCSV: DataFrame) DataFrame[source]

Model Step 17: Calculate the costs.

Parameters:

dfCSV (DataFrame) – The built input data DataFrame.

Returns:

DataFrame

building_stock_energy_model.model.s18CalculateGeneralSchedule(dfCSV: DataFrame, dfSched: DataFrame, dfTemperatures: DataFrame, dfBaseTemperatures: DataFrame, dfSolarOffice: DataFrame, dfSolarNOffice: DataFrame, nutsId: str) dict[source]

Model Step 18: Calculate the General Schedule for each archetype.

Parameters:
  • dfCSV (DataFrame) – The built input data DataFrame.

  • dfSched (DataFrame) – The DataFrame corresponding to Schedule.

  • dfTemperatures (DataFrame) – The DataFrame corresponding to Temperatures.

  • dfBaseTemperatures (DataFrame) – The DataFrame corresponding to Base Temperatures.

  • dfSolarOffice (DataFrame) – The DataFrame corresponding to Solar Office data.

  • dfSolarNOffice (DataFrame) – The DataFrame corresponding to Solar Non-Office data.

  • nutsId (str) – Identifier of NUTS2 region for which the analysis will be carried out.

Returns:

dict

building_stock_energy_model.model.s19CalculateScenario(dfCSV: DataFrame, dictSchedule: dict) dict[source]

Model Step 19: Calculate the Scenario.

Parameters:
  • dfCSV (DataFrame) – The built input data DataFrame.

  • dictSchedule (dict) –

    The dictionary corresponding to the Schedule. Example:

    {
        "use": "Apartment Block" "schedule": DataFrame,
        "use": "Single family- Terraced houses" "schedule" DataFrame,
        "use": "Offices", "schedule" DataFrame,
        "use": "Education" "schedule": DataFrame,
        "use": "Health", "schedule": DataFrame,
        "use": "Trade", "schedule" DataFrame,
        "use": "Hotels and Restaurants", "schedule" DataFrame,
        "use": "Other non-residential buildings" "schedule" DataFrame,
        "use": "Sport", "schedule": DataFrame
    }
    

Returns:

dict

building_stock_energy_model.model.s20CalculateAnualResults(dfCSV: DataFrame, dictSchedule: dict) DataFrame[source]

Model Step 20: Calculate the Anual Results.

Parameters:
  • dfCSV (DataFrame) – The built input data DataFrame.

  • dictSchedule (dict) –

    The dictionary corresponding to the Schedule. Example:

    {
        "use": "Apartment Block" "schedule": DataFrame,
        "use": "Single family- Terraced houses" "schedule" DataFrame,
        "use": "Offices", "schedule" DataFrame,
        "use": "Education" "schedule": DataFrame,
        "use": "Health", "schedule": DataFrame,
        "use": "Trade", "schedule" DataFrame,
        "use": "Hotels and Restaurants", "schedule" DataFrame,
        "use": "Other non-residential buildings" "schedule" DataFrame,
        "use": "Sport", "schedule": DataFrame
    }
    

Returns:

DataFrame

building_stock_energy_model.model.s21CalculateConsolidate(dictSchedule: dict, archetype: str) DataFrame[source]

Model Step 21: Calculate the Consolidate.

Parameters:
  • dictSchedule (dict) –

    The dictionary corresponding to the Schedule. Example:

    {
        "use": "Apartment Block" "schedule": DataFrame,
        "use": "Single family- Terraced houses" "schedule" DataFrame,
        "use": "Offices", "schedule" DataFrame,
        "use": "Education" "schedule": DataFrame,
        "use": "Health", "schedule": DataFrame,
        "use": "Trade", "schedule" DataFrame,
        "use": "Hotels and Restaurants", "schedule" DataFrame,
        "use": "Other non-residential buildings" "schedule" DataFrame,
        "use": "Sport", "schedule": DataFrame
    }
    

  • archetype (str) – The name of the archetype (building use).

Returns:

DataFrame

building_stock_energy_model.model.s22CalculateHourlyResults(dfCSV: DataFrame, dfSolar: DataFrame, dictSchedule: dict, archetype: str) DataFrame[source]

Model Step 22: Calculate the Hourly Results.

Parameters:
  • dfCSV (DataFrame) – The built input data DataFrame.

  • dfSolar (DataFrame) – The solar data DataFrame.

  • dictSchedule (dict) –

    The dictionary corresponding to the Schedule. Example:

    {
        "use": "Apartment Block" "schedule": DataFrame,
        "use": "Single family- Terraced houses" "schedule" DataFrame,
        "use": "Offices", "schedule" DataFrame,
        "use": "Education" "schedule": DataFrame,
        "use": "Health", "schedule": DataFrame,
        "use": "Trade", "schedule" DataFrame,
        "use": "Hotels and Restaurants", "schedule" DataFrame,
        "use": "Other non-residential buildings" "schedule" DataFrame,
        "use": "Sport", "schedule": DataFrame
    }
    

  • archetype (str) – The name of the archetype (building use).

Returns:

DataFrame

building_stock_energy_model.model.x01AddFeb29IfMissingForTemperaturesData(df: DataFrame, targetYear: int) DataFrame[source]
Auxiliary function 01: If the destination year is a leap year

and the original year was not, replace 28-Feb with 29-Feb.

Parameters:
  • df (DataFrame) – The source DataFrame.

  • targetYear (int) – The target year.

Returns:

DataFrame

building_stock_energy_model.model.x02AddFeb29IfMissingForRadiationData(df: DataFrame, targetYear: int) DataFrame[source]
Auxiliary function 02: If the destination year is a leap year

and the original year was not, replace 28-Feb with 29-Feb.

Parameters:
  • df (DataFrame) – The source DataFrame.

  • targetYear (int) – The target year.

Returns:

DataFrame

building_stock_energy_model.model.x03DropFeb29IfPresentForTemperaturesData(df: DataFrame) DataFrame[source]

Auxiliary function 03: Delete the rows for February 29 (if they exist).

Parameters:

df (DataFrame) – The source DataFrame.

Returns:

DataFrame

building_stock_energy_model.model.x04DropFeb29IfPresentForRadiationData(df: DataFrame) DataFrame[source]

Auxiliary function 04: Delete the rows for February 29 (if they exist).

Parameters:

df (DataFrame) – The source DataFrame.

Returns:

DataFrame

building_stock_energy_model.model.x05RemapYear(tsIndex: DatetimeIndex, targetYear: int) DatetimeIndex[source]
Auxiliary function 05: Change the year of a DatetimeIndex while keeping

the month/day/hour/minute/second values.

Parameters:
  • tsIndex (DatetimeIndex) – The source DatetimeIndex.

  • targetYear (int) – The target year.

Returns:

DatetimeIndex

building_stock_energy_model.model.x06EstablishValue(dict: dict, name: str, limitDown: float, limitUp: float, defaultValue: float) float[source]

Auxiliary function 06: Establish value between limits.

Parameters:
  • dict (dict) – The source dictionary.

  • name (str) – The source property.

  • limitDown (float) – The lower limit of the value.

  • limitUp (float) – The upper limit of the value.

  • defaultValue (float) – The default value.

Returns:

float

building_stock_energy_model.model.x07GetAvailableArea(parameters: list, cost: float, landUse: float) tuple[source]

Auxiliary function 07: Obtain the available area.

Parameters:
  • parameters (list) – The list of parameters.

  • cost (float) – The value of the cost.

  • landUse (float) – The value of the land use.

Returns:

tuple

building_stock_energy_model.model.x08GetRegions(dictScada: dict, area: float, minGhi: float) tuple[source]

Auxiliary function 08: Obtain the regions.

Parameters:
  • dictScada (DataFrame) – The scada dataframe.

  • area (float) – The value of the area.

  • minGhi (float) – The value of the min GHI.

Returns:

tuple

building_stock_energy_model.model.x09GetPVProduction(rows: list, landUse: float, tilt: float, distribAzimuth: float, tracking: float, loss: float, porcent: float, year: int) list[source]

Auxiliary function 09: Obtain the PV production.

Parameters:
  • rows (list) – The list of rows.

  • landUse (float) – The value of the land use.

  • tilt (float) – The value of the tilt.

  • distribAzimuth (float) – The value of the distribAzimuth.

  • tracking (float) – The value of the tracking.

  • loss (float) – The value of the loss.

  • porcent (float) – The value of the porcent.

  • year (int) – The year.

Returns:

list

building_stock_energy_model.model.x10GetDistribution(rows: list, label: str) tuple[source]

Auxiliary function 10: Obtain the distribution.

Parameters:
  • rows (list) – The list of rows.

  • label (str) – The label.

Returns:

tuple

building_stock_energy_model.model.x11GetCoordinates(sourceDF: DataFrame) tuple[source]

Auxiliary function 11: Obtain the coordinates.

Parameters:

sourceDF (DataFrame) – The source DataFrame.

Returns:

tuple

building_stock_energy_model.model.x12CalculateOPEX(pot: dict, opexPV: float) tuple[source]

Auxiliary function 12: Calculate the OPEX.

Parameters:
  • pot (dict) – The pot dictionary.

  • opexPV (float) – The OPEX for PV.

Returns:

tuple

Validator Module

building_stock_energy_model.validator.validateCommandLineParameters(parameters: list)[source]

Funtion to validate the command line parameters.

Parameters:

parameters (list) –

The list of command line parameters. Example:

[
    "building_energy_process.py",
    "input.json",
    "2019-03-01T13:00:00",
    "2019-03-02T13:00:00",
    "Offices"
]

Returns:

None

building_stock_energy_model.validator.validateDatabaseIntegrity()[source]

Funtion to validate the integrity of the database.

Parameters:

None

Returns:

None

building_stock_energy_model.validator.validateLimits(value: float, limitDown: float, limitUp: float) bool[source]

Function to check the limits of a given value.

Parameters:
  • value (float) – The value of the property to be evaluated.

  • limitDown (float) – The lower limit.

  • limitUp (float) – The highest limit.

Returns:

bool

building_stock_energy_model.validator.validateProcessOutput(result: dict) bool[source]

Funtion to validate the process output.

Parameters:

result (dict) –

The process result. Example:

{
     "Apartment Block": DataFrame,
     "Single family- Terraced houses": DataFrame,
     "Offices",: DataFrame,
     "Education": DataFrame,
     "Health": DataFrame,
     "Trade": DataFrame,
     "Hotels and Restaurants": DataFrame,
     "Other non-residential buildings": DataFrame,
     "Sport": DataFrame
 }

Returns:

bool

building_stock_energy_model.validator.validateProcessPayload(payload: dict) dict[source]

Funtion to validate the process payload.

Parameters:

payload (dict) –

The process payload:

Example: see "input.json" file in the root directory.

Returns:

dict