Merge remote-tracking branch 'origin/master'

# Conflicts:
#	catalog_factories/construction_catalog_factory.py
#	unittests/test_greenery_catalog.py
This commit is contained in:
Guille Gutierrez 2022-04-11 12:39:45 -04:00
commit 8b952e3254
31 changed files with 75 additions and 151 deletions

View File

@ -4,115 +4,50 @@
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
community a harassment-free experience for everyone, rejecting any kind of discrimination.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Demonstrating empathy and kindness toward other people.
* Being respectful of differing opinions, viewpoints, and experiences.
* Giving and gracefully accepting constructive feedback.
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
and learning from the experience.
* Focusing on what is best not just for us as individuals, but for the
overall community
overall community.
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
advances of any kind.
* Trolling, insulting or derogatory comments, and personal or political attacks.
* Public or private harassment.
* Publishing others' private information, such as a physical or email
address, without their explicit permission
address, without their explicit permission.
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
professional setting.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
posting via an official social media account, participating in a congress
or acting as an appointed representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
guillermo.gutierrezmorote@concordia.ca.
Instances of abusive, harassing, or otherwise unacceptable behavior might be
reported to guillermo.gutierrezmorote@concordia.ca or ursula.eicker@concordia.ca.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
@ -123,7 +58,3 @@ Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

View File

@ -1,20 +1,20 @@
# Libs
Libs is part of Insel4D architecture for the urban simulations, created by the CERC group at Concordia University.
Libs is part of Insel4D architecture for urban simulations, created by the CERC group at Concordia University.
Libs repository contains a set of classes modeling the data for urban environments in the form of:
* city_model_structure
* geometry
* physics
* usages
Libs repository contains:
* city_model_structure: a central data model specifically design to model urban environments. An instance of this is called City.
* catalog_factories: a set of classes to describe catalog structures used by the import and export factories.
* imports: factories to import data from different formats to feed the city model structure (and create a City) or the catalog structures depending on the purpose.
* exports: factories to export desired parts of the City to different formats depending on the purpose, or to export catalogs in a common format.
* data: contains offered data, either for geometry, weather or different types of catalogs.
* other folders to support manipulating data.
Released under [LGPL license](LICENSE.md), will provide an object-oriented, modular approach to urban simulations.
Our aims are:
* involve as many scientists and contributors as possible
* involve as many scientists and contributors as possible.
* provide a complete set of classes that help scientists and students to model urban environments.
Please check the [contributing information](CONTRIBUTING.md) and [code of conduct](CODE_OF_CONDUCT.md) if you want to contribute, and let us know any new feature you may be of interest for you or your team.

View File

@ -7,7 +7,7 @@ Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
class Catalog:
"""
Catalogs base class not implemented instance of the Catalog base class, catalogs will inherit from this class.
Catalogs base class not implemented instance of the Catalog base class, catalog_factories will inherit from this class.
"""
def names(self, category=None):

View File

@ -7,14 +7,14 @@ Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
import xmltodict
from pathlib import Path
from catalogs.catalog import Catalog
from catalogs.data_models.construction.window import Window
from catalogs.data_models.construction.material import Material
from catalogs.data_models.construction.layer import Layer
from catalogs.data_models.construction.construction import Construction
from catalogs.data_models.construction.content import Content
from catalogs.data_models.construction.archetype import Archetype
from catalogs.construction.construction_helpers import nrel_to_function, reference_standard_to_construction_period
from catalog_factories.catalog import Catalog
from catalog_factories.data_models.construction.window import Window
from catalog_factories.data_models.construction.material import Material
from catalog_factories.data_models.construction.layer import Layer
from catalog_factories.data_models.construction.construction import Construction
from catalog_factories.data_models.construction.content import Content
from catalog_factories.data_models.construction.archetype import Archetype
from catalog_factories.construction.construction_helpers import nrel_to_function, reference_standard_to_construction_period
class NrelCatalog(Catalog):

