From 9e4b3f4d599efd51e9f683349529bdb0498c0db5 Mon Sep 17 00:00:00 2001 From: Robin Steuteville Date: Wed, 22 Jan 2025 11:08:32 -0700 Subject: [PATCH] working on updating arrays in 2022_Hyundai_Sonata_Hybrid_Blue.yaml --- .../2021_Hyundai_Sonata_Hybrid_Blue.yaml | 360 +----------------- cal_and_val/thermal/updated_sonata_hybrid.py | 32 ++ 2 files changed, 34 insertions(+), 358 deletions(-) create mode 100644 cal_and_val/thermal/updated_sonata_hybrid.py diff --git a/cal_and_val/thermal/f3-vehicles/2021_Hyundai_Sonata_Hybrid_Blue.yaml b/cal_and_val/thermal/f3-vehicles/2021_Hyundai_Sonata_Hybrid_Blue.yaml index 3ad486db..da356877 100644 --- a/cal_and_val/thermal/f3-vehicles/2021_Hyundai_Sonata_Hybrid_Blue.yaml +++ b/cal_and_val/thermal/f3-vehicles/2021_Hyundai_Sonata_Hybrid_Blue.yaml @@ -58,205 +58,29 @@ pt_type: Interp1D: x: - 0.0 - - 0.001 - - 0.002 - - 0.003 - - 0.004 - 0.005 - - 0.006 - - 0.007 - - 0.008 - - 0.009 - - 0.01 - - 0.011 - - 0.012 - - 0.013 - - 0.014 - 0.015 - - 0.016 - - 0.017 - - 0.018 - - 0.019 - - 0.02 - - 0.021 - - 0.022 - - 0.023 - - 0.024 - - 0.025 - - 0.026 - - 0.027 - - 0.028 - - 0.029 - - 0.03 - - 0.035 - 0.04 - - 0.045 - - 0.05 - - 0.055 - 0.06 - - 0.065 - - 0.07 - - 0.08 - - 0.09 - 0.1 - - 0.11 - - 0.12 - - 0.13 - 0.14 - - 0.15 - - 0.16 - - 0.17 - - 0.18 - - 0.19 - 0.2 - - 0.21 - - 0.22 - - 0.23 - - 0.24 - - 0.25 - - 0.26 - - 0.27 - - 0.28 - - 0.29 - - 0.3 - - 0.31 - - 0.32 - - 0.33 - - 0.34 - - 0.35 - - 0.36 - - 0.37 - - 0.38 - - 0.39 - 0.4 - - 0.41 - - 0.42 - - 0.43 - - 0.44 - - 0.45 - - 0.46 - - 0.47 - - 0.48 - - 0.49 - - 0.5 - - 0.51 - - 0.52 - - 0.53 - - 0.54 - - 0.55 - - 0.56 - - 0.57 - - 0.58 - - 0.59 - 0.6 - - 0.65 - - 0.7 - - 0.75 - 0.8 - - 0.85 - - 0.9 - - 0.95 - 1.0 f_x: - 0.08 - - 0.084 - - 0.08800000000000001 - - 0.092 - - 0.096 - 0.1 - - 0.116 - - 0.132 - - 0.14800000000000002 - - 0.164 - - 0.18000000000000002 - - 0.196 - - 0.21200000000000002 - - 0.22800000000000004 - - 0.24400000000000005 - 0.26 - - 0.26280000000000003 - - 0.2656 - - 0.2684 - - 0.2712 - - 0.274 - - 0.2768 - - 0.2796 - - 0.2824 - - 0.2852 - - 0.28800000000000003 - - 0.2908 - - 0.2936 - - 0.2964 - - 0.2992 - - 0.302 - - 0.316 - 0.33 - - 0.33625 - - 0.3425 - - 0.34875 - 0.355 - - 0.356875 - - 0.35875 - - 0.3625 - - 0.36624999999999996 - 0.37 - - 0.3725 - - 0.375 - - 0.3775 - - 0.38 - - 0.38 - - 0.38 - - 0.38 - 0.38 - 0.38 - - 0.38 - - 0.3785 - - 0.377 - - 0.3755 - - 0.374 - - 0.3725 - - 0.371 - - 0.3695 - - 0.368 - - 0.3665 - - 0.365 - - 0.3635 - - 0.362 - - 0.3605 - - 0.359 - - 0.3575 - - 0.356 - - 0.3545 - - 0.353 - - 0.3515 - 0.35 - - 0.3495 - - 0.349 - - 0.3485 - - 0.348 - - 0.3475 - - 0.347 - - 0.3465 - - 0.346 - - 0.3455 - - 0.345 - - 0.34450000000000003 - - 0.34400000000000003 - - 0.3435 - - 0.343 - - 0.3425 - - 0.342 - - 0.3415 - - 0.341 - - 0.3405 - 0.34 - - 0.3375 - - 0.335 - - 0.3325 - 0.33 - - 0.3275 - - 0.325 - - 0.3225 - 0.32 strategy: Linear extrapolate: Error @@ -267,208 +91,28 @@ pt_type: Interp1D: x: - 0.0 - - 0.01 - 0.02 - - 0.03 - 0.04 - - 0.05 - 0.06 - - 0.07 - 0.08 - - 0.09 - 0.1 - - 0.11 - - 0.12 - - 0.13 - - 0.14 - - 0.15 - - 0.16 - - 0.17 - - 0.18 - - 0.19 - 0.2 - - 0.21 - - 0.22 - - 0.23 - - 0.24 - - 0.25 - - 0.26 - - 0.27 - - 0.28 - - 0.29 - - 0.3 - - 0.31 - - 0.32 - - 0.33 - - 0.34 - - 0.35 - - 0.36 - - 0.37 - - 0.38 - - 0.39 - 0.4 - - 0.41 - - 0.42 - - 0.43 - - 0.44 - - 0.45 - - 0.46 - - 0.47 - - 0.48 - - 0.49 - - 0.5 - - 0.51 - - 0.52 - - 0.53 - - 0.54 - - 0.55 - - 0.56 - - 0.57 - - 0.58 - - 0.59 - 0.6 - - 0.61 - - 0.62 - - 0.63 - - 0.64 - - 0.65 - - 0.66 - - 0.67 - - 0.68 - - 0.69 - - 0.7 - - 0.71 - - 0.72 - - 0.73 - - 0.74 - - 0.75 - - 0.76 - - 0.77 - - 0.78 - - 0.79 - 0.8 - - 0.81 - - 0.82 - - 0.83 - - 0.84 - - 0.85 - - 0.86 - - 0.87 - - 0.88 - - 0.89 - - 0.9 - - 0.91 - - 0.92 - - 0.93 - - 0.94 - - 0.95 - - 0.96 - - 0.97 - - 0.98 - - 0.99 - 1.0 f_x: - 0.84 - - 0.84 - - 0.85 - 0.86 - - 0.87 - 0.88 - - 0.89 - - 0.895 - 0.9 - - 0.905 - 0.91 - - 0.912 - - 0.914 - - 0.916 - - 0.918 - 0.92 - - 0.922 - - 0.924 - - 0.926 - - 0.928 - - 0.93 - - 0.9305 - - 0.931 - - 0.9315 - - 0.932 - - 0.9325 - - 0.933 - - 0.9335 - - 0.934 - - 0.9345 - - 0.9349999999999999 - - 0.9355 - - 0.9359999999999999 - - 0.9365 - - 0.9369999999999999 - - 0.9375 - - 0.938 - - 0.9385 - - 0.939 - - 0.9395 - - 0.94 - - 0.94 - - 0.94 - - 0.94 - - 0.94 - - 0.94 - - 0.94 - - 0.94 - - 0.94 - - 0.94 - - 0.94 - - 0.94 - - 0.94 - - 0.94 - - 0.94 - - 0.94 - - 0.94 - - 0.94 - - 0.94 - 0.94 + - 0.95 + - 0.95 - 0.94 - - 0.9395 - - 0.939 - - 0.9385 - - 0.938 - - 0.9375 - - 0.9369999999999999 - - 0.9365 - - 0.9359999999999999 - - 0.9355 - - 0.935 - - 0.9345 - - 0.934 - - 0.9335 - - 0.933 - - 0.9325 - - 0.932 - - 0.9315 - - 0.931 - - 0.9305 - 0.93 - - 0.9295 - - 0.929 - - 0.9285000000000001 - - 0.928 - - 0.9275000000000001 - - 0.927 - - 0.9265000000000001 - - 0.926 - - 0.9255 - - 0.925 - - 0.9245 - - 0.924 - - 0.9235 - - 0.923 - - 0.9225000000000001 - - 0.922 - - 0.9215000000000001 - - 0.921 - - 0.9205000000000001 - - 0.92 strategy: Linear extrapolate: Error eff_interp_at_max_input: diff --git a/cal_and_val/thermal/updated_sonata_hybrid.py b/cal_and_val/thermal/updated_sonata_hybrid.py new file mode 100644 index 00000000..aa159b98 --- /dev/null +++ b/cal_and_val/thermal/updated_sonata_hybrid.py @@ -0,0 +1,32 @@ +#%% +import fastsim as fsim + +veh = fsim.Vehicle.from_resource("2021_Hyundai_Sonata_Hybrid_Blue.yaml") + +print(veh.to_pydict()) + +# %% +#pt_type.HybridElectricVehicle.fc.eff_interp_from_pwr_out.Interp1D.x +# fsim.set_param_from_path(veh, "pt_type.fc.eff_interp_from_pwr_out.x", [0.00, 0.02, 0.04, 0.06, 0.08, 0.10, 0.20, 0.40, 0.60, 0.80, 1.00]) +# fsim.set_param_from_path(veh, "pt_type.fc.eff_interp_from_pwr_out.x", [0.83, 0.85, 0.87, 0.89, 0.90, 0.91, 0.93, 0.94, 0.94, 0.93, 0.92]) + +# %% +veh_pydict = veh.to_pydict() +print(veh_pydict) +# eff_interp_from_pwr_out = fsim.Interpolator.from_pydict(veh_pydict['veh']['pt_type']['BatteryElectricVehicle']['fc']['eff_interp_from_pwr_out']) +# eff_interp_from_pwr_out.set_x([0.00, 0.02, 0.04, 0.06, 0.08, 0.10, 0.20, 0.40, 0.60, 0.80, 1.00]) +# eff_interp_from_pwr_out.set_f_x([0.83, 0.85, 0.87, 0.89, 0.90, 0.91, 0.93, 0.94, 0.94, 0.93, 0.92]) + +# eff_interp_from_pwr_out = veh_pydict['pt_type']['HybridElectricVehicle']['fc']['eff_interp_from_pwr_out']['Interp1D'] +# eff_interp_from_pwr_out['x'] = [0.00, 0.02, 0.04, 0.06, 0.08, 0.10, 0.20, 0.40, 0.60, 0.80, 1.00] +# eff_interp_from_pwr_out['f_x'] = [0.83, 0.85, 0.87, 0.89, 0.90, 0.91, 0.93, 0.94, 0.94, 0.93, 0.92] +# veh_pydict['pt_type']['HybridElectricVehicle']['fc']['eff_interp_from_pwr_out'] = eff_interp_from_pwr_out + +# veh_pydict['pt_type']['HybridElectricVehicle']['fc']['eff_interp_from_pwr_out']['Interp1D']['x'] = [0.00, 0.02, 0.04, 0.06, 0.08, 0.10, 0.20, 0.40, 0.60, 0.80, 1.00] +# veh_pydict['pt_type']['HybridElectricVehicle']['fc']['eff_interp_from_pwr_out']['Interp1D']['f_x'] = [0.83, 0.85, 0.87, 0.89, 0.90, 0.91, 0.93, 0.94, 0.94, 0.93, 0.92] + +veh_pydict['pt_type']['HybridElectricVehicle']['em']['eff_interp_achieved']['Interp1D']['x'] = [0.00, 0.02, 0.04, 0.06, 0.08, 0.10, 0.20, 0.40, 0.60, 0.80, 1.00] +veh_pydict['pt_type']['HybridElectricVehicle']['em']['eff_interp_achieved']['Interp1D']['f_x'] = [0.83, 0.85, 0.87, 0.89, 0.90, 0.91, 0.93, 0.94, 0.94, 0.93, 0.92] + +veh = fsim.Vehicle.from_pydict(veh_pydict) +veh.to_yaml() \ No newline at end of file