EPW / Weather data adjustment

Hi all,

I want my students to understand energy simulations better. So we are comparing a simple Excel sheet with the results of E+ / HB simulations.

I want to make two additional weather files from existing weather files; a) one without any radiation, and b) one without radiation and an ambient temperature of 0 degrees.
Now, making the weather file option A is not a problem. But when I tried to set the ambient (and dew point) temperature to 0 degree, I get an error in Honeybee: ‘Solution exception:index out of range: 922’.

Anyone has an idea what is causing this problem? I even tried to find one hour in the weather data where the ambient temperature was 0 and copied all data from that row, but still I get that error.

/Jouri

This sounds like a cool experiment. So is the idea is to approximate steady-state conditions with the rewritten EPW files and then compare that with your student’s steady state energy calculations?

And, if you attach a grasshopper file with a replication of your problem we can take a look at it.

Which component gives you this error? There is a chance that when you edit the original file it has left a number of trailing commas.

If you have Honeybee[+] installed then this code should generate both weather files for you. I tested them and they work fine with import epw.

from ladybug.epw import EPW
from ladybug.analysisperiod import AnalysisPeriod

# Change the original file to a valid path. Here is an example
# original_file = r'C:\EnergyPlusV8-6-0\WeatherData\USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw'
original_file = r'PATH_TO_YOUR_WEATHER_FILE'

epw_file = EPW(original_file)

zero_values = 8760 * [0]
ap = AnalysisPeriod()  # create an annual analysis period
# set radiation values to 0
epw_file.direct_normal_radiation.update_data_for_analysis_period(zero_values, ap)
epw_file.diffuse_horizontal_radiation.update_data_for_analysis_period(zero_values, ap)
epw_file.global_horizontal_radiation.update_data_for_analysis_period(zero_values, ap)

# save first modified file
epw_file.save(r'c:\ladybug', '{}_zero_radiation.epw'.format(epw_file.location.city))

# now update temperature values
epw_file.dew_point_temperature.update_data_for_analysis_period(zero_values, ap)
epw_file.dry_bulb_temperature.update_data_for_analysis_period(zero_values, ap)

# save second modified file
epw_file.save(r'c:\ladybug', '{}_zero_temp_radiation.epw'.format(epw_file.location.city))

@SaeranVasanthakumar. Yes, that is right. We will start with a very simple room and then we slowly work our way through different elements, like ventilation, internal loads, etc. So that’s why I wanted to start with a weather data without any weather :slight_smile:

@mostapha . Thanks for your code. It generated two weather files. However, it still generates an error in the ‘run EP’ component when I add the weather data with the ambient temp as 0. The other one works fine. I thought that it might had to do with relative humidity too but now I checked that too and it still doesn’t work.

/Jouri

controlmethod_forum.gh (500.3 KB)
COPENHAGEN_zero_temp_radiation.epw (1.4 MB)
COPENHAGEN_zero_radiation.epw (1.4 MB)

I still haven’t solved the problem.
When I used the import EPW it works fine, but if I want the run an energy simulation it doesn’t want to work. I also tried to change the header in the weather file (where it says typical winter week, etc), but that didn’t help either.
Then I tried to import the changed wetaher file with an ambient temp of 0 into Archsim and that works. Since they both rely on Energy+ it has to be something in the Honeybee environment.

/Jouri

Hi @JouriKanters,

I checked the file and the error happens because Honeybee cannot find the ddy file and tries to figure out design days from the input weather file and since all the values are 0 it gets confused. I leave this to @chris as he has written the method and knows more about the details.

Also there is a mistake in preparing the file. You should pick a single program from zone programs otherwise you’re creating a separate HBZone for each program.

Gosh, I’m sorry for such a late response, @JouriKanters . Your issue is happening because honeybee has no ddy file with which to size your HVAC system and so it tries to come up with sizing criteria from the epw data but fails because the data has no variation with which to decide the heating design condition from the cooling design condition. If you just put a ddy file next to your epw, it will work.

I’ll try to add in a warning to catch this case and give you the right warning in the future.

1 Like

I added in a warning to the component such that you will now get the correct warning when this situation happens:

2 Likes

Hi,
I’m trying to use this code to replace the dry-bulb temperature of the epw file with my own data. However, I get this error : ‘HourlyContinuousCollection’ object has no attribute ‘update_data_for_analysis_period’. I really appreciate your help if you can help me with this issue

It looks like the method has been removed. @chris should be able to shed some light here about the change and the alternative solution.

Hey @AminHosseini ,

I should add some new sample code into the SDK Docs. This is how you should do this type of operation now:

from ladybug.epw import EPW

# Change the original file to a valid path. Here is an example
# original_file = r'C:\EnergyPlusV8-6-0\WeatherData\USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw'
original_file = r'PATH_TO_YOUR_WEATHER_FILE'

epw_file = EPW(original_file)

zero_values = 8760 * [0]
# set radiation values to 0
epw_file.direct_normal_radiation.values = zero_values
epw_file.diffuse_horizontal_radiation.values = zero_values
epw_file.global_horizontal_radiation.values = zero_values

# save first modified file
epw_file.save(r'c:\ladybug', '{}_zero_radiation.epw'.format(epw_file.location.city))

# now update temperature values
epw_file.dew_point_temperature.values = zero_values
epw_file.dry_bulb_temperature.values = zero_values

# save second modified file
epw_file.save(r'c:\ladybug', '{}_zero_temp_radiation.epw'.format(epw_file.location.city))

Thanks,

This code solved my problem!