diff --git a/fastsim-core/src/macros.rs b/fastsim-core/src/macros.rs index b5d97773..fd5da1fd 100644 --- a/fastsim-core/src/macros.rs +++ b/fastsim-core/src/macros.rs @@ -72,7 +72,7 @@ macro_rules! impl_get_set_eff_range { ]; let eff_interp_fwd = self.eff_interp_fwd.0; eff_interp_fwd.set_f_x(f_x)?; - self.eff_interp_fwd = InterpolatorWrapper(eff_interp_fwd); + self.eff_interp_fwd = eff_interp_fwd; Ok(()) } else if (0.0..=1.0).contains(&eff_range) { let old_min = self.get_eff_min(); diff --git a/fastsim-core/src/vehicle/powertrain/electric_machine.rs b/fastsim-core/src/vehicle/powertrain/electric_machine.rs index 93f2f209..dd48cec8 100644 --- a/fastsim-core/src/vehicle/powertrain/electric_machine.rs +++ b/fastsim-core/src/vehicle/powertrain/electric_machine.rs @@ -1,7 +1,5 @@ //! Module for electric machine (i.e. bidirectional electromechanical device), generator, or motor -use utils::interp::InterpolatorWrapper; - use super::*; #[allow(unused_imports)] @@ -68,12 +66,12 @@ pub struct ElectricMachine { #[api(skip_set)] /// Efficiency array corresponding to [Self::pwr_out_frac_interp] and [Self::pwr_in_frac_interp] /// eff_interp_fwd and eff_interp_bwd have the same f_x but different x - pub eff_interp_fwd: utils::interp::InterpolatorWrapper, + pub eff_interp_fwd: utils::interp::Interpolator, #[serde(skip)] #[api(skip_set)] // if it is not provided, needs to be set during init, can figure out what to do // for that by looking at how pwr_in_frac_interp is initialized - pub eff_interp_bwd: Option, + pub eff_interp_bwd: Option, /// Electrical input power fraction array at which efficiencies are evaluated. /// Calculated during runtime if not provided. #[serde(skip)] @@ -152,7 +150,7 @@ impl ElectricMachine { .map(|(x, y)| x / y) .collect(), ); - self.eff_interp_bwd = Some(InterpolatorWrapper(eff_interp_bwd)); + self.eff_interp_bwd = Some(eff_interp_bwd); // self.set_pwr_in_frac_interp() // .with_context(|| format_dbg!())?; } @@ -342,7 +340,7 @@ impl Init for ElectricMachine { .map(|(x, y)| x / y) .collect(), ); - self.eff_interp_bwd = Some(InterpolatorWrapper(eff_interp_bwd)); + self.eff_interp_bwd = Some(eff_interp_bwd); // self.set_pwr_in_frac_interp() // .with_context(|| format_dbg!())?; } diff --git a/fastsim-core/src/vehicle/powertrain/fuel_converter.rs b/fastsim-core/src/vehicle/powertrain/fuel_converter.rs index cae0da18..a1b0f96c 100644 --- a/fastsim-core/src/vehicle/powertrain/fuel_converter.rs +++ b/fastsim-core/src/vehicle/powertrain/fuel_converter.rs @@ -68,7 +68,7 @@ pub struct FuelConverter { pub pwr_ramp_lag: si::Time, /// interpolator for calculating [Self] efficiency as a function of output power #[api(skip_get, skip_set)] - pub eff_interp_from_pwr_out: utils::interp::InterpolatorWrapper, + pub eff_interp_from_pwr_out: utils::interp::Interpolator, /// idle fuel power to overcome internal friction (not including aux load) \[W\] #[serde(rename = "pwr_idle_fuel_watts")] pub pwr_idle_fuel: si::Power, diff --git a/fastsim-core/src/vehicle/vehicle_model.rs b/fastsim-core/src/vehicle/vehicle_model.rs index 71ca423d..811c2714 100644 --- a/fastsim-core/src/vehicle/vehicle_model.rs +++ b/fastsim-core/src/vehicle/vehicle_model.rs @@ -375,7 +375,7 @@ impl TryFrom<&fastsim_2::vehicle::RustVehicle> for PowertrainType { }, em: ElectricMachine { state: Default::default(), - eff_interp_fwd: InterpolatorWrapper(Interpolator::Interp1D( + eff_interp_fwd: (Interpolator::Interp1D( Interp1D::new( f2veh.mc_pwr_out_perc.to_vec(), f2veh.mc_eff_array.to_vec(), @@ -385,7 +385,7 @@ impl TryFrom<&fastsim_2::vehicle::RustVehicle> for PowertrainType { ) .unwrap(), )), - eff_interp_bwd: Some(InterpolatorWrapper(Interpolator::Interp1D( + eff_interp_bwd: Some(Interpolator::Interp1D( Interp1D::new( // before adding the interpolator, pwr_in_frac_interp was set as Default::default(), can this // be transferred over as done here, or does a new defualt need to be defined? @@ -396,7 +396,7 @@ impl TryFrom<&fastsim_2::vehicle::RustVehicle> for PowertrainType { Extrapolate::Error, ) .unwrap(), - ))), + )), // pwr_in_frac_interp: Default::default(), pwr_out_max: f2veh.mc_max_kw * uc::KW, specific_pwr: None,