mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
fixed solar tests & added additional description to wall map
This commit is contained in:
parent
36e963c7aa
commit
2142bb7843
2 changed files with 27 additions and 23 deletions
|
|
@ -71,6 +71,7 @@ class WallRecommendations(Definitions):
|
||||||
"Timber frame, as built, no insulation": "Timber frame, with external insulation",
|
"Timber frame, as built, no insulation": "Timber frame, with external insulation",
|
||||||
'Timber frame, as built, partial insulation': 'Timber frame, with external insulation',
|
'Timber frame, as built, partial insulation': 'Timber frame, with external insulation',
|
||||||
"Sandstone or limestone, as built, no insulation": "Sandstone or limestone, with external insulation",
|
"Sandstone or limestone, as built, no insulation": "Sandstone or limestone, with external insulation",
|
||||||
|
"Sandstone or limestone, as built, partial insulation": "Sandstone or limestone, with external insulation",
|
||||||
"Sandstone, as built, no insulation": "Sandstone, with external insulation",
|
"Sandstone, as built, no insulation": "Sandstone, with external insulation",
|
||||||
"Sandstone, as built, partial insulation": "Sandstone, with external insulation",
|
"Sandstone, as built, partial insulation": "Sandstone, with external insulation",
|
||||||
}
|
}
|
||||||
|
|
@ -88,6 +89,7 @@ class WallRecommendations(Definitions):
|
||||||
"Timber frame, as built, no insulation": "Timber frame, with internal insulation",
|
"Timber frame, as built, no insulation": "Timber frame, with internal insulation",
|
||||||
'Timber frame, as built, partial insulation': 'Timber frame, with internal insulation',
|
'Timber frame, as built, partial insulation': 'Timber frame, with internal insulation',
|
||||||
"Sandstone or limestone, as built, no insulation": "Sandstone or limestone, with internal insulation",
|
"Sandstone or limestone, as built, no insulation": "Sandstone or limestone, with internal insulation",
|
||||||
|
"Sandstone or limestone, as built, partial insulation": "Sandstone or limestone, with internal insulation",
|
||||||
"Sandstone, as built, no insulation": "Sandstone, with internal insulation",
|
"Sandstone, as built, no insulation": "Sandstone, with internal insulation",
|
||||||
"Sandstone, as built, partial insulation": "Sandstone, with internal insulation",
|
"Sandstone, as built, partial insulation": "Sandstone, with internal insulation",
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
import pytest
|
|
||||||
from recommendations.SolarPvRecommendations import SolarPvRecommendations
|
|
||||||
from backend.Property import Property
|
|
||||||
from etl.epc.Record import EPCRecord
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import pytest
|
||||||
|
from backend.Property import Property
|
||||||
|
from etl.epc.Record import EPCRecord
|
||||||
|
from recommendations.tests.test_data.materials import materials
|
||||||
|
from recommendations.SolarPvRecommendations import SolarPvRecommendations
|
||||||
|
|
||||||
|
|
||||||
class TestSolarPvRecommendations:
|
class TestSolarPvRecommendations:
|
||||||
|
|
@ -16,6 +17,7 @@ class TestSolarPvRecommendations:
|
||||||
}
|
}
|
||||||
property_instance_invalid_type = Property(id=1, address="", postcode="", epc_record=epc_record)
|
property_instance_invalid_type = Property(id=1, address="", postcode="", epc_record=epc_record)
|
||||||
property_instance_invalid_type.roof = {"is_flat": False, "is_pitched": False, "is_roof_room": False}
|
property_instance_invalid_type.roof = {"is_flat": False, "is_pitched": False, "is_roof_room": False}
|
||||||
|
property_instance_invalid_type.already_installed = []
|
||||||
return property_instance_invalid_type
|
return property_instance_invalid_type
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
@ -29,6 +31,7 @@ class TestSolarPvRecommendations:
|
||||||
property_instance_invalid_roof.roof = {
|
property_instance_invalid_roof.roof = {
|
||||||
"is_flat": False, "is_pitched": False, "is_roof_room": False, "thermal_transmittance": None
|
"is_flat": False, "is_pitched": False, "is_roof_room": False, "thermal_transmittance": None
|
||||||
}
|
}
|
||||||
|
property_instance_invalid_roof.already_installed = []
|
||||||
return property_instance_invalid_roof
|
return property_instance_invalid_roof
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
@ -39,6 +42,7 @@ class TestSolarPvRecommendations:
|
||||||
"property-type": "House"}
|
"property-type": "House"}
|
||||||
property_instance_has_solar_pv = Property(id=1, address="", postcode="", epc_record=epc_record)
|
property_instance_has_solar_pv = Property(id=1, address="", postcode="", epc_record=epc_record)
|
||||||
property_instance_has_solar_pv.roof = {"is_flat": True, "thermal_transmittance": None}
|
property_instance_has_solar_pv.roof = {"is_flat": True, "thermal_transmittance": None}
|
||||||
|
property_instance_has_solar_pv.already_installed = []
|
||||||
return property_instance_has_solar_pv
|
return property_instance_has_solar_pv
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
@ -50,6 +54,7 @@ class TestSolarPvRecommendations:
|
||||||
property_instance_valid_all.roof_area = 40
|
property_instance_valid_all.roof_area = 40
|
||||||
property_instance_valid_all.number_of_floors = 2
|
property_instance_valid_all.number_of_floors = 2
|
||||||
property_instance_valid_all.roof = {"is_flat": True, "thermal_transmittance": None}
|
property_instance_valid_all.roof = {"is_flat": True, "thermal_transmittance": None}
|
||||||
|
property_instance_valid_all.already_installed = []
|
||||||
property_instance_valid_all.solar_panel_configuration = {
|
property_instance_valid_all.solar_panel_configuration = {
|
||||||
"panel_performance": pd.DataFrame(
|
"panel_performance": pd.DataFrame(
|
||||||
[
|
[
|
||||||
|
|
@ -66,35 +71,32 @@ class TestSolarPvRecommendations:
|
||||||
return property_instance_valid_all
|
return property_instance_valid_all
|
||||||
|
|
||||||
def test_invalid_property_type(self, property_instance_invalid_type):
|
def test_invalid_property_type(self, property_instance_invalid_type):
|
||||||
solar_pv = SolarPvRecommendations(property_instance_invalid_type)
|
solar_pv = SolarPvRecommendations(property_instance_invalid_type, materials=materials)
|
||||||
solar_pv.recommend(phase=0)
|
solar_pv.recommend(phase=0)
|
||||||
assert not solar_pv.recommendation
|
assert not solar_pv.recommendation
|
||||||
|
|
||||||
def test_invalid_roof_type(self, property_instance_invalid_roof):
|
def test_invalid_roof_type(self, property_instance_invalid_roof):
|
||||||
solar_pv = SolarPvRecommendations(property_instance_invalid_roof)
|
solar_pv = SolarPvRecommendations(property_instance_invalid_roof, materials=materials)
|
||||||
solar_pv.recommend(phase=0)
|
solar_pv.recommend(phase=0)
|
||||||
assert not solar_pv.recommendation
|
assert not solar_pv.recommendation
|
||||||
|
|
||||||
def test_existing_solar_pv(self, property_instance_has_solar_pv):
|
def test_existing_solar_pv(self, property_instance_has_solar_pv):
|
||||||
solar_pv = SolarPvRecommendations(property_instance_has_solar_pv)
|
solar_pv = SolarPvRecommendations(property_instance_has_solar_pv, materials=materials)
|
||||||
solar_pv.recommend(phase=0)
|
solar_pv.recommend(phase=0)
|
||||||
assert not solar_pv.recommendation
|
assert not solar_pv.recommendation
|
||||||
|
|
||||||
def test_valid_all_conditions(self, property_instance_valid_all):
|
def test_valid_all_conditions(self, property_instance_valid_all):
|
||||||
solar_pv = SolarPvRecommendations(property_instance_valid_all)
|
solar_pv = SolarPvRecommendations(property_instance_valid_all, materials=materials)
|
||||||
solar_pv.recommend(phase=0)
|
solar_pv.recommend(phase=0)
|
||||||
assert len(solar_pv.recommendation) == 2
|
assert len(solar_pv.recommendation) == 11
|
||||||
assert solar_pv.recommendation == [
|
assert solar_pv.recommendation[0]["description"] == '10 panel system, 400W solar panels - 4.0 kWp system'
|
||||||
{'phase': 0, 'parts': [], 'type': 'solar_pv', 'measure_type': 'solar_pv',
|
assert not solar_pv.recommendation[0]["has_battery"]
|
||||||
'description': 'Install a 4.0 kilowatt-peak (kWp) solar panel system.', 'starting_u_value': None,
|
assert solar_pv.recommendation[0]["initial_ac_kwh_per_year"] == np.int64(3800)
|
||||||
'new_u_value': None, 'sap_points': np.float64(10.0), 'already_installed': False,
|
assert solar_pv.recommendation[0]["description_simulation"] == {'photo-supply': np.float64(50.0)}
|
||||||
'total': 6013.139999999999, 'subtotal': 5010.95, 'vat': 0, 'labour_hours': 48, 'labour_days': 2,
|
assert solar_pv.recommendation[0]["simulation_config"] == {'photo_supply_ending': np.float64(50.0)}
|
||||||
'photo_supply': np.float64(50.0), 'has_battery': False, 'initial_ac_kwh_per_year': np.int64(3800),
|
|
||||||
'description_simulation': {'photo-supply': np.float64(50.0)}},
|
assert (
|
||||||
{'phase': 0, 'parts': [], 'type': 'solar_pv', 'measure_type': 'solar_pv',
|
solar_pv.recommendation[1]["description"] ==
|
||||||
'description': 'Install a 4.0 kilowatt-peak (kWp) solar panel system, with a battery.',
|
'10 panel system, 400W solar panels, 5.8kw Growatt battery - 4.0 kWp system'
|
||||||
'starting_u_value': None, 'new_u_value': None, 'sap_points': np.float64(10.0), 'already_installed': False,
|
)
|
||||||
'total': 10537.008, 'subtotal': 8780.84, 'vat': 0, 'labour_hours': 48, 'labour_days': 2,
|
assert solar_pv.recommendation[1]["has_battery"]
|
||||||
'photo_supply': np.float64(50.0), 'has_battery': True, 'initial_ac_kwh_per_year': np.int64(3800),
|
|
||||||
'description_simulation': {'photo-supply': np.float64(50.0)}}
|
|
||||||
]
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue