mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
commit
f27a43b8c4
13 changed files with 469 additions and 262 deletions
27
.github/workflows/_deploy_lambda.yml
vendored
27
.github/workflows/_deploy_lambda.yml
vendored
|
|
@ -42,6 +42,18 @@ on:
|
|||
required: true
|
||||
AWS_REGION:
|
||||
required: true
|
||||
TF_VAR_api_key:
|
||||
required: false
|
||||
TF_VAR_secret_key:
|
||||
required: false
|
||||
TF_VAR_domain_name:
|
||||
required: false
|
||||
TF_VAR_epc_auth_token:
|
||||
required: false
|
||||
TF_VAR_google_solar_api_key:
|
||||
required: false
|
||||
TF_VAR_predictions_bucket:
|
||||
required: false
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
|
|
@ -90,6 +102,13 @@ jobs:
|
|||
|
||||
- name: Terraform Plan
|
||||
working-directory: ${{ inputs.lambda_path }}
|
||||
env:
|
||||
TF_VAR_api_key: ${{ secrets.TF_VAR_api_key }}
|
||||
TF_VAR_secret_key: ${{ secrets.TF_VAR_secret_key }}
|
||||
TF_VAR_domain_name: ${{ secrets.TF_VAR_domain_name }}
|
||||
TF_VAR_epc_auth_token: ${{ secrets.TF_VAR_epc_auth_token }}
|
||||
TF_VAR_google_solar_api_key: ${{ secrets.TF_VAR_google_solar_api_key }}
|
||||
TF_VAR_predictions_bucket: ${{ secrets.TF_VAR_predictions_bucket }}
|
||||
run: |
|
||||
terraform plan \
|
||||
-var="stage=${{ inputs.stage }}" \
|
||||
|
|
@ -106,10 +125,16 @@ jobs:
|
|||
- name: Terraform Destroy
|
||||
if: inputs.terraform_destroy == 'true' && inputs.terraform_apply != 'true'
|
||||
working-directory: ${{ inputs.lambda_path }}
|
||||
env:
|
||||
TF_VAR_api_key: ${{ secrets.TF_VAR_api_key }}
|
||||
TF_VAR_secret_key: ${{ secrets.TF_VAR_secret_key }}
|
||||
TF_VAR_domain_name: ${{ secrets.TF_VAR_domain_name }}
|
||||
TF_VAR_epc_auth_token: ${{ secrets.TF_VAR_epc_auth_token }}
|
||||
TF_VAR_google_solar_api_key: ${{ secrets.TF_VAR_google_solar_api_key }}
|
||||
TF_VAR_predictions_bucket: ${{ secrets.TF_VAR_predictions_bucket }}
|
||||
run: |
|
||||
terraform destroy -auto-approve \
|
||||
-var="stage=${{ inputs.stage }}" \
|
||||
-var="lambda_name=${{ inputs.lambda_name }}" \
|
||||
-var="ecr_repo_url=${{ steps.repo.outputs.ecr_repo_url }}" \
|
||||
-var="image_digest=${{ inputs.image_digest }}"
|
||||
|
||||
|
|
|
|||
33
.github/workflows/deploy_terraform.yml
vendored
33
.github/workflows/deploy_terraform.yml
vendored
|
|
@ -241,4 +241,37 @@ jobs:
|
|||
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
|
||||
AWS_REGION: ${{ secrets.DEV_AWS_REGION }}
|
||||
|
||||
# ============================================================
|
||||
# Ara Engine image and Push
|
||||
# ============================================================
|
||||
ara_engine_image:
|
||||
needs: [determine_stage, shared_terraform]
|
||||
uses: ./.github/workflows/_build_image.yml
|
||||
with:
|
||||
ecr_repo: engine-${{ needs.determine_stage.outputs.stage }}
|
||||
dockerfile_path: backend/docker/engine.Dockerfile
|
||||
build_context: .
|
||||
|
||||
# ============================================================
|
||||
# Deploy Categorisation Lambda
|
||||
# ============================================================
|
||||
ara_engine_lambda:
|
||||
needs: [ara_engine_image, determine_stage]
|
||||
uses: ./.github/workflows/_deploy_lambda.yml
|
||||
with:
|
||||
lambda_name: ara_engine
|
||||
lambda_path: infrastructure/terraform/lambda/engine
|
||||
stage: ${{ needs.determine_stage.outputs.stage }}
|
||||
ecr_repo: engine-${{ needs.determine_stage.outputs.stage }}
|
||||
image_digest: ${{ needs.ara_engine_image.outputs.image_digest }}
|
||||
terraform_apply: ${{ needs.determine_stage.outputs.terraform_apply }}
|
||||
secrets:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
|
||||
AWS_REGION: ${{ secrets.DEV_AWS_REGION }}
|
||||
TF_VAR_api_key: ${{ secrets.DEV_API_KEY }}
|
||||
TF_VAR_secret_key: ${{ secrets.DEV_SECRET_KEY }}
|
||||
TF_VAR_domain_name: ${{ secrets.DEV_DOMAIN_NAME }}
|
||||
TF_VAR_epc_auth_token: ${{ secrets.DEV_EPC_AUTH_TOKEN }}
|
||||
TF_VAR_google_solar_api_key: ${{ secrets.DEV_GOOGLE_SOLAR_API_KEY }}
|
||||
TF_VAR_predictions_bucket: ${{ secrets.DEV_PREDICTIONS_BUCKET }}
|
||||
|
|
@ -12,6 +12,10 @@ WALL_INSULATION_MEASURES = ["internal_wall_insulation", "external_wall_insulatio
|
|||
ROOF_INSULATION_MEASURES = [
|
||||
"loft_insulation", "flat_roof_insulation", "room_roof_insulation", "sloping_ceiling_insulation"
|
||||
]
|
||||
WALL_INSULATION_WITH_VENTILATION_MEASURES = [
|
||||
"internal_wall_insulation+mechanical_ventilation", "external_wall_insulation+mechanical_ventilation",
|
||||
"cavity_wall_insulation+mechanical_ventilation"
|
||||
]
|
||||
|
||||
# Both all and roof insulaiton measures are eligible for ECO4. These are the remaining fabric and heating measures
|
||||
# This is based on th measures we have recommendations for
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ module "lambda" {
|
|||
# Optional: Set maximum_concurrency to limit concurrent SQS-triggered invocations (2-1000)
|
||||
maximum_concurrency = var.maximum_concurrency
|
||||
|
||||
batch_size = var.batch_size
|
||||
|
||||
environment = {
|
||||
STAGE = var.stage
|
||||
LOG_LEVEL = "info"
|
||||
|
|
|
|||
|
|
@ -23,6 +23,11 @@ variable "maximum_concurrency" {
|
|||
description = "Maximum number of concurrent Lambda invocations from SQS (2-1000). null = no limit."
|
||||
}
|
||||
|
||||
variable "batch_size" {
|
||||
type = number
|
||||
default = 1
|
||||
}
|
||||
|
||||
locals {
|
||||
image_uri = "${var.ecr_repo_url}@${var.image_digest}"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ module "lambda" {
|
|||
|
||||
name = "categorisation"
|
||||
stage = var.stage
|
||||
|
||||
image_uri = local.image_uri
|
||||
|
||||
maximum_concurrency = var.maximum_concurrency
|
||||
batch_size = var.batch_size
|
||||
|
||||
environment = merge(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,6 +23,11 @@ variable "maximum_concurrency" {
|
|||
description = "Maximum number of concurrent Lambda invocations from SQS (2-1000). null = no limit."
|
||||
}
|
||||
|
||||
variable "batch_size" {
|
||||
type = number
|
||||
default = 2
|
||||
}
|
||||
|
||||
locals {
|
||||
image_uri = "${var.ecr_repo_url}@${var.image_digest}"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,15 @@ data "terraform_remote_state" "shared" {
|
|||
}
|
||||
}
|
||||
|
||||
data "aws_secretsmanager_secret_version" "db_credentials" {
|
||||
secret_id = "${var.stage}/assessment_model/db_credentials"
|
||||
}
|
||||
|
||||
locals {
|
||||
db_credentials = jsondecode(data.aws_secretsmanager_secret_version.db_credentials.secret_string)
|
||||
}
|
||||
|
||||
|
||||
module "lambda" {
|
||||
source = "../modules/lambda_with_sqs"
|
||||
|
||||
|
|
@ -18,8 +27,49 @@ module "lambda" {
|
|||
# Optional: Set maximum_concurrency to limit concurrent SQS-triggered invocations (2-1000)
|
||||
maximum_concurrency = var.maximum_concurrency
|
||||
|
||||
environment = {
|
||||
STAGE = var.stage
|
||||
LOG_LEVEL = "info"
|
||||
}
|
||||
environment = merge(
|
||||
{
|
||||
STAGE = var.stage
|
||||
LOG_LEVEL = "info"
|
||||
|
||||
# DB from Secrets Manager
|
||||
DB_USERNAME = local.db_credentials.db_assessment_model_username
|
||||
DB_PASSWORD = local.db_credentials.db_assessment_model_password
|
||||
|
||||
# Secrets from GitHub
|
||||
DB_HOST = var.db_host
|
||||
DB_NAME = var.db_name
|
||||
DB_PORT = var.db_port
|
||||
API_KEY = var.api_key
|
||||
SECRET_KEY = var.secret_key
|
||||
DOMAIN_NAME = var.domain_name
|
||||
EPC_AUTH_TOKEN = var.epc_auth_token
|
||||
GOOGLE_SOLAR_API_KEY = var.google_solar_api_key
|
||||
PREDICTIONS_BUCKET = var.predictions_bucket
|
||||
|
||||
# Buckets - from terraform state
|
||||
PLAN_TRIGGER_BUCKET = data.terraform_remote_state.shared.outputs.retrofit_plan_trigger_bucket_name
|
||||
DATA_BUCKET = data.terraform_remote_state.shared.outputs.retrofit_sap_data_bucket_name
|
||||
SAP_PREDICTIONS_BUCKET = data.terraform_remote_state.shared.outputs.retrofit_sap_predictions_bucket_name
|
||||
CARBON_PREDICTIONS_BUCKET = data.terraform_remote_state.shared.outputs.retrofit_carbon_predictions_bucket_name
|
||||
HEAT_PREDICTIONS_BUCKET = data.terraform_remote_state.shared.outputs.retrofit_heat_predictions_bucket_name
|
||||
HEATING_KWH_PREDICTIONS_BUCKET = data.terraform_remote_state.shared.outputs.retrofit_heating_kwh_predictions_bucket_name
|
||||
HOTWATER_KWH_PREDICTIONS_BUCKET = data.terraform_remote_state.shared.outputs.retrofit_hotwater_kwh_predictions_bucket_name
|
||||
ENERGY_ASSESSMENTS_BUCKET = data.terraform_remote_state.shared.outputs.retrofit_energy_assessments_bucket_name
|
||||
|
||||
# SQS
|
||||
ENGINE_SQS_URL = module.lambda.sqs_queue_url
|
||||
|
||||
# Deployment
|
||||
ECR_URI = var.ecr_repo_url
|
||||
GITHUB_SHA = var.image_digest
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
### Policies and IAM
|
||||
# S3
|
||||
resource "aws_iam_role_policy_attachment" "engine_s3_read_and_write" {
|
||||
role = module.lambda.role_name
|
||||
policy_arn = data.terraform_remote_state.shared.outputs.engine_s3_read_and_write_arn
|
||||
}
|
||||
|
|
@ -23,10 +23,46 @@ variable "maximum_concurrency" {
|
|||
description = "Maximum number of concurrent Lambda invocations from SQS (2-1000). null = no limit."
|
||||
}
|
||||
|
||||
variable "api_key" {
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "secret_key" {
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "domain_name" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "epc_auth_token" {
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "google_solar_api_key" {
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "plan_trigger_bucket" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "data_bucket" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "predictions_bucket" {
|
||||
type = string
|
||||
}
|
||||
|
||||
locals {
|
||||
image_uri = "${var.ecr_repo_url}@${var.image_digest}"
|
||||
}
|
||||
|
||||
output "resolved_image_uri" {
|
||||
value = local.image_uri
|
||||
}
|
||||
}
|
||||
|
|
@ -102,6 +102,11 @@ module "s3_presignable_bucket" {
|
|||
allowed_origins = var.allowed_origins
|
||||
}
|
||||
|
||||
output "retrofit_plan_trigger_bucket_name" {
|
||||
value = module.s3_presignable_bucket.bucket_name
|
||||
description = "Name of the retrofit plan trigger bucket"
|
||||
}
|
||||
|
||||
module "s3_due_considerations_bucket" {
|
||||
source = "../modules/s3_presignable_bucket"
|
||||
bucketname = "retrofit-due-considerations-${var.stage}"
|
||||
|
|
@ -134,6 +139,11 @@ module "retrofit_sap_predictions" {
|
|||
allowed_origins = var.allowed_origins
|
||||
}
|
||||
|
||||
output "retrofit_sap_predictions_bucket_name" {
|
||||
value = module.retrofit_sap_predictions.bucket_name
|
||||
description = "Name of the retrofit SAP predictions bucket"
|
||||
}
|
||||
|
||||
module "retrofit_sap_data" {
|
||||
source = "../modules/s3"
|
||||
bucketname = "retrofit-data-${var.stage}"
|
||||
|
|
@ -151,12 +161,22 @@ module "retrofit_carbon_predictions" {
|
|||
allowed_origins = var.allowed_origins
|
||||
}
|
||||
|
||||
output "retrofit_carbon_predictions_bucket_name" {
|
||||
value = module.retrofit_carbon_predictions.bucket_name
|
||||
description = "Name of the retrofit carbon predictions bucket"
|
||||
}
|
||||
|
||||
module "retrofit_heat_predictions" {
|
||||
source = "../modules/s3"
|
||||
bucketname = "retrofit-heat-predictions-${var.stage}"
|
||||
allowed_origins = var.allowed_origins
|
||||
}
|
||||
|
||||
output "retrofit_heat_predictions_bucket_name" {
|
||||
value = module.retrofit_heat_predictions.bucket_name
|
||||
description = "Name of the retrofit heat predictions bucket"
|
||||
}
|
||||
|
||||
module "retrofit_lighting_cost_predictions" {
|
||||
source = "../modules/s3"
|
||||
bucketname = "retrofit-lighting-cost-predictions-${var.stage}"
|
||||
|
|
@ -181,12 +201,22 @@ module "retrofit_heating_kwh_predictions" {
|
|||
allowed_origins = var.allowed_origins
|
||||
}
|
||||
|
||||
output "retrofit_heating_kwh_predictions_bucket_name" {
|
||||
value = module.retrofit_heating_kwh_predictions.bucket_name
|
||||
description = "Name of the retrofit heating kWh predictions bucket"
|
||||
}
|
||||
|
||||
module "retrofit_hotwater_kwh_predictions" {
|
||||
source = "../modules/s3"
|
||||
bucketname = "retrofit-hotwater-kwh-predictions-${var.stage}"
|
||||
allowed_origins = var.allowed_origins
|
||||
}
|
||||
|
||||
output "retrofit_hotwater_kwh_predictions_bucket_name" {
|
||||
value = module.retrofit_hotwater_kwh_predictions.bucket_name
|
||||
description = "Name of the retrofit hotwater kWh predictions bucket"
|
||||
}
|
||||
|
||||
module "retrofit_sap_baseline_predictions" {
|
||||
source = "../modules/s3"
|
||||
bucketname = "retrofit-sap-baseline-predictions-${var.stage}"
|
||||
|
|
@ -201,6 +231,11 @@ module "retrofit_energy_assessments" {
|
|||
environment = var.stage
|
||||
}
|
||||
|
||||
output "retrofit_energy_assessments_bucket_name" {
|
||||
value = module.retrofit_energy_assessments.bucket_name
|
||||
description = "Name of the retrofit energy assessments bucket"
|
||||
}
|
||||
|
||||
# Set up the route53 record for the API
|
||||
module "route53" {
|
||||
source = "../modules/route53"
|
||||
|
|
@ -429,4 +464,28 @@ module "engine_registry" {
|
|||
source = "../modules/container_registry"
|
||||
name = "engine"
|
||||
stage = var.stage
|
||||
}
|
||||
}
|
||||
|
||||
# S3 policy for Engine to read and write from various S3 buckets
|
||||
module "engine_s3_read_and_write" {
|
||||
source = "../modules/s3_iam_policy"
|
||||
|
||||
policy_name = "EngineReadandWriteS3"
|
||||
policy_description = "Allow Engine Lambda to read from and write to various S3 buckets"
|
||||
bucket_arns = [
|
||||
"arn:aws:s3:::${module.s3_presignable_bucket.bucket_name}",
|
||||
"arn:aws:s3:::${module.retrofit_sap_data.bucket_name}",
|
||||
"arn:aws:s3:::${module.retrofit_sap_predictions.bucket_name}",
|
||||
"arn:aws:s3:::${module.retrofit_carbon_predictions.bucket_name}",
|
||||
"arn:aws:s3:::${module.retrofit_heat_predictions.bucket_name}",
|
||||
"arn:aws:s3:::${module.retrofit_heating_kwh_predictions.bucket_name}",
|
||||
"arn:aws:s3:::${module.retrofit_hotwater_kwh_predictions.bucket_name}",
|
||||
"arn:aws:s3:::${module.retrofit_energy_assessments.bucket_name}"
|
||||
]
|
||||
actions = ["s3:*"]
|
||||
resource_paths = ["/*"]
|
||||
}
|
||||
|
||||
output "engine_s3_read_and_write_arn" {
|
||||
value = module.engine_s3_read_and_write.policy_arn
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,7 +165,6 @@ class StrategicOptimiser:
|
|||
min_gain=self.target_gain,
|
||||
verbose=self.verbose
|
||||
)
|
||||
|
||||
opt.setup()
|
||||
opt.solve()
|
||||
|
||||
|
|
|
|||
|
|
@ -14,10 +14,9 @@ from typing import Mapping, Union
|
|||
from itertools import product
|
||||
|
||||
from backend.app.plan.schemas import (
|
||||
WALL_INSULATION_MEASURES, ROOF_INSULATION_MEASURES, ECO4_ELIGIBILE_FABRIC_MEASURES
|
||||
WALL_INSULATION_MEASURES, ROOF_INSULATION_MEASURES, ECO4_ELIGIBILE_FABRIC_MEASURES,
|
||||
WALL_INSULATION_WITH_VENTILATION_MEASURES
|
||||
)
|
||||
from recommendations.optimiser.CostOptimiser import CostOptimiser
|
||||
from recommendations.optimiser.GainOptimiser import GainOptimiser
|
||||
from recommendations.optimiser.StrategicOptimiser import StrategicOptimiser
|
||||
from utils.logger import setup_logger
|
||||
from backend.Funding import Funding
|
||||
|
|
@ -689,9 +688,10 @@ def optimise_with_scenarios(
|
|||
# - Only once the fabric has been upgraded, do we consider heating upgrades
|
||||
|
||||
# This should be wall insulation, roof insulation, floor insulation and windows
|
||||
fabric_measures = WALL_INSULATION_MEASURES + ROOF_INSULATION_MEASURES + ECO4_ELIGIBILE_FABRIC_MEASURES + [
|
||||
"internal_wall_insulation+mechanical_ventilation", "external_wall_insulation+mechanical_ventilation"
|
||||
]
|
||||
fabric_measures = (
|
||||
WALL_INSULATION_MEASURES + ROOF_INSULATION_MEASURES + ECO4_ELIGIBILE_FABRIC_MEASURES +
|
||||
WALL_INSULATION_WITH_VENTILATION_MEASURES
|
||||
)
|
||||
|
||||
fabric_only_measures = [
|
||||
[opt for opt in group if opt["type"] in fabric_measures] for group in optimisation_measures
|
||||
|
|
@ -751,11 +751,9 @@ def optimise_with_scenarios(
|
|||
# Scenario 1: Air source heat pump with required insulation
|
||||
# ------------------------------------------------------------------
|
||||
if enforce_heat_pump_insulation:
|
||||
# Wall measures could be IWI or EWI
|
||||
# Wall measures could be IWI, EWI or CWI
|
||||
remaining_wall_measures = [
|
||||
x for x in all_measure_types if x in WALL_INSULATION_MEASURES + [
|
||||
"internal_wall_insulation+mechanical_ventilation", "external_wall_insulation+mechanical_ventilation",
|
||||
]
|
||||
x for x in all_measure_types if x in WALL_INSULATION_MEASURES + WALL_INSULATION_WITH_VENTILATION_MEASURES
|
||||
]
|
||||
remaining_roof_measures = [x for x in all_measure_types if x in ROOF_INSULATION_MEASURES]
|
||||
|
||||
|
|
|
|||
|
|
@ -588,248 +588,30 @@ class TestCheckNeedsVentilation:
|
|||
class TestOptimiseWithScenarios:
|
||||
|
||||
def test_zero_gain(self, property_instance):
|
||||
input_measures = [[{'id': '0_phase=0', 'cost': 16901.01977922431, 'gain': np.float64(2.0),
|
||||
'type': 'internal_wall_insulation+mechanical_ventilation', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 16901.01977922431, 'raw_cost': 16341.019779224309,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 0}],
|
||||
[{'id': '1_phase=1', 'cost': 1197.0, 'gain': 0, 'type': 'loft_insulation',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 1197.0, 'raw_cost': 1197.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 0},
|
||||
{'id': '2_phase=1', 'cost': 1026.0, 'gain': 0, 'type': 'loft_insulation',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 1026.0, 'raw_cost': 1026.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 0},
|
||||
{'id': '3_phase=1', 'cost': 855.0, 'gain': 0, 'type': 'loft_insulation',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 855.0, 'raw_cost': 855.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 0}],
|
||||
[{'id': '5_phase=3', 'cost': 5343.75, 'gain': 1, 'type': 'suspended_floor_insulation',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 5343.75, 'raw_cost': 5343.75,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 0}],
|
||||
[{'id': '6_phase=4', 'cost': 1009.5600000000001, 'gain': np.float64(0.9000000000000057),
|
||||
'type': 'time_temperature_zone_control', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 1009.5600000000001, 'raw_cost': 1009.5600000000001,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 0},
|
||||
{'id': '7_phase=4', 'cost': 18979.9, 'gain': np.float64(6.9), 'type': 'air_source_heat_pump',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 18979.9, 'raw_cost': 18979.9,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 0}],
|
||||
[{'id': '8_phase=5', 'cost': 5420.0, 'gain': np.float64(9.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 5420.0, 'raw_cost': 5420.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 3.6},
|
||||
{'id': '9_phase=5', 'cost': 6210.0, 'gain': np.float64(9.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 6210.0, 'raw_cost': 6210.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 3.6},
|
||||
{'id': '10_phase=5', 'cost': 6820.0, 'gain': np.float64(9.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 6820.0, 'raw_cost': 6820.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 3.6},
|
||||
{'id': '11_phase=5', 'cost': 7202.0, 'gain': np.float64(10.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 7202.0, 'raw_cost': 7202.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 3.915},
|
||||
{'id': '12_phase=5', 'cost': 6495.0, 'gain': np.float64(10.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 6495.0, 'raw_cost': 6495.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 3.92},
|
||||
{'id': '13_phase=5', 'cost': 7285.0, 'gain': np.float64(10.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 7285.0, 'raw_cost': 7285.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 3.92},
|
||||
{'id': '14_phase=5', 'cost': 7895.0, 'gain': np.float64(10.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 7895.0, 'raw_cost': 7895.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 3.92},
|
||||
{'id': '15_phase=5', 'cost': 5520.0, 'gain': np.float64(10.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 5520.0, 'raw_cost': 5520.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 4.0},
|
||||
{'id': '16_phase=5', 'cost': 6310.0, 'gain': np.float64(10.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 6310.0, 'raw_cost': 6310.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 4.0},
|
||||
{'id': '17_phase=5', 'cost': 6920.0, 'gain': np.float64(10.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 6920.0, 'raw_cost': 6920.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 4.0},
|
||||
{'id': '18_phase=5', 'cost': 5840.0, 'gain': np.float64(13.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 5840.0, 'raw_cost': 5840.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 5.2},
|
||||
{'id': '19_phase=5', 'cost': 6630.0, 'gain': np.float64(13.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 6630.0, 'raw_cost': 6630.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 5.2},
|
||||
{'id': '20_phase=5', 'cost': 7240.0, 'gain': np.float64(13.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 7240.0, 'raw_cost': 7240.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 5.2},
|
||||
{'id': '21_phase=5', 'cost': 8630.0, 'gain': np.float64(14.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 8630.0, 'raw_cost': 8630.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 5.655},
|
||||
{'id': '22_phase=5', 'cost': 7660.0, 'gain': np.float64(14.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 7660.0, 'raw_cost': 7660.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 5.66},
|
||||
{'id': '23_phase=5', 'cost': 8470.0, 'gain': np.float64(14.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 8470.0, 'raw_cost': 8470.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 5.66},
|
||||
{'id': '24_phase=5', 'cost': 9090.0, 'gain': np.float64(14.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 9090.0, 'raw_cost': 9090.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 5.66},
|
||||
{'id': '25_phase=5', 'cost': 7240.0, 'gain': np.float64(12.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 7240.0, 'raw_cost': 7240.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 4.79},
|
||||
{'id': '26_phase=5', 'cost': 8050.0, 'gain': np.float64(12.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 8050.0, 'raw_cost': 8050.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 4.79},
|
||||
{'id': '27_phase=5', 'cost': 8660.0, 'gain': np.float64(12.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 8660.0, 'raw_cost': 8660.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 4.79},
|
||||
{'id': '28_phase=5', 'cost': 5740.0, 'gain': np.float64(12.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 5740.0, 'raw_cost': 5740.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 4.8},
|
||||
{'id': '29_phase=5', 'cost': 6530.0, 'gain': np.float64(12.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 6530.0, 'raw_cost': 6530.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 4.8},
|
||||
{'id': '30_phase=5', 'cost': 7140.0, 'gain': np.float64(12.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 7140.0, 'raw_cost': 7140.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 4.8},
|
||||
{'id': '31_phase=5', 'cost': 8360.0, 'gain': np.float64(13.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 8360.0, 'raw_cost': 8360.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 5.22},
|
||||
{'id': '32_phase=5', 'cost': 7470.0, 'gain': np.float64(13.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 7470.0, 'raw_cost': 7470.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 5.22},
|
||||
{'id': '33_phase=5', 'cost': 8280.0, 'gain': np.float64(13.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 8280.0, 'raw_cost': 8280.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 5.22},
|
||||
{'id': '34_phase=5', 'cost': 8890.0, 'gain': np.float64(13.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 8890.0, 'raw_cost': 8890.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 5.22},
|
||||
{'id': '35_phase=5', 'cost': 5892.21, 'gain': np.float64(13.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 5892.21, 'raw_cost': 5892.21,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 5.34},
|
||||
{'id': '36_phase=5', 'cost': 5320.0, 'gain': np.float64(8.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 5320.0, 'raw_cost': 5320.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 3.2},
|
||||
{'id': '37_phase=5', 'cost': 6110.0, 'gain': np.float64(8.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 6110.0, 'raw_cost': 6110.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 3.2},
|
||||
{'id': '38_phase=5', 'cost': 6720.0, 'gain': np.float64(8.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 6720.0, 'raw_cost': 6720.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 3.2},
|
||||
{'id': '39_phase=5', 'cost': 6932.0, 'gain': np.float64(9.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 6932.0, 'raw_cost': 6932.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 3.48},
|
||||
{'id': '40_phase=5', 'cost': 6295.0, 'gain': np.float64(9.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 6295.0, 'raw_cost': 6295.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 3.48},
|
||||
{'id': '41_phase=5', 'cost': 7085.0, 'gain': np.float64(9.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 7085.0, 'raw_cost': 7085.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 3.48},
|
||||
{'id': '42_phase=5', 'cost': 7695.0, 'gain': np.float64(9.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 7695.0, 'raw_cost': 7695.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 3.48},
|
||||
{'id': '43_phase=5', 'cost': 5640.0, 'gain': np.float64(11.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 5640.0, 'raw_cost': 5640.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 4.4},
|
||||
{'id': '44_phase=5', 'cost': 6430.0, 'gain': np.float64(11.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 6430.0, 'raw_cost': 6430.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 4.4},
|
||||
{'id': '45_phase=5', 'cost': 7040.0, 'gain': np.float64(11.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 7040.0, 'raw_cost': 7040.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 4.4},
|
||||
{'id': '46_phase=5', 'cost': 8090.0, 'gain': np.float64(12.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 8090.0, 'raw_cost': 8090.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 4.785},
|
||||
{'id': '47_phase=5', 'cost': 7240.0, 'gain': np.float64(12.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 7240.0, 'raw_cost': 7240.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 4.79},
|
||||
{'id': '48_phase=5', 'cost': 8050.0, 'gain': np.float64(12.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 8050.0, 'raw_cost': 8050.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 4.79},
|
||||
{'id': '49_phase=5', 'cost': 8660.0, 'gain': np.float64(12.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 8660.0, 'raw_cost': 8660.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 4.79},
|
||||
{'id': '50_phase=5', 'cost': 5520.0, 'gain': np.float64(10.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 5520.0, 'raw_cost': 5520.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 4.0},
|
||||
{'id': '51_phase=5', 'cost': 6310.0, 'gain': np.float64(10.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 6310.0, 'raw_cost': 6310.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 4.0},
|
||||
{'id': '52_phase=5', 'cost': 6920.0, 'gain': np.float64(10.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 6920.0, 'raw_cost': 6920.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 4.0},
|
||||
{'id': '53_phase=5', 'cost': 7820.0, 'gain': np.float64(11.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 7820.0, 'raw_cost': 7820.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 4.35},
|
||||
{'id': '54_phase=5', 'cost': 6675.0, 'gain': np.float64(11.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 6675.0, 'raw_cost': 6675.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 4.35},
|
||||
{'id': '55_phase=5', 'cost': 7485.0, 'gain': np.float64(11.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 7485.0, 'raw_cost': 7485.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 4.35},
|
||||
{'id': '56_phase=5', 'cost': 8095.0, 'gain': np.float64(11.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 8095.0, 'raw_cost': 8095.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 4.35},
|
||||
{'id': '57_phase=5', 'cost': 5640.0, 'gain': np.float64(11.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 5640.0, 'raw_cost': 5640.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 4.4},
|
||||
{'id': '58_phase=5', 'cost': 6430.0, 'gain': np.float64(11.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 6430.0, 'raw_cost': 6430.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 4.4},
|
||||
{'id': '59_phase=5', 'cost': 7040.0, 'gain': np.float64(11.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 7040.0, 'raw_cost': 7040.0,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': True, 'array_size': 4.4},
|
||||
{'id': '60_phase=5', 'cost': 5692.21, 'gain': np.float64(11.0), 'type': 'solar_pv',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 5692.21, 'raw_cost': 5692.21,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 4.45}]]
|
||||
input_measures = [
|
||||
[
|
||||
{'already_installed': False, 'id': '0_phase=0',
|
||||
'type': 'internal_wall_insulation+mechanical_ventilation',
|
||||
'gain': np.float64(2.0), 'cost': 16901.01977922431}
|
||||
],
|
||||
[
|
||||
{'already_installed': False, 'id': '1_phase=1', 'type': 'loft_insulation', 'gain': 0, 'cost': 1197.0},
|
||||
],
|
||||
[
|
||||
{'already_installed': False, 'id': '5_phase=3', 'type': 'suspended_floor_insulation', 'gain': 1,
|
||||
'cost': 5343.75}],
|
||||
[
|
||||
{'already_installed': False, 'id': '6_phase=4', 'type': 'time_temperature_zone_control',
|
||||
'gain': np.float64(0.9000000000000057), 'cost': 1009.5600000000001},
|
||||
{'already_installed': False, 'id': '7_phase=4', 'type': 'air_source_heat_pump', 'gain': np.float64(6.9),
|
||||
'cost': 18979.9}],
|
||||
[
|
||||
{'already_installed': False, 'id': '8_phase=5', 'type': 'solar_pv', 'gain': np.float64(9.0),
|
||||
'cost': 5420.0, "has_battery": False},
|
||||
{'already_installed': False, 'id': '9_phase=5', 'type': 'solar_pv', 'gain': np.float64(9.0),
|
||||
'cost': 6210.0, "has_battery": False},
|
||||
]
|
||||
]
|
||||
|
||||
solutions = optimise_with_scenarios(
|
||||
p=property_instance,
|
||||
|
|
@ -842,3 +624,212 @@ class TestOptimiseWithScenarios:
|
|||
)
|
||||
|
||||
assert solutions.empty
|
||||
|
||||
def test_ashp_needing_cwi_first(self, property_instance):
|
||||
input_measures = [
|
||||
[
|
||||
{'id': '0_phase=0', 'cost': 1653.5495595376553, 'gain': 1,
|
||||
'type': 'cavity_wall_insulation+mechanical_ventilation', 'already_installed': False},
|
||||
{'id': '1_phase=0', 'cost': 1535.3279855335845, 'gain': 1,
|
||||
'type': 'cavity_wall_insulation+mechanical_ventilation', 'already_installed': False},
|
||||
{'id': '2_phase=0', 'cost': 1801.326527042744, 'gain': 1,
|
||||
'type': 'cavity_wall_insulation+mechanical_ventilation', 'already_installed': False},
|
||||
{'id': '3_phase=0', 'cost': 1505.7725920325668, 'gain': 1,
|
||||
'type': 'cavity_wall_insulation+mechanical_ventilation', 'already_installed': False}
|
||||
],
|
||||
[
|
||||
{'id': '4_phase=1', 'cost': 766.5, 'gain': 0, 'type': 'loft_insulation', 'already_installed': False},
|
||||
{'id': '5_phase=1', 'cost': 657.0, 'gain': 0, 'type': 'loft_insulation', 'already_installed': False},
|
||||
{'id': '6_phase=1', 'cost': 547.5, 'gain': 0, 'type': 'loft_insulation', 'already_installed': False}
|
||||
],
|
||||
[
|
||||
{'id': '8_phase=3', 'cost': 7.0, 'gain': 0, 'type': 'low_energy_lighting', 'already_installed': False}
|
||||
],
|
||||
[
|
||||
{'id': '9_phase=4', 'cost': 1009.5600000000001, 'gain': np.float64(0.3),
|
||||
'type': 'time_temperature_zone_control', 'already_installed': False},
|
||||
{'id': '10_phase=4', 'cost': 18979.9, 'gain': np.float64(7.5), 'type': 'air_source_heat_pump',
|
||||
'already_installed': False}
|
||||
],
|
||||
[
|
||||
{'id': '11_phase=5', 'cost': 150.0, 'gain': np.float64(3.3), 'type': 'secondary_heating',
|
||||
'already_installed': False}
|
||||
],
|
||||
[
|
||||
{'id': '12_phase=6', 'cost': 5420.0, 'gain': np.float64(15.4), 'type': 'solar_pv',
|
||||
'already_installed': False, "has_battery": False},
|
||||
{'id': '13_phase=6', 'cost': 6210.0, 'gain': np.float64(15.4), 'type': 'solar_pv',
|
||||
'already_installed': False, "has_battery": False}
|
||||
]
|
||||
]
|
||||
|
||||
solutions = optimise_with_scenarios(
|
||||
p=property_instance,
|
||||
input_measures=input_measures,
|
||||
budget=None,
|
||||
target_gain=7.5,
|
||||
enforce_heat_pump_insulation=True,
|
||||
enforce_fabric_first=False,
|
||||
already_installed_sap=0, # To be passed to output
|
||||
)
|
||||
|
||||
# heat pump solutions
|
||||
heat_pump_solutions = solutions[solutions["scenario"] == "heat_pump_with_insulation"]
|
||||
assert len(heat_pump_solutions) == 12
|
||||
|
||||
for x in heat_pump_solutions["items"].values:
|
||||
res = [y["type"] for y in x]
|
||||
# All results should include loft & CWI
|
||||
assert "loft_insulation" in res
|
||||
assert "cavity_wall_insulation+mechanical_ventilation" in res
|
||||
|
||||
def test_fabric_first(self, property_instance):
|
||||
input_measures = [
|
||||
[{'id': '0_phase=0', 'cost': 1653.5495595376553, 'gain': 1,
|
||||
'type': 'cavity_wall_insulation+mechanical_ventilation', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 1653.5495595376553, 'raw_cost': 1093.5495595376553, 'partial_project_funding': 0,
|
||||
'partial_project_score': 0, 'uplift_project_score': 0, 'already_installed': False, 'has_battery': False,
|
||||
'array_size': 0},
|
||||
{'id': '1_phase=0', 'cost': 1535.3279855335845, 'gain': 1,
|
||||
'type': 'cavity_wall_insulation+mechanical_ventilation', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 1535.3279855335845, 'raw_cost': 975.3279855335845,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 0},
|
||||
{'id': '2_phase=0', 'cost': 1801.326527042744, 'gain': 1,
|
||||
'type': 'cavity_wall_insulation+mechanical_ventilation', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 1801.326527042744, 'raw_cost': 1241.326527042744, 'partial_project_funding': 0,
|
||||
'partial_project_score': 0, 'uplift_project_score': 0, 'already_installed': False, 'has_battery': False,
|
||||
'array_size': 0},
|
||||
{'id': '3_phase=0', 'cost': 1505.7725920325668, 'gain': 1,
|
||||
'type': 'cavity_wall_insulation+mechanical_ventilation', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 1505.7725920325668, 'raw_cost': 945.7725920325668,
|
||||
'partial_project_funding': 0, 'partial_project_score': 0, 'uplift_project_score': 0,
|
||||
'already_installed': False, 'has_battery': False, 'array_size': 0}],
|
||||
[{'id': '4_phase=1', 'cost': 766.5, 'gain': 1, 'type': 'loft_insulation', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 766.5, 'raw_cost': 766.5, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 0},
|
||||
{'id': '5_phase=1', 'cost': 657.0, 'gain': 1, 'type': 'loft_insulation', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 657.0, 'raw_cost': 657.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 0},
|
||||
{'id': '6_phase=1', 'cost': 547.5, 'gain': 1, 'type': 'loft_insulation', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 547.5, 'raw_cost': 547.5, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 0}],
|
||||
[{'id': '8_phase=3', 'cost': 7.0, 'gain': 1, 'type': 'low_energy_lighting', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 7.0, 'raw_cost': 7.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 0}],
|
||||
[{'id': '9_phase=4', 'cost': 1009.5600000000001, 'gain': np.float64(0.3),
|
||||
'type': 'time_temperature_zone_control', 'innovation_uplift': 0, 'cost_minus_uplift': 1009.5600000000001,
|
||||
'raw_cost': 1009.5600000000001, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 0},
|
||||
{'id': '10_phase=4', 'cost': 18979.9, 'gain': np.float64(7.5), 'type': 'air_source_heat_pump',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 18979.9, 'raw_cost': 18979.9, 'partial_project_funding': 0,
|
||||
'partial_project_score': 0, 'uplift_project_score': 0, 'already_installed': False, 'has_battery': False,
|
||||
'array_size': 0}],
|
||||
[{'id': '11_phase=5', 'cost': 150.0, 'gain': np.float64(3.3), 'type': 'secondary_heating',
|
||||
'innovation_uplift': 0, 'cost_minus_uplift': 150.0, 'raw_cost': 150.0, 'partial_project_funding': 0,
|
||||
'partial_project_score': 0, 'uplift_project_score': 0, 'already_installed': False, 'has_battery': False,
|
||||
'array_size': 0}],
|
||||
[{'id': '12_phase=6', 'cost': 5420.0, 'gain': np.float64(15.4), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 5420.0, 'raw_cost': 5420.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 3.6},
|
||||
{'id': '13_phase=6', 'cost': 6210.0, 'gain': np.float64(15.4), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 6210.0, 'raw_cost': 6210.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': True, 'array_size': 3.6},
|
||||
{'id': '14_phase=6', 'cost': 6820.0, 'gain': np.float64(15.4), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 6820.0, 'raw_cost': 6820.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': True, 'array_size': 3.6},
|
||||
{'id': '15_phase=6', 'cost': 7202.0, 'gain': np.float64(15.9), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 7202.0, 'raw_cost': 7202.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 3.915},
|
||||
{'id': '16_phase=6', 'cost': 6495.0, 'gain': np.float64(15.9), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 6495.0, 'raw_cost': 6495.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 3.92},
|
||||
{'id': '17_phase=6', 'cost': 7285.0, 'gain': np.float64(15.9), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 7285.0, 'raw_cost': 7285.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': True, 'array_size': 3.92},
|
||||
{'id': '18_phase=6', 'cost': 7895.0, 'gain': np.float64(15.9), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 7895.0, 'raw_cost': 7895.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': True, 'array_size': 3.92},
|
||||
{'id': '19_phase=6', 'cost': 5520.0, 'gain': np.float64(16.7), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 5520.0, 'raw_cost': 5520.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 4.0},
|
||||
{'id': '20_phase=6', 'cost': 6310.0, 'gain': np.float64(16.7), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 6310.0, 'raw_cost': 6310.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': True, 'array_size': 4.0},
|
||||
{'id': '21_phase=6', 'cost': 6920.0, 'gain': np.float64(16.7), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 6920.0, 'raw_cost': 6920.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': True, 'array_size': 4.0},
|
||||
{'id': '22_phase=6', 'cost': 5320.0, 'gain': np.float64(13.6), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 5320.0, 'raw_cost': 5320.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 3.2},
|
||||
{'id': '23_phase=6', 'cost': 6110.0, 'gain': np.float64(13.6), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 6110.0, 'raw_cost': 6110.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': True, 'array_size': 3.2},
|
||||
{'id': '24_phase=6', 'cost': 6720.0, 'gain': np.float64(13.6), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 6720.0, 'raw_cost': 6720.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': True, 'array_size': 3.2},
|
||||
{'id': '25_phase=6', 'cost': 6932.0, 'gain': np.float64(15.4), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 6932.0, 'raw_cost': 6932.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 3.48},
|
||||
{'id': '26_phase=6', 'cost': 6295.0, 'gain': np.float64(15.4), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 6295.0, 'raw_cost': 6295.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 3.48},
|
||||
{'id': '27_phase=6', 'cost': 7085.0, 'gain': np.float64(15.4), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 7085.0, 'raw_cost': 7085.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': True, 'array_size': 3.48},
|
||||
{'id': '28_phase=6', 'cost': 7695.0, 'gain': np.float64(15.4), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 7695.0, 'raw_cost': 7695.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': True, 'array_size': 3.48},
|
||||
{'id': '29_phase=6', 'cost': 5220.0, 'gain': np.float64(12.2), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 5220.0, 'raw_cost': 5220.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 2.8},
|
||||
{'id': '30_phase=6', 'cost': 6662.0, 'gain': np.float64(12.8), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 6662.0, 'raw_cost': 6662.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 3.045},
|
||||
{'id': '31_phase=6', 'cost': 6095.0, 'gain': np.float64(12.8), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 6095.0, 'raw_cost': 6095.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 3.05},
|
||||
{'id': '32_phase=6', 'cost': 5160.0, 'gain': np.float64(10.1), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 5160.0, 'raw_cost': 5160.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 2.4},
|
||||
{'id': '33_phase=6', 'cost': 6392.0, 'gain': np.float64(10.1), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 6392.0, 'raw_cost': 6392.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 2.61},
|
||||
{'id': '34_phase=6', 'cost': 5910.0, 'gain': np.float64(10.1), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 5910.0, 'raw_cost': 5910.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 2.61},
|
||||
{'id': '35_phase=6', 'cost': 5100.0, 'gain': np.float64(8.0), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 5100.0, 'raw_cost': 5100.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 2.0},
|
||||
{'id': '36_phase=6', 'cost': 6098.0, 'gain': np.float64(9.1), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 6098.0, 'raw_cost': 6098.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 2.175},
|
||||
{'id': '37_phase=6', 'cost': 5725.0, 'gain': np.float64(9.1), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 5725.0, 'raw_cost': 5725.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 2.18},
|
||||
{'id': '38_phase=6', 'cost': 5040.0, 'gain': np.float64(7.0), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 5040.0, 'raw_cost': 5040.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 1.6},
|
||||
{'id': '39_phase=6', 'cost': 5828.0, 'gain': np.float64(7.0), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 5828.0, 'raw_cost': 5828.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 1.74},
|
||||
{'id': '40_phase=6', 'cost': 5540.0, 'gain': np.float64(7.0), 'type': 'solar_pv', 'innovation_uplift': 0,
|
||||
'cost_minus_uplift': 5540.0, 'raw_cost': 5540.0, 'partial_project_funding': 0, 'partial_project_score': 0,
|
||||
'uplift_project_score': 0, 'already_installed': False, 'has_battery': False, 'array_size': 1.74}]
|
||||
]
|
||||
|
||||
solutions = optimise_with_scenarios(
|
||||
p=property_instance,
|
||||
input_measures=input_measures,
|
||||
budget=None,
|
||||
target_gain=7.5,
|
||||
enforce_heat_pump_insulation=True,
|
||||
enforce_fabric_first=True,
|
||||
already_installed_sap=0, # To be passed to output
|
||||
)
|
||||
|
||||
assert solutions.shape[0] == 1
|
||||
items = solutions["items"].values[0]
|
||||
types = [x["type"] for x in items]
|
||||
|
||||
assert types == ['cavity_wall_insulation+mechanical_ventilation', 'loft_insulation', 'solar_pv']
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue