sunlightHoursAnalysis - limiting anlaysisPeriod and sun to surface angle



Dear All,

we would love to use sunlightHoursAnalysis for the code compliance checking BUT we need to:

  1. analysisPeriod must be 1st March from 7:15 to 16:45. Problem is that analysisPeriod toHour will accept only integer numbers from 1 to 24 thus it is not possible to define fractional time such as 7.25 to 16.75 despite the fact that timeStep can be down to 1 minute (timeStep = 60).

  2. sunlighHoursAnalysis must be constrained in the way of excluding sun azimuth angle of 25o of the facade face. Or in other words any sun visible in the sector of 25o of the analysis surface plane must be disregarded (sun directions close to analysis surface parallel (till 25o) are disregarded).

We believe that this could be achieved by some changes to the source code. Is there anybody that would take on this consultancy job for us?

Best regards,



The easy way is to use the [+] libraries which gives you a better control on hours using hoy input but you can also make this work using the legacy component. Since you want to run the analysis for a single day you can directly generate the hours can connect them to sunpath.

  1. Use a series component to generate the hours.

  2. Now you can run the sunlight hours study and use testVector and isSunVisible outputs to pick the sun vectors that meets the angle criteria for each test point. Finally you can use recolor mesh to color the input meshes based on the final results. (416.2 KB)


Dear Mostapha,

thank you very much for your help. I can see that “recolor mesh” is reporting actually number of how many times is sun visible BUT not the sun access hours.

I do assume that some more calculation needs to be done to convert is sun visible hits to hours based on given time step e.g. in your example script this would be - one hit = 15 minutes.

We are going to use 1 min time step so in our case it is simple 1 hit = 1 minute?

Best regards,


Dear Mostapha,

thank you very much for your assistance. Could you please have a look at logic of cutting_angle as this is not giving the right numbers.

For example in your script if you examine east façade:

  1. no cutting angle = 0 the results are correct cca 285 minutes

  1. however when 25o cutting angle is applied the result is cca 265 minutes and this should be around 200 minutes

Best regards,



Hi @janak,

You are right. I made a mistake and removed the vectors that where perpendicular to surface instead of the ones that are parallel to surface. The real cutting angle is (90 - 25) 65 degrees. I don’t get the exact value as you mentioned above but close. Am I using the correct location from weather file? You can create your own custom location using :constructlocation: component.

Here is the updated file with some visualization. I run the study for a single point. Make sure to remove the visualization and adjust the grid size for your study. (434.8 KB)


Dear Mostapha,

I do really appreciate your assistance a lot.

We have a wee misunderstanding about cutting angle. This should not be direct angle between 2 vectors (surface normal and sun vector as shown in your graphics) but its projection angle into XY plane or in other words it must be azimuth angle.

So for example your direct angle between 2 vectors is 65.1 BUT this will not correspond to the same azimuth angle in XY plane between surface normal azimuth angle and sun azimuth angle.

Best regards,


That’s an easy fix. You can project the vectors to XY before calculating the angles.

This will get us down to 203 minutes. Not sure how this will work for roofs? When vector is (0, 0, 1)? That will give you invalid vector (0, 0, 0)!


Dear Mostapha,

thanks a lot - script is working just fine as far as I was able to test up till now by comparing to Ecotect point values.

Don’t You have some example script for “Vertical Sky Component”. I am trying to make it work with VSC Recipes but not sure how to progress.

Best regards,



You’re welcome. I’m still not sure how do you deal with roofs? Just remove them from the study?

It’s like any other daylight studies. Find a daylight factor study and replace the recipe with VSC recipe and there you have it. If you have any other questions please open a new topic.


The roof are fortunately no practical problem as there are no windows in flat roofs :slight_smile:

Best regards,