Exemplo n.º 1
0
    def interpolate_veh(case):
        _prop, wot, n2vs = vehdb.load_vehicle_accdb(h5_accdb, case)

        wot = wot[["Pwot", "ASM"]]
        wot["n"] = wot.index

        return engine.interpolate_wot_on_v_grid(wot, n2vs)
Exemplo n.º 2
0
    def make_v_maxes(vehnum):
        props, wot, n2vs = vehdb.load_vehicle_accdb(h5_accdb, vehnum)
        wot = wot.rename({"Pwot": "p"}, axis=1)
        wot["n"] = wot.index
        gwots = engine.interpolate_wot_on_v_grid(wot, n2vs)
        gwots = engine.calc_p_avail_in_gwots(gwots, SM=0.1)
        gwots["p_resist"] = vehicle.calc_road_load_power(
            gwots.index, props.f0, props.f1, props.f2)
        rec = vmax.calc_v_max(gwots)

        return (props["v_max"], rec.v_max, props["gear_v_max"], rec.g_vmax,
                rec.wot)
Exemplo n.º 3
0
def test_full_build_smoketest(h5_accdb):
    vehnum = 8
    veh_class = 3  # v008's class
    t_cold_end = 470  # stop in all classes
    prop, wot, n2vs = vehdb.load_vehicle_accdb(h5_accdb, vehnum)
    renames = vehdb.accdb_renames()
    prop = prop.rename(renames)
    wot = wot.rename(renames, axis=1)
    wot["n"] = wot.index

    V = datamodel.get_class_v_cycle(veh_class)
    wltc_parts = datamodel.get_class_parts_limits(veh_class)

    pm = cycler.PhaseMarker()
    cb = cycler.CycleBuilder(V)
    cb.cycle = pm.add_phase_markers(cb.cycle, cb.V, cb.A)
    for err in cb.validate_nims_t_cold_end(t_cold_end, wltc_parts):
        raise err
    cb.cycle = pm.add_class_phase_markers(cb.cycle, wltc_parts)

    SM = 0.1
    gwots = engine.interpolate_wot_on_v_grid(wot, n2vs)
    gwots = engine.calc_p_avail_in_gwots(gwots, SM=SM)
    gwots["p_resist"] = vehicle.calc_road_load_power(gwots.index, prop.f0,
                                                     prop.f1, prop.f2)

    kr = 1.03
    cb.add_wots(gwots)

    cb.cycle["p_inert"] = vehicle.calc_inertial_power(cb.V, cb.A,
                                                      prop.test_mass, kr)
    cb.cycle["p_req"] = vehicle.calc_required_power(cb.cycle["p_inert"],
                                                    cb.cycle["p_resist"])

    acc_cycle = vehdb.load_vehicle_nodes(h5_accdb, vehnum, "cycle")

    diffs = {}

    def cmpr_cols(c1, c2):
        diffs[c1.name] = (c1 - c2).abs()

    acc_cycle["P_tot"], "p_required"
Exemplo n.º 4
0
# %%
disp_gwots(ac_props, py_props, gwots, 6)
disp_gwots(ac_props, py_props, gwots, 5)

# %% [markdown]
# ## Manual run

# %%
caseno = 64
# caseno = 48  # maxWOT
# caseno = 20  # maxWOT last gear
ac_props, wot, n2vs = vehdb.load_vehicle_accdb(inp_h5fname, caseno)
wot = wot.rename(vehdb.accdb_renames(), axis=1)
wot["n"] = wot.index
ac_props = ac_props.rename(vehdb.accdb_renames())
gwots = engine.interpolate_wot_on_v_grid(wot, n2vs)
gwots = engine.attach_p_avail_in_gwots(gwots, f_safety_margin=0.1)
gwots["p_resist"] = vehicle.calc_p_resist(gwots.index, ac_props.f0,
                                          ac_props.f1, ac_props.f2)

# %%
w = wio.pstep_factory.get()
gidx = wio.GearMultiIndexer.from_df(gwots)

rec = vmax.calc_v_max(gwots)
print(f"VMAX: {rec.v_max}, G_VMAX: {rec.g_vmax}, maxWOT? {rec.is_n_lim}")
display(rec.wot[f"g{rec.g_vmax}"])

# %% [markdown]
# # Museum