Skip to content

Commit

Permalink
added state vars to track power and cumulative energy for hvac stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
calbaker committed Jan 20, 2025
1 parent f7a0892 commit 270be10
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 10 deletions.
19 changes: 15 additions & 4 deletions fastsim-core/src/vehicle/hvac/hvac_sys_for_lumped_cabin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,12 @@ impl HVACSystemForLumpedCabin {
(pwr_thrml_hvac_to_cabin, pwr_thrml_fc_to_cabin, cop)
};
self.state.cop = cop;
Ok((pwr_thrml_hvac_to_cabin, pwr_thrml_fc_to_cabin))
self.state.pwr_thrml_hvac_to_cabin = pwr_thrml_hvac_to_cabin;
self.state.pwr_thrml_fc_to_cabin = pwr_thrml_fc_to_cabin;
Ok((
self.state.pwr_thrml_hvac_to_cabin,
self.state.pwr_thrml_fc_to_cabin,
))
}

fn handle_heat_source(
Expand Down Expand Up @@ -289,9 +294,15 @@ pub struct HVACSystemForLumpedCabinState {
/// Aux power demand from [Vehicle::hvac] system
pub pwr_aux_for_hvac: si::Power,
/// Cumulative aux energy for HVAC system
pub energy_aux: si::Energy,
/// Cumulative energy demand by HVAC system from thermal component (e.g. [FuelConverter])
pub energy_thermal_req: si::Energy,
pub energy_aux_for_hvac: si::Energy,
/// Thermal power from HVAC system to cabin, positive is heating the cabin
pub pwr_thrml_hvac_to_cabin: si::Power,
/// Cumulative thermal energy from HVAC system to cabin, positive is heating the cabin
pub energy_thrml_hvac_to_cabin: si::Energy,
/// Thermal power from [FuelConverter] to [Cabin]
pub pwr_thrml_fc_to_cabin: si::Power,
/// Cumulative thermal energy from [FuelConverter] to [Cabin]
pub energy_thrml_fc_to_cabin: si::Energy,
}
impl Init for HVACSystemForLumpedCabinState {}
impl SerdeAPI for HVACSystemForLumpedCabinState {}
26 changes: 20 additions & 6 deletions fastsim-core/src/vehicle/hvac/hvac_sys_for_lumped_cabin_and_res.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,14 @@ impl HVACSystemForLumpedCabinAndRES {
self.state.pwr_aux_for_hvac
};

self.state.pwr_thrml_hvac_to_cabin = pwr_thrml_hvac_to_cabin;
self.state.pwr_thrml_fc_to_cabin = pwr_thrml_fc_to_cabin;
self.state.pwr_thrml_hvac_to_res = pwr_thrml_hvac_to_res;

Ok((
pwr_thrml_hvac_to_cabin,
pwr_thrml_fc_to_cabin,
pwr_thrml_hvac_to_res,
self.state.pwr_thrml_hvac_to_cabin,
self.state.pwr_thrml_fc_to_cabin,
self.state.pwr_thrml_hvac_to_res,
))
}

Expand Down Expand Up @@ -479,9 +483,19 @@ pub struct HVACSystemForLumpedCabinAndRESState {
/// Au power demand from [Vehicle::hvac] system
pub pwr_aux_for_hvac: si::Power,
/// Cumulative aux energy for HVAC system
pub energy_aux: si::Energy,
/// Cumulative energy demand by HVAC system from thermal component (e.g. [FuelConverter])
pub energy_thermal_req: si::Energy,
pub energy_aux_for_hvac: si::Energy,
/// Thermal power from HVAC system to cabin, positive is heating the cabin
pub pwr_thrml_hvac_to_cabin: si::Power,
/// Cumulative thermal energy from HVAC system to cabin, positive is heating the cabin
pub energy_thrml_hvac_to_cabin: si::Energy,
/// Thermal power from [FuelConverter] to [Cabin]
pub pwr_thrml_fc_to_cabin: si::Power,
/// Cumulative thermal energy from [FuelConverter] to [Cabin]
pub energy_thrml_fc_to_cabin: si::Energy,
/// Thermal power from HVAC to [ReversibleEnergyStorage]
pub pwr_thrml_hvac_to_res: si::Power,
/// Cumulative thermal energy from HVAC to [ReversibleEnergyStorage]
pub energy_thrml_hvac_to_res: si::Energy,
}
impl Init for HVACSystemForLumpedCabinAndRESState {}
impl SerdeAPI for HVACSystemForLumpedCabinAndRESState {}
Expand Down

0 comments on commit 270be10

Please sign in to comment.