Skip to content

Commit

Permalink
Creating pillars with new arguments added to the system. Also Layers …
Browse files Browse the repository at this point in the history
…is now namespace and not class as before.
  • Loading branch information
vidanovic committed Jun 26, 2024
1 parent 3853d31 commit 06fb1ca
Show file tree
Hide file tree
Showing 3 changed files with 167 additions and 158 deletions.
2 changes: 1 addition & 1 deletion CMakeLists-WinCalc.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include(ExternalProject)

ExternalProject_Add(wincalc
GIT_REPOSITORY https://github.com/LBNL-ETA/WinCalc.git
GIT_TAG "VariableAirflowCoefficients"
GIT_TAG "VacuumDec2023"

UPDATE_COMMAND ""
PATCH_COMMAND ""
Expand Down
94 changes: 34 additions & 60 deletions pywincalc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,68 +1,42 @@
from pathlib import Path
import deprecation

# Ideally the following long list would just be `from wincalcbindings import *`.
# But there are a few things that we'd like to provide python versions of
# while keeping the same function name for backwards compatibility.
# So the options seem to be either change the name of the C++ bindings, which is a possiblilty
# or specifically import the functions that should be re-exported and alias them in the process
#
# Currently this seems like a better approach since it allows for future cases if needed.
# Also changing library code because of an issue in the client does not seem like the correct approach in general.
#
# If there were a way to import * and then rename the individual functions that would likely work as well
# and require less maintenance. However so far the only way I have come up with is something like
#
# def prepend_underscore_to_package_item(package, name):
# f = getattr(package, name)
# setattr(package, "_"+name, f)
# delattr(package, name)
# return package
#
# wincalcbindings_pkg = importlib.import_module("wincalcbindings")
# wincalcbindings_pkg = prepend_underscore_to_package_item(wincalcbindings_pkg, "load_standard")
# wincalcbindings_pkg = prepend_underscore_to_package_item(wincalcbindings_pkg, "GlazingSystem")
# globals().update(vars(wincalcbindings_pkg))
#
# And I don't think I understand the implications of that fully enough to trust it doesn't have
# any other side effets. e.g. __file__ changes after the globals update

from wincalcbindings import AirHorizontalDirection, BSDF, BSDFBasisType, BSDFDirection, BSDFDirections, BSDFHemisphere, \
BSDFIntegrator, BoundaryConditionsCoefficientModelType, CMABestWorstUFactors, CMAResult, CMAWindow, \
CMAWindowDualVisionHorizontal, CMAWindowDualVisionVertical, CMAWindowSingleVision, CellSpacingType, PolygonType, pillar_cell_area, \
PillarData, CylindricalPillar, SphericalPillar, RectangularPillar, TriangularPillar, PentagonPillar, HexagonPillar, LinearBearingPillar, TruncatedConePillar, Glass, PillarMeasurement, \
AnnulusCylinderPillar, CShapedCylinderPillar, UniversalSupportPillar, CylindricalPillarLayer, SphericalPillarLayer, RectangularPillarLayer, \
TriangularPillarLayer, PentagonPillarLayer, HexagonPillarLayer, LinearBearingPillarLayer, TruncatedConePillarLayer, \
AnnulusCylinderPillarLayer, CShapedCylinderPillarLayer, MeasuredPillarLayer, CoatedSide, \
ColorResult, DeflectionResults, DistributionMethodType, DualBandBSDF, EffectiveOpenness, Environment, Environments, \
FlippableSolidLayer, Gas, GasCoefficients, GasData, GlazingSystem as _GlazingSystem, GlazingSystemDimensions, \
IGUGapLayer, IntegrationRule, IntegrationRuleType, Lab, Layers, MaterialType, \
OpticalMeasurementComponent, OpticalResultAbsorptance, OpticalResultFluxType, OpticalResultFluxTypeColor, \
OpticalResultLayer, OpticalResultSide, OpticalResultSideColor, OpticalResultSide_Layer, OpticalResultTransmission, \
OpticalResultTransmissionColor, OpticalResults, OpticalResultsColor, OpticalStandard, OpticalStandardMethod, \
PVPowerProperty, PVWavelengthData, ParsedPerforatedGeometry, ParsedVenetianGeometry, ParsedWovenGeometry, \
PerforatedGeometry, PredefinedGasType, ProductComposistionData, ProductData, \
ProductDataOptical, ProductDataOpticalAndThermal, ProductDataOpticalDualBand, \
ProductDataOpticalDualBandBSDF, ProductDataOpticalDualBandHemispheric, ProductDataOpticalNBand, \
ProductDataOpticalPerforatedScreen, ProductDataOpticalVenetian, ProductDataOpticalWithMaterial, \
ProductDataOpticalWovenShade, ProductDataThermal, ProductGeometry, PropertySimple, RGB, Side, \
SpectalDataWavelengthRangeMethodType, Spectrum, SpectrumType, SquareMatrix, TarcogSystemType, \
ThermalIRResults, ThmxBoundaryCondition, ThmxBoundaryConditionPolygon, ThmxCMABestWorstOption, ThmxCMAOptions, \
ThmxFileContents, ThmxMaterial, ThmxMeshParameters, ThmxPolygon, ThmxPolygonPoint, ThmxRGB, ThmxResult, \
ThmxUFactorProjectionResult, ThmxUFactorResults, Trichromatic, VenetianGeometry, WavelengthBSDFs, \
WavelengthBoundary, WavelengthBoundaryType, WavelengthData, WavelengthSet, WavelengthSetType, WovenGeometry, \
load_standard as _load_standard, calc_cma, calc_thermal_ir, convert_to_solid_layer, convert_to_solid_layers, \
create_best_worst_u_factor_option, create_gas, create_perforated_screen, create_venetian_blind, create_woven_shade, \
get_cma_window_double_vision_horizontal, get_cma_window_double_vision_vertical, get_cma_window_single_vision, \
get_spacer_keff, nfrc_shgc_environments, nfrc_u_environments, parse_bsdf_xml_file, parse_bsdf_xml_string, \
parse_json, parse_json_file, parse_optics_file, parse_thmx_file, parse_thmx_string, IGUVentilatedGapLayer, \
forced_ventilation_gap


from wincalcbindings import (
AirHorizontalDirection, BSDF, BSDFBasisType, BSDFDirection, BSDFDirections, BSDFHemisphere,
BSDFIntegrator, BoundaryConditionsCoefficientModelType, CMABestWorstUFactors, CMAResult, CMAWindow,
CMAWindowDualVisionHorizontal, CMAWindowDualVisionVertical, CMAWindowSingleVision, layers, CellSpacingType, PolygonType, pillar_cell_area,
PillarData, CylindricalPillar, SphericalPillar, RectangularPillar, TriangularPillar, PentagonPillar, HexagonPillar, LinearBearingPillar, TruncatedConePillar, Glass, PillarMeasurement,
AnnulusCylinderPillar, CShapedCylinderPillar, UniversalSupportPillar, CylindricalPillarLayer, SphericalPillarLayer, RectangularPillarLayer,
TriangularPillarLayer, PentagonPillarLayer, HexagonPillarLayer, LinearBearingPillarLayer, TruncatedConePillarLayer,
AnnulusCylinderPillarLayer, CShapedCylinderPillarLayer, MeasuredPillarLayer, CoatedSide,
ColorResult, DeflectionResults, DistributionMethodType, DualBandBSDF, EffectiveOpenness, Environment, Environments,
FlippableSolidLayer, Gas, GasCoefficients, GasData, GlazingSystem as _GlazingSystem, GlazingSystemDimensions,
IGUGapLayer, IntegrationRule, IntegrationRuleType, Lab, MaterialType,
OpticalMeasurementComponent, OpticalResultAbsorptance, OpticalResultFluxType, OpticalResultFluxTypeColor,
OpticalResultLayer, OpticalResultSide, OpticalResultSideColor, OpticalResultSide_Layer, OpticalResultTransmission,
OpticalResultTransmissionColor, OpticalResults, OpticalResultsColor, OpticalStandard, OpticalStandardMethod,
PVPowerProperty, PVWavelengthData, ParsedPerforatedGeometry, ParsedVenetianGeometry, ParsedWovenGeometry,
PerforatedGeometry, PredefinedGasType, ProductComposistionData, ProductData,
ProductDataOptical, ProductDataOpticalAndThermal, ProductDataOpticalDualBand,
ProductDataOpticalDualBandBSDF, ProductDataOpticalDualBandHemispheric, ProductDataOpticalNBand,
ProductDataOpticalPerforatedScreen, ProductDataOpticalVenetian, ProductDataOpticalWithMaterial,
ProductDataOpticalWovenShade, ProductDataThermal, ProductGeometry, PropertySimple, RGB, Side,
SpectalDataWavelengthRangeMethodType, Spectrum, SpectrumType, SquareMatrix, TarcogSystemType,
ThermalIRResults, ThmxBoundaryCondition, ThmxBoundaryConditionPolygon, ThmxCMABestWorstOption, ThmxCMAOptions,
ThmxFileContents, ThmxMaterial, ThmxMeshParameters, ThmxPolygon, ThmxPolygonPoint, ThmxRGB, ThmxResult,
ThmxUFactorProjectionResult, ThmxUFactorResults, Trichromatic, VenetianGeometry, WavelengthBSDFs,
WavelengthBoundary, WavelengthBoundaryType, WavelengthData, WavelengthSet, WavelengthSetType, WovenGeometry,
load_standard as _load_standard, calc_cma, calc_thermal_ir, convert_to_solid_layer, convert_to_solid_layers,
create_best_worst_u_factor_option, create_gas, create_perforated_screen, create_venetian_blind, create_woven_shade,
get_cma_window_double_vision_horizontal, get_cma_window_double_vision_vertical, get_cma_window_single_vision,
get_spacer_keff, nfrc_shgc_environments, nfrc_u_environments, parse_bsdf_xml_file, parse_bsdf_xml_string,
parse_json, parse_json_file, parse_optics_file, parse_thmx_file, parse_thmx_string, IGUVentilatedGapLayer,
forced_ventilation_gap
)

@deprecation.deprecated(deprecated_in="3.0.0", removed_in="4.0.0",
current_version="3.0.0",
details="Use pywincalc.Layers.gap or pywincalc.create_gas instead")
details="Use pywincalc.layers.gap or pywincalc.create_gas instead")
def Gap(gas, thickness):
converted_gas = None
if type(gas) is list:
Expand All @@ -72,7 +46,7 @@ def Gap(gas, thickness):
else:
# otherwise it is just a single component and therefore 100% of the mixture
converted_gas = create_gas([[1.0, gas]])
return Layers.gap(gas=converted_gas, thickness=thickness)
return layers.gap(gas=converted_gas, thickness=thickness)


@deprecation.deprecated(deprecated_in="3.0.0", removed_in="4.0.0",
Expand Down
Loading

0 comments on commit 06fb1ca

Please sign in to comment.