@@ -2041,11 +2041,20 @@ def u_dot_generalized_3dof(self, t, u, post_processing=False):
20412041 R3 += fz
20422042
20432043 # Thrust and weight
2044- thrust = self .rocket .motor .thrust .get_value_opt (t )
2044+ # Calculate net thrust including pressure thrust correction if motor is burning
2045+ if self .rocket .motor .burn_start_time < t < self .rocket .motor .burn_out_time :
2046+ pressure = self .env .pressure .get_value_opt (z )
2047+ net_thrust = max (
2048+ self .rocket .motor .thrust .get_value_opt (t )
2049+ + self .rocket .motor .pressure_thrust (pressure ),
2050+ 0 ,
2051+ )
2052+ else :
2053+ net_thrust = 0
20452054 gravity = self .env .gravity .get_value_opt (z )
20462055 weight_body = Kt @ Vector ([0 , 0 , - total_mass * gravity ])
20472056
2048- total_force = Vector ([0 , 0 , thrust ]) + weight_body + Vector ([R1 , R2 , R3 ])
2057+ total_force = Vector ([0 , 0 , net_thrust ]) + weight_body + Vector ([R1 , R2 , R3 ])
20492058
20502059 # Dynamics
20512060 v_dot = K @ (total_force / total_mass )
@@ -2133,7 +2142,7 @@ def u_dot_generalized_3dof(self, t, u, post_processing=False):
21332142
21342143 if post_processing :
21352144 self .__post_processed_variables .append (
2136- [t , * v_dot , * w_dot , R1 , R2 , R3 , 0 , 0 , 0 ]
2145+ [t , * v_dot , * w_dot , R1 , R2 , R3 , 0 , 0 , 0 , net_thrust ]
21372146 )
21382147
21392148 return u_dot
0 commit comments