refactored

This commit is contained in:
2025-03-09 19:23:29 +01:00
parent a585194cfe
commit 7eb0ab96ef
+5 -6
View File
@@ -19,7 +19,7 @@ def bas(soc: float):
# Linfeng Zheng et al., University of Technology Sydney, Australia
# URL:
# https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://opus.lib.uts.edu.au/rest/bitstreams/80b07f8a-db41-4cdc-b645-dbe5c0bf2446/retrieve&ved=2ahUKEwi4teeEzv2LAxVVxgIHHZwIF1IQFnoECBkQAQ&usg=AOvVaw30hTrXeAXEETJDmB7-0rze
def model_r(temperature: float, soc: float, p: Params):
def model_bat_dcr(temperature: float, soc: float, p: Params):
rb, tb = bas(soc)
tb = 25
tb2 = tb*tb
@@ -40,12 +40,12 @@ i_ = p_/ul
bat_params = Params(alpha=0.0007545, beta=-0.07033)
rt_ = []
for t in temps:
rt_.append(model_r(t, 100, bat_params))
rt_.append(model_bat_dcr(t, 100, bat_params))
plot.figure()
plot.plot(temps, rt_)
r, t = bas(100)
plot.title(f"Ri vs temperature (Base R={r}@{t}°C)")
plot.title(f"DCR vs temperature (Base DCR={r}@{t}°C)")
plot.xlabel("Temperature [°C]")
plot.ylabel("R [Ohm]")
plot.grid()
@@ -59,8 +59,8 @@ for sp, name, title in zip([0, 1], ["P_loss [kW]", "P_batt [kW]"], titles):
legs = []
plot.grid()
for temp in temps:
ri = model_r(temp, 100, bat_params)
pi_ = (ri * i_ * i_) + sp*p_
dcr = model_bat_dcr(temp, 100, bat_params)
pi_ = (dcr * i_ * i_) + sp*p_
x = p_/1000
y = pi_/1000
legs.append(f"temp={temp} °C")
@@ -71,5 +71,4 @@ for sp, name, title in zip([0, 1], ["P_loss [kW]", "P_batt [kW]"], titles):
plot.legend(legs)
plot.ylabel(name)
plot.show()