当前位置: 首页>>代码示例>>Python>>正文


Python TracerEngine.minener方法代码示例

本文整理汇总了Python中tracer.tracer_engine.TracerEngine.minener方法的典型用法代码示例。如果您正苦于以下问题:Python TracerEngine.minener方法的具体用法?Python TracerEngine.minener怎么用?Python TracerEngine.minener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tracer.tracer_engine.TracerEngine的用法示例。


在下文中一共展示了TracerEngine.minener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: trace

# 需要导入模块: from tracer.tracer_engine import TracerEngine [as 别名]
# 或者: from tracer.tracer_engine.TracerEngine import minener [as 别名]
	def trace(self, rph, iters = 10000, minE = 1e-9, render = False):
		"""Commences raytracing using (rph) number of rays per heliostat, for a maximum of 
		   (iters) iterations, discarding rays with energy less than (minE). If render is
		   True, a 3D scene will be displayed which would need to be closed to proceed."""
		# Get the solar vector using azimuth and elevation
		sun_vec = solar_vector(self.sun_az*degree, self.sun_elev*degree)
        	# Calculate number of rays used. Rays per heliostat * number of heliostats.
        	num_rays = rph*len(self.field.get_heliostats())
		self.no_of_rays += num_rays
		# Generates the ray bundle
        	rot_sun = rotation_to_z(-sun_vec)
        	direct = N.dot(rot_sun, pillbox_sunshape_directions(num_rays, 0.00465))
        
        	xy = N.random.uniform(low=-0.25, high=0.25, size=(2, num_rays))
        	base_pos = N.tile(self.pos, (rph, 1)).T #Check if its is rph or num_rays
       		base_pos += N.dot(rot_sun[:,:2], xy)
        	
        	base_pos -= direct
        	rays = RayBundle(base_pos, direct, energy=N.ones(num_rays))

		# Perform the raytracing
		e = TracerEngine(self.plant)
		e.ray_tracer(rays, iters, minE, tree=True)
		e.minener = minE
		rays_in = sum(e.tree._bunds[0].get_energy())
		self.helio_hits = sum(e.tree._bunds[1].get_energy())


		# Optional rendering
		if render == True:
			trace_scene = Renderer(e)
			trace_scene.show_rays()
开发者ID:zebkee,项目名称:Bladed_Receiver,代码行数:34,代码来源:tower_scene.py

示例2: trace

# 需要导入模块: from tracer.tracer_engine import TracerEngine [as 别名]
# 或者: from tracer.tracer_engine.TracerEngine import minener [as 别名]
    def trace(self):
        """Generate a flux map using much more rays than drawn"""
        # Generate a large ray bundle using a radial stagger much denser
        # than the field.
        sun_vec = solar_vector(self.sun_az*degree, self.sun_elev*degree)
        
        hstat_rays = 20
        num_rays = hstat_rays*len(self.field.get_heliostats())
        rot_sun = rotation_to_z(-sun_vec)
        direct = N.dot(rot_sun, pillbox_sunshape_directions(num_rays, 0.00465))
        
        xy = N.random.uniform(low=-0.25, high=0.25, size=(2, num_rays))
        base_pos = N.tile(self.pos, (hstat_rays, 1)).T
        base_pos += N.dot(rot_sun[:,:2], xy)
        
        base_pos -= direct
        rays = RayBundle(base_pos, direct, energy=N.ones(num_rays))
        
        # Perform the trace:
        e = TracerEngine(self.plant)
        e.ray_tracer(rays, 100, 0.05, tree=True)
        e.minener = 1e-5

		# Render:
        trace_scene = Renderer(e)
        trace_scene.show_rays()
开发者ID:jx1a0,项目名称:Tracer,代码行数:28,代码来源:Heliostat_field_coin.py

示例3: trace

# 需要导入模块: from tracer.tracer_engine import TracerEngine [as 别名]
# 或者: from tracer.tracer_engine.TracerEngine import minener [as 别名]
    def trace(self):
        """Generate a flux map using much more rays than drawn"""
        # Generate a large ray bundle using a radial stagger much denser
        # than the field.
        sun_vec = solar_vector(self.sun_az*degree, self.sun_elev*degree)
        #hstat_rays
        hstat_rays = 1000
        num_rays = hstat_rays*len(self.field.get_heliostats())
        rot_sun = rotation_to_z(-sun_vec)
        direct = N.dot(rot_sun, pillbox_sunshape_directions(num_rays, 0.00465))
        
        xy = N.random.uniform(low=-0.25, high=0.25, size=(2, num_rays))
        base_pos = N.tile(self.pos, (hstat_rays, 1)).T
        base_pos += N.dot(rot_sun[:,:2], xy)
        
        base_pos -= direct
        rays = RayBundle(base_pos, direct, energy=N.ones(num_rays))
        
        # Perform the trace:
        e = TracerEngine(self.plant)
        e.ray_tracer(rays, 100, 0.05, tree=True)
        e.minener = 1e-6 # default 1e-5

	# Render:
        #trace_scene = Renderer(e)
        #trace_scene.show_rays()

        # Initialise a histogram of hits:
        energy, pts = self.reclist.get_optics_manager().get_all_hits()
        x, y = self.reclist.global_to_local(pts)[:2]
        rngx = 0.55 #0.5
        rngy = 0.55 #0.5
        
        bins = 100 #50
        H, xbins, ybins = N.histogram2d(x, y, bins, \
            range=([-rngx,rngx], [-rngy,rngy]), weights=energy)
        
        #print(H, xbins, ybins)
        total=N.sum(H)
        print(total)

        extent = [ybins[0], ybins[-1], xbins[-1], xbins[0]]
        plt.imshow(H, extent=extent, interpolation='nearest')
        plt.colorbar()
	plt.title("front")
        plt.show()
开发者ID:jessicashropshire,项目名称:Tracer,代码行数:48,代码来源:zeb.py

示例4: print

# 需要导入模块: from tracer.tracer_engine import TracerEngine [as 别名]
# 或者: from tracer.tracer_engine.TracerEngine import minener [as 别名]
engine=TracerEngine(scene._asm)

engine.ray_tracer(scene._source, 10, 1e-9, True )
#engine.ray_tracer(scene._source, 10, 1e-9, True )

print(engine.tree._bunds[0].get_energy(),'tree',len(engine.tree._bunds[0].get_energy()))
print(engine.tree._bunds[1].get_energy(),'tree',len(engine.tree._bunds[1].get_energy()))#print(engine.tree._bunds[2].get_energy(),'tree',len(engine.tree._bunds[2].get_energy()))
print(engine.tree._bunds[3].get_energy(),'tree',len(engine.tree._bunds[3].get_energy()))
print(engine.tree._bunds[4].get_energy(),'tree',len(engine.tree._bunds[4].get_energy()))
print(engine.tree._bunds[5].get_energy(),'tree',len(engine.tree._bunds[5].get_energy()))
print(engine.tree._bunds[6].get_energy(),'tree',len(engine.tree._bunds[6].get_energy()))

eff=(N.sum(engine.tree._bunds[2].get_energy())+N.sum(engine.tree._bunds[4].get_energy()))*9/(len(engine.tree._bunds[1].get_energy())*engine.tree._bunds[1].get_energy()[0])
print(eff,'eff') #  the demoninator includes the sum rays on the back. i.e. the blocking is accounted for

engine.minener = 1e-20
recv=scene._asm.get_local_objects()[0] #here the scene._asm is an assembly and _object[1] returns an object Now it's really the receiver
#print(scene._asm.get_local_objects(),'scene_recv')
count = 0
totalenergy = 0

'''
for face in recv.get_surfaces(): # definitely has gone through only one iteration. check .surface for definitioin
	#energy, pts = face._optics.get_all_hits()
	#that's when everything gets doubled
	#print(recv.get_surfaces())
	energy, pts =face.get_optics_manager().get_all_hits() # an instance of a reflective receiver
	print(energy,len(energy),'energy')
	subtotalenergy = energy.sum() # for each surface
	#print(subtotalenergy,'subtotalenergy')
	totalenergy += subtotalenergy
开发者ID:jessicashropshire,项目名称:Tracer,代码行数:33,代码来源:parabolic_dish_jess_4.py


注:本文中的tracer.tracer_engine.TracerEngine.minener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。