From 28ebc46e3f5e3640d4cf993093c978a5a5b3fec3 Mon Sep 17 00:00:00 2001 From: MateusStano Date: Tue, 2 Apr 2024 15:55:16 +0200 Subject: [PATCH] ENH: calculate u_dot only once for all sensors --- rocketpy/simulation/flight.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rocketpy/simulation/flight.py b/rocketpy/simulation/flight.py index dc922dba2..f82b63b1c 100644 --- a/rocketpy/simulation/flight.py +++ b/rocketpy/simulation/flight.py @@ -709,13 +709,12 @@ def __init__( for callback in node.callbacks: callback(self) + # calculate u_dot for sensors + u_dot = phase.derivative(self.t, self.y_sol) for sensor, position in node._component_sensors: relative_position = position - self.rocket._csys * Vector( [0, 0, self.rocket.center_of_dry_mass_position] ) - u_dot = phase.derivative( - self.t, self.y_sol - ) # calling udot for each sensor. Not optimal sensor.measure( self.t, self.y_sol,