Configuration#

Configuration class#

class automatic_warehouse.warehouse_configuration_singleton.WarehouseConfigurationSingleton(file_path: str = '/home/docs/checkouts/readthedocs.org/user_builds/simulator-automatic-warehouse/envs/latest/lib/python3.12/site-packages/automatic_warehouse-config/sample_config.yaml')#

Singleton class to provide access to a single configuration.

This class is responsible for safely loading yaml from a file, overriding an existing configuration with a new yaml file or hardcoded configuration. It also calls the ConfigurationValidator class to check some additional logical properties.

Use it as follows: WarehouseConfigurationSingleton.get_instance().get_configuration().

Parameters:

file_path (str) – the configuration to load into the simulator. If not specified, the sample configuration will be loaded.

get_configuration() WarehouseConfiguration#

Get the raw configuration from the environment path specified by the user.

Return type:

dict

Returns:

raw configuration extracted via YAML.

static get_instance()#

Use this method to get an instance and get the configuration file.

Return type:

WarehouseConfigurationSingleton

Returns:

the instance of WarehouseConfigurationSingleton.

update_config(configuration: WarehouseConfiguration)#

Update the configuration from a dataclass (hardcoded).

Return type:

WarehouseConfigurationSingleton

Parameters:

configuration (WarehouseConfiguration) – hardcoded configuration.

Returns:

the instance of WarehouseConfigurationSingleton (get_instance()).

Raises:

jsonschema.exceptions.ValidationError – if the instance is invalid.

static update_config_from_file(file_path: str)#

Update the configuration from a file.

Return type:

WarehouseConfigurationSingleton

Parameters:

file_path (str) – file path of the file.

Returns:

the instance of WarehouseConfigurationSingleton (get_instance()).

Hardcoded configuration#

class automatic_warehouse.warehouse_configuration_singleton.WarehouseConfiguration(height_warehouse: int, default_height_space: int, speed_per_sec: int | float, tray: TrayConfiguration, columns: list[ColumnConfiguration], carousel: CarouselConfiguration, simulation: SimulationConfiguration)#

Python Dataclass - Warehouse Configuration.

class automatic_warehouse.warehouse_configuration_singleton.SimulationConfiguration(num_actions: int, trays_to_gen: int, materials_to_gen: int, gen_bay: bool, gen_buffer: bool, time: int | None = None)#

Python Dataclass - Simulation Configuration.

class automatic_warehouse.warehouse_configuration_singleton.CarouselConfiguration(length: int, width: int, hole_height: int, bay_height: int, buffer_height: int, x_offset: int, description: str | None = None, offset_formula_description: str | None = None)#

Python Dataclass - Carousel Configuration.

class automatic_warehouse.warehouse_configuration_singleton.ColumnConfiguration(length: int, height: int, x_offset: int, width: int, height_last_position: int, description: str | None = None, offset_formula_description: str | None = None)#

Python Dataclass - Column Configuration.

class automatic_warehouse.warehouse_configuration_singleton.TrayConfiguration(length: int, width: int, maximum_height: int)#

Python Dataclass - Tray Configuration.

Configuration validator#

class automatic_warehouse.configuration_validator.ConfigurationValidator(schema: WarehouseConfiguration)#

A configuration validator used to validate a WarehouseConfiguration schema.

Parameters:

schema (WarehouseConfiguration) – schema to validate.

validate()#

Validates the configuration against the schema.

The properties checked are:

  1. The height property of each column can’t be greater than the height of the warehouse (height_warehouse).

  2. The default_height_space should be a multiple of the column, otherwise the number of drawers in a column could be float (impossible).

  3. The height_last_position should be a multiple of default_height_space because it indicates how many entries are in the last position of the column.

  4. If a column has the same x_offset as the carousel, then that column is above the carousel. This means that:

    1. The sum of the height of the column plus the height of the hole, buffer and bay of the carousel should be equal to or less than height_warehouse.

    2. (not an error, but a warning) The length should be equal.

  5. The maximum height of the tray should be less than the height of each column/carousel.

  6. The height of the hole in the carousel should be greater than the maximum height of the tray.

  7. Two columns should have a distance greater than or equal to zero.

  8. The height of the buffer plus the height of the carousel bay must not exceed the height of the warehouse.

Raises:

ConfigValidatorError – if validation fails.

class automatic_warehouse.configuration_validator.ConfigValidatorError(msg: str)#

Exception raised when a configuration validation fails.