Exemplo n.º 1
0
def main():
    """a simple example of calculating solar incident radiation.  
  given a user-defined plane to evaluate, a hard-coded position, 
  and a EPW file that associates date/time with radiation level, 
  calculates the amount of radition striking the plane
  and produces a simple visualization.
  """
    outie = fp.make_out(fp.outies.Rhino, "solar incidence")
    outie.set_color(Color(0.75))

    # getting user input
    epwdata = epwData("USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw")
    plane = Ray(Point(0, 0, 2), Vec(5, 2, 1))  #user-defined plane
    day = sg.calc_dayOfYear(
        "01/03")  #day of the year to calculate solar incidence
    hour = (24 * (day - 1)) + int(sg.calc_hourDecimal(
        "14:00"))  #hour of the day to calculate solar incidence

    #Yearly Average
    srfIrr = 0
    for h in range(hour, hour + 1):
        srfIrr = (srfIrradiance(plane, h, epwdata))  #/24
        print srfIrr
        #print srfIrr
        #srfIrr = 0
        #for irrVal in srfIrr:
        #  irrVal += srfIrr
    #   print irrVal
    #for srfIrr in range(24):
    #srfIrr += (srfIrradiance(plane,h,epwdata))/8760
    print '{} total w/m2 for first 48 hours'.format(srfIrr)

    #visualize results
    colorA = Color.HSB(
        0.0)  #saturation and brightness of HSB colors default to 1.0
    colorB = Color.HSB(
        0.75)  #saturation and brightness of HSB colors default to 1.0
    color = Color.interpolate(colorA, colorB, srfIrr * .001)
    plane.set_color(color)
    plane.vec.length = srfIrr / 10

    outie.put([plane])
    outie.draw()
Exemplo n.º 2
0
def main():
  """a simple example of calculating solar incident radiation.  
  given a user-defined plane to evaluate, a hard-coded position, 
  and a EPW file that associates date/time with radiation level, 
  calculates the amount of radition striking the plane
  and produces a simple visualization.
  """
  outie = fp.make_out(fp.outies.Rhino, "solar incidence")
  outie.set_color(Color(0.75))
  
  # getting user input
  epwdata = epwData("USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw")
  plane = Ray(Point(0,0,2), Vec(5,2,1)) #user-defined plane
  day = sg.calc_dayOfYear("01/03") #day of the year to calculate solar incidence 
  hour = (24*(day-1))+int(sg.calc_hourDecimal("14:00")) #hour of the day to calculate solar incidence
  
  #Yearly Average
  srfIrr = 0
  for h in range(hour, hour+1):
    srfIrr = (srfIrradiance(plane,h,epwdata))#/24
    print srfIrr
    #print srfIrr
    #srfIrr = 0 
    #for irrVal in srfIrr:
    #  irrVal += srfIrr
   #   print irrVal
    #for srfIrr in range(24):
    #srfIrr += (srfIrradiance(plane,h,epwdata))/8760
  print '{} total w/m2 for first 48 hours'.format(srfIrr)
  
  #visualize results
  colorA = Color.HSB(0.0) #saturation and brightness of HSB colors default to 1.0
  colorB = Color.HSB(0.75) #saturation and brightness of HSB colors default to 1.0
  color = Color.interpolate(colorA,colorB,srfIrr*.001)
  plane.set_color(color)
  plane.vec.length = srfIrr/10
  
  outie.put([plane])
  outie.draw()
Exemplo n.º 3
0
def main():
  """a simple example of calculating solar incident radiation.  
  given a user-defined plane to evaluate, and hard-coded position, date/time and radiation level, 
  calculates the amount of radition striking the plane
  and produces a simple visualization.
  """
  outie = fp.make_out(fp.outies.Rhino, "solar incidence")
  outie.set_color(Color(0.75))
  
  # getting user input
  lat,long,tmz = 40.75,-73.5,-5.0 #global position
  plane = Ray(Point(0,0,0), Vec(5,2,1)) #user-defined plane
  date,hour = "05/16", "12:00" #hard-coded date/time
  radiation = 1000 #user-defined solar intensity (direct normal)
  
  #calculate the solar vector
  day = sg.calc_dayOfYear(date)
  hour = sg.calc_hourDecimal(hour)
  sunvec = sg.calc_sunVector(lat, long, tmz, day, hour)
  
  #find the angle between our plane and the sun direction
  incidenceAngle = sunvec.angle(plane.vec)
  if incidenceAngle > math.pi/2 or radiation == 0:
    #if the sun is behind our plane then no radiation is possible
    print "Solar Incidence on the Surface = 0" 
    return
  else :
    #calculate the amout of radition striking our surface
    srfIrr = radiation * math.cos(incidenceAngle)
  print "srfIrr = {}".format(srfIrr)
  
  #visualize results
  colorA = Color.HSB(0.75) #saturation and brightness of HSB colors default to 1.0
  colorB = Color.HSB(0.0) #saturation and brightness of HSB colors default to 1.0
  color = Color.interpolate(colorA,colorB,srfIrr/100)
  plane.set_color(color) #assign HSB color to user-defined plane
  plane.vec.length = srfIrr/10 #scale the vector to a length proportional to the surface irradiance
  outie.put([plane,sunvec])
  outie.draw()
Exemplo n.º 4
0
			AddVector(v, p1)



# Get the points of the tower 
tower = getPointsTower(30, 10)
print tower
# Fix a location 
latitude = 40.75
longitude = -73.5
timezone = -5.0

#----------------------------------------------------------------------------------------------------------------
# First calculate surface irradiance on the tower for a fixed hour of a given day
day = sg.calc_dayOfYear("03/16")
hour = sg.calc_hourDecimal("13:00")
sun = rs.VectorUnitize(sg.calc_sunVector(latitude, longitude, timezone, day, hour))

#define the direct normal data file to use for irradiance values 
file = open("c:\dirNormals.txt", "r")
dirNormalIrad=dirNormalIrad_fromFile(file)

#retrieve the corresponding value of I_n for the particular hour that we're interested in;

#I_n = dirNormalIrad_Placeholder(day, h)
I_n = dirNormalIrad[int((day-1)*24 + hour -1)]  #currently rounds to the nearest hour if reading from file
surfaceIrradiance_fixed(tower, sun, I_n)

#----------------------------------------------------------------------------------------------------------------
#Next, let's calculate an aggregated surface irradiance over a consecutive period of time 
dayStart = sg.calc_dayOfYear("03/21")
Exemplo n.º 5
0
            v = rs.VectorScale(n, factor)
            AddVector(v, p1)


# Get the points of the tower
tower = getPointsTower(30, 10)
print tower
# Fix a location
latitude = 40.75
longitude = -73.5
timezone = -5.0

#----------------------------------------------------------------------------------------------------------------
# First calculate surface irradiance on the tower for a fixed hour of a given day
day = sg.calc_dayOfYear("03/16")
hour = sg.calc_hourDecimal("13:00")
sun = rs.VectorUnitize(
    sg.calc_sunVector(latitude, longitude, timezone, day, hour))

#define the direct normal data file to use for irradiance values
file = open("c:\dirNormals.txt", "r")
dirNormalIrad = dirNormalIrad_fromFile(file)

#retrieve the corresponding value of I_n for the particular hour that we're interested in;

#I_n = dirNormalIrad_Placeholder(day, h)
I_n = dirNormalIrad[
    int((day - 1) * 24 + hour -
        1)]  #currently rounds to the nearest hour if reading from file
surfaceIrradiance_fixed(tower, sun, I_n)