|
6 | 6 | from rocketpy.rocket.aero_surface import ( |
7 | 7 | AirBrakes, |
8 | 8 | EllipticalFins, |
| 9 | + LinearGenericSurface, |
9 | 10 | NoseCone, |
10 | 11 | RailButtons, |
11 | 12 | Tail, |
@@ -546,3 +547,91 @@ def create_object(self): |
546 | 547 | ) |
547 | 548 | air_brakes.drag_coefficient *= generated_dict["drag_coefficient_curve_factor"] |
548 | 549 | return air_brakes |
| 550 | + |
| 551 | + |
| 552 | +class StochasticLinearGenericSurface(StochasticModel): |
| 553 | + """A Stochastic Linear Generic Surface class that inherits from StochasticModel. |
| 554 | +
|
| 555 | + See Also |
| 556 | + -------- |
| 557 | + :ref:`stochastic_model` and |
| 558 | + :class:`LinearGenericSurface <rocketpy.LinearGenericSurface>` |
| 559 | +
|
| 560 | + Attributes |
| 561 | + ---------- |
| 562 | + object : LinearGenericSurface |
| 563 | + LinearGenericSurface object to be used for validation. |
| 564 | + reference_area : tuple, list, int, float |
| 565 | + Reference area of the aerodynamic surface. Has the unit of meters |
| 566 | + squared. Commonly defined as the rocket's cross-sectional area. |
| 567 | + reference_length : tuple, list, int, float |
| 568 | + Reference length of the aerodynamic surface. Has the unit of meters. |
| 569 | + Commonly defined as the rocket's diameter. |
| 570 | + center_of_pressure : tuple, optional |
| 571 | + Application point of the aerodynamic forces and moments. The |
| 572 | + center of pressure is defined in the local coordinate system of the |
| 573 | + aerodynamic surface. |
| 574 | + coefficient_curve_factor : tuple, list, int, float, optional |
| 575 | + The drag curve factor of the air brakes. This value scales the |
| 576 | + drag coefficient curve to introduce stochastic variability. |
| 577 | + name : list[str] |
| 578 | + List with the name of the object. This attribute can not be randomized. |
| 579 | + """ |
| 580 | + |
| 581 | + def __init__( |
| 582 | + self, |
| 583 | + linear_generic_surface, |
| 584 | + reference_area=None, |
| 585 | + reference_length=None, |
| 586 | + coefficient_constants=None, |
| 587 | + center_of_pressure=None, |
| 588 | + ): |
| 589 | + """Initializes the Stochastic Linear Generic Surface class. |
| 590 | +
|
| 591 | + See Also |
| 592 | + -------- |
| 593 | + :ref:`stochastic_model` |
| 594 | +
|
| 595 | + Parameters |
| 596 | + ---------- |
| 597 | + linear_generic_surface : LinearGenericSurface |
| 598 | + LinearGenericSurface object to be used for validation. |
| 599 | + reference_area : int, float |
| 600 | + Reference area of the aerodynamic surface. Has the unit of meters |
| 601 | + squared. Commonly defined as the rocket's cross-sectional area. |
| 602 | + reference_length : int, float |
| 603 | + Reference length of the aerodynamic surface. Has the unit of meters. |
| 604 | + Commonly defined as the rocket's diameter. |
| 605 | + coefficients : dict |
| 606 | + Dictionary containing the aerodynamic coefficients of the surface. |
| 607 | + center_of_pressure : tuple, optional |
| 608 | + Application point of the aerodynamic forces and moments. The center of pressure is defined in the local coordinate system of the |
| 609 | + coefficient_curve_factor : tuple, list, int, float, optional |
| 610 | + The drag curve factor of the air brakes. This value scales the |
| 611 | + drag coefficient curve to introduce stochastic variability. |
| 612 | + """ |
| 613 | + super().__init__( |
| 614 | + linear_generic_surface, |
| 615 | + reference_area=reference_area, |
| 616 | + reference_length=reference_length, |
| 617 | + coefficient_constants=coefficient_constants, |
| 618 | + center_of_pressure=center_of_pressure, |
| 619 | + name=None, |
| 620 | + ) |
| 621 | + |
| 622 | + def create_object(self): |
| 623 | + """Creates and returns a LinearGenericSurface object from the randomly generated input arguments. |
| 624 | +
|
| 625 | + Returns |
| 626 | + ------- |
| 627 | + linear_generic_surface : LinearGenericSurface |
| 628 | + LinearGenericSurface object with the randomly generated input arguments. |
| 629 | + """ |
| 630 | + generated_dict = next(self.dict_generator()) |
| 631 | + linear_generic_surface = LinearGenericSurface( |
| 632 | + reference_area=generated_dict["reference_area"], |
| 633 | + reference_length=generated_dict["reference_length"], |
| 634 | + coefficient_constants=generated_dict["coefficient_constants"], |
| 635 | + center_of_pressure=generated_dict["center_of_pressure"], |
| 636 | + ) |
| 637 | + return linear_generic_surface |
0 commit comments