Skip to content

Conversation

calbaker
Copy link
Collaborator

@calbaker calbaker commented May 6, 2025

@michael-okeefe , I could sure use some help troubleshooting teh test_net_accel_calc failure in:
https://github.com/NREL/fastsim/actions/runs/16008814973/job/45161617012

As of 727ea7b, it's

---- simdrivelabel::tests::test_net_accel_calc stdout ----

thread 'simdrivelabel::tests::test_net_accel_calc' panicked at fastsim-core/src/simdrivelabel.rs:1403:49:
called `Result::unwrap()` on an `Err` value: [fastsim-core/src/simdrivelabel.rs:23]

Caused by:
    0: [fastsim-core/src/simdrive.rs:338]
       time step: TrackedState(1, Fresh)
    1: [fastsim-core/src/simdrive.rs:439]
    2: [fastsim-core/src/vehicle/vehicle_model.rs:416]
    3: [fastsim-core/src/vehicle/conv.rs:94]
    4: [fastsim-core/src/vehicle/powertrain/fuel_converter.rs:285]
       `pwr_out_req` (23.307e3 W) must be < `self.state.pwr_prop_max` (21.050e3 W)

@calbaker calbaker marked this pull request as draft May 7, 2025 23:10
@kylecarow
Copy link
Collaborator

kylecarow commented May 28, 2025

@calbaker on 887f7aa, we also did something similar in #194 BTW. We may be able to combine this code

@calbaker
Copy link
Collaborator Author

@michael-okeefe could you see if you can get this one over the finish line? The three failing tests are checking against fastsim-2.

Chad Baker and others added 23 commits July 15, 2025 11:29
With pwr_aux_base set to 0 kW, we can actually run the HEV label test without panic to the end. This shows that there must be a discrepancy in how aux loads are being handled at the "max power" phase vs the backward solution phase. This seems to only happen for the HEV.
This checks the electric machine for whether
the maximum output is being requested (either
for tractive effort or regen). If so, the same
efficiency value used when calculating the max
possible effort is reused as the efficiency value.
This prevents slight lookup discrepancies and
allows the backward path to match the forward
path for the powertrain.
The eff_interp_at_max_input map was not being regenerated after the tweak done in f3veh_with_f2_eff(.) call. This corrects the issue.
To detect if we have max output or not, we check with pwr_mech_fwd_out_max (NOT pwr_mech_prop_out).
This enables the BEV to pass.
Michael O'Keefe added 7 commits August 8, 2025 09:57
This method does some sanity checking around the values used for the discharge, charge, and regen buffers and their associated speeds.
This helper function checks the fuel economy comparison between fastsim 2 and fastsim 3.
For the simdrive label helper function, we now output the error vs the tolerance limit so it is easy to see what error value we have.
Added code that limits the traction based on friction limitations for the tire/roadway interface.
@michael-okeefe
Copy link
Collaborator

This post documents the current status of comparison between FASTSim 2 and FASTSim 3 over the vehicles used for comparison with the simdrivelabel functionality.

The vehicles used by powertrain are:

Powertrain Vehicle
CONV fastsim-2_2012_Ford_Fusion.yaml
BEV fastsim-2_2022_Renault_Zoe_ZE50_R135.yaml
HEV fastsim-2_2016_TOYOTA_Prius_Two.yaml
PHEV f2-vehicles/2016 CHEVROLET Volt.yaml

Note: values for EPA results are taken from the validation information from the yaml file when available (see val_udds_mpgge and val_hwy_mpgge and val_comb_mpgge and similar). Otherwise, we reference the following links:

City (UDDS)

Powertrain FASTSim 2 FASTSim 3 EPA City
CONV (mpg) 34.383 33.827 22
BEV (kWh/mi) 0.187 0.187 N/A
HEV (mpg) 63.411 71.426 54 - 58
PHEV (mpgge) 354.666 370.064 ??

Highway (HWY)

Powertrain FASTSim 2 FASTSim 3 EPA City
CONV (mpg) 46.984 46.008 32
BEV (kWh/mi) 0.223 0.226 N/A
HEV (mpg) 70.214 72.387 50 - 53
PHEV (mpgge) 273.412 282.759 ??

Combined

Powertrain FASTSim 2 FASTSim 3 EPA City
CONV (mpg) 39.102 38.402 25.6
BEV (kWh/mi) 0.203 0.204 ??
HEV (mpg) 66.302 71.855 52 - 56
PHEV (mpgge) 312.830 324.919 *

* Volt has 106 MPGe (electric) and 42 MPG (reg gas).

Acceleration (0 to 60 mph)

Values are in seconds. The Google Search results are from a query of the form "What is the 0 to 60 mph acceleration time for the {{year}} {{make}} {{model}}?". Sport versions of the vehicle were eliminated from the results.

Powertrain FASTSim 2 FASTSim 3 Google Search
CONV 8.246 8.598 7.3 - 8.9
BEV 7.892 9.252 9.5
HEV 7.817 7.997 9.8
PHEV 7.165 7.963 8.4

Michael O'Keefe added 15 commits August 14, 2025 10:31
The function has been updated so that all results are reported if any of the tests fail to match within tolerance.
Note: all tolerances for tests should be given a second look by the team. This commit just puts things in order should we want to move forward with the current PR as-is.
Updated due to change in default speed_soc_fc_on_buffer and speed_soc_disch_buffer
The speed issue was that we were pulling in
the achieved speed in m/s instead of mph. For
the tolerance, we were comparing f64 values
for direct equality. Now we add a bit of tolerance
in to see that the absolute difference (or the
absolute difference fraction, (a - b)/b) is within
tolerance. We don't expect that individual
tolerances should need to be exposed for this
function because the fastsim 2 and 3 results
should be quite close. We just need to account
for some floating point error.
Checks that the FASTSim 3 simdrive label
checks work for FASTSim 2 vehicle inputs and
that (roughly) the same outputs are calculated.
Since the PHEV requires much more tolerance (0.002 or 0.2%) versus the other powertrains, we pull that out to be explicit in the powertrain tests. This will hopefully signal future developers that there is some remaining (slight) disagreement between FASTSim 2 and FASTSim 3 with regard to label fuel economy calculation.
@robinsteuteville robinsteuteville marked this pull request as ready for review September 4, 2025 19:23
if accel_data.speed_mph.iter().any(|&x| x >= 60.0) {
// Create interpolator from speed to time
let interp: InterpolatorEnumOwned<f64> = {
let wrapped_interp = InterpolatorEnum::new_1d(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michael-okeefe little note here, I don't think there's a need for an InterpolatorEnum here (or any type annotations), a call to Interp1D::new() should be sufficient :)

The enum types are useful when we want the ability to change the underlying data (well, techincally, the dimensionality of the underlying data)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @kylecarow . I'll update it and push the change up.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kylecarow I just updated the PR with a change to simplify this. Thank you for the heads up!

Michael O'Keefe and others added 3 commits September 5, 2025 10:28
Per comment from Kyle, simplify the usage of the Interp1D. Remove type that can be inferred on interp and simplify the constructor to just Interp1D and use the ndarray constructors explicitly.
…sim-3 vehicles, so PHEVs are read in as PlugInHybridElectricVehicle and not HybridElectricVehicle
…y actually should be read into the HybridElectricVehicle struct -- since PHEVs and HEVs share the same underlying fastism-3 structure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants