Skip to content

Parametric CO2MPAS Inputs Calculation

stefanosts edited this page Aug 5, 2016 · 6 revisions

The present section provides the main functions for the calculation of the unknown parameters for running Parametric CO2MPAS, as they are defined in the section Parametric CO2MPAS Inputs.

A "draft" / preliminary analysis of the various correlations can be found here, while bellow the final functions used are described.

Engine Parameters

Engine parameters are calculated based on the engine type from the empirical function bellow.

@GEORGE WE NEED TO DEVELOP THAT. PLEASE PROVIDE SOME INFO TO ADD.

def get_co2_params_new(max_power, capacity, eng_type):
    
    params = {
        'gasoline turbo': {
                'a': 0.8882*max_power/capacity+0.377,
                'b': -0.17988*(0.882*max_power/capacity+0.377)+0.0899,
                'c': -0.06492*(-0.17988*(0.882*max_power/capacity+0.377)+0.0899)+0.000117,
                'a2': -0.00266,
                'b2': 0,
                'l': -2.49882,
                'l2': -0.0025,
                't':2.7,
                'trg': 85.,
                },
        'gasoline natural aspiration': {
                'a': 0.8882*max_power/capacity+0.377,
                'b': -0.17988*(0.882*max_power/capacity+0.377)+0.0899,
                'c': -0.06492*(-0.17988*(0.882*max_power/capacity+0.377)+0.0899)+0.000117,
                'a2': -0.00385,
                'b2': 0,
                'l': -2.14063,
                'l2': -0.00286,
                't': 2.7,
                'trg': 85.,
                },
        'diesel': {
                'a': -0.0005*max_power+0.438451,
                'b': -0.26503*(-0.0005*max_power+0.43845)+0.12675,
                'c': -0.08528*(-0.26503*(-0.0005*max_power+0.43845)+0.12675)+0.0003,
                'a2': -0.0012,
                'b2': 0,
                'l': -1.55291,
                'l2': -0.0076,
                't': 2.7,
                'trg': 85.,
                }
        }
    
    return params[eng_type]

Alternator Charging Currents

Alternator charging currents are calculated based on the alternator characteristics as follows:

acc1 = - alternator_nominal_power * 1000 * alternator_efficiency / alternator_nominal_voltage
acc2 = acc1 * 0.2
acc3 = 0.0

alternator_charging_currents = (acc1, acc2, acc3)

Fuel Lower Heating Value

Fuel's lower heating value is provided from the dictionary bellow:

fhv = {'gasoline'   : 43000,
       'diesel'     : 43600,
       'LPG'        : 46000,
       'gas'        : 46000,
       'bioethanol' : 38000
      }

Fuel Carbon Content

Fuel's carbon content is provided from the dictionary bellow:

fcc = {'gasoline'   : 3.153,
       'diesel'     : 3.153,
       'LPG'        : 3.014,
       'gas'        : 3.014,
       'bioethanol' : 2.820
      }

Speed Velocity Ratios

Speed velocity ratios are calculated, for each gear, from the following function:

stv = 1000*fd*gbr/(60*2*3.14*rd)

, where:
- fd: final drive ratio
- gbr: gear box ratio for the specific gear
- rd: dynamic rolling radius

Maximum Engine Speed

Maximum engine speed is calculated as a function of nominal engine speed, based on a linear regression performed on the measured cars data.

Engine Capacity Functions

All data which are a function of the engine capacity are calculated on the basis of a linear regression on the measured cars data.

Road Loads

Details on the calculation of the road loads are provided in the section Road Loads.

Gear-shifting

The calculation of the gear-shifting for manual cars is based on the WLTP Tool which can be found here.

AT Models

The AT models are calculated as a function of the speed velocity ratios, via the models as defined bellow. The input of the get_at_models_funcs is a dataframe containing information on the calibrated models of all measured cars.

def get_at_models_funcs(db):
    from co2mpas.functions.co2mpas_model.physical.gear_box.AT_gear import CMV
    from co2mpas.functions.co2mpas_model.physical.gear_box.AT_gear import MVL
    
    db['cmv_'] = db.apply(lambda x: get_cmv_values(x['CMV']), axis=1)
    db['mvl_'] = db.apply(lambda x: get_mvl_values(x['MVL']), axis=1)
    db['vsr_'] = db['velocity_speed_ratios'].apply(lambda x: eval(x))
    
    db['cms_'] = db.apply(lambda x: calc_cms(x['cmv_'], x['vsr_']), axis=1)
    db['msl_'] = db.apply(lambda x: calc_cms(x['mvl_'], x['vsr_']), axis=1)    
    
    cms = db['cms_'].values
    msl = db['msl_'].values
    
    dl_cms, du_cms = _avg_limits(cms)
    dl_msl, du_msl = _avg_limits(msl)
    
    _dls_cms = Spline(list(dl_cms.keys()), list(dl_cms.values()), k=1) 
    _dus_cms = Spline(list(du_cms.keys())[1:], list(du_cms.values())[1:], k=1) 
    _dls_msl = Spline(list(dl_msl.keys()), list(dl_msl.values()), k=1) 
    _dus_msl = Spline(list(du_msl.keys())[1:], list(du_msl.values())[1:], k=1) 
    
    def _cms_mean(x):
        return _dls_cms(x), _dus_cms(x)

    def _msl_mean(x):
        return _dls_msl(x), _dus_msl(x)
    
    def cms_to_cmv(stv):
        dcmv = OrderedDict()
        if 0 not in stv.keys(): stv[0] = 0
        a = len(stv)
        for k in np.arange(a):
            l, u = _cms_mean(k)
            if k == 0:
                dcmv[k] = (0., 2.)
            elif k != a-1:
                dcmv[k] = (l/stv[k], u/stv[k])
            else:
                dcmv[k] = (l/stv[k], 10000.)
        return CMV(dcmv)

    def msl_to_mvl(stv):
        dmvl = OrderedDict()
        if 0 not in stv.keys(): stv[0] = 0
        a = len(stv)
        for k in np.arange(a):
            if k not in stv.keys(): stv[k] = 0
            l, u = _msl_mean(k)
            if k == 0:
                dmvl[k] = (0., 10.)
            elif k != a-1:
                dmvl[k] = (l/stv[k], u/stv[k])
            else:
                dmvl[k] = (l/stv[k], 10000.)
        return MVL(dmvl)
    
    return cms_to_cmv, msl_to_mvl