pytrebuchet.differential_equations.ballistic_phase module
Module containing the ODEs for the ballistic phase of a projectile.
The ballistic phase occurs after release from the sling.
- pytrebuchet.differential_equations.ballistic_phase.ballistic_ode(t: float, y: tuple[float, float, float, float], environment: EnvironmentConfig, projectile: Projectile) tuple[float, float, float, float]
Ordinary differential equations (ODEs) for a ballistic projectile.
- Parameters:
t – time variable (not used in this function but required for ODE solvers)
y – tuple containing the state variables: (px, py, vx, vy) where: px: x position of the projectile py: y position of the projectile vx: x velocity of the projectile vy: y velocity of the projectile
environment – EnvironmentConfig object containing environment parameters
projectile – Projectile object containing properties of the projectile
- Returns:
derivatives: tuple containing the derivatives of the state variables: (vx, vy, ax, ay)
- pytrebuchet.differential_equations.ballistic_phase.projectile_hits_ground_event(t: float, y: tuple[float, float, float, float], environment: EnvironmentConfig, projectile: Projectile) float
Event function to determine when the projectile hits the ground.
The event occurs when the vertical position of the projectile (py) reaches zero.
- Parameters:
t – time variable (not used in this function but required for ODE solvers)
y – tuple containing the state variables: (px, py, vx, vy) where: px: x position of the projectile py: y position of the projectile vx: x velocity of the projectile vy: y velocity of the projectile
args – additional parameters required for the equations: (wind_speed, rho, nu, g, projectile) where: wind_speed: wind speed rho: air density nu: kinematic viscosity of the air g: gravitational acceleration projectile: Projectile object containing properties of the projectile
- Returns:
py: vertical position of the projectile