artist.scenario.scenario
Attributes
A logger for the scenario. |
Classes
Initialize the scenario. |
Module Contents
- artist.scenario.scenario.log
A logger for the scenario.
- class artist.scenario.scenario.Scenario(power_plant_position: torch.Tensor, target_areas: artist.field.tower_target_areas.TowerTargetAreas, light_sources: artist.scene.light_source_array.LightSourceArray, heliostat_field: artist.field.heliostat_field.HeliostatField)
Initialize the scenario.
A scenario defines the physical objects and scene to be used by
ARTIST. Therefore, a scenario contains at least one target area that is a receiver, at least one light source and at least one heliostat in a heliostat field.ARTISTalso supports scenarios that contain multiple target areas, multiple light sources, and multiple heliostats. (Note: Currently only a single light source can be provided.)Parameters
- power_plant_positiontorch.Tensor,
The position of the power plant as latitude, longitude and altitude. Tensor of shape [3].
- target_areasTargetAreaArray
A list of tower target areas included in the scenario.
- light_sourcesLightSourceArray
A list of light sources included in the scenario. Currently only a single light source can be provided.
- heliostat_fieldHeliostatField
A field of heliostats included in the scenario.
- power_plant_position
- target_areas
- light_sources
- heliostat_field
- static get_number_of_heliostat_groups_from_hdf5(scenario_path: pathlib.Path) int
Get the number of heliostat groups to initiate distributed setup from the HDF5 scenario file.
Parameters
- scenario_pathpathlib.Path
File path to the HDF5 scenario file.
Returns
- int
Number of heliostat groups to initiate distributed setup.
- classmethod load_scenario_from_hdf5(scenario_file: h5py.File, number_of_surface_points_per_facet: torch.Tensor = torch.tensor([50, 50]), change_number_of_control_points_per_facet: torch.Tensor | None = None, device: torch.device | None = None) typing_extensions.Self
Class method to load the scenario from an HDF5 file.
Parameters
- scenario_fileh5py.File
The config file containing all the information about the scenario being loaded.
- number_of_surface_points_per_facettorch.Tensor
The number of sampling points along each direction of each 2D facet (default is torch.tensor([50,50])). Tensor of shape [2].
- change_number_of_control_points_per_facettorch.Tensor | None
The updated number of control points along each direction of each 2D facet (default is None). Providing this parameter should be done with caution. In a scenario with surfaces generated by deflectometry, this parameter should be None, otherwise the deflectometry surface will be overwritten and become ideal. For ideal surfaces this parameter can be used to change the number of control points specified in the .h5 scenario. Tensor of shape [2].
- devicetorch.device | None
The device on which to perform computations or load tensors and models (default is None). If None,
ARTISTwill automatically select the most appropriate device (CUDA or CPU) based on availability and OS.
Returns
- Scenario
The
ARTISTscenario loaded from the HDF5 file.
- index_mapping(heliostat_group: artist.field.heliostat_group.HeliostatGroup, string_mapping: list[tuple[str, str, torch.Tensor]] | None = None, single_incident_ray_direction: torch.Tensor = torch.tensor([0.0, 1.0, 0.0, 0.0]), single_target_area_index: int = 0, device: torch.device | None = None) tuple[torch.Tensor, torch.Tensor, torch.Tensor]
Create an index mapping from heliostat names, target area names and incident ray directions.
If no mapping is provided, a default mapping for all heliostats within this group will be created. The default mapping will map all heliostats to the default
single_incident_ray_direction, which simulates a light source positioned in the south and the defaultsingle_target_area_index, which is 0. To overwrite these defaults, please provide asingle_incident_ray_directionor asingle_target_area_index.Parameters
- heliostat_groupHeliostatGroup
The current heliostat group.
- string_mappinglist[tuple[str, str, torch.Tensor]] | None
Strings that map heliostats to target areas and incident ray direction tensors (default is None).
- single_incident_ray_directiontorch.Tensor
The default incident ray direction (default is torch.tensor([0.0, 1.0, 0.0, 0.0])). Tensor of shape [4].
- single_target_area_indexint
The default target area index (default is 0).
- devicetorch.device | None
The device on which to perform computations or load tensors and models (default is None). If None,
ARTISTwill automatically select the most appropriate device (CUDA or CPU) based on availability and OS.
Returns
- torch.Tensor
The mask specifying which heliostat is selected and how many times. Tensor of shape [number_of_heliostats_in_group].
- torch.Tensor
The indices of target areas for all selected heliostats in order. Tensor of shape [number_of_active_heliostats_in_group].
- torch.Tensor
The incident ray directions for the selected heliostats in order. Tensor of shape [number_of_active_heliostats_in_group, 4].
- set_number_of_rays(number_of_rays: int) None
Set the number of rays simulated by the light source.
Parameters
- number_of_raysint
The new number of rays simulated by the light source.
- __repr__() str
Return a string representation of the scenario.