Skip to content

Commit f9b08e0

Browse files
Merge pull request #38 from LBNL-ETA/develop
Develop
2 parents 57d430e + 44c6a8b commit f9b08e0

File tree

169 files changed

+3964
-2488
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+3964
-2488
lines changed

.github/workflows/build_wheels.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
name: Build wheels
22

3-
on:
4-
# Triggers the workflow on push or pull request events but only for the main branch
5-
push:
6-
branches: [ main ]
7-
pull_request:
8-
branches: [ main ]
3+
on: [push, pull_request]
94

10-
# Cannot use cibuildwheels because the current images used by cibuildwheels do not support C++17.
5+
# Cannot use cibuildwheels because the current images used by cibuildwheels do not support C++17.
116

127
jobs:
138
build_wheels_windows:
@@ -17,7 +12,7 @@ jobs:
1712
matrix:
1813
os: [windows-2019]
1914
arch: [x86, x64]
20-
python-version: [3.7, 3.8, 3.9, "3.10"]
15+
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
2116

2217
steps:
2318
- name: Checkout repository
@@ -48,8 +43,10 @@ jobs:
4843
# Trying to use cibuildwheels to build mac wheels fails because the version of XCode is not high enough.
4944
# There is documentation here https://github.com/pypa/cibuildwheel/blob/main/docs/cpp_standards.md on how to
5045
# set it but I could not get it to work while using the standard images provided by github actions does work.
51-
os: [macos-10.15]
52-
python-version: [3.7, 3.8, 3.9, "3.10"]
46+
os: [macos-latest]
47+
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
48+
env:
49+
SYSTEM_VERSION_COMPAT: 0
5350

5451
steps:
5552
- name: Checkout repository

CMakeLists-WinCalc.txt.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ include(ExternalProject)
44

