|
9 | 9 | RailButtons, |
10 | 10 | Tail, |
11 | 11 | TrapezoidalFins, |
| 12 | + AirBrakes, |
12 | 13 | ) |
13 | 14 |
|
14 | 15 | from .stochastic_model import StochasticModel |
@@ -432,3 +433,114 @@ def create_object(self): |
432 | 433 | """ |
433 | 434 | generated_dict = next(self.dict_generator()) |
434 | 435 | return RailButtons(**generated_dict) |
| 436 | + |
| 437 | + |
| 438 | +class StochasticAirBrakes(StochasticModel): |
| 439 | + """A Stochastic Air Brakes class that inherits from StochasticModel. |
| 440 | +
|
| 441 | + See Also |
| 442 | + -------- |
| 443 | + :ref:`stochastic_model` and |
| 444 | + :class:`AirBrakes <rocketpy.AirBrakes>` |
| 445 | +
|
| 446 | + Attributes |
| 447 | + ---------- |
| 448 | + object : AirBrakes |
| 449 | + AirBrakes object to be used for validation. |
| 450 | + drag_coefficient_curve : list, str |
| 451 | + The drag coefficient curve of the air brakes can account for |
| 452 | + either the air brakes' drag alone or the combined drag of both |
| 453 | + the rocket and the air brakes. |
| 454 | + drag_coefficient_curve_factor : tuple, list, int, float |
| 455 | + The drag curve factor of the air brakes. This value scales the |
| 456 | + drag coefficient curve to introduce stochastic variability. |
| 457 | + reference_area : tuple, list, int, float |
| 458 | + Reference area used to non-dimensionalize the drag coefficients. |
| 459 | + clamp : bool |
| 460 | + If True, the simulation will clamp the deployment level to 0 or 1 if |
| 461 | + the deployment level is out of bounds. If False, the simulation will |
| 462 | + not clamp the deployment level and will instead raise a warning if |
| 463 | + the deployment level is out of bounds. |
| 464 | + override_rocket_drag : bool |
| 465 | + If False, the air brakes drag coefficient will be added to the |
| 466 | + rocket's power off drag coefficient curve. If True, during the |
| 467 | + simulation, the rocket's power off drag will be ignored and the air |
| 468 | + brakes drag coefficient will be used for the entire rocket instead. |
| 469 | + deployment_level : tuple, list, int, float |
| 470 | + Initial deployment level, ranging from 0 to 1. |
| 471 | + name : list[str] |
| 472 | + List with the air brakes object name. This attribute can't be randomized. |
| 473 | + """ |
| 474 | + |
| 475 | + def __init__( |
| 476 | + self, |
| 477 | + air_brakes, |
| 478 | + drag_coefficient_curve=None, |
| 479 | + drag_coefficient_curve_factor=(1, 0), |
| 480 | + reference_area=None, |
| 481 | + clamp=None, |
| 482 | + override_rocket_drag=None, |
| 483 | + deployment_level=(0, 0), |
| 484 | + ): |
| 485 | + """Initializes the Stochastic AirBrakes class. |
| 486 | +
|
| 487 | + See Also |
| 488 | + -------- |
| 489 | + :ref:`stochastic_model` |
| 490 | +
|
| 491 | + Parameters |
| 492 | + ---------- |
| 493 | + air_brakes : AirBrakes |
| 494 | + AirBrakes object to be used for validation. |
| 495 | + drag_coefficient_curve : list, str, optional |
| 496 | + The drag coefficient curve of the air brakes can account for |
| 497 | + either the air brakes' drag alone or the combined drag of both |
| 498 | + the rocket and the air brakes. |
| 499 | + drag_coefficient_curve_factor : tuple, list, int, float, optional |
| 500 | + The drag curve factor of the air brakes. This value scales the |
| 501 | + drag coefficient curve to introduce stochastic variability. |
| 502 | + reference_area : tuple, list, int, float, optional |
| 503 | + Reference area used to non-dimensionalize the drag coefficients. |
| 504 | + clamp : bool, optional |
| 505 | + If True, the simulation will clamp the deployment level to 0 or 1 if |
| 506 | + the deployment level is out of bounds. If False, the simulation will |
| 507 | + not clamp the deployment level and will instead raise a warning if |
| 508 | + the deployment level is out of bounds. |
| 509 | + override_rocket_drag : bool, optional |
| 510 | + If False, the air brakes drag coefficient will be added to the |
| 511 | + rocket's power off drag coefficient curve. If True, during the |
| 512 | + simulation, the rocket's power off drag will be ignored and the air |
| 513 | + brakes drag coefficient will be used for the entire rocket instead. |
| 514 | + deployment_level : tuple, list, int, float, optional |
| 515 | + Initial deployment level, ranging from 0 to 1. |
| 516 | + """ |
| 517 | + super().__init__( |
| 518 | + air_brakes, |
| 519 | + drag_coefficient_curve=drag_coefficient_curve, |
| 520 | + drag_coefficient_curve_factor=drag_coefficient_curve_factor, |
| 521 | + reference_area=reference_area, |
| 522 | + clamp=clamp, |
| 523 | + override_rocket_drag=override_rocket_drag, |
| 524 | + deployment_level=deployment_level, |
| 525 | + name=None, |
| 526 | + ) |
| 527 | + |
| 528 | + def create_object(self): |
| 529 | + """Creates and returns an AirBrakes object from the randomly generated |
| 530 | + input arguments. |
| 531 | +
|
| 532 | + Returns |
| 533 | + ------- |
| 534 | + air_brake : AirBrakes |
| 535 | + AirBrakes object with the randomly generated input arguments. |
| 536 | + """ |
| 537 | + generated_dict = next(self.dict_generator()) |
| 538 | + air_brakes = AirBrakes( |
| 539 | + drag_coefficient_curve=generated_dict["drag_coefficient_curve"], |
| 540 | + reference_area=generated_dict["reference_area"], |
| 541 | + clamp=generated_dict["clamp"], |
| 542 | + override_rocket_drag=generated_dict["override_rocket_drag"], |
| 543 | + deployment_level=generated_dict["deployment_level"], |
| 544 | + ) |
| 545 | + air_brakes.drag_coefficient *= generated_dict["drag_coefficient_curve_factor"] |
| 546 | + return air_brakes |
0 commit comments