Manipulation des couches d'une paroi d'une construction¶
In [25]:
Copied!
import os
import pathlib
from eppy import bunch_subclass
from eppy.modeleditor import IDF
import os
import pathlib
from eppy import bunch_subclass
from eppy.modeleditor import IDF
In [26]:
Copied!
iddfile = "/Applications/EnergyPlus-23-2-0/Energy+.idd"
IDF.setiddname(iddfile)
iddfile = "/Applications/EnergyPlus-23-2-0/Energy+.idd"
IDF.setiddname(iddfile)
In [27]:
Copied!
run_dir = pathlib.Path("../examples")
case_dir = pathlib.Path(os.path.join(run_dir, "design_cabane"))
idf_path = pathlib.Path(os.path.join(case_dir, "cabane.idf"))
epw_path = pathlib.Path(os.path.join(case_dir, "CLERMONT-FERRAND_2019.epw"))
run_dir = pathlib.Path("../examples")
case_dir = pathlib.Path(os.path.join(run_dir, "design_cabane"))
idf_path = pathlib.Path(os.path.join(case_dir, "cabane.idf"))
epw_path = pathlib.Path(os.path.join(case_dir, "CLERMONT-FERRAND_2019.epw"))
In [28]:
Copied!
idf = IDF(idf_path)
idf = IDF(idf_path)
Bibliothèque de matériaux¶
In [29]:
Copied!
materiaux : bunch_subclass.EpBunch= idf.idfobjects["Material"]
materiaux : bunch_subclass.EpBunch= idf.idfobjects["Material"]
In [30]:
Copied!
materiaux
materiaux
Out[30]:
[
Material,
Concrete 120mm, !- Name
MediumRough, !- Roughness
0.12, !- Thickness
1.2, !- Conductivity
2400, !- Density
850, !- Specific Heat
0.9, !- Thermal Absorptance
0.65, !- Solar Absorptance
0.65; !- Visible Absorptance
,
Material,
Concrete 150mm, !- Name
MediumRough, !- Roughness
0.15, !- Thickness
1.2, !- Conductivity
2400, !- Density
850, !- Specific Heat
0.9, !- Thermal Absorptance
0.65, !- Solar Absorptance
0.65; !- Visible Absorptance
,
Material,
GlassWool 40mm, !- Name
Smooth, !- Roughness
0.04, !- Thickness
0.045, !- Conductivity
100, !- Density
1000, !- Specific Heat
0.9, !- Thermal Absorptance
0.7, !- Solar Absorptance
0.7; !- Visible Absorptance
,
Material,
PUR 30mm, !- Name
Smooth, !- Roughness
0.03, !- Thickness
0.035, !- Conductivity
35, !- Density
1400, !- Specific Heat
0.9, !- Thermal Absorptance
0.7, !- Solar Absorptance
0.7; !- Visible Absorptance
,
Material,
Wood, !- Name
Rough, !- Roughness
0.02, !- Thickness
0.15, !- Conductivity
550, !- Density
2600, !- Specific Heat
0.2, !- Thermal Absorptance
0.4, !- Solar Absorptance
0.4; !- Visible Absorptance
]
Chercher un objet constructif¶
In [31]:
Copied!
mur : bunch_subclass.EpBunch= idf.getobject(key="Construction", name="Mur")
mur : bunch_subclass.EpBunch= idf.getobject(key="Construction", name="Mur")
In [32]:
Copied!
mur
mur
Out[32]:
Construction,
Mur, !- Name
Concrete 120mm, !- Outside Layer
GlassWool 40mm; !- Layer 2
Ajouter une couche¶
In [33]:
Copied!
mur.obj.append("Wood")
mur.obj.append("Wood")
In [34]:
Copied!
mur
mur
Out[34]:
Construction,
Mur, !- Name
Concrete 120mm, !- Outside Layer
GlassWool 40mm, !- Layer 2
Wood; !- Layer 3
Insérer une couche avec index (attention il faut commencer à partir de l'index 2)¶
In [35]:
Copied!
mur.obj.insert(3,"GlassWool 40mm")
mur.obj.insert(3,"GlassWool 40mm")
In [36]:
Copied!
mur
mur
Out[36]:
Construction,
Mur, !- Name
Concrete 120mm, !- Outside Layer
GlassWool 40mm, !- Layer 2
GlassWool 40mm, !- Layer 3
Wood; !- Layer 4
Supprimer une couche avec index¶
In [37]:
Copied!
mur.obj.pop(3)
mur.obj.pop(3)
Out[37]:
'GlassWool 40mm'
In [38]:
Copied!
mur
mur
Out[38]:
Construction,
Mur, !- Name
Concrete 120mm, !- Outside Layer
GlassWool 40mm, !- Layer 2
Wood; !- Layer 3
In [39]:
Copied!
## Supprimer des couches avec leurs noms
## Supprimer des couches avec leurs noms
In [40]:
Copied!
def remove_layer_from_name(construction: bunch_subclass.EpBunch=mur,layer_lst_name:list=["GlassWool 40mm"]):
for field,value in zip(construction.fieldnames, construction.fieldvalues):
if value in layer_lst_name:
index_find = construction.fieldnames.index(field)
construction.obj.pop(index_find)
def remove_layer_from_name(construction: bunch_subclass.EpBunch=mur,layer_lst_name:list=["GlassWool 40mm"]):
for field,value in zip(construction.fieldnames, construction.fieldvalues):
if value in layer_lst_name:
index_find = construction.fieldnames.index(field)
construction.obj.pop(index_find)
In [41]:
Copied!
remove_layer_from_name(construction=mur, layer_lst_name=["GlassWool 40mm"])
remove_layer_from_name(construction=mur, layer_lst_name=["GlassWool 40mm"])
In [42]:
Copied!
mur
mur
Out[42]:
Construction,
Mur, !- Name
Concrete 120mm, !- Outside Layer
Wood; !- Layer 2