PET example in Ladybug


This is a continuation of the discussion from the Butterfly github topic.

Byron, I would say that the confusion came from the assumption that “Thermal Comfort Indices” component will act the same as “Outdoor Comfort Calculator” component when it comes to data matching. So you supplied a list of certain values for each “Thermal Comfort Indices” component and expected from it to calculate the same number of PET values.
“Outdoor Comfort Calcualtor” component acts in this way because it is using certain predefined equations where you just supply the four input values (Ta, Mrt, ws, rh) and it will do the data matching. “Thermal Comfort Indices” component does not act in this way, as it needs to calculate the sun angles first.

This is why the “Thermal Comfort Indices” component’s inputs are restricted to either a single value or 8767/8760 (with/without heading) values.
So what you had to do is to graft all the inputs instead of flattening them. In this way each input value will be considered as a single value input. Check the attached file.

Another and more clear solution is to graft only the solar radiation input, while keeping all the other inputs at 8767 values and use the HOY_ input. This is the file attached.

Last night I modified the mean radiant temperature formula a bit (adding cloudiness factor), so you might also want to download the newest Thermal Comfort Indices component (click on Raw, and move the downloaded .ghuser file to your File -> Special Folders -> User Object Folder)

Hope this helps. (697 KB) (615 KB)

Thanks Djordje. As it is already merged into master’s branch using update component will also update the userobjects to the latest version.

Sorry for missing that. Thank you Mostapha.

Hi Djordje,

Thank you very much for looking into this. I understand why the component is like that, I just misjudged the part about grafting because in my case I have both wind and solar radiation being different on each grid point, but still that would not be any problem if I kept it grafted. Once more I went the long way to a simple problem.

Thanks again for your time and for the amazing tools. I will definitely have a look into the new Tmrt code.

keep up the amazing work.


Hi Byron,

Thank you for the kind words.
It it always useful to hear the comments and suggestions and bug fixes from people, as in this way components are getting better.
Have a great weekend.

Hi Djordje,

this is really amazing and thank you very much for the example files!
I’m trying with Letizia to calculate the PET Index on an analysis grid (as you do on the PET_on_Grid example files) within an Urban context and taking into account the shading of the surrounding context, and we are testing the Ladybug Thermal Comfort Indices component. For what we understand there are two ways to take into account the Mean Radiant Temperature, you can either plug the meanRadiantTemperature_ or the solarRadiationPerHour_. According to the meanRadiantTemperature_ description it seems that if we are doing the calculation outside in the sun we mustn’t plug in anything and we must work only with the solarRadiationPerHour_ (as you also do in the example). Is it correct?

solarRadiationPerHour_ can be calculated in two ways, the first one is shown in your example and uses Ladybug_Radiation analysis component (Very clear thank you so much! : ) ) The other one uses the Ladybug_Sunpath Shading component and from the description is supposed to be more precise. And here are the other questions:

  1.   there is a parameter that takes into account vegetation, with which degree of detail should it be represented? 2D(silhouette) or 3D surface? Should we separate the trunk from the crown?
  2.  In this component we can also insert an albedo value. Is this value taken into account in the PET calculation and if yes, how?
  3.  In the Ladybug_Radiation Analysis component we can input a geometry at the ground level to be calculated and then place an analysis grid at 1.1 _disFromBase. Using Ladybug_Sunpath Shading, where should we place the geometry to be calculated and how can we place the analysis grid like in the other case?

We apologise for the long post!

Thank you very much for all your efforts!!

Hi Filippo,

You can add data to meanRadiantTemperature_ input even if you are doing an analysis in outside in the sun. This depends on how those meanRadiantTemperature_ values were calculated.
PET index requires four weather data inputs: air temperature (_dryBulbTemperature), relative humidity (relativeHumidity_), wind speed at 1.1 meters from the ground (windSpeed_) and mean radiant temperature (meanRadiantTemperature_).

You can add values to the first three inputs from the Ladybug “Import Epw” component. For the last (meanRadiantTemperature_), you can add it from Ladybug’s “Outdoor Solar Adjusted Temperature Calculator” component, or let “Thermal Comfort Index” component to calculate it. Both use different methods to calculate the final values.

I attached an example file below with second option.

For more precise calculations you can use Honeybee and Chris’ microclimate maps.

An icing on the cake for the end: one of Ladybug developers yesterday released a set of Ladybug components for modelling in ENVI-met application. ENVI-met is cutting-edge microclimate software, which can be downloaded for free. It opens a number of advanced new analysis in outdoor domain, which couldn’t have been done with the current Ladybug+Honeybee tools. So you can perform the simulation in ENVI-met 4 free software, and then add mean radiant temperature values from ENVI-met simulation to “Thermal Comfort Indices” component. Here is an example file.

If you would like to go with the last approach, then the best would be to post a question about it in this topic.

1) You can make a polygonized tree.
I haven’t subtracted the trunk from the crown, but I guess it makes sense that it can be done.

2) In most solar related simulations, a default albedo value of 0.2 is used. This corresponds to average albedo value taken from materials surrounding the urban or countryside location (concrete, grass, gravel, sand, asphalt…). However the presence of snow can significantly magnify the average albedo value several times. “Sunpath shading” components albedo_ input has an ability to calculate albedo due to presence of snow, if nothing is added to it (to albedo_ input). As you are performing the analysis of PET in a horizontal plane, it will not affect your calculations.

3) Most thermal comfort indices will require performing analysis at 1.1 meters above the ground. This is considered to be height of standing person’s gravity center.
The same goes for PET index. So you are correct: you should place the analysis grid at 1.1 meters above the ground before adding it to the “Sunpath Shading” component.

It is worth mentioning that “Thermal Comfort Indices” component used in this topic’s and files is from last year, and much slower than the newest one (VER 0.0.64 MAR 18 2017) used in the example attached below. Just a remainder if you have been using older version of this component.

Let me know if I misunderstood some of your questions, or if I missed to answer some of them.

EDIT: sorry for posting a double reply. When I posted it the first time, I only got links visible, with no text. Something has been wrong with grasshopper ning forum for the last couple of months. (665 KB)

Dear Djordje,

thank you very much for the long, fast and detailed answer! : )

You’ve got all the questions, now we’ll be studying the updated file, documentation and forum thread you pointed out!

We’ll keep in touch! And thanks again for your kindness!


Hi Djordje!

We’ve started to study your reply, just one quick question, in the example file you provided, in the “context” surface for the “Ladybug Sunpath Shading” calculation, shouldn’t we put inside also the ground surface (that is used to create the analysis grid). This way even if it dosen’t shade the grid points its influence on the calculation can be considered as reflection through the albedo default value of the component.

kind regards!


Hi Filippo,

The “Sunpath shading” component’s shadedSolarRadiationPerHour output will not take into account the multi-reflection of the solar radiation/rays from the ground, and then to other vertical surfaces (building facades for example).
Still ground reflected solar radiation is the lowest of the three solar radiation components (beam and diffuse).
If your location is somewhere in the Mediterranean Italy, then it is unlikely that albedo values will be altered for the influence of snow and therefor affect your ground reflected radiation.
The albedo_ input (and through it the ground reflected radiation itself) can be important for calculation of solar radiation on a Photovoltaics module, or a Solar hot water collecter, in higher latitude locations, or mountainous locations, with high modules/collectors tilt angles.
So you can include the ground surface, but that won’t make a difference.