Paquete instalable para EnerHabitat
Project description
EnerHabitat
Tools for evaluating the thermal performance of structures based on EPW files
Contents
- Installation
- Recommended structure
- Key concepts
- Quickstart
- Main Structures
- Materials
- Dependencies
- License
Getting started
enerhabitat is a Python package for thermal simulation of constructive systems based on meteorological data from EPW files. The values that are calculated include:
- Ta : Ambient temperature
- Tsa : Sun-air temperature
- Ti : Interior temperature
- Ig : Global horizontal irradiance
- Ib : Direct normal irradiance
- Id : Diffuse horizontal irradiance
- Is : Surface irradiance
Installation
The source code is currently hosted on GitHub at EnerHabitat
Binary installers for the latest released version are available at the Python Package Index PyPI
pip install enerhabitat
If you're working with the uv Python package manager you can use the following
$ uv add enerhabitat
Folder structure
The following shows the basic folder structure recommended
├── main.py
├── materials.ini # Materials properties
└── epw
├── ...
└── example_file.epw
Key concepts
Locationreads an EPW file and computes the average day withmeanDay().Systemuses aLocationand a list of layers to computeTsa,solve, andsolveAC.configis a global instance. Modifyconfig's attributes to change all subsequent computations behavior.
Quickstart
import enerhabitat as eh
# 1) Global configuration
# eh.config.file = "./materials.ini"
# 2) Location
epw_file = "./epw/example.epw"
loc = eh.Location(epw_file)
# 3) Constructive system
wall = eh.System(location=loc)
wall.layers = [("Adobe", 0.2)]
# 4) Solve
tsa = wall.Tsa()
ti = wall.solve()
Main structures
Load the EnerHabitat package for use
import enerhabitat as eh
Location
Create a location object from an EPW file.
import enerhabitat as eh
epw_file = "./epw/example.epw"
loc = eh.Location(epw_file)
Attributes
The EPW path is stored infile, other Location read-only values include:
city:strwith the city of the EPW header.latitude:floatvalue in degrees.longitude:floatin degrees.altitude:floatvalue in meters.timezone:pytz.timezoneobject.
Read-only attributes are recovered from the file header, assign a new EPW file to file to modify them
loc.file = "./epw/other.epw"
Methods
meanDay()Calculates the average-day DataFrame with Ta, Ig, Ib, Id, and Tn.copy()Returns a copy of the instanceinfo()Prints instance attributesflag()Dict with the lastmeanDay()computation values
Examples:
loc.meanDay(month="6", year=2020).info()
loc.info()
print(loc.flag()["date"])
System
Models a constructive system and computes interior temperatures. Crate a System from a Location object
import enerhabitat as eh
loc = eh.Location("./epw/example.epw")
wall = eh.System(location = loc)
Attributes
location: AssociatedLocationobjecttilt:floatazimuth:floatabsortance:floatlayers:listwith(material, width)tuples
wall.location = loc_2
wall.tilt = 0
wall.azimuth = 45,
wall.absortance = 0.3)
# Layers from outside to inside
wall.layers = [("Adobe", 0.10), ("Acero", 0.05), ("Ladrillo", 0.02)]
# Add and remove layers
wall.add_layer("Mortero", 0.20)
wall.remove_layer(2)
Other computation result values are stores as read-only attributes, this include:
energy_transfer: Total energy transfer computed insolve()heating_energy: Total heating energy need computed insolveAC()cooling_energy: Total cooling energy need computed insolveAC()
Methods
Tsa()computes Tsa and Is based onLocation.meanDay()solve()computes Ti for the constructive system'slayerssolveAC()computes cooling and heating energy with constant Ticopy()returns a copy of the instanceinfo()prints attributesflag()tells whether the cached value was recalculated
Examples:
# Tsa
wall.Tsa().info()
# Computation internal temperature
ti = wall.solve()
energy = wall.energy_transfer
# Computation Air conditioning
wall.solveAC()
c_energy = wall.cooling_energy
h_energy = wall.heating_energy
Config (global)
config stores parameters shared by all instances.
Note: this is global. Changing it affects future computations for any Location or System.
Attributes:
file: Path to.inifile containing material's name and propertysLa: length of the fictional roomNx: Number of elements to discretize the construction systemho: Outside convection heat transferhi: Inside coonvection heat transferdt: Time step inseconds
Example:
import enerhabitat as eh
# Change materials file
eh.config.file = "./materials.ini"
# Update parameters
eh.config.La = 2.0
eh.config.Nx = 300
eh.config.ho = 12
eh.config.hi = 8.3
eh.config.dt = 60
Additionally config stores materials propertys in the read-only materials attribute in the form of a dict with the names of materials as keys and their properties k, rho and c class attributes
eh.config.materials
# Prueba con un solo material
adobe = eh.config.materials["Adobe"]
adobe.rho
adobe.c
adobe.k
Methods
info()prints currentconfigvaluesto_dict()returnsconfigparameters as adictreset()restores defaultconfigvaluesmaterials_list()returns the material names defined infilematerials_dict()returns adictof material properties
Materials
The material's name and their properties are specified in the materials.ini configuration file, specifying the material name as the key and its values for k, rho and c.
[concrete]
k = 1.35 # Overall heat transfer coefficient
rho = 1800 # Density
c = 1000 # Specific heat
[adobe]
k = 0.58
rho = 1500
c = 1480
To set a configuration file, use the config.file attribute and specify the path.
eh.config.file = "./config/new_materials.ini"
Dependencies
License
Code released under the MIT license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file enerhabitat-0.1.7.tar.gz.
File metadata
- Download URL: enerhabitat-0.1.7.tar.gz
- Upload date:
- Size: 59.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cb4e94a77e53a4fb6e0ac8ba15a322f96808d033fdcd510b1453ad23cbb445a
|
|
| MD5 |
53fdbb40ff757eeb7aead13f1fc7a02a
|
|
| BLAKE2b-256 |
edf87d436a01d08ebbf0886ed8fa354b9bce4aa528e7471a59f173c7ee9e182b
|
File details
Details for the file enerhabitat-0.1.7-py3-none-any.whl.
File metadata
- Download URL: enerhabitat-0.1.7-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26768ea69aefa645fe52fd5107a0f684964737ba2e29fd01589eafe912b21972
|
|
| MD5 |
7b9bd3b0fa84091af4276d46703af54a
|
|
| BLAKE2b-256 |
ca620bc5d5829266fd6ffe3c0fa6925106a93431e60ddd5007d9b143037a9e88
|