#ifndef RECOVERYSYSTEM_H #define RECOVERYSYSTEM_H #include /** * @brief Represents a recovery system for a rocket stage. * * The RecoverySystem class models parachutes, drogues, or streamers * and handles deployment logic based on flight conditions. */ class RecoverySystem { public: /** * @brief Deployment trigger types. */ enum class DeploymentType { Apogee, Altitude, Timer }; /** * @brief Constructs a new RecoverySystem. * @param name Name of the recovery device. * @param deploymentType Type of deployment trigger (apogee, altitude, timer). * @param triggerValue Value associated with deployment trigger (e.g., altitude in meters or time in seconds). * @param dragCoefficient Drag coefficient of the recovery device. * @param referenceArea Reference area (canopy projected area) in square meters. */ RecoverySystem(const std::string& name, DeploymentType deploymentType, double triggerValue, double dragCoefficient, double referenceArea); /** * @brief Default destructor. */ ~RecoverySystem() = default; /** * @brief Checks if deployment conditions are met based on flight state. * @param altitude Current altitude above ground (meters). * @param velocity Current vertical velocity (m/s). * @param time Elapsed flight time (seconds). * @param atApogee Flag indicating if rocket has reached apogee. * @return True if deployment should occur. */ bool checkDeploymentCondition(double altitude, double velocity, double time, bool atApogee) const; /** * @brief Marks the recovery system as deployed. */ void deploy(); /** * @brief Returns whether the recovery system has been deployed. * @return True if deployed. */ bool isDeployed() const; /** * @brief Gets the drag coefficient. * @return Drag coefficient (dimensionless). */ double getDragCoefficient() const; /** * @brief Gets the reference area. * @return Reference area (square meters). */ double getReferenceArea() const; /** * @brief Gets the name of the recovery system. * @return Recovery system name as a constant reference. */ const std::string& getName() const; private: std::string name_; ///< Name of the recovery system. DeploymentType deploymentType_; ///< Deployment trigger type. double triggerValue_; ///< Trigger value (meters for altitude, seconds for timer). double dragCoefficient_; ///< Drag coefficient after deployment. double referenceArea_; ///< Reference area [m2]. bool deployed_; ///< Whether the recovery system has been deployed. }; #endif // RECOVERYSYSTEM_H