View File

@ -7,8 +7,8 @@ Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
from pathlib import Path
from typing import TypeVar
from catalogs.construction.nrel_catalog import NrelCatalog
# from catalogs.construction.nrcan_catalog import NrcanCatalog
from catalog_factories.construction.nrel_catalog import NrelCatalog
# from catalog_factories.construction.nrcan_catalog import NrcanCatalog
Catalog = TypeVar('Catalog')
class ConstructionCatalogFactory:
@ -36,12 +36,4 @@ class ConstructionCatalogFactory:
Enrich the city given to the class using the class given handler
:return: Catalog
"""
return getattr(self, self._catalog_type, lambda: None)
@property
def catalog_debug(self) -> Catalog:
"""
Enrich the city given to the class using the class given handler
:return: Catalog
"""
return NrelCatalog(self._path)
return getattr(self, self._catalog_type, lambda: None)

View File

@ -5,7 +5,7 @@ Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from catalogs.data_models.greenery.soil import Soil as libs_soil
from catalog_factories.data_models.greenery.soil import Soil as libs_soil
class Plant:

View File

@ -5,7 +5,7 @@ Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from catalogs.data_models.greenery.plant import Plant as libs_plant
from catalog_factories.data_models.greenery.plant import Plant as libs_plant
class PlantPercentage(libs_plant):

View File

@ -5,7 +5,7 @@ Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from catalogs.data_models.greenery.plant_percentage import PlantPercentage
from catalog_factories.data_models.greenery.plant_percentage import PlantPercentage
class Vegetation:
def __init__(self, category, vegetation, plant_percentages):

View File

@ -6,14 +6,14 @@ Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from pyecore.resources import ResourceSet, URI
from catalogs.greenery.ecore_greenery.greenerycatalog import GreeneryCatalog as gc
from catalogs.catalog import Catalog
from catalog_factories.greenery.ecore_greenery.greenerycatalog import GreeneryCatalog as gc
from catalog_factories.catalog import Catalog
from pathlib import Path
from catalogs.data_models.greenery.vegetation import Vegetation as libs_vegetation
from catalogs.data_models.greenery.plant import Plant as libs_plant
from catalogs.data_models.greenery.soil import Soil as libs_soil
from catalogs.data_models.greenery.plant_percentage import PlantPercentage as libs_pp
from catalogs.data_models.greenery.content import Content as GreeneryContent
from catalog_factories.data_models.greenery.vegetation import Vegetation as libs_vegetation
from catalog_factories.data_models.greenery.plant import Plant as libs_plant
from catalog_factories.data_models.greenery.soil import Soil as libs_soil
from catalog_factories.data_models.greenery.plant_percentage import PlantPercentage as libs_pp
from catalog_factories.data_models.greenery.content import Content as GreeneryContent
class GreeneryCatalog(Catalog):

View File

@ -7,7 +7,7 @@ Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
from pathlib import Path
from typing import TypeVar
from catalogs.greenery.greenery_catalog import GreeneryCatalog
from catalog_factories.greenery.greenery_catalog import GreeneryCatalog
Catalog = TypeVar('Catalog')
class GreeneryCatalogFactory:

View File

@ -1,5 +1,5 @@
"""
InternalGains module
InternalGain module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
@ -9,9 +9,9 @@ from typing import Union, List
from city_model_structure.attributes.schedule import Schedule
class InternalGains:
class InternalGain:
"""
InternalGains class
InternalGain class
"""
def __init__(self):

View File

