TariffsEngine

class iesve.TariffsEngine
class iesve.TariffsEngine(pcProjectFolder: str, pcAPSFile: str, pcAPSComparisonFiles: str, oStrInfoMessage: String, oStrError: String, eUnitsSystem: EUnitsSystem | int = EUnitsSystem.METRIC, eMode: EModes | int = EModes.MODE_NORMAL, eEnergyDataset: EEnergyDataset | int = EEnergyDataset.ENERGY_DATASET_GENERIC, oComputeCosts: EComputeCosts | int = EComputeCosts.COMPUTE_COSTS_YES)

Bases: object

Support for tariffs engine.

Basic usage:

 1import iesve
 2
 3strProjectFolder = 'C:\MyProject'
 4strAPSFile = 'C:\MyProject\vista\a_tariff analysis.aps'
 5strAPSComparisonFiles = 'C:\MyProject\vista\prb.aps'
 6strInfoMessage = iesve.TariffsEngine.String()
 7strError = iesve.TariffsEngine.String()
 8
 9eUnitsSystem = iesve.TariffsEngine.EUnitsSystem.UNITS_SYSTEM_METRIC # (default)
10             # iesve.TariffsEngine.EUnitsSystem.UNITS_SYSTEM_IP
11
12eMode = iesve.TariffsEngine.EModes.MODE_NORMAL # (default)
13      # iesve.TariffsEngine.EModes.MODE_UPDATE_XML_FILE_TARIFFS_NODE
14      # iesve.TariffsEngine.EModes.MODE_CHECK_UTILITIES_VARIABLES
15
16eComputeCosts = iesve.TariffsEngine.EComputeCosts.COMPUTE_COSTS_NO
17              # iesve.TariffsEngine.EComputeCosts.COMPUTE_COSTS_YES
18
19te = iesve.TariffsEngine(strProjectFolder, strAPSFile, strAPSComparisonFiles,
20                         strInfoMessage, strError,  eUnitsSystem, eMode, eComputeCosts)
21
22if (strError.Empty() == False):
23    print(strError.GetString())
24else:
25    print("Init ok")
26
27if (strInfoMessage.Empty() == False):
28    print(strInfoMessage.GetString())


class EComputeCosts(*values)

Bases: IntEnum

Tariff Engine enum.


COMPUTE_COSTS_NO = 0


COMPUTE_COSTS_YES = 1



class EEnergyDataset(*values)

Bases: IntEnum

Tariff Engine enum.


ENERGY_DATASET_ASHRAE = 0


ENERGY_DATASET_GENERIC = 1


ENERGY_DATASET_LOAD_STORED = -1


ENERGY_DATASET_REFERENCE = 3


ENERGY_DATASET_UK_PART_L2 = 2



class EModes(*values)

Bases: IntEnum

Tariff Engine enum.


MODE_CHECK_UTILITIES_VARIABLES = 2


MODE_NORMAL = 0


MODE_UPDATE_XML_FILE_TARIFFS_NODE = 1



class EUnitsSystem(*values)

Bases: IntEnum

Tariff Engine enum.


IP = 1


METRIC = 0



class EUtilities(*values)

Bases: IntEnum

Tariff Engine enum.


COAL = 3


ELECTRICITY = 0


GAS = 1


MISCELLANEOUS = 4


OIL = 2


RENEWABLES = 5



class String

Bases: object


Empty() bool


GetString() str


SetString(pwcString: str) None


Length: int



AcceptChanges() str

Accepts changes done. It will save the results, selected tariffs etc.

Returns:

Error message if any

Return type:

str


ComputeWithFlatRate(iUtilityId: int, dbFlatRate: float = -1.0) None

Computes the utility’s costs using the flat rate.

Parameters:
  • iUtilityId (int) – iesve.TariffsEngine.EUtilities value.

  • dbFlatRate (float, Optional) – flat rate to use. If <0, the current utility’s flat rate will be used. Defaults to -1.0.


ComputeWithTariff(iUtilityId: int, iSupplierId: int, iTariffId: int) None

