Rocketpy -Fehler: Mehrere Fallschirme, die gleichzeitig auslösenPython

Python-Programme
Guest
 Rocketpy -Fehler: Mehrere Fallschirme, die gleichzeitig auslösen

Post by Guest »

Ich mache einige Monte -Carlo -Simulationen in Rocketpy. Ich versuche zu simulieren, was für ein Raketenstart mit 2 Fallschirmen verwendet wird. ein Dogue und ein Hauptfallschirm. Ich denke, dies ist eine einfache Lösung, aber aus irgendeinem Grund kann ich nicht sehen, warum dieser Fehler auftritt. : < /p>
# Setting up the directory for where to save these files:
filename = "monte_carlo_analysis_outputs/Valetudo_V0"
number_of_simulations = 100

# Create data files for inputs, outputs and error logging
dispersion_error_file = open(str(filename) + ".disp_errors.txt", "w")
dispersion_input_file = open(str(filename) + ".disp_inputs.txt", "w")
dispersion_output_file = open(str(filename) + ".disp_outputs.txt", "w")

# Set iterator value
i = 0

initial_wall_time = time()
initial_cpu_time = process_time()

# Define basic Environment object
Env = Environment(date=(2025, 2, 7, 0), latitude=67.89325597913002, longitude=21.065756056273834, elevation=300)
Env.max_expected_height = 40000
Env.set_atmospheric_model(
type="Ensemble",
file="GEFS",
#dictionary="ECMWF",
)

# Set up parachutes.

# Drogue is set off after apogee to slow rocket down. This continues all the way down to a certain altitude when the main parachute is then deployed.
def drogue_trigger(p, h, y):
# If rocket is going down (has passed the apogee) then set off the trigger
vertical_velocity = y[5]
return True if vertical_velocity < 0 else False

# Main is set to trigger 1km from the ground to minimise drift from original launch site.

def main_trigger(p, h, y):
return True if h < 1000 else False

# Iterating over flight settings
out = display("Starting", display_id=True)

###############################################################

output_lines = ["Starting"]

for setting in flight_settings(analysis_parameters, number_of_simulations):
start_time = process_time()
i += 1

# Update the chosen environment object
Env.select_ensemble_member(setting["ensemble_member"])

# Create motor
ValetudoMotor = SolidMotor(
thrust_source=r"...\Python Modelling\Thrust curves\Valetudo.eng"
burn_time=13.1,
reshape_thrust_curve=(setting["burn_time"], setting["impulse"]),
nozzle_radius=setting["nozzle_radius"],
throat_radius=setting["throat_radius"],
grain_number=1,
grain_separation=setting["grain_separation"],
grain_density=setting["grain_density"],
grain_outer_radius=setting["grain_outer_radius"],
grain_initial_inner_radius=setting["grain_initial_inner_radius"],
grain_initial_height=setting["grain_initial_height"],
interpolation_method="linear",
coordinate_system_orientation="nozzle_to_combustion_chamber",
nozzle_position=setting["nozzle_position"],
grains_center_of_mass_position=setting["grains_center_of_mass_position"],
dry_mass=setting["motor_dry_mass"],
dry_inertia=(
setting["motor_inertia_11"],
setting["motor_inertia_11"],
setting["motor_inertia_33"],
),
center_of_dry_mass_position=setting["motor_dry_mass_position"],
)

# Creating the rocket
Valetudo = Rocket(
radius=setting["radius"],
mass=setting["rocket_mass"],
inertia=(
setting["rocket_inertia_11"],
setting["rocket_inertia_11"],
setting["rocket_inertia_33"],
),
power_off_drag=r"...\Python Modelling\Drag curves\Cesaroni_6026M1670_PpowerOffDragCurve.eng",
power_on_drag=r"...\Python Modelling\Drag curves\Cesaroni_6026M1670_PpowerOnDragCurve.eng",
center_of_mass_without_motor=4.45,
coordinate_system_orientation="tail_to_nose",
)
Valetudo.set_rail_buttons(1.3, 4)

Valetudo.add_motor(ValetudoMotor, position=6.6428125)

# Edit rocket drag
Valetudo.power_off_drag *= setting["power_off_drag"]
Valetudo.power_on_drag *= setting["power_on_drag"]

NoseCone = Valetudo.add_nose(
length=setting["nose_length"],
kind="ogive",
position=setting["nose_distance_to_CM"] +setting["nose_length"],
)
Finset = Valetudo.add_trapezoidal_fins(
n=3,
span=setting["fin_span"],
root_chord=setting["fin_root_chord"],
tip_chord=setting["fin_tip_chord"],
position=setting["fin_distance_to_CM"],
cant_angle=0,
airfoil=None,
)

# Add parachutes

Drogue = Valetudo.add_parachute(
"Drogue",
cd_s=setting["cd_s_drogue"],
trigger=drogue_trigger,
sampling_rate=105,
lag=setting["lag_rec"] +setting["lag_se"],
noise=(0, 8.3, 0.5),
)

Main = Valetudo.add_parachute(
"Main",
cd_s=setting["cd_s_main"],
trigger=main_trigger,
sampling_rate=105,
lag=setting["lag_rec"] + setting["lag_se"],
noise=(0, 8.3, 0.5),
)
# Running simulation

try:
test_flight = Flight(
rocket=Valetudo,
environment = Env,
rail_length = setting["rail_length"],
inclination = setting["inclination"],
heading = setting["heading"],
max_time = 600,
)
export_flight_data(setting, test_flight, process_time() - start_time)
except Exception as E:
print(E)
export_flight_error(setting)

# Register time
out.update(
f"Current iteration: {i:06d} | Average Time per Iteration: {(process_time() - initial_cpu_time)/i:2.6f} s"
)
iteration_message = f"Current iteration: {i:06d} "
output_lines.append(iteration_message)
out.update(output_lines)

# Done
< /code>
(Der Rest des Beispiels ist der Seite von Monte Carlo Simulations auf der Rocketpy -Website sehr ähnlich: Rocketpy_Docs. < /p>
Aber hier ist die Fehlermeldung Ich empfange: < /p>
WARNING: Trying to add flight phase starting *together* with the one *preceding* it. This may be caused by multiple parachutes being triggered simultaneously.
array must not contain infs or NaNs
< /code>
Ich bin mir nicht sicher, was das verursacht, da ich unterschiedliche Auslöser für die 2 Fallschirme habe. Hat jemand irgendwelche Vorschläge?>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post