def single_computation(*args): (w, ) = args l_s = otsun.LightSource(current_scene, emitting_region, w, 1.0, direction_distribution, polarization_vector) exp = otsun.Experiment(current_scene, l_s, number_of_rays) exp.run() print(f"Computed w={w}, theta={theta}, S/P={sp}") return (w, exp.Th_energy, exp.Th_wavelength, exp.captured_energy_Th)
def single_computation(*args): (ph, th) = args main_direction = otsun.polar_to_cartesian(ph, th) * -1.0 # Sun direction vector current_scene = otsun.Scene(sel) tracking = otsun.MultiTracking(main_direction, current_scene) tracking.make_movements() emitting_region = otsun.SunWindow(current_scene, main_direction) l_s = otsun.LightSource(current_scene, emitting_region, light_spectrum, 1.0, direction_distribution) exp = otsun.Experiment(current_scene, l_s, number_of_rays, None) exp.run() tracking.undo_movements() print(f"Computed ph={ph}, th={th}") efficiency_from_source_Th = (exp.captured_energy_Th / aperture_collector_Th) / ( exp.number_of_rays / exp.light_source.emitting_region.aperture) return ph, th, efficiency_from_source_Th
PV_wavelength = [] PV_values = [] # --------- end # objects for scene sel = doc.Objects current_scene = otsun.Scene(sel) for w in np.arange(wavelength_ini, wavelength_end, wavelength_step): light_spectrum = w main_direction = otsun.polar_to_cartesian( phi, theta) * -1.0 # Sun direction vector emitting_region = otsun.SunWindow(current_scene, main_direction) l_s = otsun.LightSource(current_scene, emitting_region, light_spectrum, 1.0, direction_distribution, polarization_vector) exp = otsun.Experiment(current_scene, l_s, number_of_rays, show_in_doc) exp.run(show_in_doc) print("%s" % (w) + '\n') Th_energy.append(exp.Th_energy) Th_wavelength.append(exp.Th_wavelength) PV_energy.append(exp.PV_energy) PV_wavelength.append(exp.PV_wavelength) source_wavelength.append(w) if exp.PV_values: PV_values.append(exp.PV_values) if exp.points_absorber_Th: Th_points_absorber.append(exp.points_absorber_Th) captured_energy_PV += exp.captured_energy_PV captured_energy_Th += exp.captured_energy_Th # ---