@ -11,7 +11,7 @@ from typing import List, Union, TypeVar
from city_model_structure.building_demand.occupancy import Occupancy
from city_model_structure.building_demand.appliances import Appliances
from city_model_structure.building_demand.lighting import Lighting
from city_model_structure.building_demand.internal_gains import InternalGains
from city_model_structure.building_demand.internal_gain import InternalGain
from city_model_structure.attributes.schedule import Schedule
from city_model_structure.building_demand.thermal_control import ThermalControl
from city_model_structure.energy_systems.hvac_system import HvacSystem
@ -242,15 +242,15 @@ class ThermalZone:
return None
@property
def not_detailed_source_mean_annual_internal_gains(self) -> Union[None, List[InternalGains]]:
def not_detailed_source_mean_annual_internal_gains(self) -> Union[None, List[InternalGain]]:
"""
Get thermal zone internal gains with unknown energy source
:return: [InternalGains]
:return: [InternalGain]
"""
if self._parent_internal_zone.usage_zones is None:
return None
if self._not_detailed_source_mean_annual_internal_gains is None:
_grouped_internal_gain = InternalGains()
_grouped_internal_gain = InternalGain()
_grouped_internal_gain.type = 'grouped internal gains for thermal zone'
_average_internal_gain = 0
_convective_part = 0
@ -311,7 +311,7 @@ class ThermalZone:
def not_detailed_source_mean_annual_internal_gains(self, value):
"""
Set thermal zone internal gains with unknown energy source
:param value: [InternalGains]
:param value: [InternalGain]
"""
self._not_detailed_source_mean_annual_internal_gains = value
@ -563,10 +563,10 @@ class ThermalZone:
_internal_gain.convective_fraction = internal_gain_type.convective_fraction
_internal_gain.schedules = internal_gain_type.schedules
def get_internal_gains(self) -> [InternalGains]:
def get_internal_gains(self) -> [InternalGain]:
"""
Calculates and returns the list of all internal gains defined
:return: InternalGains
:return: [InternalGain]
"""
if self.not_detailed_source_mean_annual_internal_gains is not None:
self._internal_gains = []
@ -575,7 +575,7 @@ class ThermalZone:
if self.occupancy is not None:
if self.occupancy.latent_internal_gain is not None:
_internal_gain = InternalGains()
_internal_gain = InternalGain()
_internal_gain.type = cte.OCCUPANCY
_total_heat_gain = (self.occupancy.sensible_convective_internal_gain
+ self.occupancy.sensible_radiative_internal_gain
@ -596,7 +596,7 @@ class ThermalZone:
self._internal_gains = [_internal_gain]
if self.lighting is not None:
_internal_gain = InternalGains()
_internal_gain = InternalGain()
_internal_gain.type = cte.LIGHTING
self._add_internal_gain(self.lighting, _internal_gain)
if self._internal_gains is not None:
@ -605,7 +605,7 @@ class ThermalZone:
self._internal_gains = [_internal_gain]
if self.appliances is not None:
_internal_gain = InternalGains()
_internal_gain = InternalGain()
_internal_gain.type = cte.APPLIANCES
self._add_internal_gain(self.appliances, _internal_gain)
if self._internal_gains is not None:

View File

@ -7,7 +7,7 @@ Code contributors: Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
import uuid
from typing import List, Union
from city_model_structure.building_demand.internal_gains import InternalGains
from city_model_structure.building_demand.internal_gain import InternalGain
from city_model_structure.building_demand.occupancy import Occupancy
from city_model_structure.building_demand.lighting import Lighting
from city_model_structure.building_demand.appliances import Appliances
@ -77,10 +77,10 @@ class UsageZone:
self._percentage = float(value)
@property
def not_detailed_source_mean_annual_internal_gains(self) -> List[InternalGains]:
def not_detailed_source_mean_annual_internal_gains(self) -> List[InternalGain]:
"""
Get usage zone internal gains with unknown energy source
:return: [InternalGains]
:return: [InternalGain]
"""
return self._not_detailed_source_mean_annual_internal_gains
@ -88,7 +88,7 @@ class UsageZone:
def not_detailed_source_mean_annual_internal_gains(self, value):
"""
Set usage zone internal gains with unknown energy source
:param value: [InternalGains]
:param value: [InternalGain]
"""
self._not_detailed_source_mean_annual_internal_gains = value

View File

@ -10,7 +10,7 @@ from imports.geometry.helpers.geometry_helper import GeometryHelper
from imports.usage.hft_usage_interface import HftUsageInterface
from imports.usage.helpers.usage_helper import UsageHelper
from city_model_structure.building_demand.usage_zone import UsageZone
from city_model_structure.building_demand.internal_gains import InternalGains
from city_model_structure.building_demand.internal_gain import InternalGain
from city_model_structure.building_demand.occupancy import Occupancy
from city_model_structure.building_demand.appliances import Appliances
from city_model_structure.building_demand.thermal_control import ThermalControl
@ -74,7 +74,7 @@ class CaUsageParameters(HftUsageInterface):
usage_zone.thermal_control = _control
_internal_gains = []
for archetype_internal_gain in archetype.not_detailed_source_mean_annual_internal_gains:
_internal_gain = InternalGains()
_internal_gain = InternalGain()
_internal_gain.average_internal_gain = archetype_internal_gain.average_internal_gain
_internal_gain.convective_fraction = archetype_internal_gain.convective_fraction
_internal_gain.radiative_fraction = archetype_internal_gain.radiative_fraction

View File

@ -30,7 +30,7 @@ class UsageZoneArchetype:
def not_detailed_source_mean_annual_internal_gains(self) -> List[HftInternalGainsArchetype]:
"""
Get usage zone internal gains from not detailed heating source in W/m2
:return: [InternalGains]
:return: [InternalGain]
"""
return self._not_detailed_source_mean_annual_internal_gains

View File

@ -8,7 +8,7 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
import xmltodict
import copy
from city_model_structure.building_demand.usage_zone import UsageZone
from city_model_structure.building_demand.internal_gains import InternalGains
from city_model_structure.building_demand.internal_gain import InternalGain
from city_model_structure.building_demand.occupancy import Occupancy
from city_model_structure.building_demand.appliances import Appliances
from city_model_structure.building_demand.thermal_control import ThermalControl
@ -49,7 +49,7 @@ class HftUsageInterface:
usage_zone_archetype.occupancy = _occupancy
if 'internGains' in zone_usage_type['occupancy']:
_internal_gain = InternalGains()
_internal_gain = InternalGain()
_internal_gain.latent_fraction = zone_usage_type['occupancy']['internGains']['latentFraction']
_internal_gain.convective_fraction = zone_usage_type['occupancy']['internGains']['convectiveFraction']
_internal_gain.average_internal_gain = zone_usage_type['occupancy']['internGains']['averageInternGainPerSqm']
@ -164,7 +164,7 @@ class HftUsageInterface:
usage_zone_archetype.occupancy = _occupancy
if 'internGains' in usage_zone_variant['occupancy']:
_internal_gain = InternalGains()
_internal_gain = InternalGain()
if 'latentFraction' in usage_zone_variant['occupancy']['internGains']:
_internal_gain.latent_fraction = usage_zone_variant['occupancy']['internGains']['latentFraction']
if 'convectiveFraction' in usage_zone_variant['occupancy']['internGains']:

View File

@ -76,7 +76,7 @@ class HftUsageParameters(HftUsageInterface):
usage_zone.thermal_control = _control
_internal_gains = []
for archetype_internal_gain in archetype.not_detailed_source_mean_annual_internal_gains:
_internal_gain = InternalGains()
_internal_gain = InternalGain()
_internal_gain.average_internal_gain = archetype_internal_gain.average_internal_gain
_internal_gain.convective_fraction = archetype_internal_gain.convective_fraction
_internal_gain.radiative_fraction = archetype_internal_gain.radiative_fraction

View File

@ -6,7 +6,8 @@ Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from unittest import TestCase
from catalogs.greenery_catalog_factory import GreeneryCatalogFactory
from catalog_factories.greenery_catalog_factory import GreeneryCatalogFactory
class TestGreeneryCatalog(TestCase):