Transportation

class qsdsan.Transportation(ID='', linked_unit=None, item=None, load_type='mass', load=1.0, load_unit='kg', distance=1.0, distance_unit='km', interval=1.0, interval_unit='hr')

Transportation activity for cost and environmental impact calculations.

Parameters:
  • ID (str) – ID of this transportation activity, a default ID will be given if not provided. If this transportation activity is linked to a unit, then the actual ID will be {unit.ID}_{ID}.

  • linked_unit (obj) – Unit that this transportation activity is linked to, can be left as None.

  • item (ImpactItem) – Impact item associated with this transportation activity.

  • load_type (str) – Can be either ‘mass’ or ‘volume’.

  • load (float) – Quantity of the load per trip.

  • load_unit (str) – Unit of the load.

  • distance (float) – Distance per trip.

  • distance_unit (str) – Unit of the distance.

  • interval (float) – Distance per trip.

  • interval_unit (str) – Unit of the transportation interval.

Examples

>>> import qsdsan as qs
>>> # Make impact indicator
>>> GWP = qs.ImpactIndicator('GlobalWarming', alias='GWP', unit='kg CO2-eq')
>>> FEC = qs.ImpactIndicator('FossilEnergyConsumption', alias='FEC', unit='MJ')
>>> # Assuming transporting 1 kg of goods for 1 km emits 10 kg CO2-eq
>>> Trucking = qs.ImpactItem('Trucking', 'kg*km', GWP=10, FEC=5)
>>> # Make a transportation activity for transporting 1000 kg goods for 1 mile every day
>>> shipping = qs.Transportation('shipping', item=Trucking,
...                              load_type='mass', load=1, load_unit='tonne',
...                              distance='1', distance_unit='mile',
...                              interval='1', interval_unit='day')
>>> shipping.show()
Transportation: shipping
Impact item   : Trucking [per trip]
Load          : 1000 kg
Distance      : 1.61 km
Interval      : 24 hr
Total cost    : None USD
Total impacts :
                              Impacts
GlobalWarming (kg CO2-eq)    1.61e+04
FossilEnergyConsumption (MJ) 8.05e+03
>>> # Registry management (transportation activities will be auto-registered)
>>> shipping.deregister()
The transportation activity "shipping" has been removed from the registry.
>>> shipping.register()
The transportation activity "shipping" has been added to the registry.
>>> Transportation.clear_registry()
All transportation activities have been removed from the registry.
property ID

Unique identification (str). If set as ‘’, it will choose a default ID.

classmethod clear_registry(print_msg=True)

Remove all existing transportation activities from the registry.

property cost

[float] Total cost per trip.

deregister(print_msg=True)

Remove this transportation activity to the registry.

property distance

[float] Transportation distance each trip.

Note

Set this to 1 and let the distance_unit match the functional unit of the item if distance does not affect price and impacts.

property impacts

[dict] Total impacts of this transportation item.

property indicators

[tuple] Impact indicators associated with the transportation item.

property interval

[float] Time between trips.

property item

[ImpactItem] Item associated with this transportation activity.

property linked_unit

SanUnit The unit that this transportation activity belongs to.

Note

This property will be updated upon initialization of the unit.

property load

[float] Transportation load each trip.

Note

Set this to 1 and let the load_unit match the functional unit of the item if load does not affect price and impacts.

property load_type

[str] Either “mass” or “volume”.

property price

[float] Unit price of the item.

property quantity

[float] Quantity of item functional unit.

register(print_msg=True)

Add this transportation activity to the registry.