LCOV - code coverage report
Current view: top level - EnergyPlus - TARCOGArgs.cc (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 0.0 % 265 0
Test Date: 2025-06-02 12:03:30 Functions: 0.0 % 3 0

            Line data    Source code
       1              : // EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois,
       2              : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
       3              : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
       4              : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
       5              : // contributors. All rights reserved.
       6              : //
       7              : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
       8              : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
       9              : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
      10              : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
      11              : // derivative works, and perform publicly and display publicly, and to permit others to do so.
      12              : //
      13              : // Redistribution and use in source and binary forms, with or without modification, are permitted
      14              : // provided that the following conditions are met:
      15              : //
      16              : // (1) Redistributions of source code must retain the above copyright notice, this list of
      17              : //     conditions and the following disclaimer.
      18              : //
      19              : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
      20              : //     conditions and the following disclaimer in the documentation and/or other materials
      21              : //     provided with the distribution.
      22              : //
      23              : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
      24              : //     the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
      25              : //     used to endorse or promote products derived from this software without specific prior
      26              : //     written permission.
      27              : //
      28              : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
      29              : //     without changes from the version obtained under this License, or (ii) Licensee makes a
      30              : //     reference solely to the software portion of its product, Licensee must refer to the
      31              : //     software as "EnergyPlus version X" software, where "X" is the version number Licensee
      32              : //     obtained under this License and may not use a different name for the software. Except as
      33              : //     specifically required in this Section (4), Licensee shall not use in a company name, a
      34              : //     product name, in advertising, publicity, or other promotional activities any name, trade
      35              : //     name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
      36              : //     similar designation, without the U.S. Department of Energy's prior written consent.
      37              : //
      38              : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
      39              : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
      40              : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
      41              : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
      42              : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
      43              : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      44              : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
      45              : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
      46              : // POSSIBILITY OF SUCH DAMAGE.
      47              : 
      48              : #include <EnergyPlus/DataGlobals.hh>
      49              : 
      50              : // EnergyPlus Headers
      51              : #include <EnergyPlus/TARCOGArgs.hh>
      52              : #include <EnergyPlus/TARCOGCommon.hh>
      53              : #include <EnergyPlus/TARCOGGassesParams.hh>
      54              : #include <EnergyPlus/TARCOGParams.hh>
      55              : 
      56              : namespace EnergyPlus::TARCOGArgs {
      57              : 
      58              : // MODULE INFORMATION:
      59              : //       AUTHOR         Simon Vidanovic
      60              : //       DATE WRITTEN   June/22/2010
      61              : //       MODIFIED       na
      62              : //       RE-ENGINEERED  na
      63              : //  Revision: 6.0.36  (June/22/2010)
      64              : //   - Initial setup, extracted from TARCOG.for
      65              : 
      66              : // PURPOSE OF THIS MODULE:
      67              : // A module which contains common functions for error checking and
      68              : //    preparation of arguments and intermediate variables
      69              : 
      70              : // Using/Aliasing
      71              : using namespace TARCOGCommon;
      72              : using namespace TARCOGGassesParams;
      73              : using namespace TARCOGOutput;
      74              : using namespace TARCOGParams;
      75              : 
      76            0 : int ArgCheck(EnergyPlusData &state,
      77              :              Files &files,
      78              :              int const nlayer,
      79              :              int const iwd,
      80              :              Real64 const tout,
      81              :              Real64 const tind,
      82              :              Real64 const trmin,
      83              :              Real64 const wso,
      84              :              Real64 const wsi,
      85              :              Real64 const dir,
      86              :              Real64 const outir,
      87              :              int const isky,
      88              :              Real64 const tsky,
      89              :              Real64 const esky,
      90              :              Real64 const fclr,
      91              :              Real64 const VacuumPressure,
      92              :              Real64 const VacuumMaxGapThickness,
      93              :              DeflectionCalculation const CalcDeflection,
      94              :              Real64 const Pa,
      95              :              Real64 const Pini,
      96              :              Real64 const Tini,
      97              :              const Array1D<Real64> &gap,
      98              :              const Array1D<Real64> &GapDef,
      99              :              const Array1D<Real64> &thick,
     100              :              const Array1D<Real64> &scon,
     101              :              const Array1D<Real64> &YoungsMod,
     102              :              const Array1D<Real64> &PoissonsRat,
     103              :              const Array1D<Real64> &tir,
     104              :              const Array1D<Real64> &emis,
     105              :              Real64 const totsol,
     106              :              Real64 const tilt,
     107              :              const Array1D<Real64> &asol,
     108              :              Real64 const height,
     109              :              Real64 const heightt,
     110              :              Real64 const width,
     111              :              const Array1D<Real64> &presure,
     112              :              Array2A_int const iprop,
     113              :              Array2A<Real64> const frct,
     114              :              Array2A<Real64> const xgcon,
     115              :              Array2A<Real64> const xgvis,
     116              :              Array2A<Real64> const xgcp,
     117              :              const Array1D<Real64> &xwght,
     118              :              const Array1D<Real64> &gama,
     119              :              const Array1D_int &nmix,
     120              :              const Array1D_int &SupportPillar,     // Shows whether or not gap have support pillar
     121              :              const Array1D<Real64> &PillarSpacing, // Pillar spacing for each gap (used in case there is support pillar)
     122              :              const Array1D<Real64> &PillarRadius,  // Pillar radius for each gap (used in case there is support pillar)
     123              :              Real64 &hin,
     124              :              Real64 &hout,
     125              :              const Array1D_int &ibc,
     126              :              const Array1D<Real64> &Atop,
     127              :              const Array1D<Real64> &Abot,
     128              :              const Array1D<Real64> &Al,
     129              :              const Array1D<Real64> &Ar,
     130              :              const Array1D<Real64> &Ah,
     131              :              const Array1D<Real64> &SlatThick,
     132              :              const Array1D<Real64> &SlatWidth,
     133              :              const Array1D<Real64> &SlatAngle,
     134              :              const Array1D<Real64> &SlatCond,
     135              :              const Array1D<Real64> &SlatSpacing,
     136              :              const Array1D<Real64> &SlatCurve,
     137              :              const Array1D<Real64> &vvent,
     138              :              const Array1D<Real64> &tvent,
     139              :              const Array1D<TARCOGParams::TARCOGLayerType> &LayerType,
     140              :              const Array1D_int &nslice,
     141              :              const Array1D<Real64> &LaminateA,
     142              :              const Array1D<Real64> &LaminateB,
     143              :              const Array1D<Real64> &sumsol,
     144              :              TARCOGGassesParams::Stdrd const standard,
     145              :              TARCOGThermalModel const ThermalMod,
     146              :              Real64 const SDScalar,
     147              :              std::string &ErrorMessage)
     148              : {
     149              : 
     150              :     // Return value
     151              :     int ArgCheck;
     152              : 
     153              :     // Argument array dimensioning
     154            0 :     EP_SIZE_CHECK(gap, maxlay);
     155            0 :     EP_SIZE_CHECK(GapDef, MaxGap);
     156            0 :     EP_SIZE_CHECK(thick, maxlay);
     157            0 :     EP_SIZE_CHECK(scon, maxlay);
     158            0 :     EP_SIZE_CHECK(YoungsMod, maxlay);
     159            0 :     EP_SIZE_CHECK(PoissonsRat, maxlay);
     160            0 :     EP_SIZE_CHECK(tir, maxlay2);
     161            0 :     EP_SIZE_CHECK(emis, maxlay2);
     162            0 :     EP_SIZE_CHECK(asol, maxlay);
     163            0 :     EP_SIZE_CHECK(presure, maxlay1);
     164            0 :     iprop.dim(maxgas, maxlay1);
     165            0 :     frct.dim(maxgas, maxlay1);
     166            0 :     xgcon.dim(3, maxgas);
     167            0 :     xgvis.dim(3, maxgas);
     168            0 :     xgcp.dim(3, maxgas);
     169            0 :     EP_SIZE_CHECK(xwght, maxgas);
     170            0 :     EP_SIZE_CHECK(gama, maxgas);
     171            0 :     EP_SIZE_CHECK(nmix, maxlay1);
     172            0 :     EP_SIZE_CHECK(SupportPillar, maxlay);
     173            0 :     EP_SIZE_CHECK(PillarSpacing, maxlay);
     174            0 :     EP_SIZE_CHECK(PillarRadius, maxlay);
     175            0 :     EP_SIZE_CHECK(ibc, 2);
     176            0 :     EP_SIZE_CHECK(Atop, maxlay);
     177            0 :     EP_SIZE_CHECK(Abot, maxlay);
     178            0 :     EP_SIZE_CHECK(Al, maxlay);
     179            0 :     EP_SIZE_CHECK(Ar, maxlay);
     180            0 :     EP_SIZE_CHECK(Ah, maxlay);
     181            0 :     EP_SIZE_CHECK(SlatThick, maxlay);
     182            0 :     EP_SIZE_CHECK(SlatWidth, maxlay);
     183            0 :     EP_SIZE_CHECK(SlatAngle, maxlay);
     184            0 :     EP_SIZE_CHECK(SlatCond, maxlay);
     185            0 :     EP_SIZE_CHECK(SlatSpacing, maxlay);
     186            0 :     EP_SIZE_CHECK(SlatCurve, maxlay);
     187            0 :     EP_SIZE_CHECK(vvent, maxlay1);
     188            0 :     EP_SIZE_CHECK(tvent, maxlay1);
     189            0 :     EP_SIZE_CHECK(LayerType, maxlay);
     190            0 :     EP_SIZE_CHECK(nslice, maxlay);
     191            0 :     EP_SIZE_CHECK(LaminateA, maxlay);
     192            0 :     EP_SIZE_CHECK(LaminateB, maxlay);
     193            0 :     EP_SIZE_CHECK(sumsol, maxlay);
     194              : 
     195              :     // bi...Write debug output files - if debug flag = 1:
     196              : 
     197            0 :     if (files.WriteDebugOutput) {
     198              : 
     199            0 :         WriteInputArguments(state,
     200            0 :                             files.DebugOutputFile,
     201            0 :                             files.DBGD,
     202              :                             tout,
     203              :                             tind,
     204              :                             trmin,
     205              :                             wso,
     206              :                             iwd,
     207              :                             wsi,
     208              :                             dir,
     209              :                             outir,
     210              :                             isky,
     211              :                             tsky,
     212              :                             esky,
     213              :                             fclr,
     214              :                             VacuumPressure,
     215              :                             VacuumMaxGapThickness,
     216              :                             ibc,
     217              :                             hout,
     218              :                             hin,
     219              :                             standard,
     220              :                             ThermalMod,
     221              :                             SDScalar,
     222              :                             height,
     223              :                             heightt,
     224              :                             width,
     225              :                             tilt,
     226              :                             totsol,
     227              :                             nlayer,
     228              :                             LayerType,
     229              :                             thick,
     230              :                             scon,
     231              :                             asol,
     232              :                             tir,
     233              :                             emis,
     234              :                             Atop,
     235              :                             Abot,
     236              :                             Al,
     237              :                             Ar,
     238              :                             Ah,
     239              :                             SlatThick,
     240              :                             SlatWidth,
     241              :                             SlatAngle,
     242              :                             SlatCond,
     243              :                             SlatSpacing,
     244              :                             SlatCurve,
     245              :                             nslice,
     246              :                             LaminateA,
     247              :                             LaminateB,
     248              :                             sumsol,
     249              :                             gap,
     250              :                             vvent,
     251              :                             tvent,
     252              :                             presure,
     253              :                             nmix,
     254              :                             iprop,
     255              :                             frct,
     256              :                             xgcon,
     257              :                             xgvis,
     258              :                             xgcp,
     259              :                             xwght);
     260              : 
     261            0 :         std::string const VersionNumber(" 7.0.15.00 ");
     262            0 :         WriteTARCOGInputFile(state,
     263              :                              files,
     264              :                              VersionNumber,
     265              :                              tout,
     266              :                              tind,
     267              :                              trmin,
     268              :                              wso,
     269              :                              iwd,
     270              :                              wsi,
     271              :                              dir,
     272              :                              outir,
     273              :                              isky,
     274              :                              tsky,
     275              :                              esky,
     276              :                              fclr,
     277              :                              VacuumPressure,
     278              :                              VacuumMaxGapThickness,
     279              :                              CalcDeflection,
     280              :                              Pa,
     281              :                              Pini,
     282              :                              Tini,
     283              :                              ibc,
     284              :                              hout,
     285              :                              hin,
     286              :                              standard,
     287              :                              ThermalMod,
     288              :                              SDScalar,
     289              :                              height,
     290              :                              heightt,
     291              :                              width,
     292              :                              tilt,
     293              :                              totsol,
     294              :                              nlayer,
     295              :                              LayerType,
     296              :                              thick,
     297              :                              scon,
     298              :                              YoungsMod,
     299              :                              PoissonsRat,
     300              :                              asol,
     301              :                              tir,
     302              :                              emis,
     303              :                              Atop,
     304              :                              Abot,
     305              :                              Al,
     306              :                              Ar,
     307              :                              Ah,
     308              :                              SupportPillar,
     309              :                              PillarSpacing,
     310              :                              PillarRadius,
     311              :                              SlatThick,
     312              :                              SlatWidth,
     313              :                              SlatAngle,
     314              :                              SlatCond,
     315              :                              SlatSpacing,
     316              :                              SlatCurve,
     317              :                              nslice,
     318              :                              gap,
     319              :                              GapDef,
     320              :                              vvent,
     321              :                              tvent,
     322              :                              presure,
     323              :                              nmix,
     324              :                              iprop,
     325              :                              frct,
     326              :                              xgcon,
     327              :                              xgvis,
     328              :                              xgcp,
     329              :                              xwght,
     330              :                              gama);
     331              : 
     332            0 :     } // if debug=1 - write dbg output file
     333              : 
     334              :     // bi...assume All OK
     335            0 :     ArgCheck = 0;
     336              : 
     337              :     // dr...check for error messages
     338            0 :     if (nlayer < 1) {
     339            0 :         ArgCheck = 17;
     340            0 :         ErrorMessage = "Number of layers must be >0.";
     341            0 :         return ArgCheck;
     342              :     }
     343              : 
     344            0 :     if ((static_cast<int>(standard) < MinStandard) || (static_cast<int>(standard) > MaxStandard)) {
     345            0 :         ArgCheck = 28;
     346            0 :         ErrorMessage = "Invalid code for standard.";
     347            0 :         return ArgCheck;
     348              :     }
     349              : 
     350            0 :     if ((ThermalMod != TARCOGThermalModel::ISO15099) && (ThermalMod != TARCOGThermalModel::SCW) && (ThermalMod != TARCOGThermalModel::CSM)) {
     351            0 :         ArgCheck = 29;
     352            0 :         ErrorMessage = "Invalid code for thermal mode.";
     353            0 :         return ArgCheck;
     354              :     }
     355              : 
     356            0 :     if ((iwd != 0) && (iwd != 1)) {
     357            0 :         ArgCheck = 18;
     358            0 :         ErrorMessage = "Wind direction can be windward (=0) or leeward (=1).";
     359            0 :         return ArgCheck;
     360              :     }
     361              : 
     362            0 :     if ((fclr < 0.0) || (fclr > 1.0)) {
     363            0 :         ArgCheck = 19;
     364            0 :         ErrorMessage = "Fraction of sky that is clear can be in range between 0 and 1.";
     365            0 :         return ArgCheck;
     366              :     }
     367              : 
     368            0 :     for (int i = 1; i <= nlayer - 1; ++i) {
     369            0 :         if (gap(i) <= 0.0) {
     370            0 :             ArgCheck = 20;
     371            0 :             ErrorMessage = format("Gap width is less than (or equal to) zero. Gap #{:3}", i);
     372            0 :             return ArgCheck;
     373              :         }
     374              :     }
     375              : 
     376            0 :     for (int i = 1; i <= nlayer; ++i) {
     377            0 :         if (thick(i) <= 0.0) {
     378            0 :             ArgCheck = 21;
     379            0 :             ErrorMessage = format("Layer width is less than (or equal to) zero. Layer #{:3}", i);
     380            0 :             return ArgCheck;
     381              :         }
     382            0 :         if ((i < nlayer) && IsShadingLayer(LayerType(i)) && IsShadingLayer(LayerType(i + 1))) {
     383            0 :             ArgCheck = 37;
     384            0 :             ErrorMessage = "Cannot handle two consecutive shading layers.";
     385            0 :             return ArgCheck;
     386              :         }
     387              :         // Deflection cannot be calculated with IGU containing shading layer. This error check is to be
     388              :         // removed once that extension is programmed
     389            0 :         if ((CalcDeflection != TARCOGParams::DeflectionCalculation::NONE) && (LayerType(i) != TARCOGParams::TARCOGLayerType::SPECULAR)) {
     390            0 :             ArgCheck = 42;
     391            0 :             ErrorMessage = "Cannot calculate deflection with IGU containing shading devices.";
     392            0 :             return ArgCheck;
     393              :         }
     394              :     }
     395              : 
     396            0 :     if (height <= 0.0) {
     397            0 :         ArgCheck = 23;
     398            0 :         ErrorMessage = "IGU cavity height must be greater than zero.";
     399            0 :         return ArgCheck;
     400              :     }
     401              : 
     402            0 :     if (heightt <= 0.0) {
     403            0 :         ArgCheck = 24;
     404            0 :         ErrorMessage = "Total window height must be greater than zero.";
     405            0 :         return ArgCheck;
     406              :     }
     407              : 
     408            0 :     if (width <= 0.0) {
     409            0 :         ArgCheck = 25;
     410            0 :         ErrorMessage = "Window width must be greater than zero.";
     411            0 :         return ArgCheck;
     412              :     }
     413              : 
     414            0 :     if ((SDScalar < 0.0) || (SDScalar > 1.0)) {
     415            0 :         ArgCheck = 30;
     416            0 :         ErrorMessage = "SDscalar is out of range (<0.0 or >1.0).";
     417            0 :         return ArgCheck;
     418              :     }
     419              : 
     420              :     // bi...Check layers and update Venetian blinds properties:
     421            0 :     for (int i = 1; i <= nlayer; ++i) {
     422            0 :         if (scon(i) <= 0.0) {
     423            0 :             ArgCheck = 26;
     424            0 :             ErrorMessage = format("Layer {:3} has conductivity which is less or equal to zero.", i);
     425            0 :             return ArgCheck;
     426              :         }
     427              : 
     428            0 :         if (LayerType(i) != TARCOGLayerType::SPECULAR && LayerType(i) != TARCOGLayerType::WOVSHADE &&
     429            0 :             LayerType(i) != TARCOGLayerType::VENETBLIND_HORIZ && LayerType(i) != TARCOGLayerType::PERFORATED &&
     430            0 :             LayerType(i) != TARCOGLayerType::DIFFSHADE && LayerType(i) != TARCOGLayerType::BSDF && LayerType(i) != TARCOGLayerType::VENETBLIND_VERT)
     431              : 
     432              :         {
     433            0 :             ArgCheck = 22;
     434            0 :             ErrorMessage = format("Incorrect layer type for layer #{:3}"
     435              :                                   ".  Layer type can either be 0 (glazing layer), 1 (Venetian blind), 2 (woven shade), 3 (perforated), 4 (diffuse "
     436              :                                   "shade) or 5 (bsdf).",
     437            0 :                                   i);
     438            0 :             return ArgCheck;
     439              :         }
     440              : 
     441              :         // bi...TEMPORARY! Don't allow CSW and CSM method for outdoor and indoor SD layers
     442            0 :         if ((IsShadingLayer(LayerType(1))) && ((ThermalMod == TARCOGThermalModel::SCW) || (ThermalMod == TARCOGThermalModel::CSM))) {
     443            0 :             ArgCheck = 39;
     444            0 :             ErrorMessage = "CSM and SCW thermal models cannot be used for outdoor and indoor SD layers.";
     445            0 :             return ArgCheck;
     446              :         }
     447            0 :         if ((IsShadingLayer(LayerType(nlayer))) && ((ThermalMod == TARCOGThermalModel::SCW) || (ThermalMod == TARCOGThermalModel::CSM))) {
     448            0 :             ArgCheck = 39;
     449            0 :             ErrorMessage = "CSM and SCW thermal models cannot be used for outdoor and indoor SD layers.";
     450            0 :             return ArgCheck;
     451              :         }
     452              : 
     453            0 :         if (LayerType(i) == TARCOGParams::TARCOGLayerType::VENETBLIND_HORIZ ||
     454            0 :             LayerType(i) == TARCOGParams::TARCOGLayerType::VENETBLIND_VERT) { // Venetian blind specific:
     455            0 :             if (SlatThick(i) <= 0) {
     456            0 :                 ArgCheck = 31;
     457            0 :                 ErrorMessage = format("Invalid slat thickness (must be >0). Layer #{:3}", i);
     458            0 :                 return ArgCheck;
     459              :             }
     460            0 :             if (SlatWidth(i) <= 0.0) {
     461            0 :                 ArgCheck = 32;
     462            0 :                 ErrorMessage = format("Invalid slat width (must be >0). Layer #{:3}", i);
     463            0 :                 return ArgCheck;
     464              :             }
     465            0 :             if ((SlatAngle(i) < -90.0) || (SlatAngle(i) > 90.0)) {
     466            0 :                 ArgCheck = 33;
     467            0 :                 ErrorMessage = format("Invalid slat angle (must be between -90 and 90). Layer #{:3}", i);
     468            0 :                 return ArgCheck;
     469              :             }
     470            0 :             if (SlatCond(i) <= 0.0) {
     471            0 :                 ArgCheck = 34;
     472            0 :                 ErrorMessage = format("Invalid conductivity of slat material (must be >0). Layer #{:3}", i);
     473            0 :                 return ArgCheck;
     474              :             }
     475            0 :             if (SlatSpacing(i) <= 0.0) {
     476            0 :                 ArgCheck = 35;
     477            0 :                 ErrorMessage = format("Invalid slat spacing (must be >0). Layer #{:3}", i);
     478            0 :                 return ArgCheck;
     479              :             }
     480            0 :             if ((SlatCurve(i) != 0.0) && (std::abs(SlatCurve(i)) <= (SlatWidth(i) / 2.0))) {
     481            0 :                 ArgCheck = 36;
     482            0 :                 ErrorMessage = format("Invalid curvature radius (absolute value must be >SlatWidth/2, or 0 for flat slats). Layer #{:3}", i);
     483            0 :                 return ArgCheck;
     484              :             }
     485              : 
     486              :         } //  LayerType is Venetian
     487              : 
     488              :     } // Layers...
     489              : 
     490            0 :     for (int i = 1; i <= nlayer + 1; ++i) {
     491            0 :         if (presure(i) < 0.0) {
     492            0 :             ArgCheck = 27;
     493            0 :             if ((i == 1) || (i == (nlayer + 1))) {
     494            0 :                 ErrorMessage = "One of environments (inside or outside) has pressure which is less than zero.";
     495              :             } else {
     496            0 :                 ErrorMessage = format("One of gaps has pressure which is less than zero. Gap #{:3}", i);
     497              :             }
     498            0 :             return ArgCheck;
     499              :         }
     500              :     }
     501              : 
     502            0 :     return ArgCheck;
     503              : }
     504              : 
     505            0 : void PrepVariablesISO15099(int const nlayer,
     506              :                            Real64 const tout,
     507              :                            Real64 const tind,
     508              :                            Real64 &trmin,
     509              :                            int const isky,
     510              :                            Real64 const outir,
     511              :                            // IR radiance of window's exterior/interior surround (W/m2)
     512              :                            Real64 const tsky,
     513              :                            Real64 &esky,
     514              :                            Real64 const fclr,
     515              :                            Array1D<Real64> &gap,
     516              :                            Array1D<Real64> &thick,
     517              :                            Array1D<Real64> &scon,
     518              :                            const Array1D<Real64> &tir,
     519              :                            const Array1D<Real64> &emis,
     520              :                            Real64 const tilt,
     521              :                            Real64 &hin,
     522              :                            Real64 &hout,
     523              :                            const Array1D_int &ibc,
     524              :                            const Array1D<Real64> &SlatThick,
     525              :                            const Array1D<Real64> &SlatWidth,
     526              :                            const Array1D<Real64> &SlatAngle,
     527              :                            const Array1D<Real64> &SlatCond,
     528              :                            const Array1D<TARCOGLayerType> &LayerType,
     529              :                            TARCOGThermalModel const ThermalMod,
     530              :                            Real64 const SDScalar,
     531              :                            Real64 &ShadeEmisRatioOut,
     532              :                            Real64 &ShadeEmisRatioIn,
     533              :                            Real64 &ShadeHcRatioOut,
     534              :                            Real64 &ShadeHcRatioIn,
     535              :                            Array1D<Real64> &Keff,
     536              :                            Array1D<Real64> &ShadeGapKeffConv,
     537              :                            Real64 &sc,
     538              :                            Real64 &shgc,
     539              :                            Real64 &ufactor,
     540              :                            Real64 &flux,
     541              :                            Array1D<Real64> &LaminateAU,
     542              :                            Array1D<Real64> &sumsolU,
     543              :                            Array1D<Real64> &sol0,
     544              :                            Real64 &hint,
     545              :                            Real64 &houtt,
     546              :                            Real64 &trmout,
     547              :                            Real64 &ebsky,
     548              :                            Real64 &ebroom,
     549              :                            Real64 &Gout,
     550              :                            Real64 &Gin,
     551              :                            Array1D<Real64> &rir,
     552              :                            Array1D<Real64> &vfreevent,
     553              :                            int &nperr,
     554              :                            std::string &ErrorMessage)
     555              : {
     556              : 
     557              :     // Argument array dimensioning
     558            0 :     EP_SIZE_CHECK(gap, MaxGap);
     559            0 :     EP_SIZE_CHECK(thick, maxlay);
     560            0 :     EP_SIZE_CHECK(scon, maxlay);
     561            0 :     EP_SIZE_CHECK(tir, maxlay2);
     562            0 :     EP_SIZE_CHECK(emis, maxlay2);
     563            0 :     EP_SIZE_CHECK(ibc, 2);
     564            0 :     EP_SIZE_CHECK(SlatThick, maxlay);
     565            0 :     EP_SIZE_CHECK(SlatWidth, maxlay);
     566            0 :     EP_SIZE_CHECK(SlatAngle, maxlay);
     567            0 :     EP_SIZE_CHECK(SlatCond, maxlay);
     568            0 :     EP_SIZE_CHECK(LayerType, maxlay);
     569            0 :     EP_SIZE_CHECK(Keff, maxlay);
     570            0 :     EP_SIZE_CHECK(ShadeGapKeffConv, MaxGap);
     571            0 :     EP_SIZE_CHECK(LaminateAU, maxlay);
     572            0 :     EP_SIZE_CHECK(sumsolU, maxlay);
     573            0 :     EP_SIZE_CHECK(sol0, maxlay);
     574            0 :     EP_SIZE_CHECK(rir, maxlay2);
     575            0 :     EP_SIZE_CHECK(vfreevent, maxlay1);
     576              : 
     577              :     int k1;
     578              :     Real64 tiltr;
     579              :     Real64 Rsky;
     580              :     Real64 Fsky;
     581              :     Real64 Fground;
     582              :     Real64 e0;
     583            0 :     std::string a;
     584              : 
     585              :     //! Scalars:
     586            0 :     ShadeEmisRatioOut = 1.0;
     587            0 :     ShadeEmisRatioIn = 1.0;
     588            0 :     ShadeHcRatioOut = 1.0;
     589            0 :     ShadeHcRatioIn = 1.0;
     590              : 
     591              :     //! re-initialize iteration parameters:
     592            0 :     sc = 0.0;
     593            0 :     shgc = 0.0;
     594            0 :     ufactor = 0.0;
     595            0 :     flux = 0.0;
     596              : 
     597              :     //! Vectors:
     598            0 :     LaminateAU = 0.0;
     599            0 :     sumsolU = 0.0;
     600            0 :     vfreevent = 0.0;
     601            0 :     sol0 = 0.0;
     602              :     // bi...    Clear keff, keffc elements:
     603            0 :     Keff = 0.0;
     604            0 :     ShadeGapKeffConv = 0.0;
     605              : 
     606              :     // Adjust shading layer properties
     607            0 :     for (int i = 1; i <= nlayer; ++i) {
     608            0 :         if ((TARCOGLayerType)LayerType(i) == TARCOGParams::TARCOGLayerType::VENETBLIND_HORIZ ||
     609            0 :             (TARCOGLayerType)LayerType(i) == TARCOGParams::TARCOGLayerType::VENETBLIND_VERT) {
     610            0 :             scon(i) = SlatCond(i);
     611            0 :             if (ThermalMod == TARCOGThermalModel::SCW) {
     612              :                 // bi...the idea here is to have glass-to-glass width the same as before scaling
     613              :                 // bi...TODO: check for outdoor and indoor blinds! SCW model is only applicable to in-between SDs!!!
     614            0 :                 thick(i) = SlatWidth(i) * std::cos(SlatAngle(i) * Constant::Pi / 180.0);
     615            0 :                 if (i > 1) {
     616            0 :                     gap(i - 1) += (1.0 - SDScalar) / 2.0 * thick(i); // Autodesk:BoundsViolation gap(i-1) @ i=1: Added if condition
     617              :                 }
     618            0 :                 gap(i) += (1.0 - SDScalar) / 2.0 * thick(i);
     619            0 :                 thick(i) *= SDScalar;
     620            0 :                 if (thick(i) < SlatThick(i)) {
     621            0 :                     thick(i) = SlatThick(i);
     622              :                 }
     623            0 :             } else if ((ThermalMod == TARCOGThermalModel::ISO15099) || (ThermalMod == TARCOGThermalModel::CSM)) {
     624            0 :                 thick(i) = SlatThick(i);
     625            0 :                 const Real64 slatAngRad = SlatAngle(i) * 2.0 * Constant::Pi / 360.0;
     626            0 :                 Real64 C4_VENET(0);
     627            0 :                 if ((TARCOGLayerType)LayerType(i) == TARCOGParams::TARCOGLayerType::VENETBLIND_HORIZ) {
     628            0 :                     C4_VENET = C4_VENET_HORIZONTAL;
     629              :                 }
     630            0 :                 if ((TARCOGLayerType)LayerType(i) == TARCOGParams::TARCOGLayerType::VENETBLIND_VERT) {
     631            0 :                     C4_VENET = C4_VENET_VERTICAL;
     632              :                 }
     633            0 :                 thick(i) = C4_VENET * (SlatWidth(i) * cos(slatAngRad) + thick(i) * sin(slatAngRad));
     634              :             }
     635              :         } // Venetian
     636              :     }
     637              : 
     638            0 :     hint = hin;
     639            0 :     houtt = hout;
     640            0 :     tiltr = tilt * 2.0 * Constant::Pi / 360.0; // convert tilt in degrees to radians
     641              : 
     642              :     // external radiation term
     643            0 :     switch (isky) {
     644            0 :     case 3:
     645            0 :         Gout = outir;
     646            0 :         trmout = root_4(Gout / Constant::StefanBoltzmann);
     647            0 :         break;
     648            0 :     case 2: // effective clear sky emittance from swinbank (SPC142/ISO15099 equations 131, 132, ...)
     649            0 :         Rsky = 5.31e-13 * pow_6(tout);
     650            0 :         esky = Rsky / (Constant::StefanBoltzmann * pow_4(tout)); // check esky const, also check what esky to use when tsky input...
     651            0 :         break;
     652            0 :     case 1:
     653            0 :         esky = pow_4(tsky) / pow_4(tout);
     654            0 :         break;
     655            0 :     case 0: // for isky=0 it is assumed that actual values for esky and Tsky are specified
     656            0 :         esky *= pow_4(tsky) / pow_4(tout);
     657            0 :         break;
     658            0 :     default:
     659            0 :         nperr = 1; // error 2010: isky can be: 0(esky,Tsky input), 1(Tsky input), or 2(Swinbank model)
     660            0 :         return;
     661              :     }
     662              : 
     663              :     // Simon: In this case we do not need to recalculate Gout and Trmout again
     664            0 :     if (isky != 3) {
     665            0 :         Fsky = (1.0 + std::cos(tiltr)) / 2.0;
     666            0 :         Fground = 1.0 - Fsky;
     667            0 :         e0 = Fground + (1.0 - fclr) * Fsky + Fsky * fclr * esky;
     668              :         //  Trmout = Tout * e0**0.25d0
     669              : 
     670              :         // bi   Set mean radiant temps for fixed combined film coef. case:
     671              : 
     672            0 :         if (ibc(1) == 1) { // outside BC - fixed combined film coef.
     673            0 :             trmout = tout;
     674              :         } else {
     675            0 :             trmout = tout * root_4(e0);
     676              :         }
     677              : 
     678            0 :         Gout = Constant::StefanBoltzmann * pow_4(trmout);
     679              :     } // if (isky.ne.3) then
     680              : 
     681            0 :     ebsky = Gout;
     682              : 
     683            0 :     if (ibc(2) == 1) { // inside BC - fixed combined film coef.
     684            0 :         trmin = tind;
     685              :     }
     686              : 
     687            0 :     Gin = Constant::StefanBoltzmann * pow_4(trmin);
     688            0 :     ebroom = Gin;
     689              : 
     690              :     // calculate ir reflectance:
     691            0 :     for (int k = 1; k <= nlayer; ++k) {
     692            0 :         k1 = 2 * k - 1;
     693            0 :         rir(k1) = 1 - tir(k1) - emis(k1);
     694            0 :         rir(k1 + 1) = 1 - tir(k1) - emis(k1 + 1);
     695            0 :         if ((tir(k1) < 0.0) || (tir(k1) > 1.0) || (tir(k1 + 1) < 0.0) || (tir(k1 + 1) > 1.0)) {
     696            0 :             nperr = 4;
     697            0 :             ErrorMessage = format("Layer transmissivity is our of range (<0 or >1). Layer #{:3}", k);
     698            0 :             return;
     699              :         }
     700            0 :         if ((emis(k1) < 0.0) || (emis(k1) > 1.0) || (emis(k1 + 1) < 0.0) || (emis(k1 + 1) > 1.0)) {
     701            0 :             nperr = 14;
     702            0 :             ErrorMessage = format("Layer emissivity is our of range (<0 or >1). Layer #{:3}", k);
     703            0 :             return;
     704              :         }
     705            0 :         if ((rir(k1) < 0.0) || (rir(k1) > 1.0) || (rir(k1 + 1) < 0.0) || (rir(k1 + 1) > 1.0)) {
     706            0 :             nperr = 3;
     707            0 :             ErrorMessage = format("Layer reflectivity is our of range (<0 or >1). Layer #{:3}", k);
     708            0 :             return;
     709              :         }
     710              :     }
     711            0 : }
     712              : 
     713            0 : bool GoAhead(int const nperr)
     714              : {
     715            0 :     return !(((nperr > 0) && (nperr < 1000)) || ((nperr > 2000) && (nperr < 3000)));
     716              : }
     717              : 
     718              : } // namespace EnergyPlus::TARCOGArgs
        

Generated by: LCOV version 2.0-1