forked from s_ranjbar/city_retrofit
Basic style correction and missing docstrings
This commit is contained in:
parent
d5c443a57b
commit
f2bfc297b3
|
@ -50,11 +50,11 @@ class Archetype:
|
|||
_systems = []
|
||||
for _system in self.systems:
|
||||
_systems.append(_system.to_dictionary())
|
||||
content = {'Archetype': {'name': self.name,
|
||||
content = {
|
||||
'Archetype': {
|
||||
'name': self.name,
|
||||
'level of detail': self.lod,
|
||||
'systems': _systems
|
||||
}
|
||||
}
|
||||
return content
|
||||
|
||||
|
||||
|
|
|
@ -30,9 +30,7 @@ class MontrealCustomCatalog(Catalog):
|
|||
'demand', 'system_id'))
|
||||
|
||||
self._lod = float(self._archetypes['catalog']['@lod'])
|
||||
|
||||
self._catalog_generation_equipments, self._catalog_storage_equipments = \
|
||||
self._load_generation_and_storage_equipments()
|
||||
self._catalog_generation_equipments, self._catalog_storage_equipments = self._load_generation_and_storage_equipments()
|
||||
self._catalog_distribution_equipments = self._load_distribution_equipments()
|
||||
self._catalog_emission_equipments = self._load_emission_equipments()
|
||||
self._catalog_systems = self._load_systems()
|
||||
|
@ -63,6 +61,7 @@ class MontrealCustomCatalog(Catalog):
|
|||
electricity_efficiency = None
|
||||
if 'electrical_efficiency' in equipment:
|
||||
electricity_efficiency = float(equipment['electrical_efficiency'])
|
||||
# todo: this may be optionals instead?
|
||||
generation_system = GenerationSystem(equipment_id,
|
||||
name,
|
||||
None,
|
||||
|
|
|
@ -56,7 +56,7 @@ class NorthAmericaEnergySystemCatalog(Catalog):
|
|||
boiler_maximum_heat_output = float(boiler['@maximumHeatOutput'])
|
||||
boiler_minimum_heat_output = float(boiler['@minimumHeatOutput'])
|
||||
boiler_heat_efficiency = float(boiler['@nominalEfficiency'])
|
||||
|
||||
# todo: this may be optionals instead?
|
||||
boiler_component = GenerationSystem(boiler_id,
|
||||
boiler_name,
|
||||
boiler_model_name,
|
||||
|
@ -405,15 +405,16 @@ class NorthAmericaEnergySystemCatalog(Catalog):
|
|||
for material in materials:
|
||||
if int(material.id) == int(material_id):
|
||||
_material = material
|
||||
return _material
|
||||
|
||||
break
|
||||
if _material is None:
|
||||
raise ValueError(f'Material with the id = [{material_id}] not found in catalog ')
|
||||
return _material
|
||||
|
||||
@staticmethod
|
||||
def _search_generation_equipment(generation_systems, generation_id):
|
||||
_generation_systems = []
|
||||
if type(generation_id) == list:
|
||||
|
||||
if isinstance(generation_id, list):
|
||||
integer_ids = [int(item) for item in generation_id]
|
||||
for generation in generation_systems:
|
||||
if int(generation.id) in integer_ids:
|
||||
|
|
|
@ -89,7 +89,7 @@ class Building(CityObject):
|
|||
elif surface.type == cte.INTERIOR_SLAB:
|
||||
self._interior_slabs.append(surface)
|
||||
else:
|
||||
logging.error(f'Building %s [%s] has an unexpected surface type %s.', self.name, self.aliases, surface.type)
|
||||
logging.error('Building %s [%s] has an unexpected surface type %s.', self.name, self.aliases, surface.type)
|
||||
|
||||
@property
|
||||
def shell(self) -> Polyhedron:
|
||||
|
|
|
@ -578,7 +578,7 @@ class ThermalZone:
|
|||
for i_type, _ in enumerate(_types_reference):
|
||||
_schedules = []
|
||||
_schedule_type = _types_reference[i_type][1]
|
||||
for i_schedule, schedule_value in enumerate(_schedule_type):
|
||||
for _, schedule_value in enumerate(_schedule_type):
|
||||
schedule = Schedule()
|
||||
schedule.type = schedule_value.type
|
||||
schedule.day_types = schedule_value.day_types
|
||||
|
|
|
@ -13,6 +13,9 @@ from hub.city_model_structure.energy_systems.generic_storage_system import Gener
|
|||
|
||||
|
||||
class ElectricalStorageSystem:
|
||||
"""
|
||||
Electrical Storage system class
|
||||
"""
|
||||
def __init__(self):
|
||||
self._model_name = None
|
||||
self._manufacturer = None
|
||||
|
@ -150,6 +153,3 @@ class ElectricalStorageSystem:
|
|||
:return: float
|
||||
"""
|
||||
self._self_discharge_rate = value
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,9 @@ from __future__ import annotations
|
|||
|
||||
|
||||
class GenericStorageSystem:
|
||||
"""
|
||||
Generic storage System class
|
||||
"""
|
||||
def __init__(self):
|
||||
self._storage_type = None
|
||||
self._nominal_capacity = None
|
||||
|
@ -62,4 +65,3 @@ class GenericStorageSystem:
|
|||
:return: float
|
||||
"""
|
||||
self._losses_ratio = value
|
||||
|
||||
|
|
|
@ -101,5 +101,3 @@ class PerformanceCurves:
|
|||
:return: [coefficients]
|
||||
"""
|
||||
self._coefficients = value
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|||
Copyright © 2022 Concordia CERC group
|
||||
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
"""
|
||||
import math
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
|
@ -59,7 +58,6 @@ class Obj:
|
|||
mtl.write("Ks 1.0 1.0 1.0 # Specular color (white)\n")
|
||||
mtl.write("Ns 400.0 # Specular exponent (defines shininess)\n")
|
||||
vertices = {}
|
||||
normals_index = {}
|
||||
faces = []
|
||||
vertex_index = 0
|
||||
normal_index = 0
|
||||
|
|
|
@ -32,7 +32,7 @@ class EilatPhysicsParameters:
|
|||
city = self._city
|
||||
eilat_catalog = ConstructionCatalogFactory('eilat').catalog
|
||||
for building in city.buildings:
|
||||
if building.function not in Dictionaries().hub_function_to_eilat_construction_function.keys():
|
||||
if building.function not in Dictionaries().hub_function_to_eilat_construction_function:
|
||||
logging.error('Building %s has an unknown building function %s', building.name, building.function)
|
||||
continue
|
||||
function = Dictionaries().hub_function_to_eilat_construction_function[building.function]
|
||||
|
|
|
@ -32,8 +32,8 @@ class NrcanPhysicsParameters:
|
|||
city = self._city
|
||||
nrcan_catalog = ConstructionCatalogFactory('nrcan').catalog
|
||||
for building in city.buildings:
|
||||
if building.function not in Dictionaries().hub_function_to_nrcan_construction_function.keys():
|
||||
logging.error(f'Building %s has an unknown building function %s', building.name, building.function)
|
||||
if building.function not in Dictionaries().hub_function_to_nrcan_construction_function:
|
||||
logging.error('Building %s has an unknown building function %s', building.name, building.function)
|
||||
continue
|
||||
function = Dictionaries().hub_function_to_nrcan_construction_function[building.function]
|
||||
try:
|
||||
|
|
|
@ -6,21 +6,20 @@ Project Coder Saeed Ranjbar saeed.ranjbar@concordia.ca
|
|||
Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
|
||||
import logging
|
||||
import copy
|
||||
import logging
|
||||
|
||||
from pandas import DataFrame
|
||||
|
||||
from hub.catalog_factories.energy_systems_catalog_factory import EnergySystemsCatalogFactory
|
||||
from hub.city_model_structure.energy_systems.generic_energy_system import GenericEnergySystem
|
||||
from hub.city_model_structure.energy_systems.generic_generation_system import GenericGenerationSystem
|
||||
from hub.city_model_structure.energy_systems.energy_system import EnergySystem
|
||||
from hub.city_model_structure.energy_systems.generation_system import GenerationSystem
|
||||
from hub.city_model_structure.energy_systems.distribution_system import DistributionSystem
|
||||
from hub.city_model_structure.energy_systems.emission_system import EmissionSystem
|
||||
from hub.helpers.dictionaries import Dictionaries
|
||||
from hub.city_model_structure.energy_systems.generic_storage_system import GenericStorageSystem
|
||||
from hub.city_model_structure.energy_systems.energy_system import EnergySystem
|
||||
from hub.city_model_structure.energy_systems.generation_system import GenerationSystem
|
||||
from hub.city_model_structure.energy_systems.generic_energy_system import GenericEnergySystem
|
||||
from hub.city_model_structure.energy_systems.generic_generation_system import GenericGenerationSystem
|
||||
from hub.city_model_structure.energy_systems.thermal_storage_system import ThermalStorageSystem
|
||||
from hub.helpers.dictionaries import Dictionaries
|
||||
|
||||
|
||||
class NorthAmericaCustomEnergySystemParameters:
|
||||
|
@ -83,7 +82,7 @@ class NorthAmericaCustomEnergySystemParameters:
|
|||
energy_system = GenericEnergySystem()
|
||||
_hub_demand_types = []
|
||||
demand_types = system.demand_types
|
||||
if type(demand_types) == str:
|
||||
if isinstance(demand_types, str):
|
||||
demand_types = [demand_types]
|
||||
for demand_type in demand_types:
|
||||
_hub_demand_types.append(Dictionaries().north_america_demand_type_to_hub_energy_demand_type[demand_type])
|
||||
|
@ -105,17 +104,17 @@ class NorthAmericaCustomEnergySystemParameters:
|
|||
_generation_system.source_mass_flow = archetype_generation_equipment.source_mass_flow
|
||||
_generation_system.storage = None
|
||||
_generation_system.auxiliary_equipment = None
|
||||
_generation_system._supply_medium = archetype_generation_equipment.supply_medium
|
||||
_generation_system._maximum_heat_supply_temperature = archetype_generation_equipment.maximum_heat_supply_temperature
|
||||
_generation_system._minimum_heat_supply_temperature = archetype_generation_equipment.minimum_heat_supply_temperature
|
||||
_generation_system._maximum_cooling_supply_temperature = archetype_generation_equipment.maximum_cooling_supply_temperature
|
||||
_generation_system._minimum_cooling_supply_temperature = archetype_generation_equipment.minimum_cooling_supply_temperature
|
||||
_generation_system._heat_output_curve = archetype_generation_equipment.heat_output_curve
|
||||
_generation_system._heat_fuel_consumption_curve = archetype_generation_equipment.heat_fuel_consumption_curve
|
||||
_generation_system._heat_efficiency_curve = archetype_generation_equipment.heat_efficiency_curve
|
||||
_generation_system._cooling_output_curve = archetype_generation_equipment.cooling_output_curve
|
||||
_generation_system._cooling_fuel_consumption_curve = archetype_generation_equipment.cooling_fuel_consumption_curve
|
||||
_generation_system._cooling_efficiency_curve = archetype_generation_equipment.cooling_efficiency_curve
|
||||
_generation_system.supply_medium = archetype_generation_equipment.supply_medium
|
||||
_generation_system.maximum_heat_supply_temperature = archetype_generation_equipment.maximum_heat_supply_temperature
|
||||
_generation_system.minimum_heat_supply_temperature = archetype_generation_equipment.minimum_heat_supply_temperature
|
||||
_generation_system.maximum_cooling_supply_temperature = archetype_generation_equipment.maximum_cooling_supply_temperature
|
||||
_generation_system.minimum_cooling_supply_temperature = archetype_generation_equipment.minimum_cooling_supply_temperature
|
||||
_generation_system.heat_output_curve = archetype_generation_equipment.heat_output_curve
|
||||
_generation_system.heat_fuel_consumption_curve = archetype_generation_equipment.heat_fuel_consumption_curve
|
||||
_generation_system.heat_efficiency_curve = archetype_generation_equipment.heat_efficiency_curve
|
||||
_generation_system.cooling_output_curve = archetype_generation_equipment.cooling_output_curve
|
||||
_generation_system.cooling_fuel_consumption_curve = archetype_generation_equipment.cooling_fuel_consumption_curve
|
||||
_generation_system.cooling_efficiency_curve = archetype_generation_equipment.cooling_efficiency_curve
|
||||
_generation_systems.append(_generation_system)
|
||||
|
||||
energy_system.generation_systems = _generation_systems
|
||||
|
|
|
@ -6,13 +6,16 @@ Project Coder Saeed Ranjbar saeed.ranjbar@concordia.ca
|
|||
Project collaborator Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
from pathlib import Path
|
||||
from hub.helpers.monthly_values import MonthlyValues
|
||||
import csv
|
||||
|
||||
from hub.helpers.monthly_values import MonthlyValues
|
||||
import hub.helpers.constants as cte
|
||||
|
||||
|
||||
class EnergyPlusWorkflow:
|
||||
class EnergyPlus:
|
||||
"""
|
||||
Energy plus class
|
||||
"""
|
||||
def __init__(self, city, base_path):
|
||||
self._city = city
|
||||
self._base_path = base_path
|
|
@ -10,7 +10,7 @@ from pathlib import Path
|
|||
from hub.helpers.utils import validate_import_export_type
|
||||
from hub.imports.results.insel_monthly_energry_balance import InselMonthlyEnergyBalance
|
||||
from hub.imports.results.simplified_radiosity_algorithm import SimplifiedRadiosityAlgorithm
|
||||
from hub.imports.results.energy_plus_workflow import EnergyPlusWorkflow
|
||||
from hub.imports.results.energy_plus import EnergyPlusWorkflow
|
||||
|
||||
class ResultFactory:
|
||||
"""
|
||||
|
|
|
@ -7,7 +7,7 @@ Project Coder Guille Gutierrez Guillermo.GutierrezMorote@concordia.ca
|
|||
import datetime
|
||||
import logging
|
||||
|
||||
from sqlalchemy import select, or_
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user