Add formula for vehicle and machine classes

This commit is contained in:
Alireza Adli 2024-06-26 15:16:54 -04:00
parent b5d8053deb
commit 0329c3a9a2
2 changed files with 50 additions and 5 deletions

View File

@ -8,10 +8,6 @@ Mohammad Reza Seyedabadi mohammad.seyedabadi@mail.concordia.ca
class Machine: class Machine:
"""
Machine class
"""
def __init__(self, machine_id, name, work_efficiency_rate, def __init__(self, machine_id, name, work_efficiency_rate,
work_efficiency_unit, energy_consumption_rate, work_efficiency_unit, energy_consumption_rate,
energy_consumption_unit, emission_factor, energy_consumption_unit, emission_factor,
@ -65,3 +61,9 @@ class Machine:
""":return: str""" """:return: str"""
return self._emission_unit return self._emission_unit
def total_machine_emssion(self):
""":return: float"""
return self._work_efficiency_rate * \
self._energy_consumption_rate * \
self._emission_factor

View File

@ -8,4 +8,47 @@ Mohammad Reza Seyedabadi mohammad.seyedabadi@mail.concordia.ca
class Vehicle: class Vehicle:
pass def __init__(self, vehicle_id, name, fuel_consumption_rate,
fuel_consumption_unit, carbon_emission_factor,
carbon_emission_unit):
self._vehicle_id = vehicle_id
self._name = name
self._fuel_consumption_rate = fuel_consumption_rate
self._fuel_consumption_unit = fuel_consumption_unit
self._carbon_emission_factor = carbon_emission_factor
self._carbon_emission_unit = carbon_emission_unit
@property
def id(self):
""":return: int"""
return self._vehicle_id
@property
def name(self):
""":return: str"""
return self._name
@property
def fuel_consumption_rate(self):
""":return: float"""
return self._fuel_consumption_rate
@property
def fuel_consumption_unit(self):
""":return: str"""
return self._fuel_consumption_unit
@property
def carbon_emission_factor(self):
""":return: float"""
return self._carbon_emission_factor
@property
def carbon_emission_unit(self):
""":return: str"""
return self._carbon_emission_unit
def total_vehicle_emission(self):
""":return: float"""
return self._fuel_consumption_rate * self._carbon_emission_factor