Skip to content

Unable to select key with esoreader #6

Description

@stefanvgijsel

Hi there,
I am working on a Python code in Pycharm. With this code, I run EnergyPlus for a certain IDF. Everything works, except I want to be able to select the correct zones from the eplusout.eso file. This is my code right now:


import esoreader
import pandas as pd

PATH_TO_ESO = r'/Users/stefan/Documents/Studie/TU:e/Master/Graduation/Python/Output files/EP files/eplusout.eso'
dd, data = esoreader.read(PATH_TO_ESO)

# The variables you're interested in
variables = ['Zone Air Temperature', 'Zone Mean Radiant Temperature', 'Site Outdoor Air Drybulb Temperature', 'Electricity']

output_data = {}
for variable in variables:
    found_variables = dd.find_variable(variable)
    if not found_variables:  # if the list is empty, skip this iteration
        print(f"{variable} not found.")
        continue
    frequency, key, var = found_variables[0]
    idx = dd.index[frequency, key, var]
    time_series = data[idx]
    output_data[variable] = time_series

# Convert the data to a DataFrame
eso_df = pd.DataFrame(output_data)


# Rename the columns
eso_df = eso_df.rename(columns={
    'Zone Air Temperature': 'Zone Air Temperature [C]',
    'Zone Mean Radiant Temperature': 'Zone Mean Radiant Temperature [C]',
    'Site Outdoor Air Drybulb Temperature': 'Site Outdoor Air Drybulb Temperature [C]',
    'Electricity': 'Electricity Heating [kWh]'
})

# Convert the unit of Electricity (Joules to kWh)
eso_df['Electricity Heating [kWh]'] = eso_df['Electricity Heating [kWh]'] / (3600 * 1000)


# Print the DataFrame
print(eso_df)

eso_df.to_csv('/Users/stefan/Documents/Studie/TU:e/Master/Graduation/Python/Test/eso_data.csv')

For the Zone Air Temperature and Zone Mean Radiant Temperature, 2 zones are outputted from energyplus. I am only interested in Zone 1. They are called the following in the eplusout.eso library:

  • 499,1,APARTMENT:ZONE1,Zone Air Temperature [C] !Hourly,ON
  • 289,1,APARTMENT:ZONE1,Zone Mean Radiant Temperature [C] !Hourly,ON

I guess, I should use the esoreader to select the right key, but I don't know how. Can anyone help me out?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions