From 8cd096ead842a1cabecdfb1ed2673924715b0460 Mon Sep 17 00:00:00 2001 From: Chad Baker Date: Mon, 23 Dec 2024 14:21:46 -0700 Subject: [PATCH] battery thermal and cabin are connected doc cleanup --- .../f3-vehicles/2010 Mazda 3 i-Stop.yaml | 1 - cal_and_val/f3-vehicles/2012 Ford Focus.yaml | 1 - cal_and_val/f3-vehicles/2012 Ford Fusion.yaml | 1 - .../f3-vehicles/2016 AUDI A3 4cyl 2WD.yaml | 1 - .../f3-vehicles/2016 BMW 328d 4cyl 2WD.yaml | 1 - .../2016 CHEVROLET Malibu 4cyl 2WD.yaml | 1 - .../f3-vehicles/2016 CHEVROLET Spark EV.yaml | 3 +- .../f3-vehicles/2016 FORD C-MAX HEV.yaml | 3 +- .../2016 FORD Escape 4cyl 2WD.yaml | 1 - .../2016 FORD Explorer 4cyl 2WD.yaml | 1 - .../2016 HYUNDAI Elantra 4cyl 2WD.yaml | 1 - .../2016 Hyundai Tucson Fuel Cell.yaml | 3 +- .../f3-vehicles/2016 KIA Optima Hybrid.yaml | 3 +- cal_and_val/f3-vehicles/2016 Leaf 24 kWh.yaml | 3 +- .../f3-vehicles/2016 MITSUBISHI i-MiEV.yaml | 3 +- .../f3-vehicles/2016 Nissan Leaf 30 kWh.yaml | 3 +- .../f3-vehicles/2016 TESLA Model S60 2WD.yaml | 3 +- .../2016 TOYOTA Camry 4cyl 2WD.yaml | 1 - .../2016 TOYOTA Corolla 4cyl 2WD.yaml | 1 - .../2016 TOYOTA Highlander Hybrid.yaml | 3 +- .../2016 Toyota Prius Two FWD.yaml | 3 +- .../f3-vehicles/2017 CHEVROLET Bolt.yaml | 3 +- .../f3-vehicles/2017 Maruti Dzire VDI.yaml | 1 - .../2017 Toyota Highlander 3.5 L.yaml | 1 - .../2020 Chevrolet Colorado 2WD Diesel.yaml | 1 - .../2020 Hero Splendor+ 100cc.yaml | 1 - .../f3-vehicles/2020 VW Golf 1.5TSI.yaml | 1 - .../f3-vehicles/2020 VW Golf 2.0TDI.yaml | 1 - .../f3-vehicles/2021 BMW iX xDrive40.yaml | 3 +- cal_and_val/f3-vehicles/2021 Cupra Born.yaml | 3 +- .../2021 Fiat Panda Mild Hybrid.yaml | 1 - .../f3-vehicles/2021 Honda N-Box G.yaml | 1 - cal_and_val/f3-vehicles/2021 Peugot 3008.yaml | 1 - .../2022 Ford F-150 Lightning 4WD.yaml | 3 +- .../2022 MINI Cooper SE Hardtop 2 door.yaml | 3 +- .../2022 Renault Megane E-Tech.yaml | 3 +- .../2022 Renault Zoe ZE50 R135.yaml | 3 +- .../f3-vehicles/2022 Tesla Model 3 RWD.yaml | 3 +- .../f3-vehicles/2022 Tesla Model Y RWD.yaml | 3 +- .../2022 Toyota RAV4 Hybrid LE.yaml | 3 +- .../2022 Toyota Yaris Hybrid Mid.yaml | 3 +- .../2022 Volvo XC40 Recharge twin.yaml | 3 +- .../2023 Mitsubishi Pajero Sport.yaml | 1 - ...2023 Polestar 2 Long range Dual motor.yaml | 3 +- .../f3-vehicles/2023 Volvo C40 Recharge.yaml | 3 +- .../f3-vehicles/2024 BYD Dolphin Active.yaml | 3 +- .../f3-vehicles/2024 Toyota Vios 1.5 G.yaml | 1 - .../f3-vehicles/2024 VinFast VF e34.yaml | 3 +- .../2024 Volkswagen Polo 1.0 MPI.yaml | 1 - cal_and_val/f3-vehicles/BYD ATTO 3.yaml | 3 +- cal_and_val/f3-vehicles/Bajaj Boxer 150.yaml | 1 - .../Class 4 Truck (Isuzu NPR HD).yaml | 1 - cal_and_val/f3-vehicles/Line Haul Conv.yaml | 1 - .../f3-vehicles/Maruti Swift 4cyl 2WD.yaml | 1 - cal_and_val/f3-vehicles/Nissan Navara.yaml | 1 - .../Regional Delivery Class 8 Truck.yaml | 1 - .../f3-vehicles/Renault Clio IV diesel.yaml | 1 - .../Renault Megane 1.5 dCi Authentique.yaml | 1 - .../Toyota Corolla Cross Hybrid.yaml | 3 +- .../f3-vehicles/Toyota Etios Liva diesel.yaml | 1 - .../Toyota Hilux Double Cab 4WD.yaml | 1 - cal_and_val/f3-vehicles/Toyota Mirai.yaml | 3 +- .../fastsim-proc-macros/src/fastsim_api.rs | 3 +- .../resources/vehicles/2012_Ford_Fusion.yaml | 1 - .../vehicles/2016_TOYOTA_Prius_Two.yaml | 3 +- .../vehicles/2022_Renault_Zoe_ZE50_R135.yaml | 3 +- fastsim-core/src/drive_cycle.rs | 3 +- fastsim-core/src/gas_properties.rs | 4 +- fastsim-core/src/resources.rs | 1 + fastsim-core/src/simdrive.rs | 4 +- fastsim-core/src/utils/mod.rs | 3 +- fastsim-core/src/vehicle/bev.rs | 34 ++++--- fastsim-core/src/vehicle/cabin.rs | 18 ++-- fastsim-core/src/vehicle/conv.rs | 24 ++--- fastsim-core/src/vehicle/hev.rs | 49 ++++++++--- .../vehicle/hvac/hvac_sys_for_lumped_cabin.rs | 11 ++- .../hvac/hvac_sys_for_lumped_cabin_and_res.rs | 37 ++++---- .../vehicle/powertrain/electric_machine.rs | 57 ++++++------ .../src/vehicle/powertrain/fuel_converter.rs | 31 ++++--- .../vehicle/powertrain/prepare_eff_values.py | 14 +-- .../powertrain/reversible_energy_storage.rs | 88 +++++++++++-------- fastsim-core/src/vehicle/powertrain/traits.rs | 12 +-- .../src/vehicle/powertrain/transmission.rs | 2 +- fastsim-core/src/vehicle/powertrain_type.rs | 59 ++++++++----- fastsim-core/src/vehicle/vehicle_model.rs | 62 +++++++------ .../vehicle_model/fastsim2_interface.rs | 8 +- .../variable_path_list_expected.txt | 1 - 87 files changed, 339 insertions(+), 313 deletions(-) diff --git a/cal_and_val/f3-vehicles/2010 Mazda 3 i-Stop.yaml b/cal_and_val/f3-vehicles/2010 Mazda 3 i-Stop.yaml index af1dbc49..917134a6 100644 --- a/cal_and_val/f3-vehicles/2010 Mazda 3 i-Stop.yaml +++ b/cal_and_val/f3-vehicles/2010 Mazda 3 i-Stop.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.6 mass_kilograms: 1473.9 pwr_aux_base_watts: 700.0 -pwr_aux_max_watts: 1400.0 trans_eff: 0.92 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2012 Ford Focus.yaml b/cal_and_val/f3-vehicles/2012 Ford Focus.yaml index 02d5d035..1578aaef 100644 --- a/cal_and_val/f3-vehicles/2012 Ford Focus.yaml +++ b/cal_and_val/f3-vehicles/2012 Ford Focus.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.6 mass_kilograms: 1473.9 pwr_aux_base_watts: 700.0 -pwr_aux_max_watts: 1400.0 trans_eff: 0.92 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2012 Ford Fusion.yaml b/cal_and_val/f3-vehicles/2012 Ford Fusion.yaml index 40a654be..d0079c53 100644 --- a/cal_and_val/f3-vehicles/2012 Ford Fusion.yaml +++ b/cal_and_val/f3-vehicles/2012 Ford Fusion.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.72 mass_kilograms: 1644.2724500334996 pwr_aux_base_watts: 700.0 -pwr_aux_max_watts: 1400.0 trans_eff: 0.875 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2016 AUDI A3 4cyl 2WD.yaml b/cal_and_val/f3-vehicles/2016 AUDI A3 4cyl 2WD.yaml index 170f3b27..1c214056 100644 --- a/cal_and_val/f3-vehicles/2016 AUDI A3 4cyl 2WD.yaml +++ b/cal_and_val/f3-vehicles/2016 AUDI A3 4cyl 2WD.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.6 mass_kilograms: 1606.0927171041076 pwr_aux_base_watts: 700.0 -pwr_aux_max_watts: 1400.0 trans_eff: 0.92 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2016 BMW 328d 4cyl 2WD.yaml b/cal_and_val/f3-vehicles/2016 BMW 328d 4cyl 2WD.yaml index 39c39bd7..6f9bdf77 100644 --- a/cal_and_val/f3-vehicles/2016 BMW 328d 4cyl 2WD.yaml +++ b/cal_and_val/f3-vehicles/2016 BMW 328d 4cyl 2WD.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.6 mass_kilograms: 1950.3695157008785 pwr_aux_base_watts: 700.0 -pwr_aux_max_watts: 1400.0 trans_eff: 0.92 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2016 CHEVROLET Malibu 4cyl 2WD.yaml b/cal_and_val/f3-vehicles/2016 CHEVROLET Malibu 4cyl 2WD.yaml index b3886f02..b053cfba 100644 --- a/cal_and_val/f3-vehicles/2016 CHEVROLET Malibu 4cyl 2WD.yaml +++ b/cal_and_val/f3-vehicles/2016 CHEVROLET Malibu 4cyl 2WD.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.6 mass_kilograms: 1666.874756172356 pwr_aux_base_watts: 700.0 -pwr_aux_max_watts: 1400.0 trans_eff: 0.92 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2016 CHEVROLET Spark EV.yaml b/cal_and_val/f3-vehicles/2016 CHEVROLET Spark EV.yaml index 2d26cce5..8ecc6d93 100644 --- a/cal_and_val/f3-vehicles/2016 CHEVROLET Spark EV.yaml +++ b/cal_and_val/f3-vehicles/2016 CHEVROLET Spark EV.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 0.98 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.38 mass_kilograms: 1435.996 pwr_aux_base_watts: 250.0 -pwr_aux_max_watts: 500.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2016 FORD C-MAX HEV.yaml b/cal_and_val/f3-vehicles/2016 FORD C-MAX HEV.yaml index f71087c5..af05d2a8 100644 --- a/cal_and_val/f3-vehicles/2016 FORD C-MAX HEV.yaml +++ b/cal_and_val/f3-vehicles/2016 FORD C-MAX HEV.yaml @@ -232,7 +232,7 @@ pt_type: pwr_idle_fuel_watts: 0.0 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -687,7 +687,6 @@ chassis: wheel_base_meters: 2.6 mass_kilograms: 1950.3693212520827 pwr_aux_base_watts: 500.0 -pwr_aux_max_watts: 1000.0 trans_eff: 0.95 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2016 FORD Escape 4cyl 2WD.yaml b/cal_and_val/f3-vehicles/2016 FORD Escape 4cyl 2WD.yaml index 8976566a..92bec2d7 100644 --- a/cal_and_val/f3-vehicles/2016 FORD Escape 4cyl 2WD.yaml +++ b/cal_and_val/f3-vehicles/2016 FORD Escape 4cyl 2WD.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.6 mass_kilograms: 1893.6704171330643 pwr_aux_base_watts: 700.0 -pwr_aux_max_watts: 1400.0 trans_eff: 0.92 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2016 FORD Explorer 4cyl 2WD.yaml b/cal_and_val/f3-vehicles/2016 FORD Explorer 4cyl 2WD.yaml index b2557ad2..6db5ef78 100644 --- a/cal_and_val/f3-vehicles/2016 FORD Explorer 4cyl 2WD.yaml +++ b/cal_and_val/f3-vehicles/2016 FORD Explorer 4cyl 2WD.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.6 mass_kilograms: 2403.9617607817445 pwr_aux_base_watts: 700.0 -pwr_aux_max_watts: 1400.0 trans_eff: 0.92 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2016 HYUNDAI Elantra 4cyl 2WD.yaml b/cal_and_val/f3-vehicles/2016 HYUNDAI Elantra 4cyl 2WD.yaml index bc743160..d0f061cd 100644 --- a/cal_and_val/f3-vehicles/2016 HYUNDAI Elantra 4cyl 2WD.yaml +++ b/cal_and_val/f3-vehicles/2016 HYUNDAI Elantra 4cyl 2WD.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.6 mass_kilograms: 1610.1752055806355 pwr_aux_base_watts: 700.0 -pwr_aux_max_watts: 1400.0 trans_eff: 0.92 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2016 Hyundai Tucson Fuel Cell.yaml b/cal_and_val/f3-vehicles/2016 Hyundai Tucson Fuel Cell.yaml index 374e826a..e78dc366 100644 --- a/cal_and_val/f3-vehicles/2016 Hyundai Tucson Fuel Cell.yaml +++ b/cal_and_val/f3-vehicles/2016 Hyundai Tucson Fuel Cell.yaml @@ -232,7 +232,7 @@ pt_type: pwr_idle_fuel_watts: 0.0 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -687,7 +687,6 @@ chassis: wheel_base_meters: 2.69 mass_kilograms: 2177.165764419529 pwr_aux_base_watts: 280.0 -pwr_aux_max_watts: 560.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2016 KIA Optima Hybrid.yaml b/cal_and_val/f3-vehicles/2016 KIA Optima Hybrid.yaml index 03a3b735..0fb2dc3b 100644 --- a/cal_and_val/f3-vehicles/2016 KIA Optima Hybrid.yaml +++ b/cal_and_val/f3-vehicles/2016 KIA Optima Hybrid.yaml @@ -232,7 +232,7 @@ pt_type: pwr_idle_fuel_watts: 0.0 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -687,7 +687,6 @@ chassis: wheel_base_meters: 2.6 mass_kilograms: 1893.6707541501114 pwr_aux_base_watts: 500.0 -pwr_aux_max_watts: 1000.0 trans_eff: 0.95 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2016 Leaf 24 kWh.yaml b/cal_and_val/f3-vehicles/2016 Leaf 24 kWh.yaml index 49ca6287..60f0b541 100644 --- a/cal_and_val/f3-vehicles/2016 Leaf 24 kWh.yaml +++ b/cal_and_val/f3-vehicles/2016 Leaf 24 kWh.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 0.95 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.6 mass_kilograms: 1612.897 pwr_aux_base_watts: 250.0 -pwr_aux_max_watts: 500.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2016 MITSUBISHI i-MiEV.yaml b/cal_and_val/f3-vehicles/2016 MITSUBISHI i-MiEV.yaml index 78521849..9ba9d0db 100644 --- a/cal_and_val/f3-vehicles/2016 MITSUBISHI i-MiEV.yaml +++ b/cal_and_val/f3-vehicles/2016 MITSUBISHI i-MiEV.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 0.95 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.6 mass_kilograms: 1440.0778 pwr_aux_base_watts: 250.0 -pwr_aux_max_watts: 500.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2016 Nissan Leaf 30 kWh.yaml b/cal_and_val/f3-vehicles/2016 Nissan Leaf 30 kWh.yaml index 5000d23e..ce0c3d2a 100644 --- a/cal_and_val/f3-vehicles/2016 Nissan Leaf 30 kWh.yaml +++ b/cal_and_val/f3-vehicles/2016 Nissan Leaf 30 kWh.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 0.95 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.6 mass_kilograms: 1636.03 pwr_aux_base_watts: 250.0 -pwr_aux_max_watts: 500.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2016 TESLA Model S60 2WD.yaml b/cal_and_val/f3-vehicles/2016 TESLA Model S60 2WD.yaml index 94ba4311..843064ea 100644 --- a/cal_and_val/f3-vehicles/2016 TESLA Model S60 2WD.yaml +++ b/cal_and_val/f3-vehicles/2016 TESLA Model S60 2WD.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 0.9 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.96 mass_kilograms: 2270.152 pwr_aux_base_watts: 250.0 -pwr_aux_max_watts: 500.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2016 TOYOTA Camry 4cyl 2WD.yaml b/cal_and_val/f3-vehicles/2016 TOYOTA Camry 4cyl 2WD.yaml index d97250d0..1b29dfc0 100644 --- a/cal_and_val/f3-vehicles/2016 TOYOTA Camry 4cyl 2WD.yaml +++ b/cal_and_val/f3-vehicles/2016 TOYOTA Camry 4cyl 2WD.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.6 mass_kilograms: 1893.6707212387912 pwr_aux_base_watts: 700.0 -pwr_aux_max_watts: 1400.0 trans_eff: 0.92 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2016 TOYOTA Corolla 4cyl 2WD.yaml b/cal_and_val/f3-vehicles/2016 TOYOTA Corolla 4cyl 2WD.yaml index 2595d397..46914087 100644 --- a/cal_and_val/f3-vehicles/2016 TOYOTA Corolla 4cyl 2WD.yaml +++ b/cal_and_val/f3-vehicles/2016 TOYOTA Corolla 4cyl 2WD.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.6 mass_kilograms: 1553.4758391698351 pwr_aux_base_watts: 700.0 -pwr_aux_max_watts: 1400.0 trans_eff: 0.92 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2016 TOYOTA Highlander Hybrid.yaml b/cal_and_val/f3-vehicles/2016 TOYOTA Highlander Hybrid.yaml index f4d2eefb..c2fb1a58 100644 --- a/cal_and_val/f3-vehicles/2016 TOYOTA Highlander Hybrid.yaml +++ b/cal_and_val/f3-vehicles/2016 TOYOTA Highlander Hybrid.yaml @@ -232,7 +232,7 @@ pt_type: pwr_idle_fuel_watts: 0.0 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -687,7 +687,6 @@ chassis: wheel_base_meters: 2.6 mass_kilograms: 2403.962034901285 pwr_aux_base_watts: 500.0 -pwr_aux_max_watts: 1000.0 trans_eff: 0.95 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2016 Toyota Prius Two FWD.yaml b/cal_and_val/f3-vehicles/2016 Toyota Prius Two FWD.yaml index 9b59a067..41fa70b4 100644 --- a/cal_and_val/f3-vehicles/2016 Toyota Prius Two FWD.yaml +++ b/cal_and_val/f3-vehicles/2016 Toyota Prius Two FWD.yaml @@ -232,7 +232,7 @@ pt_type: pwr_idle_fuel_watts: 0.0 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -687,7 +687,6 @@ chassis: wheel_base_meters: 2.7 mass_kilograms: 1635.0 pwr_aux_base_watts: 1050.0 -pwr_aux_max_watts: 2100.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2017 CHEVROLET Bolt.yaml b/cal_and_val/f3-vehicles/2017 CHEVROLET Bolt.yaml index 33e99057..e94f946d 100644 --- a/cal_and_val/f3-vehicles/2017 CHEVROLET Bolt.yaml +++ b/cal_and_val/f3-vehicles/2017 CHEVROLET Bolt.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 0.98 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.6 mass_kilograms: 1757.77 pwr_aux_base_watts: 250.0 -pwr_aux_max_watts: 500.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2017 Maruti Dzire VDI.yaml b/cal_and_val/f3-vehicles/2017 Maruti Dzire VDI.yaml index 755c66d9..184a0f11 100644 --- a/cal_and_val/f3-vehicles/2017 Maruti Dzire VDI.yaml +++ b/cal_and_val/f3-vehicles/2017 Maruti Dzire VDI.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.45 mass_kilograms: 972.5 pwr_aux_base_watts: 950.0 -pwr_aux_max_watts: 1900.0 trans_eff: 0.95 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2017 Toyota Highlander 3.5 L.yaml b/cal_and_val/f3-vehicles/2017 Toyota Highlander 3.5 L.yaml index 257264de..ef9fffa2 100644 --- a/cal_and_val/f3-vehicles/2017 Toyota Highlander 3.5 L.yaml +++ b/cal_and_val/f3-vehicles/2017 Toyota Highlander 3.5 L.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.72 mass_kilograms: 2270.0 pwr_aux_base_watts: 700.0 -pwr_aux_max_watts: 1400.0 trans_eff: 0.875 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2020 Chevrolet Colorado 2WD Diesel.yaml b/cal_and_val/f3-vehicles/2020 Chevrolet Colorado 2WD Diesel.yaml index 28a51f81..d4f2f881 100644 --- a/cal_and_val/f3-vehicles/2020 Chevrolet Colorado 2WD Diesel.yaml +++ b/cal_and_val/f3-vehicles/2020 Chevrolet Colorado 2WD Diesel.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 3.26 mass_kilograms: 2325.0 pwr_aux_base_watts: 1500.0 -pwr_aux_max_watts: 3000.0 trans_eff: 0.92 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2020 Hero Splendor+ 100cc.yaml b/cal_and_val/f3-vehicles/2020 Hero Splendor+ 100cc.yaml index add626fc..0d12d1bd 100644 --- a/cal_and_val/f3-vehicles/2020 Hero Splendor+ 100cc.yaml +++ b/cal_and_val/f3-vehicles/2020 Hero Splendor+ 100cc.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 1.236 mass_kilograms: 172.0 pwr_aux_base_watts: 0.0 -pwr_aux_max_watts: 0.0 trans_eff: 0.92 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2020 VW Golf 1.5TSI.yaml b/cal_and_val/f3-vehicles/2020 VW Golf 1.5TSI.yaml index ddfc2ef2..ff641ee8 100644 --- a/cal_and_val/f3-vehicles/2020 VW Golf 1.5TSI.yaml +++ b/cal_and_val/f3-vehicles/2020 VW Golf 1.5TSI.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.636 mass_kilograms: 1416.0 pwr_aux_base_watts: 750.0 -pwr_aux_max_watts: 1500.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2020 VW Golf 2.0TDI.yaml b/cal_and_val/f3-vehicles/2020 VW Golf 2.0TDI.yaml index b990cd00..4c1d0b3a 100644 --- a/cal_and_val/f3-vehicles/2020 VW Golf 2.0TDI.yaml +++ b/cal_and_val/f3-vehicles/2020 VW Golf 2.0TDI.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.636 mass_kilograms: 1390.0 pwr_aux_base_watts: 1000.0 -pwr_aux_max_watts: 2000.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2021 BMW iX xDrive40.yaml b/cal_and_val/f3-vehicles/2021 BMW iX xDrive40.yaml index a4420af0..ee13e08d 100644 --- a/cal_and_val/f3-vehicles/2021 BMW iX xDrive40.yaml +++ b/cal_and_val/f3-vehicles/2021 BMW iX xDrive40.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 0.96689295 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 3.0 mass_kilograms: 2600.0 pwr_aux_base_watts: 250.0 -pwr_aux_max_watts: 500.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2021 Cupra Born.yaml b/cal_and_val/f3-vehicles/2021 Cupra Born.yaml index fcd35072..5de332e4 100644 --- a/cal_and_val/f3-vehicles/2021 Cupra Born.yaml +++ b/cal_and_val/f3-vehicles/2021 Cupra Born.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 0.97902439 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.766 mass_kilograms: 1927.0 pwr_aux_base_watts: 250.0 -pwr_aux_max_watts: 500.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2021 Fiat Panda Mild Hybrid.yaml b/cal_and_val/f3-vehicles/2021 Fiat Panda Mild Hybrid.yaml index a2a330d5..0bd05663 100644 --- a/cal_and_val/f3-vehicles/2021 Fiat Panda Mild Hybrid.yaml +++ b/cal_and_val/f3-vehicles/2021 Fiat Panda Mild Hybrid.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.3 mass_kilograms: 1200.0 pwr_aux_base_watts: 500.0 -pwr_aux_max_watts: 1000.0 trans_eff: 0.95 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2021 Honda N-Box G.yaml b/cal_and_val/f3-vehicles/2021 Honda N-Box G.yaml index dcd96e4f..67bcaa7e 100644 --- a/cal_and_val/f3-vehicles/2021 Honda N-Box G.yaml +++ b/cal_and_val/f3-vehicles/2021 Honda N-Box G.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.52 mass_kilograms: 1050.0 pwr_aux_base_watts: 700.0 -pwr_aux_max_watts: 1400.0 trans_eff: 0.95 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2021 Peugot 3008.yaml b/cal_and_val/f3-vehicles/2021 Peugot 3008.yaml index 582a4eff..3804d2b5 100644 --- a/cal_and_val/f3-vehicles/2021 Peugot 3008.yaml +++ b/cal_and_val/f3-vehicles/2021 Peugot 3008.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.3 mass_kilograms: 1700.0 pwr_aux_base_watts: 700.0 -pwr_aux_max_watts: 1400.0 trans_eff: 0.95 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2022 Ford F-150 Lightning 4WD.yaml b/cal_and_val/f3-vehicles/2022 Ford F-150 Lightning 4WD.yaml index cedb4d7e..322ebec4 100644 --- a/cal_and_val/f3-vehicles/2022 Ford F-150 Lightning 4WD.yaml +++ b/cal_and_val/f3-vehicles/2022 Ford F-150 Lightning 4WD.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 0.98 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.6 mass_kilograms: 2728.358 pwr_aux_base_watts: 200.0 -pwr_aux_max_watts: 400.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2022 MINI Cooper SE Hardtop 2 door.yaml b/cal_and_val/f3-vehicles/2022 MINI Cooper SE Hardtop 2 door.yaml index a48288bd..0dc2444f 100644 --- a/cal_and_val/f3-vehicles/2022 MINI Cooper SE Hardtop 2 door.yaml +++ b/cal_and_val/f3-vehicles/2022 MINI Cooper SE Hardtop 2 door.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 1.0 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.495 mass_kilograms: 1587.573 pwr_aux_base_watts: 200.0 -pwr_aux_max_watts: 400.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2022 Renault Megane E-Tech.yaml b/cal_and_val/f3-vehicles/2022 Renault Megane E-Tech.yaml index fc5afed2..6127fc47 100644 --- a/cal_and_val/f3-vehicles/2022 Renault Megane E-Tech.yaml +++ b/cal_and_val/f3-vehicles/2022 Renault Megane E-Tech.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 1.0 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.685 mass_kilograms: 1706.0 pwr_aux_base_watts: 250.0 -pwr_aux_max_watts: 500.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2022 Renault Zoe ZE50 R135.yaml b/cal_and_val/f3-vehicles/2022 Renault Zoe ZE50 R135.yaml index 704702de..3f3fa253 100644 --- a/cal_and_val/f3-vehicles/2022 Renault Zoe ZE50 R135.yaml +++ b/cal_and_val/f3-vehicles/2022 Renault Zoe ZE50 R135.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 0.98 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.588 mass_kilograms: 1600.0 pwr_aux_base_watts: 250.0 -pwr_aux_max_watts: 500.0 trans_eff: 0.92 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2022 Tesla Model 3 RWD.yaml b/cal_and_val/f3-vehicles/2022 Tesla Model 3 RWD.yaml index 2b19763e..675dcde3 100644 --- a/cal_and_val/f3-vehicles/2022 Tesla Model 3 RWD.yaml +++ b/cal_and_val/f3-vehicles/2022 Tesla Model 3 RWD.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 0.98 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.87528 mass_kilograms: 1752.0 pwr_aux_base_watts: 250.0 -pwr_aux_max_watts: 500.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2022 Tesla Model Y RWD.yaml b/cal_and_val/f3-vehicles/2022 Tesla Model Y RWD.yaml index 3413ad1f..9574c908 100644 --- a/cal_and_val/f3-vehicles/2022 Tesla Model Y RWD.yaml +++ b/cal_and_val/f3-vehicles/2022 Tesla Model Y RWD.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 0.98 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.89 mass_kilograms: 1909.0 pwr_aux_base_watts: 200.0 -pwr_aux_max_watts: 400.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2022 Toyota RAV4 Hybrid LE.yaml b/cal_and_val/f3-vehicles/2022 Toyota RAV4 Hybrid LE.yaml index 36c5faa2..81236209 100644 --- a/cal_and_val/f3-vehicles/2022 Toyota RAV4 Hybrid LE.yaml +++ b/cal_and_val/f3-vehicles/2022 Toyota RAV4 Hybrid LE.yaml @@ -232,7 +232,7 @@ pt_type: pwr_idle_fuel_watts: 0.0 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -687,7 +687,6 @@ chassis: wheel_base_meters: 2.68986 mass_kilograms: 1814.369 pwr_aux_base_watts: 500.0 -pwr_aux_max_watts: 1000.0 trans_eff: 0.97 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2022 Toyota Yaris Hybrid Mid.yaml b/cal_and_val/f3-vehicles/2022 Toyota Yaris Hybrid Mid.yaml index d8f13970..42738a5f 100644 --- a/cal_and_val/f3-vehicles/2022 Toyota Yaris Hybrid Mid.yaml +++ b/cal_and_val/f3-vehicles/2022 Toyota Yaris Hybrid Mid.yaml @@ -232,7 +232,7 @@ pt_type: pwr_idle_fuel_watts: 0.0 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -687,7 +687,6 @@ chassis: wheel_base_meters: 2.56 mass_kilograms: 1670.0 pwr_aux_base_watts: 500.0 -pwr_aux_max_watts: 1000.0 trans_eff: 0.97 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2022 Volvo XC40 Recharge twin.yaml b/cal_and_val/f3-vehicles/2022 Volvo XC40 Recharge twin.yaml index cab47ce0..45130b54 100644 --- a/cal_and_val/f3-vehicles/2022 Volvo XC40 Recharge twin.yaml +++ b/cal_and_val/f3-vehicles/2022 Volvo XC40 Recharge twin.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 0.981538462 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.702 mass_kilograms: 2267.962 pwr_aux_base_watts: 250.0 -pwr_aux_max_watts: 500.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2023 Mitsubishi Pajero Sport.yaml b/cal_and_val/f3-vehicles/2023 Mitsubishi Pajero Sport.yaml index d39e0319..9d72c464 100644 --- a/cal_and_val/f3-vehicles/2023 Mitsubishi Pajero Sport.yaml +++ b/cal_and_val/f3-vehicles/2023 Mitsubishi Pajero Sport.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.8 mass_kilograms: 2080.0 pwr_aux_base_watts: 1500.0 -pwr_aux_max_watts: 3000.0 trans_eff: 0.9 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2023 Polestar 2 Long range Dual motor.yaml b/cal_and_val/f3-vehicles/2023 Polestar 2 Long range Dual motor.yaml index 2e670656..1a4519e4 100644 --- a/cal_and_val/f3-vehicles/2023 Polestar 2 Long range Dual motor.yaml +++ b/cal_and_val/f3-vehicles/2023 Polestar 2 Long range Dual motor.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 0.981538462 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.73558 mass_kilograms: 2173.0 pwr_aux_base_watts: 250.0 -pwr_aux_max_watts: 500.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2023 Volvo C40 Recharge.yaml b/cal_and_val/f3-vehicles/2023 Volvo C40 Recharge.yaml index 6e698387..517dec01 100644 --- a/cal_and_val/f3-vehicles/2023 Volvo C40 Recharge.yaml +++ b/cal_and_val/f3-vehicles/2023 Volvo C40 Recharge.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 0.981538462 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.702 mass_kilograms: 2237.0 pwr_aux_base_watts: 250.0 -pwr_aux_max_watts: 500.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2024 BYD Dolphin Active.yaml b/cal_and_val/f3-vehicles/2024 BYD Dolphin Active.yaml index d2fe4f20..505f6dfe 100644 --- a/cal_and_val/f3-vehicles/2024 BYD Dolphin Active.yaml +++ b/cal_and_val/f3-vehicles/2024 BYD Dolphin Active.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 1.0 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.7 mass_kilograms: 1405.0 pwr_aux_base_watts: 200.0 -pwr_aux_max_watts: 400.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2024 Toyota Vios 1.5 G.yaml b/cal_and_val/f3-vehicles/2024 Toyota Vios 1.5 G.yaml index 5d29e3f2..a3350f6d 100644 --- a/cal_and_val/f3-vehicles/2024 Toyota Vios 1.5 G.yaml +++ b/cal_and_val/f3-vehicles/2024 Toyota Vios 1.5 G.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.62 mass_kilograms: 1105.0 pwr_aux_base_watts: 700.0 -pwr_aux_max_watts: 1400.0 trans_eff: 0.95 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2024 VinFast VF e34.yaml b/cal_and_val/f3-vehicles/2024 VinFast VF e34.yaml index 087ee85a..508b9c52 100644 --- a/cal_and_val/f3-vehicles/2024 VinFast VF e34.yaml +++ b/cal_and_val/f3-vehicles/2024 VinFast VF e34.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 1.0 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.6108 mass_kilograms: 1606.0 pwr_aux_base_watts: 250.0 -pwr_aux_max_watts: 500.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/2024 Volkswagen Polo 1.0 MPI.yaml b/cal_and_val/f3-vehicles/2024 Volkswagen Polo 1.0 MPI.yaml index 14d21917..e3ddcaef 100644 --- a/cal_and_val/f3-vehicles/2024 Volkswagen Polo 1.0 MPI.yaml +++ b/cal_and_val/f3-vehicles/2024 Volkswagen Polo 1.0 MPI.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.552 mass_kilograms: 1202.0 pwr_aux_base_watts: 800.0 -pwr_aux_max_watts: 1600.0 trans_eff: 0.95 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/BYD ATTO 3.yaml b/cal_and_val/f3-vehicles/BYD ATTO 3.yaml index dd0f491b..811862ed 100644 --- a/cal_and_val/f3-vehicles/BYD ATTO 3.yaml +++ b/cal_and_val/f3-vehicles/BYD ATTO 3.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 0.98 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.588 mass_kilograms: 1950.0 pwr_aux_base_watts: 250.0 -pwr_aux_max_watts: 500.0 trans_eff: 0.95 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/Bajaj Boxer 150.yaml b/cal_and_val/f3-vehicles/Bajaj Boxer 150.yaml index 918ffe56..2259093a 100644 --- a/cal_and_val/f3-vehicles/Bajaj Boxer 150.yaml +++ b/cal_and_val/f3-vehicles/Bajaj Boxer 150.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 1.236 mass_kilograms: 183.0 pwr_aux_base_watts: 0.0 -pwr_aux_max_watts: 0.0 trans_eff: 0.92 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/Class 4 Truck (Isuzu NPR HD).yaml b/cal_and_val/f3-vehicles/Class 4 Truck (Isuzu NPR HD).yaml index 21edd20e..0d99e27f 100644 --- a/cal_and_val/f3-vehicles/Class 4 Truck (Isuzu NPR HD).yaml +++ b/cal_and_val/f3-vehicles/Class 4 Truck (Isuzu NPR HD).yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 4.08 mass_kilograms: 6590.0 pwr_aux_base_watts: 500.0 -pwr_aux_max_watts: 1000.0 trans_eff: 0.94 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/Line Haul Conv.yaml b/cal_and_val/f3-vehicles/Line Haul Conv.yaml index f7543df9..44448232 100644 --- a/cal_and_val/f3-vehicles/Line Haul Conv.yaml +++ b/cal_and_val/f3-vehicles/Line Haul Conv.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.7536 mass_kilograms: 21000.0 pwr_aux_base_watts: 10000.0 -pwr_aux_max_watts: 20000.0 trans_eff: 0.8 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/Maruti Swift 4cyl 2WD.yaml b/cal_and_val/f3-vehicles/Maruti Swift 4cyl 2WD.yaml index dbfb100e..37bc353c 100644 --- a/cal_and_val/f3-vehicles/Maruti Swift 4cyl 2WD.yaml +++ b/cal_and_val/f3-vehicles/Maruti Swift 4cyl 2WD.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.45 mass_kilograms: 950.0 pwr_aux_base_watts: 500.0 -pwr_aux_max_watts: 1000.0 trans_eff: 0.92 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/Nissan Navara.yaml b/cal_and_val/f3-vehicles/Nissan Navara.yaml index 97d32767..e07f8c97 100644 --- a/cal_and_val/f3-vehicles/Nissan Navara.yaml +++ b/cal_and_val/f3-vehicles/Nissan Navara.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.3 mass_kilograms: 2200.0 pwr_aux_base_watts: 800.0 -pwr_aux_max_watts: 1600.0 trans_eff: 0.95 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/Regional Delivery Class 8 Truck.yaml b/cal_and_val/f3-vehicles/Regional Delivery Class 8 Truck.yaml index 82c2b373..40feab45 100644 --- a/cal_and_val/f3-vehicles/Regional Delivery Class 8 Truck.yaml +++ b/cal_and_val/f3-vehicles/Regional Delivery Class 8 Truck.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.7536 mass_kilograms: 15076.0 pwr_aux_base_watts: 10000.0 -pwr_aux_max_watts: 20000.0 trans_eff: 0.85 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/Renault Clio IV diesel.yaml b/cal_and_val/f3-vehicles/Renault Clio IV diesel.yaml index 0910d4ed..7c1b54f7 100644 --- a/cal_and_val/f3-vehicles/Renault Clio IV diesel.yaml +++ b/cal_and_val/f3-vehicles/Renault Clio IV diesel.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.3 mass_kilograms: 1150.0 pwr_aux_base_watts: 700.0 -pwr_aux_max_watts: 1400.0 trans_eff: 0.95 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/Renault Megane 1.5 dCi Authentique.yaml b/cal_and_val/f3-vehicles/Renault Megane 1.5 dCi Authentique.yaml index 980549ab..e5c7c1f3 100644 --- a/cal_and_val/f3-vehicles/Renault Megane 1.5 dCi Authentique.yaml +++ b/cal_and_val/f3-vehicles/Renault Megane 1.5 dCi Authentique.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.3 mass_kilograms: 1550.0 pwr_aux_base_watts: 800.0 -pwr_aux_max_watts: 1600.0 trans_eff: 0.95 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/Toyota Corolla Cross Hybrid.yaml b/cal_and_val/f3-vehicles/Toyota Corolla Cross Hybrid.yaml index 32f4b30d..d3ef164a 100644 --- a/cal_and_val/f3-vehicles/Toyota Corolla Cross Hybrid.yaml +++ b/cal_and_val/f3-vehicles/Toyota Corolla Cross Hybrid.yaml @@ -232,7 +232,7 @@ pt_type: pwr_idle_fuel_watts: 0.0 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -687,7 +687,6 @@ chassis: wheel_base_meters: 2.56 mass_kilograms: 1750.0 pwr_aux_base_watts: 500.0 -pwr_aux_max_watts: 1000.0 trans_eff: 0.97 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/Toyota Etios Liva diesel.yaml b/cal_and_val/f3-vehicles/Toyota Etios Liva diesel.yaml index 2b3e3b42..e4e5af9f 100644 --- a/cal_and_val/f3-vehicles/Toyota Etios Liva diesel.yaml +++ b/cal_and_val/f3-vehicles/Toyota Etios Liva diesel.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.3 mass_kilograms: 1100.0 pwr_aux_base_watts: 700.0 -pwr_aux_max_watts: 1400.0 trans_eff: 0.95 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/Toyota Hilux Double Cab 4WD.yaml b/cal_and_val/f3-vehicles/Toyota Hilux Double Cab 4WD.yaml index 9131d763..5c52f3f6 100644 --- a/cal_and_val/f3-vehicles/Toyota Hilux Double Cab 4WD.yaml +++ b/cal_and_val/f3-vehicles/Toyota Hilux Double Cab 4WD.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.3 mass_kilograms: 2600.0 pwr_aux_base_watts: 900.0 -pwr_aux_max_watts: 1800.0 trans_eff: 0.95 save_interval: 1 state: diff --git a/cal_and_val/f3-vehicles/Toyota Mirai.yaml b/cal_and_val/f3-vehicles/Toyota Mirai.yaml index 64a307f8..ce79797b 100644 --- a/cal_and_val/f3-vehicles/Toyota Mirai.yaml +++ b/cal_and_val/f3-vehicles/Toyota Mirai.yaml @@ -232,7 +232,7 @@ pt_type: pwr_idle_fuel_watts: 0.0 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -687,7 +687,6 @@ chassis: wheel_base_meters: 2.78 mass_kilograms: 1929.5047475207882 pwr_aux_base_watts: 300.0 -pwr_aux_max_watts: 600.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/fastsim-core/fastsim-proc-macros/src/fastsim_api.rs b/fastsim-core/fastsim-proc-macros/src/fastsim_api.rs index 6c06f41d..0d29e98b 100644 --- a/fastsim-core/fastsim-proc-macros/src/fastsim_api.rs +++ b/fastsim-core/fastsim-proc-macros/src/fastsim_api.rs @@ -283,7 +283,8 @@ fn process_tuple_struct( self.0.len() } /// PyO3-exposed method to check if the vec-containing struct is empty. - fn is_empty(&self) -> bool { + #[pyo3(name = "is_empty")] + fn is_empty_py(&self) -> bool { self.0.is_empty() } } diff --git a/fastsim-core/resources/vehicles/2012_Ford_Fusion.yaml b/fastsim-core/resources/vehicles/2012_Ford_Fusion.yaml index 40a654be..d0079c53 100755 --- a/fastsim-core/resources/vehicles/2012_Ford_Fusion.yaml +++ b/fastsim-core/resources/vehicles/2012_Ford_Fusion.yaml @@ -242,7 +242,6 @@ chassis: wheel_base_meters: 2.72 mass_kilograms: 1644.2724500334996 pwr_aux_base_watts: 700.0 -pwr_aux_max_watts: 1400.0 trans_eff: 0.875 save_interval: 1 state: diff --git a/fastsim-core/resources/vehicles/2016_TOYOTA_Prius_Two.yaml b/fastsim-core/resources/vehicles/2016_TOYOTA_Prius_Two.yaml index 9b59a067..41fa70b4 100755 --- a/fastsim-core/resources/vehicles/2016_TOYOTA_Prius_Two.yaml +++ b/fastsim-core/resources/vehicles/2016_TOYOTA_Prius_Two.yaml @@ -232,7 +232,7 @@ pt_type: pwr_idle_fuel_watts: 0.0 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -687,7 +687,6 @@ chassis: wheel_base_meters: 2.7 mass_kilograms: 1635.0 pwr_aux_base_watts: 1050.0 -pwr_aux_max_watts: 2100.0 trans_eff: 0.98 save_interval: 1 state: diff --git a/fastsim-core/resources/vehicles/2022_Renault_Zoe_ZE50_R135.yaml b/fastsim-core/resources/vehicles/2022_Renault_Zoe_ZE50_R135.yaml index 704702de..3f3fa253 100644 --- a/fastsim-core/resources/vehicles/2022_Renault_Zoe_ZE50_R135.yaml +++ b/fastsim-core/resources/vehicles/2022_Renault_Zoe_ZE50_R135.yaml @@ -14,7 +14,7 @@ pt_type: max_soc: 0.98 save_interval: 1 em: - eff_interp_fwd: + eff_interp_achieved: Interp1D: x: - 0.0 @@ -94,7 +94,6 @@ chassis: wheel_base_meters: 2.588 mass_kilograms: 1600.0 pwr_aux_base_watts: 250.0 -pwr_aux_max_watts: 500.0 trans_eff: 0.92 save_interval: 1 state: diff --git a/fastsim-core/src/drive_cycle.rs b/fastsim-core/src/drive_cycle.rs index 6a39b4b3..10e8e732 100644 --- a/fastsim-core/src/drive_cycle.rs +++ b/fastsim-core/src/drive_cycle.rs @@ -1,5 +1,6 @@ use crate::imports::*; use crate::prelude::*; +#[cfg(feature = "pyo3")] use crate::resources; use fastsim_2::cycle::RustCycle as Cycle2; @@ -74,7 +75,7 @@ lazy_static! { impl Init for Cycle { /// Sets `self.dist` and `self.elev` /// # Assumptions - /// - if `init_elev.is_none()`, then defaults to [ELEV_DEFAULT] + /// - if `init_elev.is_none()`, then defaults to [static@ELEV_DEFAULT] fn init(&mut self) -> anyhow::Result<()> { ensure!(self.time.len() == self.speed.len()); ensure!(self.grade.len() == self.len()); diff --git a/fastsim-core/src/gas_properties.rs b/fastsim-core/src/gas_properties.rs index 3304069b..1a9feeba 100644 --- a/fastsim-core/src/gas_properties.rs +++ b/fastsim-core/src/gas_properties.rs @@ -14,7 +14,7 @@ lazy_static! { } #[fastsim_api( - /// Returns density of air [kg/m^3] + /// Returns density of air \[kg/m^3\] /// Source: /// /// # Equations used @@ -23,7 +23,7 @@ lazy_static! { /// /// # Arguments /// * `te_air_deg_c` - optional ambient temperature [°C] of air, defaults to 22 C - /// * `h_m` - optional elevation [m] above sea level, defaults to 180 m + /// * `h_m` - optional elevation \[m\] above sea level, defaults to 180 m #[staticmethod] #[pyo3(name = "get_density")] pub fn get_density_py(te_air_deg_c: Option, h_m: Option) -> f64 { diff --git a/fastsim-core/src/resources.rs b/fastsim-core/src/resources.rs index 18c53b33..de3ebf73 100755 --- a/fastsim-core/src/resources.rs +++ b/fastsim-core/src/resources.rs @@ -3,6 +3,7 @@ pub const RESOURCES_DIR: Dir = include_dir!("$CARGO_MANIFEST_DIR/resources"); /// List the available resources in the resources directory /// - subdir: &str, a subdirectory to choose from the resources directory +/// /// NOTE: if subdir cannot be resolved, returns an empty list /// RETURNS: a vector of strings for resources that can be loaded pub fn list_resources(subdir: &str) -> Vec { diff --git a/fastsim-core/src/simdrive.rs b/fastsim-core/src/simdrive.rs index b8abd11e..27c17a9f 100644 --- a/fastsim-core/src/simdrive.rs +++ b/fastsim-core/src/simdrive.rs @@ -220,7 +220,7 @@ impl SimDrive { /// # Arguments /// - `speed`: prescribed or achieved speed // - `speed_prev`: previously achieved speed - /// - `dt`: time step size + /// - `dt`: simulation time step size pub fn set_pwr_prop_for_speed( &mut self, speed: si::Velocity, @@ -313,7 +313,7 @@ impl SimDrive { /// Sets achieved speed based on known current max power /// # Arguments /// - `cyc_speed`: prescribed speed - /// - `dt`: time step size + /// - `dt`: simulation time step size /// - `speed_prev`: previously achieved speed pub fn set_ach_speed( &mut self, diff --git a/fastsim-core/src/utils/mod.rs b/fastsim-core/src/utils/mod.rs index 356a1944..bfbe5ecf 100755 --- a/fastsim-core/src/utils/mod.rs +++ b/fastsim-core/src/utils/mod.rs @@ -106,7 +106,8 @@ pub fn abs_checked_x_val(x_val: f64, x_data: &[f64]) -> anyhow::Result { } } -pub(crate) const COMP_EPSILON: f64 = 1e-8; +// public to enable exposure in docs +pub const COMP_EPSILON: f64 = 1e-8; /// Returns true if `val1` and `val2` are within a relative/absolute `epsilon` of each other, /// depending on magnitude. diff --git a/fastsim-core/src/vehicle/bev.rs b/fastsim-core/src/vehicle/bev.rs index b0f2b4e8..db5769c8 100644 --- a/fastsim-core/src/vehicle/bev.rs +++ b/fastsim-core/src/vehicle/bev.rs @@ -139,19 +139,6 @@ impl Powertrain for BatteryElectricVehicle { Ok(()) } - fn solve_thermal( - &mut self, - te_amb: si::Temperature, - _pwr_thrml_fc_to_cab: si::Power, - _veh_state: &mut VehicleState, - dt: si::Time, - ) -> anyhow::Result<()> { - self.res - .solve_thermal(te_amb, dt) - .with_context(|| format_dbg!())?; - Ok(()) - } - fn get_curr_pwr_prop_out_max(&self) -> anyhow::Result<(si::Power, si::Power)> { Ok(( self.em.state.pwr_mech_fwd_out_max, @@ -194,3 +181,24 @@ impl Powertrain for BatteryElectricVehicle { -self.em.state.pwr_mech_prop_out.min(si::Power::ZERO) } } + +impl BatteryElectricVehicle { + /// Solve change in temperature and other thermal effects + /// # Arguments + /// - `te_amb`: ambient temperature + /// - `pwr_thrml_hvac_to_res`: thermal power flowing from [Vehicle::hvac] system to [ReversibleEnergyStorage::thrml] + /// - `te_cab`: cabin temperature for heat transfer interaction with [ReversibleEnergyStorage] + /// - `dt`: simulation time step size + pub fn solve_thermal( + &mut self, + te_amb: si::Temperature, + pwr_thrml_hvac_to_res: si::Power, + te_cab: Option, + dt: si::Time, + ) -> anyhow::Result<()> { + self.res + .solve_thermal(te_amb, pwr_thrml_hvac_to_res, te_cab, dt) + .with_context(|| format_dbg!())?; + Ok(()) + } +} diff --git a/fastsim-core/src/vehicle/cabin.rs b/fastsim-core/src/vehicle/cabin.rs index b9bdc1ce..f83ff083 100644 --- a/fastsim-core/src/vehicle/cabin.rs +++ b/fastsim-core/src/vehicle/cabin.rs @@ -64,15 +64,18 @@ impl LumpedCabin { /// Arguments: /// - `te_amb_air`: ambient air temperature /// - `veh_state`: current [VehicleState] - /// - 'pwr_thermal_from_hvac`: power to cabin from HVAC system + /// - 'pwr_thermal_from_hvac`: power to cabin from [Vehicle::hvac] system /// - `dt`: simulation time step size + /// # Returns + /// - `te_cab`: current cabin temperature, after solving cabin for current + /// simulation time step pub fn solve( &mut self, te_amb_air: si::Temperature, - veh_state: &mut VehicleState, + veh_state: &VehicleState, pwr_thermal_from_hvac: si::Power, dt: si::Time, - ) -> anyhow::Result<()> { + ) -> anyhow::Result { self.state.pwr_thermal_from_hvac = pwr_thermal_from_hvac; // flat plate model for isothermal, mixed-flow from Incropera and deWitt, Fundamentals of Heat and Mass // Transfer, 7th Edition @@ -115,10 +118,11 @@ impl LumpedCabin { }; self.state.temp_prev = self.state.temperature; - self.state.temperature += (self.state.pwr_thermal_from_hvac + self.state.pwr_thermal_from_amb) + self.state.temperature += (self.state.pwr_thermal_from_hvac + + self.state.pwr_thermal_from_amb) / self.heat_capacitance * dt; - Ok(()) + Ok(self.state.temperature) } } @@ -134,10 +138,10 @@ pub struct LumpedCabinState { /// lumped cabin temperature at previous simulation time step // TODO: make sure this gets updated pub temp_prev: si::Temperature, - /// Thermal power coming to cabin from HVAC system. Positive indicates + /// Thermal power coming to cabin from [Vehicle::hvac] system. Positive indicates /// heating, and negative indicates cooling. pub pwr_thermal_from_hvac: si::Power, - /// Cumulative thermal energy coming to cabin from HVAC system. Positive indicates + /// Cumulative thermal energy coming to cabin from [Vehicle::hvac] system. Positive indicates /// heating, and negative indicates cooling. pub energy_thermal_from_hvac: si::Energy, /// Thermal power coming to cabin from ambient air. Positive indicates diff --git a/fastsim-core/src/vehicle/conv.rs b/fastsim-core/src/vehicle/conv.rs index 31f500a4..231e0832 100644 --- a/fastsim-core/src/vehicle/conv.rs +++ b/fastsim-core/src/vehicle/conv.rs @@ -54,17 +54,6 @@ impl Powertrain for Box { Ok(()) } - fn solve_thermal( - &mut self, - te_amb: si::Temperature, - pwr_thrl_fc_to_cab: si::Power, - veh_state: &mut VehicleState, - dt: si::Time, - ) -> anyhow::Result<()> { - self.fc - .solve_thermal(te_amb, pwr_thrl_fc_to_cab, veh_state, dt) - } - fn get_curr_pwr_prop_out_max(&self) -> anyhow::Result<(si::Power, si::Power)> { Ok((self.fc.state.pwr_prop_max, si::Power::ZERO)) } @@ -94,6 +83,19 @@ impl Powertrain for Box { } } +impl ConventionalVehicle { + pub fn solve_thermal( + &mut self, + te_amb: si::Temperature, + pwr_thrml_fc_to_cab: Option, + veh_state: &mut VehicleState, + dt: si::Time, + ) -> anyhow::Result<()> { + self.fc + .solve_thermal(te_amb, pwr_thrml_fc_to_cab, veh_state, dt) + } +} + impl Mass for ConventionalVehicle { fn mass(&self) -> anyhow::Result> { let derived_mass = self diff --git a/fastsim-core/src/vehicle/hev.rs b/fastsim-core/src/vehicle/hev.rs index c2283dc4..8c5a63a9 100644 --- a/fastsim-core/src/vehicle/hev.rs +++ b/fastsim-core/src/vehicle/hev.rs @@ -204,28 +204,46 @@ impl Powertrain for Box { Ok(()) } - fn solve_thermal( + fn pwr_regen(&self) -> si::Power { + // When `pwr_mech_prop_out` is negative, regen is happening. First, clip it at 0, and then negate it. + // see https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=e8f7af5a6e436dd1163fa3c70931d18d + // for example + -self.em.state.pwr_mech_prop_out.min(0. * uc::W) + } +} + +impl HybridElectricVehicle { + /// # Arguments + /// - `te_amb`: ambient temperature + /// - `pwr_thrml_fc_to_cab`: thermal power flow from [FuelConverter::thrml] + /// to [Vehicle::cabin], if cabin is equipped + /// - `veh_state`: current [VehicleState] + /// - `pwr_thrml_hvac_to_res`: thermal power flow from [Vehicle::hvac] -- + /// zero if `None` is passed + /// - `te_cab`: cabin temperature, required if [ReversibleEnergyStorage::thrml] is `Some` + /// - `dt`: simulation time step size + pub fn solve_thermal( &mut self, te_amb: si::Temperature, - pwr_thrl_fc_to_cab: si::Power, + pwr_thrml_fc_to_cab: Option, veh_state: &mut VehicleState, + pwr_thrml_hvac_to_res: Option, + te_cab: Option, dt: si::Time, ) -> anyhow::Result<()> { self.fc - .solve_thermal(te_amb, pwr_thrl_fc_to_cab, veh_state, dt) + .solve_thermal(te_amb, pwr_thrml_fc_to_cab, veh_state, dt) .with_context(|| format_dbg!())?; self.res - .solve_thermal(te_amb, dt) + .solve_thermal( + te_amb, + pwr_thrml_hvac_to_res.unwrap_or_default(), + te_cab, + dt, + ) .with_context(|| format_dbg!())?; Ok(()) } - - fn pwr_regen(&self) -> si::Power { - // When `pwr_mech_prop_out` is negative, regen is happening. First, clip it at 0, and then negate it. - // see https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=e8f7af5a6e436dd1163fa3c70931d18d - // for example - -self.em.state.pwr_mech_prop_out.min(0. * uc::W) - } } impl Mass for HybridElectricVehicle { @@ -326,6 +344,10 @@ impl FCOnCauses { fn push(&mut self, new: FCOnCause) { self.0.push(new) } + + fn is_empty(&self) -> bool { + self.0.is_empty() + } } // TODO: figure out why this is not appearing in the dataframe but is in the pydict @@ -438,8 +460,7 @@ pub enum HEVAuxControls { pub enum HEVPowertrainControls { /// Controls that attempt to match fastsim-2 RGWDB(Box), - /// Controls that have a dynamically updated discharge buffer but are - /// otherwise similar to [Self::Fastsim2] + /// place holder for future variants Placeholder, } @@ -597,7 +618,7 @@ pub struct RESGreedyWithDynamicBuffers { /// Minimum time engine must remain on if it was on during the previous /// simulation time step. pub fc_min_time_on: Option, - /// Speed at which [fuelconverter] is forced on. + /// Speed at which [FuelConverter] is forced on. pub speed_fc_forced_on: Option, /// Fraction of total aux and powertrain rated power at which /// [FuelConverter] is forced on. diff --git a/fastsim-core/src/vehicle/hvac/hvac_sys_for_lumped_cabin.rs b/fastsim-core/src/vehicle/hvac/hvac_sys_for_lumped_cabin.rs index 9d6b537c..eaea554c 100644 --- a/fastsim-core/src/vehicle/hvac/hvac_sys_for_lumped_cabin.rs +++ b/fastsim-core/src/vehicle/hvac/hvac_sys_for_lumped_cabin.rs @@ -41,6 +41,15 @@ pub struct HVACSystemForLumpedCabin { impl Init for HVACSystemForLumpedCabin {} impl SerdeAPI for HVACSystemForLumpedCabin {} impl HVACSystemForLumpedCabin { + /// # Arguments + /// - `te_amb_air`: ambient air temperature + /// - `te_fc`: [FuelConverter] temperature, if equipped + /// - `cab_state`: [LumpedCabinState] + /// - `cab_heat_cap`: cabin heat capacitance + /// - `dt`: simulation time step size + /// # Returns + /// - `pwr_thrml_hvac_to_cabin`: thermal power flow from [Vehicle::hvac] system to cabin + /// - `pwr_thrml_fc_to_cabin`: thermal power flow from [FuelConverter] to cabin via HVAC system pub fn solve( &mut self, te_amb_air: si::Temperature, @@ -242,7 +251,7 @@ pub struct HVACSystemForLumpedCabinState { pub energy_d: si::Energy, /// coefficient of performance (i.e. efficiency) of vapor compression cycle pub cop: si::Ratio, - /// Aux power demand from HVAC system + /// 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, diff --git a/fastsim-core/src/vehicle/hvac/hvac_sys_for_lumped_cabin_and_res.rs b/fastsim-core/src/vehicle/hvac/hvac_sys_for_lumped_cabin_and_res.rs index 016fed55..7db3951c 100644 --- a/fastsim-core/src/vehicle/hvac/hvac_sys_for_lumped_cabin_and_res.rs +++ b/fastsim-core/src/vehicle/hvac/hvac_sys_for_lumped_cabin_and_res.rs @@ -2,7 +2,7 @@ use super::*; #[fastsim_api] #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, HistoryMethods)] -/// HVAC system for [LumpedCabin] and [] +/// HVAC system for [LumpedCabin] and [ReversibleEnergyStorage::thrml] pub struct HVACSystemForLumpedCabinAndRES { /// set point temperature pub te_set: si::Temperature, @@ -61,27 +61,27 @@ impl HVACSystemForLumpedCabinAndRES { /// # Arguments /// - `te_amb_air`: ambient air temperature /// - `te_fc`: [FuelConverter] temperature, if equipped - /// - `cab_state`: [Cabin] state - /// - `cab_heat_cap`: [Cabin] heat capacity - /// - `res_temp`: [ReversibleEnergyStorage] temperature - /// - `res_temp_prev`: [ReversibleEnergyStorage] temperature at previous time step - /// - `dt`: time step size + /// - `cab_state`: [LumpedCabinState] + /// - `cab_heat_cap`: [LumpedCabinState] heat capacity + /// - `res_temp`: [ReversibleEnergyStorage] temperatures at current and previous time step + /// - `dt`: simulation time step size /// /// # Returns - /// - `pwr_thrml_hvac_to_cabin`: thermal power flowing from HVAC system to cabin + /// - `pwr_thrml_hvac_to_cabin`: thermal power flowing from [Vehicle::hvac] system to cabin /// - `pwr_thrml_fc_to_cabin`: thermal power flowing from [FuelConverter] to cabin - /// - `pwr_thrml_hvac_to_res`: thermal power flowing from HVAC system to - /// [ReversibleEnergyStorage] `thrml` system + /// - `pwr_thrml_hvac_to_res`: thermal power flowing from [Vehicle::hvac] system to + /// [ReversibleEnergyStorage] `thrml` system + #[allow(clippy::too_many_arguments)] // the order is reasonably protected by typing pub fn solve( &mut self, te_amb_air: si::Temperature, te_fc: Option, cab_state: LumpedCabinState, cab_heat_cap: si::HeatCapacity, - res_temp: si::Temperature, - res_temp_prev: si::Temperature, + res_temps: (si::Temperature, si::Temperature), dt: si::Time, ) -> anyhow::Result<(si::Power, si::Power, si::Power)> { + let (res_temp, res_temp_prev) = res_temps; let mut pwr_thrml_hvac_to_cabin = self .solve_for_cabin(te_fc, cab_state, cab_heat_cap, dt) .with_context(|| format_dbg!())?; @@ -355,6 +355,7 @@ impl HVACSystemForLumpedCabinAndRES { // If `pwr_i_res` is less than zero reset to switch from cooling to heating self.state.pwr_i_res = si::Power::ZERO; } + #[allow(clippy::let_and_return)] // for readability let pwr_thrml_hvac_to_res = (-self.state.pwr_p_res - self.state.pwr_i_res - self.state.pwr_d_res) .min(self.pwr_thermal_max); @@ -421,21 +422,21 @@ pub struct HVACSystemForLumpedCabinAndRESState { pub pwr_d: si::Power, /// portion of total HVAC cooling/heating (negative/positive) cumulative energy due to derivative gain pub energy_d: si::Energy, - /// portion of total HVAC cooling/heating (negative/positive) power to [ReversibleEnergyStorage] due to proportional gain + /// portion of total HVAC cooling/heating (negative/positive) power to [ReversibleEnergyStorage::thrml] due to proportional gain pub pwr_p_res: si::Power, - /// portion of total HVAC cooling/heating (negative/positive) cumulative energy to [ReversibleEnergyStorage] due to proportional gain + /// portion of total HVAC cooling/heating (negative/positive) cumulative energy to [ReversibleEnergyStorage::thrml] due to proportional gain pub energy_p_res: si::Energy, - /// portion of total HVAC cooling/heating (negative/positive) power to [ReversibleEnergyStorage] due to integral gain + /// portion of total HVAC cooling/heating (negative/positive) power to [ReversibleEnergyStorage::thrml] due to integral gain pub pwr_i_res: si::Power, - /// portion of total HVAC cooling/heating (negative/positive) cumulative energy to [ReversibleEnergyStorage] due to integral gain + /// portion of total HVAC cooling/heating (negative/positive) cumulative energy to [ReversibleEnergyStorage::thrml] due to integral gain pub energy_i_res: si::Energy, - /// portion of total HVAC cooling/heating (negative/positive) power to [ReversibleEnergyStorage] due to derivative gain + /// portion of total HVAC cooling/heating (negative/positive) power to [ReversibleEnergyStorage::thrml] due to derivative gain pub pwr_d_res: si::Power, - /// portion of total HVAC cooling/heating (negative/positive) cumulative energy to [ReversibleEnergyStorage] due to derivative gain + /// portion of total HVAC cooling/heating (negative/positive) cumulative energy to [ReversibleEnergyStorage::thrml] due to derivative gain pub energy_d_res: si::Energy, /// coefficient of performance (i.e. efficiency) of vapor compression cycle pub cop: si::Ratio, - /// Au power demand from HVAC system + /// 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, diff --git a/fastsim-core/src/vehicle/powertrain/electric_machine.rs b/fastsim-core/src/vehicle/powertrain/electric_machine.rs index cb7dc8bf..1c8b24b3 100755 --- a/fastsim-core/src/vehicle/powertrain/electric_machine.rs +++ b/fastsim-core/src/vehicle/powertrain/electric_machine.rs @@ -59,14 +59,16 @@ use crate::pyo3::*; /// electronics. pub struct ElectricMachine { #[api(skip_set, skip_get)] - /// 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 - /// note that the Extrapolate field of this variable is changed in get_pwr_in_req() - pub eff_interp_fwd: Interpolator, + /// Efficiency interpolator corresponding to achieved output power + /// + /// Note that the Extrapolate field of this variable is changed in [Self::get_pwr_in_req] + pub eff_interp_achieved: Interpolator, #[serde(default)] #[api(skip_set, skip_get)] - /// if it is not provided, will be set during init - /// note that the Extrapolate field of this variable is changed in set_cur_pwr_prop_out_max() + /// Efficiency interpolator corresponding to max input power + /// If `None`, will be set during [Self::init]. + /// + /// Note that the Extrapolate field of this variable is changed in [Self::set_curr_pwr_prop_out_max] pub eff_interp_at_max_input: Option, /// Electrical input power fraction array at which efficiencies are evaluated. /// Calculated during runtime if not provided. @@ -108,7 +110,7 @@ impl ElectricMachine { /// component. Zero means no power can be sent to upstream compnents and positive /// values indicate upstream components can absorb energy. /// - `pwr_aux`: aux-related power required from this component - /// - `dt`: time step size + /// - `dt`: simulation time step size pub fn set_curr_pwr_prop_out_max( &mut self, pwr_in_fwd_lim: si::Power, @@ -200,7 +202,7 @@ impl ElectricMachine { /// Solves for this powertrain system/component efficiency and sets/returns power input required. /// # Arguments /// - `pwr_out_req`: propulsion-related power output required - /// - `dt`: time step size + /// - `dt`: simulation time step size pub fn get_pwr_in_req( &mut self, pwr_out_req: si::Power, @@ -242,17 +244,18 @@ impl ElectricMachine { self.state.pwr_out_req = pwr_out_req; // ensuring eff_interp_fwd has Extrapolate set to Error before calculating self.state.eff - self.eff_interp_fwd.set_extrapolate(Extrapolate::Error)?; + self.eff_interp_achieved + .set_extrapolate(Extrapolate::Error)?; self.state.eff = uc::R * self - .eff_interp_fwd + .eff_interp_achieved .interpolate( &[{ let pwr = |pwr_uncorrected: f64| -> anyhow::Result { Ok({ if self - .eff_interp_fwd + .eff_interp_achieved .x()? .first() .with_context(|| anyhow!(format_dbg!()))? @@ -307,7 +310,7 @@ impl SerdeAPI for ElectricMachine {} impl Init for ElectricMachine { fn init(&mut self) -> anyhow::Result<()> { let _ = self.mass().with_context(|| anyhow!(format_dbg!()))?; - let _ = check_interp_frac_data(self.eff_interp_fwd.x()?, InterpRange::Either) + let _ = check_interp_frac_data(self.eff_interp_achieved.x()?, InterpRange::Either) .with_context(|| "Invalid values for `ElectricMachine::pwr_out_frac_interp`; must range from [-1..1] or [0..1].")?; self.state.init().with_context(|| anyhow!(format_dbg!()))?; @@ -321,18 +324,18 @@ impl Init for ElectricMachine { // sets eff_interp_bwd to eff_interp_fwd, but changes the x-value. // TODO: what should the default strategy be for eff_interp_bwd? let eff_interp_at_max_input = Interp1D::new( - self.eff_interp_fwd + self.eff_interp_achieved .x()? .iter() - .zip(self.eff_interp_fwd.f_x()?) + .zip(self.eff_interp_achieved.f_x()?) .map(|(x, y)| x / y) .collect(), - self.eff_interp_fwd.f_x()?.to_owned(), + self.eff_interp_achieved.f_x()?.to_owned(), // TODO: should these be set to be the same as eff_interp_fwd, // as currently is done, or should they be set to be specific // Extrapolate and Strategy types? - self.eff_interp_fwd.strategy()?.to_owned(), - self.eff_interp_fwd.extrapolate()?.to_owned(), + self.eff_interp_achieved.strategy()?.to_owned(), + self.eff_interp_achieved.extrapolate()?.to_owned(), )?; self.eff_interp_at_max_input = Some(Interpolator::Interp1D(eff_interp_at_max_input)); } @@ -414,7 +417,7 @@ impl ElectricMachine { pub fn get_eff_max_fwd(&self) -> anyhow::Result { // since efficiency is all f64 between 0 and 1, NEG_INFINITY is safe Ok(self - .eff_interp_fwd + .eff_interp_achieved .f_x()? .iter() .fold(f64::NEG_INFINITY, |acc, curr| acc.max(*curr))) @@ -437,8 +440,8 @@ impl ElectricMachine { if (0.0..=1.0).contains(&eff_max) { let old_max_fwd = self.get_eff_max_fwd()?; let old_max_bwd = self.get_eff_max_bwd()?; - let f_x_fwd = self.eff_interp_fwd.f_x()?.to_owned(); - match &mut self.eff_interp_fwd { + let f_x_fwd = self.eff_interp_achieved.f_x()?.to_owned(); + match &mut self.eff_interp_achieved { Interpolator::Interp1D(interp1d) => { interp1d .set_f_x(f_x_fwd.iter().map(|x| x * eff_max / old_max_fwd).collect())?; @@ -478,7 +481,7 @@ impl ElectricMachine { pub fn get_eff_min_fwd(&self) -> anyhow::Result { // since efficiency is all f64 between 0 and 1, NEG_INFINITY is safe Ok(self - .eff_interp_fwd + .eff_interp_achieved .f_x() .with_context(|| "eff_interp_fwd does not have f_x field")? .iter() @@ -517,12 +520,12 @@ impl ElectricMachine { if eff_range == 0.0 { let f_x_fwd = vec![ eff_max_fwd; - self.eff_interp_fwd + self.eff_interp_achieved .f_x() .with_context(|| "eff_interp_fwd does not have f_x field")? .len() ]; - self.eff_interp_fwd.set_f_x(f_x_fwd)?; + self.eff_interp_achieved.set_f_x(f_x_fwd)?; let f_x_bwd = vec![ eff_max_bwd; match &self.eff_interp_at_max_input { @@ -548,8 +551,8 @@ impl ElectricMachine { "`eff_range` is already zero so it cannot be modified." )); } - let f_x_fwd = self.eff_interp_fwd.f_x()?.to_owned(); - match &mut self.eff_interp_fwd { + let f_x_fwd = self.eff_interp_achieved.f_x()?.to_owned(); + match &mut self.eff_interp_achieved { Interpolator::Interp1D(interp1d) => { interp1d.set_f_x( f_x_fwd @@ -562,8 +565,8 @@ impl ElectricMachine { } if self.get_eff_min_fwd()? < 0.0 { let x_neg = self.get_eff_min_fwd()?; - let f_x_fwd = self.eff_interp_fwd.f_x()?.to_owned(); - match &mut self.eff_interp_fwd { + let f_x_fwd = self.eff_interp_achieved.f_x()?.to_owned(); + match &mut self.eff_interp_achieved { Interpolator::Interp1D(interp1d) => { interp1d.set_f_x(f_x_fwd.iter().map(|x| x - x_neg).collect())?; } diff --git a/fastsim-core/src/vehicle/powertrain/fuel_converter.rs b/fastsim-core/src/vehicle/powertrain/fuel_converter.rs index 0ae34112..ef875670 100755 --- a/fastsim-core/src/vehicle/powertrain/fuel_converter.rs +++ b/fastsim-core/src/vehicle/powertrain/fuel_converter.rs @@ -204,7 +204,7 @@ impl FuelConverter { /// Sets maximum possible total power [FuelConverter] /// can produce. /// # Arguments - /// - `dt`: time step size + /// - `dt`: simulation time step size pub fn set_curr_pwr_out_max(&mut self, dt: si::Time) -> anyhow::Result<()> { if self.pwr_out_max_init == si::Power::ZERO { // TODO: think about how to initialize power @@ -238,7 +238,7 @@ impl FuelConverter { /// # Arguments /// - `pwr_out_req`: tractive power output required to achieve presribed speed /// - `fc_on`: whether component is actively running - /// - `dt`: time step size + /// - `dt`: simulation time step size pub fn solve( &mut self, pwr_out_req: si::Power, @@ -321,13 +321,13 @@ impl FuelConverter { pub fn solve_thermal( &mut self, te_amb: si::Temperature, - pwr_thrl_fc_to_cab: si::Power, + pwr_thrml_fc_to_cab: Option, veh_state: &mut VehicleState, dt: si::Time, ) -> anyhow::Result<()> { let veh_speed = veh_state.speed_ach; self.thrml - .solve(&self.state, te_amb, pwr_thrl_fc_to_cab, veh_speed, dt) + .solve(&self.state, te_amb, pwr_thrml_fc_to_cab, veh_speed, dt) .with_context(|| format_dbg!()) } @@ -419,28 +419,33 @@ impl FuelConverterThermalOption { /// # Arguments /// - `fc_state`: [FuelConverter] state /// - `te_amb`: ambient temperature - /// - `pwr_thrl_fc_to_cab`: heat demand from HVAC system + /// - `pwr_thrml_fc_to_cab`: heat demand from [Vehicle::hvac] system -- zero if `None` is passed /// - `veh_speed`: current achieved speed fn solve( &mut self, fc_state: &FuelConverterState, te_amb: si::Temperature, - pwr_thrl_fc_to_cab: si::Power, + pwr_thrml_fc_to_cab: Option, veh_speed: si::Velocity, dt: si::Time, ) -> anyhow::Result<()> { match self { Self::FuelConverterThermal(fct) => fct - .solve(fc_state, te_amb, pwr_thrl_fc_to_cab, veh_speed, dt) + .solve( + fc_state, + te_amb, + pwr_thrml_fc_to_cab.unwrap_or_default(), + veh_speed, + dt, + ) .with_context(|| format_dbg!())?, Self::None => { ensure!( - pwr_thrl_fc_to_cab == si::Power::ZERO, + pwr_thrml_fc_to_cab.is_none(), format_dbg!( "`FuelConverterThermal needs to be configured to provide heat demand`" ) ); - // TODO: make sure this triggers error if appropriate } } Ok(()) @@ -536,14 +541,14 @@ impl FuelConverterThermal { /// # Arguments /// - `fc_state`: [FuelConverter] state /// - `te_amb`: ambient temperature - /// - `pwr_thrl_fc_to_cab`: heat demand from HVAC system + /// - `pwr_thrml_fc_to_cab`: heat demand from [Vehicle::hvac] system /// - `veh_speed`: current achieved speed /// - `dt`: simulation time step size fn solve( &mut self, fc_state: &FuelConverterState, te_amb: si::Temperature, - pwr_thrl_fc_to_cab: si::Power, + pwr_thrml_fc_to_cab: si::Power, veh_speed: si::Velocity, dt: si::Time, ) -> anyhow::Result<()> { @@ -605,7 +610,7 @@ impl FuelConverterThermal { let delta_temp: si::Temperature = (((self.htc_from_comb * (self.state.te_adiabatic - self.state.temperature)) .min(self.max_frac_from_comb * heat_gen) - - pwr_thrl_fc_to_cab + - pwr_thrml_fc_to_cab - self.state.heat_to_amb) * dt) / self.heat_capacitance; @@ -711,7 +716,7 @@ impl Default for FCTempEffModel { #[derive(Debug, Clone, Deserialize, Serialize, PartialEq)] pub struct FCTempEffModelLinear { pub offset: si::Ratio, - /// Change in efficiency factor per change in temperature [K] + /// Change in efficiency factor per change in temperature /[K/] pub slope_per_kelvin: f64, pub minimum: si::Ratio, } diff --git a/fastsim-core/src/vehicle/powertrain/prepare_eff_values.py b/fastsim-core/src/vehicle/powertrain/prepare_eff_values.py index a7cff7c4..22b4830e 100644 --- a/fastsim-core/src/vehicle/powertrain/prepare_eff_values.py +++ b/fastsim-core/src/vehicle/powertrain/prepare_eff_values.py @@ -1,12 +1,12 @@ """ -Python file demonstrating how to take altrios formatted efficiency arrays and +Python file demonstrating how to take ALTRIOS formatted efficiency arrays and turn them into arrays that can be accepted into FASTSim-3 Interpolator with x being power, y being SOC, and z being temperature. """ import numpy as np -# efficiency array as a function of power and SOC at constant 23 degrees C, +# efficiency array as a function of power and SOC at constant 23 °C, # corresponds to eta_interp_values[0] in Altrios arr_2d = np.array([ [ @@ -154,8 +154,8 @@ ], ]) -# transposing the altrios array so that the outermost layer is now power, and -# the innermost layer SOC (in altrios, the outermost layer is SOC and innermost +# transposing the ALTRIOS array so that the outermost layer is now power, and +# the innermost layer SOC (in ALTRIOS, the outermost layer is SOC and innermost # is power), as required in order to use this array in a FASTSim-3 interpolator, # with x being power. arr_2d_transposed can now be used in FASTSim-3. arr_2d_transposed = np.transpose(arr_2d, (1,0)) @@ -449,9 +449,9 @@ ], ] -# transposing the altrios array so that the outermost layer is now power, and -# the innermost layer temperature (in altrios, the outermost layer is +# transposing the ALTRIOS array so that the outermost layer is now power, and +# the innermost layer temperature (in ALTRIOS, the outermost layer is # temperature and innermost is power), as required in order to use this array in # a FASTSim-3 interpolator, with x being power. arr_2d_transposed can now be # used in FASTSim-3. -arr_3d_transposed = np.transpose(arr_3d, (2,1,0)) \ No newline at end of file +arr_3d_transposed = np.transpose(arr_3d, (2,1,0)) diff --git a/fastsim-core/src/vehicle/powertrain/reversible_energy_storage.rs b/fastsim-core/src/vehicle/powertrain/reversible_energy_storage.rs index 613ac8b8..f746936d 100644 --- a/fastsim-core/src/vehicle/powertrain/reversible_energy_storage.rs +++ b/fastsim-core/src/vehicle/powertrain/reversible_energy_storage.rs @@ -253,14 +253,15 @@ impl ReversibleEnergyStorage { /// # Arguments /// - `fc_state`: [ReversibleEnergyStorage] state /// - `te_amb`: ambient temperature - /// - `pwr_thrml_hvac_to_res`: thermal power flowing from HVAC system to [ReversibleEnergyStorage] - /// - `te_cab`: cabin temperature for heat transfer interaction with [ReversiblEnergyStorage] - /// - `dt`: time step size + /// - `pwr_thrml_hvac_to_res`: thermal power flowing from [Vehicle::hvac] system to [Self::thrml] + /// - `te_cab`: cabin temperature for heat transfer interaction with + /// [Self], required if [Self::thrml] is `Some` + /// - `dt`: simulation time step size pub fn solve_thermal( &mut self, te_amb: si::Temperature, pwr_thrml_hvac_to_res: si::Power, - te_cab: si::Temperature, + te_cab: Option, dt: si::Time, ) -> anyhow::Result<()> { self.thrml @@ -270,7 +271,7 @@ impl ReversibleEnergyStorage { /// Sets and returns max output and max regen power based on current state /// # Arguments - /// - `dt`: time step size + /// - `dt`: simulation time step size /// - `disch_buffer`: buffer offset from static SOC limit at which discharging is not allowed /// - `chrg_buffer`: buffer offset from static SOC limit at which charging is not allowed pub fn set_curr_pwr_out_max( @@ -286,7 +287,7 @@ impl ReversibleEnergyStorage { } /// # Arguments - /// - `dt`: time step size + /// - `dt`: simulation time step size /// - `buffer`: buffer below static maximum SOC above which charging is disabled pub fn set_pwr_charge_max( &mut self, @@ -324,7 +325,7 @@ impl ReversibleEnergyStorage { } /// # Arguments - /// - `dt`: time step size + /// - `dt`: simulation time step size /// - `buffer`: buffer above static minimum SOC above which charging is disabled pub fn set_pwr_disch_max( &mut self, @@ -450,11 +451,11 @@ impl ReversibleEnergyStorage { /// Sets the ReversibleEnergyStorage eff_interp Interpolator to be a 1D /// interpolator with the default x and f_x arrays - /// Source of default efficiency values: - /// x: values in the third sub-array (corresponding to power) in Altrios' - /// eta_interp_grid - /// f_x: efficiency array as a function of power at constant 50% SOC and 23 - /// degrees C corresponds to eta_interp_values[0][5] in Altrios + /// # Source of default efficiency values + /// - `x`: values in the third sub-array (corresponding to power) in ALTRIOS's + /// eta_interp_grid + /// - `f_x`: efficiency array as a function of power at constant 50% SOC and 23 + /// °C corresponds to `eta_interp_values[0][5]` in ALTRIOS #[cfg(all(feature = "yaml", feature = "resources"))] pub fn set_default_1d_interp(&mut self) -> anyhow::Result<()> { self.eff_interp = ninterp::Interpolator::from_resource("res/default_1d.yaml", false)?; @@ -462,16 +463,16 @@ impl ReversibleEnergyStorage { } /// Sets the ReversibleEnergyStorage eff_interp Interpolator to be a 2D - /// interpolator with the default x, y and f_xy arrays - /// Source of default efficiency values: - /// x: values in the third sub-array (corresponding to power) in Altrios' - /// eta_interp_grid - /// y: values in the second sub-array (corresponding to SOC) in - /// Altrios' eta_interp_grid - /// f_xy: efficiency array as a function of power and SOC at constant 23 - /// degrees C corresponds to eta_interp_values[0] in Altrios, transposed so - /// that the outermost layer is now power, and the innermost layer SOC (in - /// altrios, the outermost layer is SOC and innermost is power) + /// interpolator with the default x, y, and f_xy arrays + /// # Source of default efficiency values + /// - `x`: values in the third sub-array (corresponding to power) in ALTRIOS's + /// eta_interp_grid + /// - `y`: values in the second sub-array (corresponding to SOC) in + /// ALTRIOS's eta_interp_grid + /// - `f_xy`: efficiency array as a function of power and SOC at constant 23 + /// °C corresponds to `eta_interp_values[0]` in ALTRIOS, transposed so + /// that the outermost layer is now power and the innermost layer SOC (in + /// ALTRIOS, the outermost layer is SOC and innermost is power) #[cfg(all(feature = "yaml", feature = "resources"))] pub fn set_default_2d_interp(&mut self) -> anyhow::Result<()> { self.eff_interp = ninterp::Interpolator::from_resource("res/default_2d.yaml", false)?; @@ -479,18 +480,18 @@ impl ReversibleEnergyStorage { } /// Sets the ReversibleEnergyStorage eff_interp Interpolator to be a 3D - /// interpolator with the default x, y, z and f_xyz arrays - /// Source of default efficiency values: - /// x: values in the third sub-array (corresponding to power) in Altrios' - /// eta_interp_grid - /// y: values in the second sub-array (corresponding to SOC) in Altrios' - /// eta_interp_grid - /// z: values in the first sub-array (corresponding to temperature) in - /// Altrios' eta_interp_grid - /// f_xyz: efficiency array as a function of power, SOC, and temperature - /// corresponds to eta_interp_values in Altrios, transposed so that the - /// outermost layer is now power, and the innermost layer temperature (in - /// altrios, the outermost layer is temperature and innermost is power) + /// interpolator with the default x, y, z, and f_xyz arrays + /// # Source of default efficiency values + /// - `x`: values in the third sub-array (corresponding to power) in ALTRIOS's + /// eta_interp_grid + /// - `y`: values in the second sub-array (corresponding to SOC) in ALTRIOS's + /// eta_interp_grid + /// - `z`: values in the first sub-array (corresponding to temperature) in + /// ALTRIOS's eta_interp_grid + /// - `f_xyz`: efficiency array as a function of power, SOC, and temperature + /// corresponds to eta_interp_values in ALTRIOS, transposed so that the + /// outermost layer is now power, and the innermost layer temperature (in + /// ALTRIOS, the outermost layer is temperature and innermost is power) #[cfg(all(feature = "yaml", feature = "resources"))] pub fn set_default_3d_interp(&mut self) -> anyhow::Result<()> { self.eff_interp = ninterp::Interpolator::from_resource("res/default_3d.yaml", false)?; @@ -723,19 +724,30 @@ impl RESThermalOption { /// # Arguments /// - `res_state`: [ReversibleEnergyStorage] state /// - `te_amb`: ambient temperature - /// - `pwr_thrml_hvac_to_res`: thermal power flowing from HVAC system to [ReversibleEnergyStorage] - /// - `dt`: time step size + /// - `pwr_thrml_hvac_to_res`: thermal power flowing from [Vehicle::hvac] + /// system to [Self], required if [Self::is_none] is false + /// - `dt`: simulation time step size fn solve( &mut self, res_state: ReversibleEnergyStorageState, te_amb: si::Temperature, pwr_thrml_hvac_to_res: si::Power, - te_cab: si::Temperature, + te_cab: Option, dt: si::Time, ) -> anyhow::Result<()> { match self { Self::RESLumpedThermal(rest) => rest - .solve(res_state, te_amb, pwr_thrml_hvac_to_res, te_cab, dt) + .solve( + res_state, + te_amb, + pwr_thrml_hvac_to_res, + te_cab.with_context(|| { + format_dbg!( + "`te_cab` must be `Some` for [RESThermalOption::RESLumpedThermal]" + ) + })?, + dt, + ) .with_context(|| format_dbg!())?, Self::None => { // TODO: make sure this triggers error if appropriate diff --git a/fastsim-core/src/vehicle/powertrain/traits.rs b/fastsim-core/src/vehicle/powertrain/traits.rs index 93a845a7..fda73dc5 100644 --- a/fastsim-core/src/vehicle/powertrain/traits.rs +++ b/fastsim-core/src/vehicle/powertrain/traits.rs @@ -9,7 +9,7 @@ pub trait Powertrain { /// required. /// # Arguments /// - `pwr_aux`: aux-related power required from this component - /// - `dt`: time step size + /// - `dt`: simulation time step size fn set_curr_pwr_prop_out_max( &mut self, pwr_aux: si::Power, @@ -26,7 +26,7 @@ pub trait Powertrain { /// - `pwr_out_req`: propulsion-related power output required /// - `veh_state`: state of vehicle /// - `enabled`: whether the component is active in current time step (e.g. engine idling v. shut off) - /// - `dt`: time step size + /// - `dt`: simulation time step size fn solve( &mut self, pwr_out_req: si::Power, @@ -35,14 +35,6 @@ pub trait Powertrain { dt: si::Time, ) -> anyhow::Result<()>; - fn solve_thermal( - &mut self, - te_amb: si::Temperature, - pwr_thrl_fc_to_cab: si::Power, - veh_state: &mut VehicleState, - dt: si::Time, - ) -> anyhow::Result<()>; - /// Returns regen power after `Powertrain::solve` has been called fn pwr_regen(&self) -> si::Power; } diff --git a/fastsim-core/src/vehicle/powertrain/transmission.rs b/fastsim-core/src/vehicle/powertrain/transmission.rs index 876f4446..8a816944 100644 --- a/fastsim-core/src/vehicle/powertrain/transmission.rs +++ b/fastsim-core/src/vehicle/powertrain/transmission.rs @@ -94,7 +94,7 @@ pub struct TransmissionState { pub pwr_out: si::Power, pub pwr_in: si::Power, - /// Power loss: [`pwr_in`] - [`pwr_out`] + /// Power loss: [Self::pwr_in] - [Self::pwr_out] pub pwr_loss: si::Power, pub energy_out: si::Energy, diff --git a/fastsim-core/src/vehicle/powertrain_type.rs b/fastsim-core/src/vehicle/powertrain_type.rs index 3e1c39e6..403683db 100644 --- a/fastsim-core/src/vehicle/powertrain_type.rs +++ b/fastsim-core/src/vehicle/powertrain_type.rs @@ -47,26 +47,6 @@ impl Powertrain for PowertrainType { } } - fn solve_thermal( - &mut self, - te_amb: si::Temperature, - pwr_thrl_fc_to_cab: si::Power, - veh_state: &mut VehicleState, - dt: si::Time, - ) -> anyhow::Result<()> { - match self { - Self::ConventionalVehicle(v) => { - v.solve_thermal(te_amb, pwr_thrl_fc_to_cab, veh_state, dt) - } - Self::HybridElectricVehicle(v) => { - v.solve_thermal(te_amb, pwr_thrl_fc_to_cab, veh_state, dt) - } - Self::BatteryElectricVehicle(v) => { - v.solve_thermal(te_amb, si::Power::ZERO, veh_state, dt) - } - } - } - fn get_curr_pwr_prop_out_max(&self) -> anyhow::Result<(si::Power, si::Power)> { match self { Self::ConventionalVehicle(v) => v.get_curr_pwr_prop_out_max(), @@ -102,6 +82,45 @@ impl SaveInterval for PowertrainType { } impl PowertrainType { + /// # Arguments: + /// - `te_amb`: ambient temperature + /// - `pwr_thrml_fc_to_cab`: thermal power flow from [FuelConverter::thrml] to [Vehicle::cabin], if both are equipped + /// - `veh_state`: current state of vehicle + /// - `pwr_thrml_hvac_to_res`: thermal power flow from [Vehicle::hvac] + /// system, if equipped, to [ReversibleEnergyStorage::thrml] -- zero if `None` is + /// passed + /// - `te_cab`: [Vehicle::cabin] temperature, if equipped + /// - `dt`: simulation time step size + pub fn solve_thermal( + &mut self, + te_amb: si::Temperature, + pwr_thrml_fc_to_cab: Option, + veh_state: &mut VehicleState, + pwr_thrml_hvac_to_res: Option, + te_cab: Option, + dt: si::Time, + ) -> anyhow::Result<()> { + match self { + Self::ConventionalVehicle(v) => { + v.solve_thermal(te_amb, pwr_thrml_fc_to_cab, veh_state, dt) + } + Self::HybridElectricVehicle(v) => v.solve_thermal( + te_amb, + pwr_thrml_fc_to_cab, + veh_state, + pwr_thrml_hvac_to_res, + te_cab, + dt, + ), + Self::BatteryElectricVehicle(v) => v.solve_thermal( + te_amb, + pwr_thrml_hvac_to_res.unwrap_or_default(), + te_cab, + dt, + ), + } + } + pub fn conv_mut(&mut self) -> Option<&mut ConventionalVehicle> { match self { Self::ConventionalVehicle(conv) => Some(conv), diff --git a/fastsim-core/src/vehicle/vehicle_model.rs b/fastsim-core/src/vehicle/vehicle_model.rs index 5c5c96fd..86e4c741 100644 --- a/fastsim-core/src/vehicle/vehicle_model.rs +++ b/fastsim-core/src/vehicle/vehicle_model.rs @@ -443,48 +443,53 @@ impl Vehicle { dt: si::Time, ) -> anyhow::Result<()> { let te_fc: Option = self.fc().and_then(|fc| fc.temperature()); - let veh_state = &mut self.state; - let pwr_thrml_fc_to_cabin = match (&mut self.cabin, &mut self.hvac) { + let res_temp = self.res().and_then(|res| res.temperature()); + let res_temp_prev = self.res().and_then(|res| res.temp_prev()); + let (pwr_thrml_fc_to_cabin, pwr_thrml_hvac_to_res, te_cab): ( + Option, + Option, + Option, + ) = match (&mut self.cabin, &mut self.hvac) { (CabinOption::None, HVACOption::None) => { - veh_state.pwr_aux = self.pwr_aux_base; - si::Power::ZERO + self.state.pwr_aux = self.pwr_aux_base; + (None, None, None) } (CabinOption::LumpedCabin(cab), HVACOption::LumpedCabin(hvac)) => { let (pwr_thrml_hvac_to_cabin, pwr_thrml_fc_to_cab) = hvac .solve(te_amb_air, te_fc, cab.state, cab.heat_capacitance, dt) .with_context(|| format_dbg!())?; - cab.solve(te_amb_air, veh_state, pwr_thrml_hvac_to_cabin, dt) + let te_cab = cab + .solve(te_amb_air, &self.state, pwr_thrml_hvac_to_cabin, dt) .with_context(|| format_dbg!())?; - veh_state.pwr_aux = self.pwr_aux_base + hvac.state.pwr_aux_for_hvac; - pwr_thrml_fc_to_cab + self.state.pwr_aux = self.pwr_aux_base + hvac.state.pwr_aux_for_hvac; + (Some(pwr_thrml_fc_to_cab), None, Some(te_cab)) } (CabinOption::LumpedCabin(cab), HVACOption::LumpedCabinAndRES(hvac)) => { - let res = self.res_mut().with_context(|| format_dbg!("`HVACOption::LumpedCabinAndRES(...)` requires powertrain with `ReversibleEnergyStorage`"))?; let (pwr_thrml_hvac_to_cabin, pwr_thrml_fc_to_cab, pwr_thrml_hvac_to_res) = hvac .solve( te_amb_air, te_fc, cab.state, cab.heat_capacitance, - res.temperature().with_context(|| { - format_dbg!( - "`ReversibleEnergyStorage` must be configured with thermal model." - ) - })?, - res.temp_prev().with_context(|| { - format_dbg!( - "`ReversibleEnergyStorage` must be configured with thermal model." - ) - })?, + ( + res_temp + .with_context( + || "{}\n[HVACOption::LumpedCabinAndRES] requires [ReversibleEnergyStorage::thrml] to be `Some`" + )?, + res_temp_prev.unwrap() + ), dt, ) .with_context(|| format_dbg!())?; - cab.solve(te_amb_air, veh_state, pwr_thrml_hvac_to_cabin, dt) + let te_cab = cab + .solve(te_amb_air, &self.state, pwr_thrml_hvac_to_cabin, dt) .with_context(|| format_dbg!())?; - res.solve_thermal(te_amb_air, pwr_thrml_hvac_to_res, cab.state.temperature, dt) - .with_context(|| format_dbg!())?; - veh_state.pwr_aux = self.pwr_aux_base + hvac.state.pwr_aux_for_hvac; - pwr_thrml_fc_to_cab + self.state.pwr_aux = self.pwr_aux_base + hvac.state.pwr_aux_for_hvac; + ( + Some(pwr_thrml_fc_to_cab), + Some(pwr_thrml_hvac_to_res), + Some(te_cab), + ) } (CabinOption::LumpedCabinWithShell, HVACOption::LumpedCabinWithShell) => { bail!("{}\nNot yet implemented.", format_dbg!()) @@ -510,7 +515,14 @@ impl Vehicle { }; self.pt_type - .solve_thermal(te_amb_air, pwr_thrml_fc_to_cabin, veh_state, dt) + .solve_thermal( + te_amb_air, + pwr_thrml_fc_to_cabin, + &mut self.state, + pwr_thrml_hvac_to_res, + te_cab, + dt, + ) .with_context(|| format_dbg!())?; Ok(()) } @@ -534,7 +546,7 @@ pub struct VehicleState { pub pwr_tractive: si::Power, /// Tractive power required for prescribed speed pub pwr_tractive_for_cyc: si::Power, - /// integral of [Self::pwr_out] + /// integral of [Self::pwr_tractive] pub energy_tractive: si::Energy, /// time varying aux load pub pwr_aux: si::Power, diff --git a/fastsim-core/src/vehicle/vehicle_model/fastsim2_interface.rs b/fastsim-core/src/vehicle/vehicle_model/fastsim2_interface.rs index 4c20ceb8..dbc34421 100644 --- a/fastsim-core/src/vehicle/vehicle_model/fastsim2_interface.rs +++ b/fastsim-core/src/vehicle/vehicle_model/fastsim2_interface.rs @@ -173,7 +173,7 @@ impl TryFrom<&fastsim_2::vehicle::RustVehicle> for PowertrainType { }, em: ElectricMachine { state: Default::default(), - eff_interp_fwd: (Interpolator::Interp1D( + eff_interp_achieved: (Interpolator::Interp1D( Interp1D::new( f2veh.mc_perc_out_array.to_vec(), { @@ -223,7 +223,7 @@ impl TryFrom<&fastsim_2::vehicle::RustVehicle> for PowertrainType { }, em: ElectricMachine { state: Default::default(), - eff_interp_fwd: (Interpolator::Interp1D(Interp1D::new( + eff_interp_achieved: (Interpolator::Interp1D(Interp1D::new( f2veh.mc_pwr_out_perc.to_vec(), f2veh.mc_eff_array.to_vec(), Strategy::LeftNearest, @@ -464,7 +464,7 @@ impl Vehicle { mc_eff_array: Default::default(), // calculated in `set_derived` mc_eff_map: self .em() - .map(|em| em.eff_interp_fwd.f_x()) + .map(|em| em.eff_interp_achieved.f_x()) .transpose()? .map(|f_x| f_x.to_vec()) .unwrap_or_else(|| vec![0., 1.]) @@ -492,7 +492,7 @@ impl Vehicle { // short array that can use xEV when implented. TODO: fix this when implementing xEV mc_pwr_out_perc: self .em() - .map(|em| em.eff_interp_fwd.x()) + .map(|em| em.eff_interp_achieved.x()) .transpose()? .map(|x| x.to_vec()) .unwrap_or_else(|| vec![0., 1.]) diff --git a/python/fastsim/resources/demos/demo_variable_paths/variable_path_list_expected.txt b/python/fastsim/resources/demos/demo_variable_paths/variable_path_list_expected.txt index 5434c271..420506fe 100644 --- a/python/fastsim/resources/demos/demo_variable_paths/variable_path_list_expected.txt +++ b/python/fastsim/resources/demos/demo_variable_paths/variable_path_list_expected.txt @@ -70,7 +70,6 @@ ['veh']['chassis']['wheel_base_meters'] ['veh']['mass_kilograms'] ['veh']['pwr_aux_base_watts'] -['veh']['pwr_aux_max_watts'] ['veh']['trans_eff'] ['veh']['save_interval'] ['veh']['state']['i']