Ejemplo n.º 1
0
    def gen_plant(self):
        xy = radial_stagger(-N.pi/4, N.pi/4 + 0.0001, self.ang_res, 5, 20, self.radial_res)
        self.pos = N.hstack((xy, N.zeros((xy.shape[0], 1))))
        self.field = HeliostatField(self.pos, 0.5, 0.5, 0, 10)

        self.rec, recobj = one_sided_receiver(1., 1.)
        rec_trans = roty(N.pi/2)
        rec_trans[2,3] = 10
        recobj.set_transform(rec_trans)

        self.plant = Assembly(objects=[recobj], subassemblies=[self.field])
Ejemplo n.º 2
0
 def test_rotated(self):
     """One-sided plate with rotation"""
     rot = sp.roty(N.pi/4.)
     self.mirror.set_transform(rot)
     
     e = TracerEngine(Assembly(objects=[self.mirror]))
     e.ray_tracer(self.bund, 1, 0.05)
     outg = e.tree[-1]
     
     correct_verts = N.array([[0., 0.5], [0., 0.], [0., -0.5]])
     N.testing.assert_array_almost_equal(
         outg.get_vertices()[:,outg.get_energy() > 0], correct_verts)
     N.testing.assert_array_almost_equal(
         outg.get_energy(), N.r_[100., 100., 0, 0])
Ejemplo n.º 3
0
    def test_rotated(self):
        """One-sided plate with rotation"""
        rot = sp.roty(N.pi / 4.)
        self.mirror.set_transform(rot)

        e = TracerEngine(Assembly(objects=[self.mirror]))
        e.ray_tracer(self.bund, 1, 0.05)
        outg = e.tree[-1]

        correct_verts = N.array([[0., 0.5], [0., 0.], [0., -0.5]])
        N.testing.assert_array_almost_equal(
            outg.get_vertices()[:, outg.get_energy() > 0], correct_verts)
        N.testing.assert_array_almost_equal(outg.get_energy(), N.r_[100., 100.,
                                                                    0, 0])
Ejemplo n.º 4
0
    def __init__(self):
        # The energy bundle we'll use for now:
        nrm = 1/(N.sqrt(2))
        direct = N.c_[[0,-nrm, nrm],[0,0,-1]]
        position = N.tile(N.c_[[0, self.source_y, self.source_z]], (1, 2))
        self.bund = RayBundle(vertices=position, directions=direct, energy=N.r_[1, 1])

        # The assembly for ray tracing:
        rot1 = N.dot(G.rotx(N.pi/4)[:3,:3], G.roty(N.pi)[:3,:3])
        surf1 = rect_one_sided_mirror(width=10, height=10)
        surf1.set_rotation(rot1)
        surf2 = rect_one_sided_mirror(width=10, height=10)
        self.assembly = Assembly(objects=[surf1, surf2])

        TracerScene.__init__(self, self.assembly, self.bund)
Ejemplo n.º 5
0
    def __init__(self):
        # The energy bundle we'll use for now:
        nrm = 1 / (N.sqrt(2))
        direct = N.c_[[0, -nrm, nrm], [0, 0, -1]]
        position = N.tile(N.c_[[0, self.source_y, self.source_z]], (1, 2))
        self.bund = RayBundle(vertices=position,
                              directions=direct,
                              energy=N.r_[1, 1])

        # The assembly for ray tracing:
        rot1 = N.dot(G.rotx(N.pi / 4)[:3, :3], G.roty(N.pi)[:3, :3])
        surf1 = rect_one_sided_mirror(width=10, height=10)
        surf1.set_rotation(rot1)
        surf2 = rect_one_sided_mirror(width=10, height=10)
        self.assembly = Assembly(objects=[surf1, surf2])

        TracerScene.__init__(self, self.assembly, self.bund)
Ejemplo n.º 6
0
    def test_rotated(self):
        """Dish with rotation"""
        bund = tracer.ray_bundle.RayBundle()

        rot = roty(N.pi / 4)
        self.md.set_transform(rot)
        bund.set_vertices(N.dot(rot[:3, :3], self.pos))
        bund.set_directions(N.dot(rot[:3, :3], self.dir))

        bund.set_energy(N.ones(5) * 100)
        bund.set_ref_index(N.ones(5))

        self.e.ray_tracer(bund, 1776, 0.05)

        receiver = self.md.get_receiver_surf()
        energy, pts = receiver.get_optics_manager().get_all_hits()
        x, y = receiver.global_to_local(pts)[:2]

        self.failUnless(N.allclose(y, 0))
        N.testing.assert_array_equal(energy, N.r_[90., 90., 81., 81.])
Ejemplo n.º 7
0
 def test_rotated(self):
     """Dish with rotation"""
     bund = tracer.ray_bundle.RayBundle()
     
     rot = roty(N.pi/4)
     self.md.set_transform(rot)
     bund.set_vertices(N.dot(rot[:3,:3], self.pos))
     bund.set_directions(N.dot(rot[:3,:3], self.dir))
     
     bund.set_energy(N.ones(5)*100)
     bund.set_ref_index(N.ones(5))
     
     self.e.ray_tracer(bund, 1776, 0.05)
     
     receiver = self.md.get_receiver_surf()
     energy, pts = receiver.get_optics_manager().get_all_hits()
     x, y = receiver.global_to_local(pts)[:2]
     
     self.failUnless(N.allclose(y, 0))
     N.testing.assert_array_equal(energy, N.r_[90., 90., 81., 81.])