Source code for haskoning_atr_tools.vibration_contour_plot.target.target

### ===================================================================================================================
###  Class for parameters of the target
### ===================================================================================================================
# Copyright ©2026 Haskoning Nederland B.V.

### ===================================================================================================================
###  1. Import modules
### ===================================================================================================================

# General imports
from dataclasses import dataclass, field
from typing import Optional, List, Literal


### ===================================================================================================================
###  2. Target class
### ===================================================================================================================

[docs] @dataclass class TargetVibrationLimits: """ Instance contains the vibration limits that apply to the target. Input: - limit_type (str): Select the type of limits provided. Currently, only 'velocity' can be selected. - frequencies (list of float): List of frequencies for the vibration limits, values in [Hz]. - limits (list of float): List of limits for the vibration at the target, values in [m/s] for limit-type 'velocity'. """ limit_type: Literal['velocity'] frequencies: List[float] limits: List[float]
[docs] @dataclass class Target: """ Instances of this class represent the position where the output of the vibration simulation is assessed. Input: - id (int): The identifier of the target. - coordinates (list of float): The coordinates (e.g., [x, y, z]) of the target's location, values in [m]. - category (str): The category of the target. This is a property of the specification supplier, but currently not used in the tool. - type (str): Optional input for the type of the target. The type is used when adding vibration limits to the target, as these are specified per type. Default value is None. - name (str): Optional input for the name of the target. The targets in the simulation are identified by their ID, name is only used for plotting. - limits (dict): Optional input for the vibration requirements. """ id: int coordinates: tuple[float, float, float] category: str type: Optional[str] = None name: Optional[str] = None limits: Optional[dict[str, TargetVibrationLimits]] = None # Private attributes to store the provided values _project: Optional[str] = field(default=None, init=False, repr=False) # Custom validation hook recognized by the decorator def __post_init__(self): if len(self.coordinates) != 3: raise ValueError( f"ERROR: Coordinates must be a tuple of three values [x, y, z]. Provided is {self.coordinates} for " f"{self.name}.") @property def project(self): return self._project @project.setter def project(self, new_project): self._project = new_project def __repr__(self) -> str: return f"Target '{self.name}' (id={self.id}): {self.category}"
### =================================================================================================================== ### 3. End of script ### ===================================================================================================================