def adrinverter(v_dc, p_dc, inverter, vtol=<NUM_LIT>):
p_nom = inverter['<STR_LIT>']<EOL>v_nom = inverter['<STR_LIT>']<EOL>pac_max = inverter['<STR_LIT>']<EOL>p_nt = inverter['<STR_LIT>']<EOL>ce_list = inverter['<STR_LIT>']<EOL>v_max = inverter['<STR_LIT>']<EOL>v_min = inverter['<STR_LIT>']<EOL>vdc_max = inverter['<STR_LIT>']<EOL>mppt_hi = inverter['<STR_LIT>']<EOL>mppt_low = inverter['<STR_LIT>']<EOL>v_lim_upper = float(np.nanmax([v_max, vdc_max, mppt_hi]) * (<NUM_LIT:1> + vtol))<EOL>v_lim_lower = float(np.nanmax([v_min, mppt_low]) * (<NUM_LIT:1> - vtol))<EOL>pdc = p_dc / p_nom<EOL>vdc = v_dc / v_nom<EOL>with np.errstate(invalid='<STR_LIT:ignore>', divide='<STR_LIT:ignore>'):<EOL><INDENT>poly = np.array([pdc**<NUM_LIT:0>,  <EOL>pdc,<EOL>pdc**<NUM_LIT:2>,<EOL>vdc - <NUM_LIT:1>,<EOL>pdc * (vdc - <NUM_LIT:1>),<EOL>pdc**<NUM_LIT:2> * (vdc - <NUM_LIT:1>),<EOL><NUM_LIT:1.> / vdc - <NUM_LIT:1>,  <EOL>pdc * (<NUM_LIT:1.> / vdc - <NUM_LIT:1>),  <EOL>pdc**<NUM_LIT:2> * (<NUM_LIT:1.> / vdc - <NUM_LIT:1>)])  <EOL><DEDENT>p_loss = np.dot(np.array(ce_list), poly)<EOL>ac_power = p_nom * (pdc-p_loss)<EOL>p_nt = -<NUM_LIT:1> * np.absolute(p_nt)<EOL>with np.errstate(invalid='<STR_LIT:ignore>'):<EOL><INDENT>invalid = (v_lim_upper < v_dc) | (v_dc < v_lim_lower)<EOL><DEDENT>ac_power = np.where(invalid, np.nan, ac_power)<EOL>ac_power = np.where(vdc == <NUM_LIT:0>, p_nt, ac_power)<EOL>ac_power = np.maximum(ac_power, p_nt)<EOL>ac_power = np.minimum(ac_power, pac_max)<EOL>if isinstance(p_dc, pd.Series):<EOL><INDENT>ac_power = pd.Series(ac_power, index=pdc.index)<EOL><DEDENT>return ac_power<EOL>
r'''
    Converts DC power and voltage to AC power using Anton Driesse's
    Grid-Connected PV Inverter efficiency model

    Parameters
    ----------
    v_dc : numeric
        A scalar or pandas series of DC voltages, in volts, which are provided
        as input to the inverter. If Vdc and Pdc are vectors, they must be
        of the same size. v_dc must be >= 0. (V)

    p_dc : numeric
        A scalar or pandas series of DC powers, in watts, which are provided
        as input to the inverter. If Vdc and Pdc are vectors, they must be
        of the same size. p_dc must be >= 0. (W)

    inverter : dict-like
        A dict-like object defining the inverter to be used, giving the
        inverter performance parameters according to the model
        developed by Anton Driesse [1].
        A set of inverter performance parameters may be loaded from the
        supplied data table using retrievesam.
        See Notes for required keys.

    vtol : numeric, default 0.1
        A unit-less fraction that determines how far the efficiency model is
        allowed to extrapolate beyond the inverter's normal input voltage
        operating range. 0.0 <= vtol <= 1.0

    Returns
    -------
    ac_power : numeric
        A numpy array or pandas series of modeled AC power output given the
        input DC voltage, v_dc, and input DC power, p_dc. When ac_power would
        be greater than pac_max, it is set to p_max to represent inverter
        "clipping". When ac_power would be less than -p_nt (energy consumed
        rather  than produced) then ac_power is set to -p_nt to represent
        nightly power losses. ac_power is not adjusted for maximum power point
        tracking (MPPT) voltage windows or maximum current limits of the
        inverter.

    Notes
    -----

    Required inverter keys are:

    =======   ============================================================
    Column    Description
    =======   ============================================================
    p_nom     The nominal power value used to normalize all power values,
              typically the DC power needed to produce maximum AC power
              output, (W).

    v_nom     The nominal DC voltage value used to normalize DC voltage
              values, typically the level at which the highest efficiency
              is achieved, (V).

    pac_max   The maximum AC output power value, used to clip the output
              if needed, (W).

    ce_list   This is a list of 9 coefficients that capture the influence
              of input voltage and power on inverter losses, and thereby
              efficiency.

    p_nt      ac-power consumed by inverter at night (night tare) to
              maintain circuitry required to sense PV array voltage, (W).
    =======   ============================================================

    References
    ----------
    [1] Beyond the Curves: Modeling the Electrical Efficiency
        of Photovoltaic Inverters, PVSC 2008, Anton Driesse et. al.

    See also
    --------
    sapm
    singlediode