CeuAzul / ADR

Aircraft Design Resources - aircraft conceptual design framework
https://ceuazul.github.io/ADR
MIT License
14 stars 2 forks source link

Number and type of aerodynamic surfaces and motors is hard-coded in Plane #137

Closed rafaellehmkuhl closed 4 years ago

rafaellehmkuhl commented 4 years ago

This is how Plane is structured today:

./Components/Plane.py

class Plane:
    def __init__(self, data):
        self.data = data
        self.plane_type = data.get("plane_type")

        wing1_data = {
            "x": data.get("wing1_x"),
            "y": data.get("wing1_y"),
            ...
            "CM_ca": data.get("wing1_CM_ca"),
        }

        wing2_data = {
            "x": data.get("wing2_x"),
            "y": data.get("wing2_y"),
            ...
            "CM_ca": data.get("wing2_CM_ca"),
        }

        hs_data = {
            "x": data.get("hs_x"),
            "y": data.get("hs_y"),
            ...
            "CM_ca": data.get("hs_CM_ca"),
        }

        vs_data = {
            "x": data.get("vs_x"),
            "y": data.get("vs_y"),
            ...
            "incidence": data.get("vs_incidence"),
        }

        motor_data = {
            "x": data.get("motor_x"),
            "y": data.get("motor_y"),
            ...
            "linear_decay_coefficient": data.get("linear_decay_coefficient"),
        }

        ....

        self.wing1 = Wing(wing1_data)
        self.wing2 = Wing(wing2_data)
        self.hs = HS(hs_data)
        self.vs = VS(vs_data)
        self.motor = Motor(motor_data)

Like #135 states for aerodynamic surface sections, we should have iterable arrays of key-value pairs associated with each component type, so we could have almost any airplane configuration. Something like this:

for motor_parameters in motors_parameters:
    motor = Motor(motor_parameters)
    self.motors.append(motor)

This also requires that the plane parameters are instantiated and passed in a different way:

./parameters.py:

motor1 = {"x": value, "y": value, "linear_decay_coefficient": value}
motor2 = {"x": value, "y": value, "linear_decay_coefficient": value}
...
motorN = {"x": value, "y": value, "linear_decay_coefficient": value}  
motors = [motor1, motor2, ..., motorN] 

This would be a big improvement not only in code structure and maintainability but also on enhanced capabilities for the analysis.

rafaellehmkuhl commented 4 years ago

Addressed in 2.0