Skip to content

Commit

Permalink
troubleshooting fusion thermal demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Steuteville committed Nov 28, 2023
1 parent fcc1ecb commit ab74072
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 4 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ dependencies = [
"typing_extensions",
"pyyaml",
"pytest",
"requests",
]

[project.urls]
Expand Down
4 changes: 3 additions & 1 deletion python/fastsim/demos/fusion_thermal_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
fusion = fsr.RustVehicle.from_file(
str(fsim.vehicle.VEHICLE_DIR / "2012_Ford_Fusion.yaml"))
fusion_thermal_base = fsr.VehicleThermal.from_file(
str(fsim.vehicle.VEHICLE_DIR / "thermal/2012_Ford_Fusion_thrml.yaml"))
# str("2012_Ford_Fusion_thrml"))
str(fsim.vehicle.VEHICLE_DIR / "thermal/2012_Ford_Fusion_thrml.yaml"))
# ! tag:vehiclethermal:fordfusion)
cyc = fsr.RustCycle.from_file(str(fsim.cycle.CYCLES_DIR / "udds.csv"))

# no arguments use default of 22°C
Expand Down
30 changes: 30 additions & 0 deletions python/fastsim/fastsimrust.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ from __future__ import annotations
from typing_extensions import Self
from typing import Dict, List, Tuple, Optional, ByteString
from abc import ABC
from fastsim.vehicle import VEHICLE_DIR
import yaml
from pathlib import Path

class RustVec(ABC):
def __repr__(self) -> str:
Expand Down Expand Up @@ -782,6 +785,33 @@ class VehicleThermal:
"""Reset the orphaned flag to false."""
...

@classmethod
def from_file(filename: str) -> Self:
...
# """
# Loads VehicleThermal from file `filename` (str). Looks in working dir and then
# fastsim/resources/vehdb/thermal.
# Argument:
# filename: path to vehicle database file
# """
# filename = str(filename)
# if str(filename).endswith('.yaml'):
# str.replace('.yaml', '.csv')
# if not(str(filename).endswith('.csv')):
# filename = str(filename) + '.csv'
# if Path(filename).exists():
# filename = Path(filename)
# elif (VEHICLE_DIR / filename).exists():
# filename = VEHICLE_DIR / filename
# else:
# raise ValueError("Invalid vehicle filename.")

# vehdf = pd.read_csv(filename)

# veh_file = filename

# return cls.from_df(vehdf, veh_file)


class ThermalStateHistoryVec(SerdeAPI, RustVec):
...
Expand Down
34 changes: 34 additions & 0 deletions python/fastsim/resources/vehdb/thermal/2012_Ford_fusion_thrml.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Param Name,Param Value
fc_c_kj__k,193.6134296
fc_l,0.276223689
fc_htc_to_amb_stop,7.231333272
fc_coeff_from_comb,0.000370665
tstat_te_sto_deg_c,85
tstat_te_delta_deg_c,5
rad_eps,6.330558106
fc_model,
Internal,
Exponential,
offset,4.036805344
lag,53.02434113
minimum,0.380851487
FuelConverter,
ess_c_kj_k,200
ess_htc_to_amb,5
cabin_hvac_model,External
cab_c_kj__k,125
cab_l_length,2
cab_l_width,2
cab_r_to_amb,0.02
cab_htc_to_amb_stop,10
exhport_model,External
exhport_ha_to_amb,5
exhport_ha_int,100
exhport_c_kj__k,10
cat_model,External
cat_l,0.5
cat_c_kj__K,15
cat_htc_to_amb_stop,10
cat_te_lightoff_deg_c,400
cat_fc_eta_coeff,0.3
hvac_model,External
1 change: 0 additions & 1 deletion python/fastsim/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from pathlib import Path
import re
from contextlib import contextmanager
import requests
import os
from pkg_resources import get_distribution
import pathlib
Expand Down
2 changes: 1 addition & 1 deletion python/fastsim/vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def from_vehdb(cls, vnum: int, veh_file: str = None, to_rust: bool = False) -> S
vehdf.set_index('selection', inplace=True, drop=False)

return cls.from_df(vehdf, vnum, veh_file, to_rust)

#need to duplicate this function for VehicleThermal -- but first need a csv file from the yaml
@classmethod
def from_file(cls, filename: str, vnum: int = None, to_rust: bool = False) -> Self:
"""
Expand Down

0 comments on commit ab74072

Please sign in to comment.