use crate::pod::problem::parameter::{Parameter, ParameterKind};
#[derive(Debug, Clone, PartialEq)]
pub struct ThrustArcConfig {
pub id: String,
pub start_seconds_tdb: f64,
pub stop_seconds_tdb: f64,
pub estimate_thrust_scale: bool,
pub estimate_delta_v: bool,
}
impl ThrustArcConfig {
pub fn parameters(&self) -> Vec<Parameter> {
let mut out = Vec::new();
if self.estimate_thrust_scale {
out.push(Parameter {
kind: ParameterKind::Custom(format!("thrust_scale[{}]", self.id)),
initial_value: 1.0,
apriori_sigma: Some(0.1),
});
}
if self.estimate_delta_v {
for axis in ['X', 'Y', 'Z'] {
out.push(Parameter {
kind: ParameterKind::Custom(format!("delta_v_{axis}[{}]", self.id)),
initial_value: 0.0,
apriori_sigma: Some(0.01),
});
}
}
out
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn emits_expected_parameters() {
let arc = ThrustArcConfig {
id: "burn1".into(),
start_seconds_tdb: 0.0,
stop_seconds_tdb: 60.0,
estimate_thrust_scale: true,
estimate_delta_v: true,
};
assert_eq!(arc.parameters().len(), 4);
}
}