updating how we simulate the impact of floor insultion

This commit is contained in:
Khalim Conn-Kowlessar 2024-02-06 21:46:02 +00:00
parent 5bd6366ad2
commit 69d53c85f9
6 changed files with 65 additions and 9 deletions

2
.idea/Model.iml generated
View file

@ -7,7 +7,7 @@
<sourceFolder url="file://$MODULE_DIR$/open_uprn" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/recommendations" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="Python 3.10 (model_data)" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.10 (backend)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyNamespacePackagesService">

2
.idea/misc.xml generated
View file

@ -3,7 +3,7 @@
<component name="Black">
<option name="sdkName" value="Python 3.10 (backend)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (model_data)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (backend)" project-jdk-type="Python SDK" />
<component name="PythonCompatibilityInspectionAdvertiser">
<option name="version" value="3" />
</component>

View file

@ -197,10 +197,11 @@ class Property:
if len(recommendation["parts"]) > 1:
raise NotImplementedError("Have more than 1 floor insulation part - handle this case")
recommendation_record["floor_thermal_transmittance_ending"] = recommendation["new_u_value"]
# recommendation_record["floor_thermal_transmittance_ending"] = recommendation["new_u_value"]
# We don't really see above average for this in the training data
recommendation_record["floor_insulation_thickness_ending"] = "average"
recommendation_record["floor_energy_eff_ending"] = "Good"
# This is rarely ever populated in the training data
# recommendation_record["floor_energy_eff_ending"] = "Good"
else:
if recommendation_record["floor_thermal_transmittance_ending"] is None:
raise ValueError("We should not have a None value for the u value")

View file

@ -75,8 +75,8 @@ def sap_to_epc(sap_points: int | float):
:return:
"""
if sap_points <= 0 or sap_points > 100:
raise ValueError("SAP points should be between 1 and 100.")
if sap_points <= 0:
raise ValueError("SAP points should be above 0.")
if sap_points >= 92:
return "A"

View file

@ -0,0 +1,55 @@
"""
This script will create an input csv for the recommendation engine and upload it to S3, which can be used for
testing
"""
import pandas as pd
from utils.s3 import save_csv_to_s3
USER_ID = 8
PORTFOLIO_ID = 62
def app():
"""
This portfolio contains propertyies that we have demo'd in pilots, or properties that were provided to us
as proprties that are being treated under funding scehemes and we have pre/post EPRs for
:return:
"""
test_file = pd.DataFrame(
[
# Pilot properties
{'address': '113 Tenby Road', 'postcode': 'B13 9LT', 'Notes': ''},
{'address': '139 School Road', 'postcode': 'B28 8JF', 'Notes': ''},
{'address': '77 Simmons Drive', 'postcode': 'B32 1SL', 'Notes': ''},
{'address': 'Flat 2, 54 Wedgewood Road', 'postcode': 'B32 1LS', 'Notes': ''},
# Warmfront ECO4 Properties
{'address': '73 Long Chaulden', 'postcode': 'HP1 2HX', 'Notes': ''},
{'address': '8 Lindlings', 'postcode': 'HP1 2HA', 'Notes': ''},
{'address': '44 Lindlings', 'postcode': 'HP1 2HE', 'Notes': ''},
{'address': '46 Chaulden Terrace', 'postcode': 'HP1 2AN', 'Notes': ''},
# Osmosis SHDF Properties
{'address': '4, Heather Shaw', 'postcode': 'BA14 7JS', 'Notes': ''},
{'address': '16 Glastonbury Road', 'postcode': 'M32 9PE', 'Notes': ''},
{'address': '31 Loddon Way', 'postcode': 'BA15 1HG', 'Notes': ''},
{'address': '62 Pearmain Drive', 'postcode': 'NG3 3DJ', 'Notes': ''},
]
)
# Store the data in s3
filename = f"{USER_ID}/{PORTFOLIO_ID}/eco4_shdf_retrofits.csv"
save_csv_to_s3(
dataframe=test_file,
bucket_name="retrofit-plan-inputs-dev",
file_name=filename
)
body = {
"portfolio_id": str(PORTFOLIO_ID),
"housing_type": "Social",
"goal": "Increase EPC",
"goal_value": "A",
"trigger_file_path": filename
}
print(body)

View file

@ -5,8 +5,8 @@ from recommendations.Costs import Costs
class SolarPvRecommendations:
# Approximate area of the solar panels
SOLAR_PANEL_AREA = 1.6
# Wattage per panel
SOLAR_PANEL_WATTAGE = 360
# Wattage per panel - this is based on the average wattage of a solar panel being between 250w and 420w
SOLAR_PANEL_WATTAGE = 250
def __init__(self, property_instance):
"""
@ -47,7 +47,7 @@ class SolarPvRecommendations:
# of solar PV installations
cost_result = self.costs.solar_pv(wattage=solar_panel_wattage)
kw = int(np.round(solar_panel_wattage / 1000))
kw = np.floor(solar_panel_wattage / 100) / 10
self.recommendation = [
{