Skip to content

Commit

Permalink
temperatures that have degrees_Celsius in the name appear to be in …
Browse files Browse the repository at this point in the history
…Kelvin
  • Loading branch information
calbaker committed Jan 24, 2025
1 parent 92b3b21 commit 6555233
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pt_type:
htc_to_amb_stop_watts_per_square_meter_degree_celsius: 50.0
conductance_from_comb_watts_per_kelvin: 5.0
max_frac_from_comb: 0.5
tstat_te_sto_kelvin: 85.0
tstat_te_sto_degrees_Celsius: 85.0
tstat_te_delta_kelvin: 5.0
tstat_interp:
Interp1D:
Expand Down Expand Up @@ -199,8 +199,8 @@ pt_type:
frac_of_most_eff_pwr_to_run_fc: 1.0
frac_res_chrg_for_fc: 0.0
frac_res_dschrg_for_fc: 1.0
temp_fc_forced_on_kelvin: 335.15
temp_fc_allowed_off_kelvin: 338.15
temp_fc_forced_on_degrees_Celsius: 62.0
temp_fc_allowed_off_degrees_Celsius: 65.0
aux_cntrl: AuxOnResPriority
mass_kilograms: ~
sim_params:
Expand Down Expand Up @@ -233,7 +233,7 @@ cabin:
width_meters: 2.0
hvac:
LumpedCabinAndRES:
te_set_kelvin: 295.15
te_set_degrees_Celsius: 22.0
te_deadband_kelvin: 1.5
p_cabin_watts_per_kelvin: 0.0
i_cabin: 0.0
Expand All @@ -253,32 +253,3 @@ mass_kilograms: 1508.195
pwr_aux_base_watts: 500.0
trans_eff: 0.98
save_interval: 1
state:
i: 0
pwr_prop_fwd_max_watts: 0.0
pwr_prop_bwd_max_watts: 0.0
pwr_tractive_watts: 0.0
pwr_tractive_for_cyc_watts: 0.0
energy_tractive_joules: 0.0
pwr_aux_watts: 0.0
energy_aux_joules: 0.0
pwr_drag_watts: 0.0
energy_drag_joules: 0.0
pwr_accel_watts: 0.0
energy_accel_joules: 0.0
pwr_ascent_watts: 0.0
energy_ascent_joules: 0.0
pwr_rr_watts: 0.0
energy_rr_joules: 0.0
pwr_whl_inertia_watts: 0.0
energy_whl_inertia_joules: 0.0
pwr_brake_watts: 0.0
energy_brake_joules: 0.0
cyc_met: true
cyc_met_overall: true
speed_ach_meters_per_second: 0.0
dist_meters: 0.0
grade_curr: 0.0
elev_curr_meters: .nan
air_density_kilograms_per_cubic_meter: 1.172
mass_kilograms: .nan
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ pub(crate) fn impl_getters_and_setters(field: &mut syn::Field) -> Option<()> {
}
"TemperatureInterval" => extract_units!(uom::si::temperature_interval::kelvin),
"Temperature" => {
extract_units!(uom::si::temperature_interval::degree_celsius)
extract_units!(uom::si::thermodynamic_temperature::degree_celsius)
}
"ThermalConductance" => {
extract_units!(uom::si::thermal_conductance::watt_per_kelvin)
Expand Down
8 changes: 4 additions & 4 deletions fastsim-core/src/vehicle/powertrain/fuel_converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ pub struct FuelConverterThermal {
/// parameter for temperature at which thermostat starts to open
pub tstat_te_sto: Option<si::Temperature>,
/// temperature delta over which thermostat is partially open
pub tstat_te_delta: Option<si::Temperature>,
pub tstat_te_delta: Option<si::TemperatureInterval>,
#[serde(default = "tstat_interp_default")]
pub tstat_interp: Interpolator,
/// Radiator effectiveness -- ratio of active heat rejection from
Expand Down Expand Up @@ -695,18 +695,18 @@ impl Init for FuelConverterThermal {
self.tstat_te_sto = self
.tstat_te_sto
.or(Some((85. + uc::CELSIUS_TO_KELVIN) * uc::KELVIN));
self.tstat_te_delta = self.tstat_te_delta.or(Some(5. * uc::KELVIN));
self.tstat_te_delta = self.tstat_te_delta.or(Some(5. * uc::KELVIN_INT));
self.tstat_interp = Interpolator::new_1d(
vec![
self.tstat_te_sto.unwrap().get::<si::degree_celsius>(),
self.tstat_te_sto.unwrap().get::<si::degree_celsius>()
+ self.tstat_te_delta.unwrap().get::<si::degree_celsius>(),
+ self.tstat_te_delta.unwrap().get::<si::kelvin>(),
],
vec![0.0, 1.0],
Strategy::Linear,
Extrapolate::Clamp,
)
.with_context(|| format_dbg!())?;
.with_context(|| format_dbg!((self.tstat_te_sto, self.tstat_te_delta)))?;
Ok(())
}
}
Expand Down
8 changes: 4 additions & 4 deletions python/fastsim/demos/demo_hev_thrml.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,24 @@ def plot_temperatures() -> Tuple[Figure, Axes]:
ax[0].set_prop_cycle(get_uni_cycler())
ax[0].plot(
df["cyc.time_seconds"],
df["cyc.temp_amb_air_kelvin"] - 273.15,
df["cyc.temp_amb_air_degrees_Celsius"],
label="amb",
)
ax[0].plot(
df["cyc.time_seconds"],
df["veh.cabin.LumpedCabin.history.temperature_kelvin"] - 273.15,
df["veh.cabin.LumpedCabin.history.temperature_degrees_Celsius"],
label="cabin",
)
ax[0].plot(
df["cyc.time_seconds"],
df["veh.pt_type.HybridElectricVehicle.res.thrml." +
"RESLumpedThermal.history.temperature_kelvin"] - 273.15,
"RESLumpedThermal.history.temperature_degrees_Celsius"],
label="res",
)
ax[0].plot(
df["cyc.time_seconds"],
df["veh.pt_type.HybridElectricVehicle.fc.thrml." +
"FuelConverterThermal.history.temperature_kelvin"] - 273.15,
"FuelConverterThermal.history.temperature_degrees_Celsius"],
label="fc",
)
ax[0].set_ylabel("Temperatures [°C]")
Expand Down

0 comments on commit 6555233

Please sign in to comment.