Computes the utility iUtilityId using supplier iSupplierId and tariff iTariffId.

Parameters:
  • iUtilityId (int) – iesve.TariffsEngine.EUtilities value.

  • iSupplierId (int) – Supplier id to be set. If not found, an exception is thrown.

  • iTariffId (int) – Tariff id to be set. If not found or doesn’t belong to iSupplierId, an exception is thrown.


GetBenchmarkNetCost(iUtilityId: int = -1) float

Returns the benchmark cost for a utility or total.

Parameters:

iUtilityId (int, Optional) – iesve.TariffsEngine.EUtilities value. If -1, the total cost of all of the utilities summed up will be returned

Returns:

benchmark total cost.

Return type:

float


GetDesignNetCost(iUtilityId: int = -1) float

Returns the design cost for a utility or total.

Parameters:

iUtilityId (int, Optional) – iesve.TariffsEngine.EUtilities value. If -1, the total cost of all of the utilities summed up will be returned.

Returns:

design total cost.

Return type:

float


GetEndUseCost(eFile: int, iUtilityId: int, eVar: EnergyUse) float

Returns the cost of an individual end use.

Parameters:
Returns:

cost of an individual end use

Return type:

float


GetEndUseCosts(eFile: int, iUtilityId: int, endUseList: list[EnergyUse], adjFactor: float = 1.0) dict[EnergyUse, float]

Returns the cost of multiple end uses

Parameters:
Returns:

costs for each end uses.

Return type:

dict[EnergyUse, float]

Code Sample:

cost = te.GetEndUseCosts(0, iesve.TariffsEngine.EUtilities.ELECTRICITY,
       [iesve.EnergyUse.prm_interior_lighting, iesve.EnergyUse.prm_space_heating]
       )


GetRatesTimeSeries(iUtility: int, iFirstDay: int = -1, iLastDay: int = -1) ndarray[Any, dtype[float32]]

Returns a numpy object with the rates applied per time gap from iFirstDay to iLastDay for utility iUtility, that has previously been computed.

Parameters:
  • iUtility (int) – _description_

  • iFirstDay (int, Optional) –

    First day whose rates per time gap will be stored: 1,… 365, 366… If -1, it will be taken from the APS.

    iFirstDay<=iLastDay.

    Defaults to -1

  • iLastDay (int, Optional) –

    Last day whose rates per time gap will be stored: 1,… 365, 366… If -1, it will be taken from the APS.

    iFirstDay<=iLastDay.

    Defaults to -1.

Returns:

numpy object the proposed demand cost per time gap.

Return type:

npt.NDArray[numpy.float32]


GetSelectedCurrency() tuple[str, str, str, str]

Gets a tuple with the selected currency data.

Returns:

tuple with the selected currency.

i.e: ['Polish zloty', 'PLN', 'Poland', 'PLN']

Return type:

tuple[str, str, str, str]


GetSuppliersForUtility(iUtilityId: int) list[tuple[str, int]]

Gets a tuples list with the suppliers belonging to a utility.

Parameters:

iUtilityId (int) – iesve.TariffsEngine.EUtilities value. If -1, the total cost of all of the utilities summed up will be returned.

Returns:

tuples list with the suppliers belonging to the

utility iUtilityId. Each tuple has utility name and id, that can be used for other functions. i.e:

[
    ('Electricity Commercial Supplier', 1),
    ('Electricity Domestic Supplier', 4)
]

Return type:

list[tuple[str, int]]


GetTariffCurrencyUnits(iUtilityId: int, iTariffId: int) str

Returns a text with the symbol of the selected currency divided by the unit of the tariff whose id is iTariffId. I.e: $/T.

Parameters:
Returns:

A text with the symbol of the selected currency divided

by the unit of the tariff whose id is iTariffId. I.e: $/T

Return type:

str

Basic Usage:

te = iesve.TariffsEngine(...)
currencyUnits = te.GetTariffCurrencyUnits(iesve.TariffsEngine.EUtilities.ELECTRICITY, 4)
print(currencyUnits)


