weac.components.model_input module¶
This module defines the input data model for the WEAC simulation.
We utilize the pydantic library instead of dataclasses to define the input data model. The advantages of pydantic are: 1. validate the input data for the WEAC simulation, compared to __post_init__ methods. 2. generate JSON schemas for the input data, which is good for API endpoints. 3. generate the documentation for the input data.
Pydantic syntax is for a field: field_name: type = Field(…, gt=0, description=”Description”) - typing, default value, conditions, description
- class weac.components.model_input.ModelInput(*, weak_layer=<factory>, layers=<factory>, scenario_config=<factory>, segments=<factory>)[source]¶
Bases:
BaseModel
Comprehensive input data model for a WEAC simulation.
- Parameters:
weak_layer (WeakLayer)
layers (List[Layer])
scenario_config (ScenarioConfig)
segments (List[Segment])
- scenario_config¶
Scenario configuration.
- Type:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- scenario_config: ScenarioConfig¶