55
ExternalProject_Add(wincalc
66
GIT_REPOSITORY https://github.com/LBNL-ETA/WinCalc.git
7-
GIT_TAG "v2.2.4"
7+
GIT_TAG "develop"
88

99
UPDATE_COMMAND ""
1010
PATCH_COMMAND ""

CMakeLists-pybind11.txt.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ include(ExternalProject)
44

55
ExternalProject_Add(pybind11
66
GIT_REPOSITORY https://github.com/pybind/pybind11.git
7-
GIT_TAG "v2.9.0"
7+
GIT_TAG "v2.10.3"
88

99
UPDATE_COMMAND ""
1010
PATCH_COMMAND ""

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
cmake_minimum_required(VERSION 3.8)
1+
cmake_minimum_required(VERSION 3.12)
22

33
set( CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON )
44

5-
set( target_name pywincalc )
5+
set( target_name wincalcbindings )
66
project( ${target_name} )
77

88
set(JSON_BuildTests OFF CACHE BOOL "")
@@ -11,7 +11,7 @@ set(BUILD_WinCalc_tests OFF CACHE BOOL "")
1111
include(CMakeLists-WinCalc.txt)
1212
include(CMakeLists-pybind11.txt)
1313

14-
pybind11_add_module(${target_name} src/pywincalc.cpp)
14+
pybind11_add_module(${target_name} src/wincalcbindings.cpp)
1515

1616
target_compile_features(${target_name} PUBLIC cxx_std_17)
1717
target_link_libraries( ${target_name} PRIVATE wincalc)
@@ -22,4 +22,4 @@ target_include_directories(${target_name}
2222
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
2323
PRIVATE
2424
${CMAKE_CURRENT_SOURCE_DIR}/src
25-
)
25+
)

MANIFEST.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
include pywincalc/standards/*.dsp
2+
include pywincalc/standards/*.loc
3+
include pywincalc/standards/*.scc
4+
include pywincalc/standards/*.ssp
5+
include pywincalc/standards/*.std
6+
include pywincalc/standards/*.wvl

examples/bsdf_integrator.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import pywincalc
2+
3+
bsdf_hemisphere = pywincalc.BSDFHemisphere.create(pywincalc.BSDFBasisType.FULL)
4+
5+
bsdf_path = "products/2011-SA1.XML"
6+
bsdf_shade = pywincalc.parse_bsdf_xml_file(bsdf_path)
7+
8+
front_transmittance_matrix = pywincalc.SquareMatrix(bsdf_shade.measurements.solar.transmittance_front.data)
9+
front_reflectance_matrix = pywincalc.SquareMatrix(bsdf_shade.measurements.solar.reflectance_front.data)
10+
11+
integrator = pywincalc.BSDFIntegrator(bsdf_hemisphere.get_directions(pywincalc.BSDFDirection.Incoming))
12+
integrator.set_matrices(front_transmittance_matrix, front_reflectance_matrix, pywincalc.Side.Front)
13+
14+
front_hemispheric_transmittances = integrator.direct_hemispheric(pywincalc.Side.Front, pywincalc.PropertySimple.T)
15+
front_hemispheric_reflectances = integrator.direct_hemispheric(pywincalc.Side.Front, pywincalc.PropertySimple.R)
16+
17+
print("Front hemipsheric transmittances for each incoming angle: {v}".format(v=front_hemispheric_transmittances))
18+
print("Front hemipsheric reflectances for each incoming angle: {v}".format(v=front_hemispheric_reflectances))

examples/bsdf_shade_igsdb_product.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import pywincalc
2+
import requests
3+
from igsdb_interaction import url_single_product, headers, url_single_product_datafile
4+
5+
bsdf_hemisphere = pywincalc.BSDFHemisphere.create(pywincalc.BSDFBasisType.FULL)
6+
7+
bsdf_igsdb_id = 14710
8+
9+
bsdf_igsdb_response = requests.get(url_single_product_datafile.format(id=bsdf_igsdb_id), headers=headers)
10+
11+
# The BSDF data is currently stored as XML on igsdb.lbl.gov. As a result it needs to be
12+
# parsed using the xml string parser instead of the json parser
13+
bsdf_shade = pywincalc.parse_bsdf_xml_string(bsdf_igsdb_response.content)
14+
15+
# Create a glazing system. This only shows an example of getting one result from a glazing system
16+
# created using default environmental conditions.
17+
#
18+
# For more possible results see optical_results_NFRC.py
19+
#
20+
# For more on environmental conditions see environmental_conditions_user_defined.py
21+
glazing_system = pywincalc.GlazingSystem(solid_layers=[bsdf_shade], bsdf_hemisphere=bsdf_hemisphere)
22+
23+
u_value = glazing_system.u()
24+
print("U-value for a BSDF shade downloaded from igsdb.lbl.glv: {v}".format(v=u_value))

examples/bsdf_shade_local_file.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import pywincalc
2+
3+
bsdf_hemisphere = pywincalc.BSDFHemisphere.create(pywincalc.BSDFBasisType.FULL)
4+
5+
bsdf_path = "products/2011-SA1.XML"
6+
bsdf_shade = pywincalc.parse_bsdf_xml_file(bsdf_path)
7+
8+
# Create a glazing system. This only shows an example of getting one result from a glazing system
9+
# created using default environmental conditions.
10+
#
11+
# For more possible results see optical_results_NFRC.py
12+
#
13+
# For more on environmental conditions see environmental_conditions_user_defined.py
14+
glazing_system = pywincalc.GlazingSystem(solid_layers=[bsdf_shade], bsdf_hemisphere=bsdf_hemisphere)
15+
16+
u_value = glazing_system.u()
17+
print("U-value for a BSDF shade created from a local file: {v}".format(v=u_value))

examples/deflection.py

Lines changed: 31 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
import pywincalc
22

3-
# Path to the optical standard file. All other files referenced by the standard file must be in the same directory
4-
# Note: While all optical standards packaged with WINDOW should work with optical calculations care should be
5-
# taken to use NFRC standards if NFRC thermal results are desired. This is because for thermal calculations currently
6-
# only ISO 15099 is supported. While it is possible to use EN optical standards and create thermal results
7-
# those results will not be based on EN 673
8-
optical_standard_path = "standards/W5_NFRC_2003.std"
9-
optical_standard = pywincalc.load_standard(optical_standard_path)
10-
113
# Load solid layer measured values. Solid layer information can come from either igsdb.lbl.gov or files generate
124
# by the Optics program. Since igsdb.lbl.gov requires registration some optics files are provided for example
135
# purposes
@@ -22,18 +14,10 @@
2214
# that was just loaded and the middle is the same glass as the single clear example above
2315
solid_layers = [clear_6, clear_3, clear_6]
2416

25-
# Solid layers must be separated by gap layers
26-
# Currently there are four pre-defined gases available: Air, Argon, Krypton, and Xenon
27-
# Vacuum gaps are not yet supported
28-
# To create a gap with 100% of a predefined gas create a Gap_Data object with the gas type
29-
# and thickness in meters
30-
gap_1 = pywincalc.Gap(pywincalc.PredefinedGasType.AIR, .0127) # .0127 is gap thickness in meters
31-
32-
# To create a mixture of predefined gases first create the components with the gas type and portion of the mixture
33-
# The following creates a gas that is 70% Krypton and 30% Xenon and 2cm thick
34-
gap_2_component_1 = pywincalc.PredefinedGasMixtureComponent(pywincalc.PredefinedGasType.KRYPTON, .7)
35-
gap_2_component_2 = pywincalc.PredefinedGasMixtureComponent(pywincalc.PredefinedGasType.XENON, .3)
36-
gap_2 = pywincalc.Gap([gap_2_component_1, gap_2_component_2], .02) # .02 is gap thickness in meters
17+
# Solid layers must be separated by gap layers. This example uses two air gaps
18+
# See gaps_and_gases.py in examples for more on creating gases
19+
gap_1 = pywincalc.Layers.gap(thickness=.0127)
20+
gap_2 = pywincalc.Layers.gap(thickness=.02)
3721

3822
# Put all gaps into a list ordered from outside to inside
3923
# Note: This is only specifying gaps between solid layers
@@ -45,14 +29,14 @@
4529
height = 1.0 # height of the glazing system in meters
4630
tilt = 90 # glazing system tilt in degrees
4731

48-
glazing_system = pywincalc.GlazingSystem(optical_standard=optical_standard, solid_layers=solid_layers, gap_layers=gaps,
49-
width_meters=width, height_meters=height, tilt_degrees=tilt,
50-
environment=pywincalc.nfrc_u_environments())
32+
glazing_system = pywincalc.GlazingSystem(solid_layers=solid_layers, gap_layers=gaps,
33+
width_meters=width, height_meters=height, tilt_degrees=tilt)
34+
5135
# Deflection calcs currently need to be specifically enabled
5236
glazing_system.enable_deflection(True)
5337

5438
# Set initial temperature and pressure. Values just chosen for example purposes
55-
glazing_system.set_deflection_properties(temperature_initial=273, pressure_initial=1013200)
39+
glazing_system.set_deflection_properties(temperature_initial=273, pressure_initial=101320)
5640

5741
# Density can be calculated using either U or SHGC TARCOG system types. Just using SHGC for this
5842
# example for simplicity.
@@ -64,13 +48,13 @@
6448
print("\tU: {val}".format(val=glazing_system.u()))
6549
print("\tSHGC: {val}".format(val=glazing_system.shgc()))
6650
print("\tLayer temperatures (U): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.U)))
67-
print("\tLayer temperatures (SHGC): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.SHGC)))
51+
print(
52+
"\tLayer temperatures (SHGC): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.SHGC)))
6853
visible_results = glazing_system.optical_method_results("PHOTOPIC")
6954
print("\tVT: {val}".format(val=visible_results.system_results.front.transmittance.direct_hemispherical))
7055

71-
7256
# Change initial temperature and pressure. Values just chosen for example purposes
73-
glazing_system.set_deflection_properties(temperature_initial=290, pressure_initial=1014500)
57+
glazing_system.set_deflection_properties(temperature_initial=290, pressure_initial=101450)
7458
print("")
7559
print("Changed initial temperature and pressure")
7660
print("\tdeflection max: {val}".format(val=deflection_results.deflection_max))
@@ -79,7 +63,8 @@
7963
print("\tU: {val}".format(val=glazing_system.u()))
8064
print("\tSHGC: {val}".format(val=glazing_system.shgc()))
8165
print("\tLayer temperatures (U): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.U)))
82-
print("\tLayer temperatures (SHGC): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.SHGC)))
66+
print(
67+
"\tLayer temperatures (SHGC): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.SHGC)))
8368
visible_results = glazing_system.optical_method_results("PHOTOPIC")
8469
print("\tVT: {val}".format(val=visible_results.system_results.front.transmittance.direct_hemispherical))
8570
# Change tilt
@@ -94,7 +79,8 @@
9479
print("\tU: {val}".format(val=glazing_system.u()))
9580
print("\tSHGC: {val}".format(val=glazing_system.shgc()))
9681
print("\tLayer temperatures (U): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.U)))
97-
print("\tLayer temperatures (SHGC): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.SHGC)))
82+
print(
83+
"\tLayer temperatures (SHGC): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.SHGC)))
9884
visible_results = glazing_system.optical_method_results("PHOTOPIC")
9985
print("\tVT: {val}".format(val=visible_results.system_results.front.transmittance.direct_hemispherical))
10086

@@ -111,7 +97,8 @@
11197
print("\tU: {val}".format(val=glazing_system.u()))
11298
print("\tSHGC: {val}".format(val=glazing_system.shgc()))
11399
print("\tLayer temperatures (U): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.U)))
114-
print("\tLayer temperatures (SHGC): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.SHGC)))
100+
print(
101+
"\tLayer temperatures (SHGC): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.SHGC)))
115102
visible_results = glazing_system.optical_method_results("PHOTOPIC")
116103
print("\tVT: {val}".format(val=visible_results.system_results.front.transmittance.direct_hemispherical))
117104

@@ -160,17 +147,7 @@
160147

161148
custom_env = pywincalc.Environments(outside=custom_outside_env, inside=custom_inside_env)
162149

163-
# changing environmental conditions currently requires creating a new glazing system
164-
# note: this resets any changes made such as if deflection is enabled or applied load is set.
165-
# if this is a problem or you think it would be better to be able to change environmental conditions
166-
# like tilt and load let us know.
167-
168-
glazing_system = pywincalc.GlazingSystem(optical_standard=optical_standard, solid_layers=solid_layers, gap_layers=gaps,
169-
width_meters=width, height_meters=height, tilt_degrees=tilt,
170-
environment=custom_env)
171-
172-
glazing_system.enable_deflection(True)
173-
glazing_system.set_deflection_properties(temperature_initial=273, pressure_initial=1013200)
150+
glazing_system.environments(custom_env)
174151
deflection_results = glazing_system.calc_deflection_properties(pywincalc.TarcogSystemType.SHGC)
175152

176153
print("")
@@ -181,7 +158,8 @@
181158
print("\tU: {val}".format(val=glazing_system.u()))
182159
print("\tSHGC: {val}".format(val=glazing_system.shgc()))
183160
print("\tLayer temperatures (U): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.U)))
184-
print("\tLayer temperatures (SHGC): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.SHGC)))
161+
print(
162+
"\tLayer temperatures (SHGC): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.SHGC)))
185163
visible_results = glazing_system.optical_method_results("PHOTOPIC")
186164
print("\tVT: {val}".format(val=visible_results.system_results.front.transmittance.direct_hemispherical))
187165

@@ -194,12 +172,9 @@
194172
custom_env_2.outside.pressure += 500
195173
custom_env_2.inside.pressure -= 200
196174

197-
glazing_system = pywincalc.GlazingSystem(optical_standard=optical_standard, solid_layers=solid_layers, gap_layers=gaps,
198-
width_meters=width, height_meters=height, tilt_degrees=tilt,
199-
environment=custom_env_2)
175+
glazing_system.environments(custom_env_2)
200176

201-
glazing_system.enable_deflection(True)
202-
glazing_system.set_deflection_properties(temperature_initial=273, pressure_initial=1013200)
177+
glazing_system.set_deflection_properties(temperature_initial=273, pressure_initial=101320)
203178
deflection_results = glazing_system.calc_deflection_properties(pywincalc.TarcogSystemType.SHGC)
204179

205180
print("")
@@ -210,7 +185,8 @@
210185
print("\tU: {val}".format(val=glazing_system.u()))
211186
print("\tSHGC: {val}".format(val=glazing_system.shgc()))
212187
print("\tLayer temperatures (U): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.U)))
213-
print("\tLayer temperatures (SHGC): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.SHGC)))
188+
print(
189+
"\tLayer temperatures (SHGC): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.SHGC)))
214190
visible_results = glazing_system.optical_method_results("PHOTOPIC")
215191
print("\tVT: {val}".format(val=visible_results.system_results.front.transmittance.direct_hemispherical))
216192

@@ -224,22 +200,22 @@
224200

225201
solid_layers = [clear_6, clear_3, clear_6]
226202

227-
glazing_system = pywincalc.GlazingSystem(optical_standard=optical_standard, solid_layers=solid_layers,
228-
gap_layers=gaps, width_meters=width, height_meters=height, tilt_degrees=tilt,
229-
environment=custom_env_2)
203+
glazing_system = pywincalc.GlazingSystem(solid_layers=solid_layers, gap_layers=gaps, width_meters=width,
204+
height_meters=height, tilt_degrees=tilt, environment=custom_env_2)
230205

231206
glazing_system.enable_deflection(True)
232-
glazing_system.set_deflection_properties(temperature_initial=273, pressure_initial=1013200)
207+
glazing_system.set_deflection_properties(temperature_initial=273, pressure_initial=101320)
233208
deflection_results = glazing_system.calc_deflection_properties(pywincalc.TarcogSystemType.SHGC)
234209

235210
print("")
236-
print("Set density and youngs modulus")
211+
print("Set density and Young's modulus")
237212
print("\tdeflection max: {val}".format(val=deflection_results.deflection_max))
238213
print("\tdeflection mean: {val}".format(val=deflection_results.deflection_mean))
239214
print("\tpanes load: {val}".format(val=deflection_results.panes_load))
240215
print("\tU: {val}".format(val=glazing_system.u()))
241216
print("\tSHGC: {val}".format(val=glazing_system.shgc()))
242217
print("\tLayer temperatures (U): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.U)))
243-
print("\tLayer temperatures (SHGC): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.SHGC)))
218+
print(
219+
"\tLayer temperatures (SHGC): {val}".format(val=glazing_system.layer_temperatures(pywincalc.TarcogSystemType.SHGC)))
244220
visible_results = glazing_system.optical_method_results("PHOTOPIC")
245-
print("\tVT: {val}".format(val=visible_results.system_results.front.transmittance.direct_hemispherical))
221+
print("\tVT: {val}".format(val=visible_results.system_results.front.transmittance.direct_hemispherical))

examples/custom_environmental_conditions.py renamed to examples/environmental_conditions_user_defined.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import pywincalc
22

3-
optical_standard_path = "standards/W5_NFRC_2003.std"
4-
optical_standard = pywincalc.load_standard(optical_standard_path)
5-
63
clear_3_path = "products/CLEAR_3.DAT"
74
clear_3 = pywincalc.parse_optics_file(clear_3_path)
85

@@ -45,5 +42,7 @@
4542
direct_solar_radiation=outside_direct_solar_radiation)
4643

4744
environmental_conditions = pywincalc.Environments(outside_environment, inside_environment)
48-
glazing_system = pywincalc.GlazingSystem(optical_standard, solid_layers, environment=environmental_conditions)
49-
print("U-value for a single-clear system with custom environmental conditions: {u}".format(u=glazing_system.u()))
45+
glazing_system = pywincalc.GlazingSystem(solid_layers=solid_layers, environment=environmental_conditions)
46+
47+
u_value = glazing_system.u()
48+
print("U-value for a glazing system with user-defined environmental conditions: {v}".format(v=u_value))

0 commit comments

Comments
 (0)