@@ -666,11 +666,10 @@ def evaluate_center_of_pressure(self):
666666
667667 # Calculate total lift coefficient derivative and center of pressure
668668 if len (self .aerodynamic_surfaces ) > 0 :
669- for aero_surface , position in self .aerodynamic_surfaces :
669+ for aero_surface , position , ref_factor in self .aerodynamic_surfaces :
670670 if isinstance (aero_surface , GenericSurface ):
671671 continue
672672 # ref_factor corrects lift for different reference areas
673- ref_factor = (aero_surface .rocket_radius / self .radius ) ** 2
674673 self .total_lift_coeff_der += ref_factor * aero_surface .clalpha
675674 self .cp_position += (
676675 ref_factor
@@ -693,7 +692,7 @@ def evaluate_surfaces_cp_to_cdm(self):
693692 Dictionary mapping the relative position of each aerodynamic
694693 surface center of pressure to the rocket's center of mass.
695694 """
696- for surface , position in self .aerodynamic_surfaces :
695+ for surface , position , _ref_factor in self .aerodynamic_surfaces :
697696 self .__evaluate_single_surface_cp_to_cdm (surface , position )
698697 return self .surfaces_cp_to_cdm
699698
@@ -794,7 +793,7 @@ def warn_if_unstable(self):
794793 """
795794 has_generic_surface = any (
796795 isinstance (aero_surface , GenericSurface )
797- for aero_surface , _position in self .aerodynamic_surfaces
796+ for aero_surface , _position , _ref_factor in self .aerodynamic_surfaces
798797 )
799798 if has_generic_surface :
800799 return False
@@ -1169,7 +1168,12 @@ def __add_single_surface(self, surface, position):
11691168 self .rail_buttons = Components ()
11701169 self .rail_buttons .add (surface , position )
11711170 else :
1172- self .aerodynamic_surfaces .add (surface , position )
1171+ # ref_factor corrects lift for different reference areas
1172+ if getattr (surface , "rocket_radius" , None ) is not None :
1173+ ref_factor = (surface .rocket_radius / self .radius ) ** 2
1174+ else :
1175+ ref_factor = 1.0
1176+ self .aerodynamic_surfaces .add (surface , position , ref_factor = ref_factor )
11731177 self .__evaluate_single_surface_cp_to_cdm (surface , position )
11741178
11751179 def add_surfaces (self , surfaces , positions ):
@@ -2338,10 +2342,10 @@ def from_dict(cls, data):
23382342 position = data ["motor_position" ],
23392343 )
23402344
2341- for surface , position in data ["aerodynamic_surfaces" ]:
2345+ for surface , position , _ref_factor in data ["aerodynamic_surfaces" ]:
23422346 rocket .add_surfaces (surfaces = surface , positions = position )
23432347
2344- for button , position in data ["rail_buttons" ]:
2348+ for button , position , _ref_factor in data ["rail_buttons" ]:
23452349 rocket .set_rail_buttons (
23462350 upper_button_position = position [2 ] + button .buttons_distance ,
23472351 lower_button_position = position [2 ],
@@ -2352,7 +2356,7 @@ def from_dict(cls, data):
23522356 for parachute in data ["parachutes" ]:
23532357 rocket .parachutes .append (parachute )
23542358
2355- for sensor , position in data ["sensors" ]:
2359+ for sensor , position , _ref_factor in data ["sensors" ]:
23562360 rocket .add_sensor (sensor , position )
23572361
23582362 for air_brake in data ["air_brakes" ]:
0 commit comments