Skip to content

Commit

Permalink
fixed bad SOC getter
Browse files Browse the repository at this point in the history
  • Loading branch information
calbaker committed Jan 29, 2025
1 parent 65bcf92 commit 17a7ac6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cal_and_val/thermal/cal_hev.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def get_mod_soc(sd_dict):
return np.array(sd_dict['veh']['pt_type']['HybridElectricVehicle']['res']['history']['soc'])

def get_exp_soc(df):
return df['HVBatt_SOC_high_precision_PCAN__per']
return df['HVBatt_SOC_high_precision_PCAN__per'] / 100

save_path = Path(__file__).parent / "pymoo_res" / Path(__file__).stem
save_path.mkdir(exist_ok=True, parents=True)
Expand Down
4 changes: 2 additions & 2 deletions cal_and_val/thermal/val_hev.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import pandas as pd

from cal_hev import cal_mod_obj, val_mod_obj,save_path
from cal_hev import cal_mod_obj, val_mod_obj, save_path

res_df = pd.read_csv(save_path / "pymoo_res_df.csv")
res_df['euclidean'] = (
res_df.iloc[:, len(cal_mod_obj.param_fns):] ** 2).sum(1).pow(1/2)
best_row = res_df["euclidean"].argmin()
best_df = res_df.iloc[best_row, :]
param_vals = res_df.iloc[best_row, : len(cal_mod_obj.params)].to_numpy()
param_vals = res_df.iloc[best_row, : len(cal_mod_obj.param_fns)].to_numpy()


2 changes: 1 addition & 1 deletion python/fastsim/pymoo_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def __post_init__(self):

def update_params(self, xs: List[Any]):
"""
Updates model parameters based on `x`, which must match length of self.params
Updates model parameters based on `x`, which must match length of self.param_fns
"""
assert len(xs) == len(self.param_fns), f"({len(xs)} != {len(self.param_fns)}"

Expand Down

0 comments on commit 17a7ac6

Please sign in to comment.