Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3
Adjusts API optional params#34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
c6d7781dec12c10c1a979eb3d79adbb6f9d8b216a1File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,28 @@ | ||
| import datetime | ||
| from enum import Enum | ||
| from typing import Optional | ||
| from pydantic import BaseModel | ||
| class AtmosphericModelTypes(str, Enum): | ||
| STANDARD_ATMOSPHERE: str = "STANDARD_ATMOSPHERE" | ||
| CUSTOM_ATMOSPHERE: str = "CUSTOM_ATMOSPHERE" | ||
| WYOMING_SOUNDING: str = "WYOMING_SOUNDING" | ||
| FORECAST: str = "FORECAST" | ||
| REANALYSIS: str = "REANALYSIS" | ||
| ENSEMBLE: str = "ENSEMBLE" | ||
| class Env(BaseModel): | ||
| latitude: float = 0 | ||
| longitude: float = 0 | ||
| elevation: Optional[int] = 1400 | ||
| latitude: float | ||
| longitude: float | ||
| elevation: Optional[int] = 1 | ||
| # Opional parameters | ||
| atmospheric_model_type: Optional[str] = "standard_atmosphere" | ||
| atmospheric_model_file: Optional[str] = "GFS" | ||
| # Optional parameters | ||
| atmospheric_model_type: AtmosphericModelTypes = ( | ||
| AtmosphericModelTypes.STANDARD_ATMOSPHERE | ||
| ) | ||
| atmospheric_model_file: Optional[str] = None | ||
| date: Optional[datetime.datetime] = ( | ||
| datetime.datetime.today() + datetime.timedelta(days=1) | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -6,26 +6,43 @@ | ||
| class EquationsOfMotion(str, Enum): | ||
| STANDARD = "STANDARD" | ||
| SOLID_PROPULSION = "SOLID_PROPULSION" | ||
| STANDARD: str = "STANDARD" | ||
| SOLID_PROPULSION: str = "SOLID_PROPULSION" | ||
| class Flight(BaseModel): | ||
| name: str = "Flight" | ||
| environment: Env = Env() | ||
| rocket: Rocket = Rocket() | ||
| rail_length: float = 5.2 | ||
| inclination: Optional[int] = 80.0 | ||
| heading: Optional[int] = 90.0 | ||
| environment: Env | ||
| rocket: Rocket | ||
| rail_length: float = 1 | ||
| time_overshoot: bool = True | ||
| terminate_on_apogee: bool = True | ||
| equations_of_motion: EquationsOfMotion = EquationsOfMotion.STANDARD | ||
| # Optional parameters | ||
| inclination: Optional[int] = None | ||
| heading: Optional[int] = None | ||
| # TODO: implement initial_solution | ||
| terminate_on_apogee: Optional[bool] = False | ||
| max_time: Optional[int] = 600 | ||
| max_time_step: Optional[float] = 9999 | ||
| min_time_step: Optional[int] = 0 | ||
| rtol: Optional[float] = 1e-3 | ||
| atol: Optional[float] = 1e-3 | ||
| time_overshoot: Optional[bool] = True | ||
| verbose: Optional[bool] = False | ||
| equations_of_motion: Optional[EquationsOfMotion] = ( | ||
| EquationsOfMotion.STANDARD | ||
| ) | ||
| max_time: Optional[int] = None | ||
| max_time_step: Optional[float] = None | ||
| min_time_step: Optional[int] = None | ||
| rtol: Optional[float] = None | ||
| atol: Optional[float] = None | ||
| verbose: Optional[bool] = None | ||
| def get_additional_parameters(self): | ||
| return { | ||
| key: value | ||
| for key, value in self.dict().items() | ||
| if value is not None | ||
| and key | ||
| not in [ | ||
| "name", | ||
| "environment", | ||
| "rocket", | ||
| "rail_length", | ||
| "time_overshoot", | ||
| "terminate_on_apogee", | ||
| "equations_of_motion", | ||
| ] | ||
| } | ||
GabrielBarberini marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
GabrielBarberini marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -7,7 +7,6 @@ | ||
| NoseCone, | ||
| Tail, | ||
| RailButtons, | ||
| FinsKinds, | ||
| ) | ||
| @@ -17,71 +16,34 @@ class CoordinateSystemOrientation(str, Enum): | ||
| class Parachute(BaseModel): | ||
| name: str = "Main" | ||
| cd_s: float = 10 | ||
| sampling_rate: int = 105 | ||
| lag: float = 1.5 | ||
| trigger: Union[str, float] = "apogee" | ||
| noise: Tuple[float, float, float] = (0, 8.3, 0.5) | ||
| name: str | ||
| cd_s: float | ||
| sampling_rate: int | ||
| lag: float | ||
| trigger: Union[str, float] | ||
| noise: Tuple[float, float, float] | ||
| class Rocket(BaseModel): | ||
| # Required parameters | ||
| motor: Motor = Motor() | ||
| radius: float = 0.0632 | ||
| mass: float = 16.235 | ||
| motor_position: float = -1.255 | ||
| center_of_mass_without_motor: int = 0 | ||
| inertia: Tuple[float, float, float] = (6.321, 6.321, 0.0346) | ||
| power_off_drag: List[Tuple[float, float]] = [ | ||
| (0.0, 0.0), | ||
| (0.1, 0.1), | ||
| (0.2, 0.2), | ||
| ] | ||
| power_on_drag: List[Tuple[float, float]] = [ | ||
| (0.0, 0.0), | ||
| (0.1, 0.1), | ||
| (0.2, 0.2), | ||
| ] | ||
| # Optional parameters | ||
| parachutes: Optional[List[Parachute]] = [Parachute()] | ||
| rail_buttons: Optional[RailButtons] = RailButtons( | ||
| name="RailButtons", | ||
| upper_button_position=-0.5, | ||
| lower_button_position=0.2, | ||
| angular_position=45, | ||
| ) | ||
| nose: Optional[NoseCone] = NoseCone( | ||
| name="Nose", | ||
| length=0.55829, | ||
| kind="vonKarman", | ||
| position=1.278, | ||
| base_radius=0.0635, | ||
| rocket_radius=0.0635, | ||
| ) | ||
| fins: Optional[List[Fins]] = [ | ||
| Fins( | ||
| fins_kind=FinsKinds.TRAPEZOIDAL, | ||
| name="Fins", | ||
| n=4, | ||
| root_chord=0.12, | ||
| tip_chord=0.04, | ||
| span=0.1, | ||
| position=-1.04956, | ||
| cant_angle=0, | ||
| radius=0.0635, | ||
| airfoil=([(0.0, 0.0), (0.1, 0.1), (0.2, 0.2)], "RADIANS"), | ||
| ) | ||
| ] | ||
| tail: Optional[Tail] = Tail( | ||
| name="Tail", | ||
| top_radius=0.0635, | ||
| bottom_radius=0.0435, | ||
| length=0.06, | ||
| position=-1.194656, | ||
| radius=0.0635, | ||
| ) | ||
| coordinate_system_orientation: Optional[CoordinateSystemOrientation] = ( | ||
| motor: Motor | ||
| radius: float | ||
| mass: float | ||
| motor_position: float | ||
| center_of_mass_without_motor: int | ||
GabrielBarberini marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| inertia: Union[ | ||
| Tuple[float, float, float], | ||
| Tuple[float, float, float, float, float, float], | ||
| ] = (0, 0, 0) | ||
GabrielBarberini marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| power_off_drag: List[Tuple[float, float]] = [(0, 0)] | ||
| power_on_drag: List[Tuple[float, float]] = [(0, 0)] | ||
| coordinate_system_orientation: CoordinateSystemOrientation = ( | ||
| CoordinateSystemOrientation.TAIL_TO_NOSE | ||
| ) | ||
| # Optional parameters | ||
| parachutes: Optional[List[Parachute]] = None | ||
| rail_buttons: Optional[RailButtons] = None | ||
| nose: Optional[NoseCone] = None | ||
| fins: Optional[List[Fins]] = None | ||
| tail: Optional[Tail] = None | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.