flexops.costing.tariff_currency_units

flexops.costing.tariff_currency_units(tariff: DataFrame)

Return the Pyomo currency unit for a tariff’s currency basis.

Reads the tariff’s charge units column (e.g. "$/kWh"), takes the currency symbol (the numerator before the /), and returns the matching Pyomo currency unit — registering it on first use. EECO tariffs are dollar-based ("$" → USD). FlexCosting labels every operating-cost expression with this unit, so the currency basis is data-driven from the tariff sheet rather than hardcoded.

Parameters:

tariff – An EECO rate_data DataFrame (from load_tariff()).

Returns:

The Pyomo currency units object (e.g. USD).

Raises:

FlexDataError – If the tariff has no units column, or its charges do not share exactly one recognized currency symbol.