Utilities

sum_system_utility

qsdsan.utils.sum_system_utility(system, operating_hours=None, exclude_units=(), utility='power', result_unit=None, calculate_net_utility=False)

Sum up the select utility of a system (power in kWh/yr, heating/cooling duty in GJ/yr, note that the duty will be negative for cooling utilities).

Parameters:
  • system (obj) – The system whose utility usage will be calculated.

  • operating_hours (float) – Operating hours for the utility, will use system.operating_hours if not provided here and operating_hours has been set for the system, will be set to 1 if neither information is available.

  • exclude_units (Iterable(obj)) – Units within the system that will be excluded from the calculation.

  • utility (str) – Utility of interest, can be either “power”, “heating”, or “cooling”.

  • result_unit (str) – If provided, the results will be converted to this unit.

  • calculate_net_utility (bool) – Whether to calculate the net utility usage (e.g., subtract the amount produced by some units such as CHP).

Examples

>>> from qsdsan.utils import create_example_system, sum_system_utility
>>> sys = create_example_system()
>>> sys.simulate()
>>> sum_system_utility(sys, utility='heating', result_unit='kJ/yr') 
463479...
>>> sum_system_utility(sys, utility='cooling', result_unit='GJ/yr') 
0.0
>>> # Exclude a certain unit
>>> sum_system_utility(sys, utility='power') 
0.9157...
>>> sum_system_utility(sys, utility='power', exclude_units=(sys.units[0],)) 
0.6612...