import pandas as pd from BaseUtility import Definitions from backend.Property import Property class VentilationRecommendations(Definitions): """ For properties that do not have ventilation, we recommend installing ventilaion This is particularly important for properties that have insulated walls and is also crucial for prevent overheating risks in warmer months """ VENTILATION_DESCRIPTIONS = [ 'mechanical, extract only', 'mechanical, supply and extract' ] # We introduce a SAP limit, to prevent over-predicting the SAP impact of mechanical ventilation SAP_LIMIT = 2 def __init__( self, property_instance: Property, materials ): self.property = property_instance self.has_ventilaion = None self.recommendation = None self.materials = [part for part in materials if part["type"] == "mechanical_ventilation"] def identify_ventilation(self): self.has_ventilaion = self.property.data["mechanical-ventilation"] in self.VENTILATION_DESCRIPTIONS def recommend(self): """ If there is no ventilation, we recommend installing ventilation Generally, best practice is to install controlled ventilation for insulated walls so we still recommend ventilation if there is natural ventilation :return: """ self.identify_ventilation() if self.has_ventilaion: return if len(self.materials) != 1: raise NotImplementedError("Only handled the case of having one venilation option") # We recommend installing 2 units n_units = 2 part = self.materials.copy() estimated_cost = n_units * part[0]["cost"] part[0]["total"] = estimated_cost part[0]["quantity"] = n_units part[0]["quantity_unit"] = "part" # We recommend installing two mechanical ventilation systems self.recommendation = [ { "parts": part, "type": part[0]["type"], "description": f"Install {n_units} {part[0]['description']} units", "starting_u_value": None, "new_u_value": None, "sap_points": None, "total": estimated_cost, # We use a very simple and rough estimate of 4 hours per unit "labour_hours": 4 * n_units, "labour_days": 4 * n_units / 8.0 # Assume 8 hour day } ]