def read_veh(vehnum, silent=False): ac_props, wot, _ = vehdb.load_vehicle_accdb(inp_h5fname, vehnum) py_props, _, gwots = vehdb.load_vehicle_pyalgo(out_h5fname, vehnum) if not silent: display(ac_props[["no_of_gears", "gear_v_max", "v_max"]], "", py_props) ax = None ax = gwots.loc[:, ("g6 g5 g4".split(), "p_avail")].plot(ax=ax) gwots.loc[:, ("g6 g5 g4".split(), "p_resist")].plot(ax=ax) return ac_props, py_props, wot, gwots
import vehdb idx = pd.IndexSlice log = logging.getLogger("VMax.ipynb") logging.basicConfig( level=logging.INFO, format="%(asctime)s|%(levelname)4.4s|%(module)s:[%(funcName)s]:\n +--> %(message)s", datefmt="%Y-%m-%d,%H:%M:%S", ) pd.set_option("display.max_columns", 64) # %% h5 = "VehData/WltpGS-msaccess.h5" caseno = 1 prop, wot, n2vs = vehdb.load_vehicle_accdb(h5, caseno) acc_cycle = vehdb.load_vehicle_nodes(h5, 1, "cycle") # %% print(list(prop.index)) # %% # renames = vehdb.accdb_renames() # prop = prop.rename(renames) mdl = vehdb.mdl_from_accdb(prop, wot, n2vs) datamodel.validate_model(mdl, additional_properties="true") wot = mdl["wot"] # %% print(list(acc_cycle.columns)) print(list(mdl.keys()))
pd.set_option("display.max_columns", 32) # %% ## DEFINITIONS # inp_h5fname = "VehData/WltpGS-msaccess.h5" out_h5fname = "VehData/WltpGS-pyalgo.h5" c_n, c_p, c_n_norm, c_p_norm = "n", "Pwot", "n_norm", "p_norm" # vehdb.print_nodes(inp_h5fname) # vehdb.print_nodes(out_h5fname) # %% vehnum = 35 ac_props, wot, _ = vehdb.load_vehicle_accdb(inp_h5fname, vehnum) wot # %% [markdown] # ## Good case from h5db # %% def read_veh(vehnum, silent=False): ac_props, wot, _ = vehdb.load_vehicle_accdb(inp_h5fname, vehnum) py_props, _, gwots = vehdb.load_vehicle_pyalgo(out_h5fname, vehnum) if not silent: display(ac_props[["no_of_gears", "gear_v_max", "v_max"]], "", py_props) ax = None ax = gwots.loc[:, ("g6 g5 g4".split(), "p_avail")].plot(ax=ax)
"n_max": mdl["n_max"], "wltc_class": mdl["wltc_class"], "f_dsc_raw": mdl["f_dsc_raw"], "f_dsc": mdl["f_dsc"], } pprint(oprops) display(mdl["cycle"]) # %% [markdown] # ## Run a case from AccDb # The same vehicle data as above, read from h5db. # %% h5 = "VehData/WltpGS-msaccess.h5" prop, wot, n2vs = vehdb.load_vehicle_accdb(h5, 1) acc_cycle = vehdb.load_vehicle_nodes(h5, 1, "cycle") # %% case_no = 88 props, wot, n2vs = vehdb.load_vehicle_accdb(h5, case_no) mdl = vehdb.mdl_from_accdb(props, wot, n2vs) datamodel.validate_model(mdl, additional_properties=True) exp = Experiment(mdl, skip_model_validation=True) # %time mdl = exp.run() oprops = { "pmr": mdl["pmr"], "n95_low": mdl["n95_low"],