GetTariffName(iUtilityId: int, iTariffId: int) str

Retrieves the name of the tariff whose id is iTariffId and belongs to the utility iUtilityId

Parameters:
  • iUtilityId (int) – iesve.TariffsEngine.EUtilities value. Neither miscellaneous nor renewables are possible.

  • iTariffId (int) – Tariff’s id to check

Returns:

tariff name or “” if not found

Return type:

str


GetTariffsForSupplier(iSupplierId: int, strCurrencyId: str = '') list[tuple[str, int]]

Gets a tuple with the tariffs belonging to a supplier and, optionally, a currency.

Parameters:
  • iSupplierId (int) – Supplier id whose tariffs will be retrieved.

  • strCurrencyId (str, Optional) – Currency id the tariffs will have to have in order to be retrieved. If “”, no currency checking will be carried out. Default “”

Returns:

the tariffs belonging to the supplier whose id is

strSupplierId and using the currency if specified. i.e:

[
    ("Unrestricted Tariff (£ GBP)", 12),
    ("Two Rate Tariff (£ GBP)", 13),
    ("Economy-7 Tariff (£ GBP)", 21),
    ("Unrestricted Tariff ($ USD)", 23),
    ("Two Rate Tariff ($ USD)", 24),
    ("Economy-7 Tariff ($ USD)", 28),
]

Return type:

list[tuple[str, int]]


GetUtilitiesNamesAndIds() list[tuple[str, int]]

Gets a list of tuples with the utilities names and its ids.

Returns:

list with the utilities. i.e: [[‘Electricity’, 0],

[‘Gas’, 1], [‘Oil’, 2], [‘Coal’, 3], [‘Miscellaneous’, 4], [‘Renewables’, 5]]

Return type:

(list[tuple[str, int]])


Init(pcProjectFolder: str, pcAPSFile: str, pcAPSComparisonFiles: str, oStrInfoMessage: String, oStrError: String, eUnitsSystem: EUnitsSystem | int = EUnitsSystem.METRIC, eMode: EModes | int = EModes.MODE_NORMAL, eEnergyDataset: EEnergyDataset | int = EEnergyDataset.ENERGY_DATASET_GENERIC, oComputeCosts: EComputeCosts | int = EComputeCosts.COMPUTE_COSTS_YES) bool

Init the tariffs engine. See iesve.TariffsEngine for usage example

Parameters:
  • pcProjectFolder (str) – MIT project folder ending by ‘/’ or not. I.e: C://My project//

  • pcAPSFile (str) – APS file with path. I.e: C://My project//vista//test.aps

  • pcAPSComparisonFiles (str) –

    3 options:

    • Files separated by ? that will be stored for comparing. I.e : File1 ? File2 ? File3

    • Empty string. Comparison files will be cleared so no files will be used to compare to.

    • nullptr. Comparison files won’t be modified and pcAPSFile will be compared to them.

  • oStrInfoMessage (String) – Error message if any. Out parameter

  • oStrError (String) – Non error message to show after initialization. If not nullptr, it has a message and has to be deleted

  • eUnitsSystem (EUnitsSystem, int], Optional) – Defaults to EUnitsSystem.METRIC.

  • eMode (EModes | int, Optional) – TariffsEngine mode. Defaults to EModes.MODE_NORMAL.

  • eEnergyDataset (EEnergyDataset | int, int], Optional) – Energy option. Defaults to EEnergyDataset.ENERGY_DATASET_GENERIC.

  • oComputeCosts (EComputeCosts | int, Optional) – Compute utilities or not . Defaults to EComputeCosts.COMPUTE_COSTS_YES.

Returns:

True if success. False if fail. See oStrError

Return type:

bool


SetBenchmarkProfile(pwcFiles: str) None

Sets the file(s) to compare with.

Parameters:

pwcFiles – files separated by ? or empty. I.e: “File1?File2?File3”

te = iesve.TariffsEngine(...)
te. SetBenchmarkProfile("prb.aps?prb2.aps")


Improvement: float

Read only property containing the % of improvement.