LCOV - code coverage report
Current view: top level - EnergyPlus - WindTurbine.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 100.0 % 7 7
Test Date: 2025-05-22 16:09:37 Functions: 100.0 % 3 3

            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              : #ifndef WindTurbine_hh_INCLUDED
      49              : #define WindTurbine_hh_INCLUDED
      50              : 
      51              : // ObjexxFCL Headers
      52              : #include <ObjexxFCL/Array1D.hh>
      53              : 
      54              : // EnergyPlus Headers
      55              : #include <EnergyPlus/Data/BaseData.hh>
      56              : #include <EnergyPlus/DataGlobals.hh>
      57              : #include <EnergyPlus/ElectricPowerServiceManager.hh>
      58              : #include <EnergyPlus/EnergyPlus.hh>
      59              : 
      60              : namespace EnergyPlus {
      61              : 
      62              : // Forward declarations
      63              : struct EnergyPlusData;
      64              : 
      65              : namespace WindTurbine {
      66              : 
      67              :     enum class RotorType
      68              :     {
      69              :         Invalid = -1,
      70              :         HorizontalAxis,
      71              :         VerticalAxis,
      72              :         Num
      73              :     };
      74              : 
      75              :     enum class ControlType
      76              :     {
      77              :         Invalid = -1,
      78              :         FixedSpeedFixedPitch,
      79              :         FixedSpeedVariablePitch,
      80              :         VariableSpeedFixedPitch,
      81              :         VariableSpeedVariablePitch,
      82              :         Num
      83              :     };
      84              : 
      85              :     struct WindTurbineParams
      86              :     {
      87              :         // Members
      88              :         std::string Name;                               // The component name
      89              :         RotorType rotorType = RotorType::Invalid;       // Rotor type (HAWT or VAWT)
      90              :         ControlType controlType = ControlType::Invalid; // Control type
      91              :         Sched::Schedule *availSched = nullptr;
      92              :         int NumOfBlade = 0;                        // Blade number
      93              :         Real64 RatedRotorSpeed = 0.0;              // Rated rotor speed in m/s
      94              :         Real64 RotorDiameter = 0.0;                // Diameter of rotor in m
      95              :         Real64 RotorHeight = 0.0;                  // Overall height of the rotor in m
      96              :         Real64 RatedPower = 0.0;                   // Nominal average power output at the rated wind speed in Watts
      97              :         Real64 RatedWindSpeed = 0.0;               // Rated wind speed showing maximum power output in Watts
      98              :         Real64 CutInSpeed = 0.0;                   // Minimum wind speed for system operation in m/s
      99              :         Real64 CutOutSpeed = 0.0;                  // Maximum wind speed for system operation in m/s
     100              :         Real64 SysEfficiency = 0.0;                // Overall system efficiency including subsystems and losses
     101              :         Real64 MaxTipSpeedRatio = 0.0;             // Maximum tip speed ratio
     102              :         Real64 MaxPowerCoeff = 0.0;                // Maximum power coefficient
     103              :         Real64 LocalAnnualAvgWS = 0.0;             // Annual average wind speed locally measured in m/s
     104              :         Real64 AnnualTMYWS = 0.0;                  // Annual average wind speed from stat file in m/s
     105              :         Real64 HeightForLocalWS = 0.0;             // Height of the local station in m
     106              :         Real64 ChordArea = 0.0;                    // Chord area of a single blade for VAWTs in m2
     107              :         Real64 DragCoeff = 0.0;                    // Empirical blade drag coefficient for VAWTs
     108              :         Real64 LiftCoeff = 0.0;                    // Empirical blade lift coefficient for VAWTs
     109              :         std::array<Real64, 6> PowerCoeffs = {0.0}; // Empirical power coefficients for analytical calculation
     110              :         Real64 TotPower = 0.0;                     // Maximum power produced from the wind in Watts
     111              :         Real64 Power = 0.0;                        // Actual power wind turbine supplies to the building in Watts
     112              :         Real64 TotEnergy = 0.0;                    // Maximum energy produced from the wind in Joules
     113              :         Real64 Energy = 0.0;                       // Actual energy wind turbine supplies to the building in Joules
     114              :         Real64 LocalWindSpeed = 0.0;               // Local wind speed estimated at the particular height in m/s
     115              :         Real64 LocalAirDensity = 0.0;              // Local air density estimated at the particular height kg/m3
     116              :         Real64 PowerCoeff = 0.0;                   // Power coefficient determined
     117              :         Real64 ChordalVel = 0.0;                   // Chordal velocity for VAWTs in m/s
     118              :         Real64 NormalVel = 0.0;                    // Normal velocity for VAWTs in m/s
     119              :         Real64 RelFlowVel = 0.0;                   // Relative flow velocity for VAWTs in m/s
     120              :         Real64 TipSpeedRatio = 0.0;                // Relative flow velocity for VAWTs in m/s
     121              :         Real64 WSFactor = 0.0;                     // Relative flow velocity for VAWTs in m/s
     122              :         Real64 AngOfAttack = 0.0;                  // Angle of attack in degree
     123              :         Real64 IntRelFlowVel = 0.0;                // Integral of relative flow velocity
     124              :         Real64 TanForce = 0.0;                     // Tangential force
     125              :         Real64 NorForce = 0.0;                     // Normal force in N.m
     126              :         Real64 TotTorque = 0.0;                    // Total torque in N.m
     127              :         Real64 AzimuthAng = 0.0;                   // Azimuth angle between blades
     128              :     };
     129              : 
     130              :     void SimWindTurbine(EnergyPlusData &state,
     131              :                         GeneratorType GeneratorType,      // Type of Generator
     132              :                         std::string const &GeneratorName, // User specified name of Generator
     133              :                         int &GeneratorIndex,              // Generator index
     134              :                         bool RunFlag,                     // ON or OFF
     135              :                         Real64 WTLoad                     // Electrical load on WT (not used)
     136              :     );
     137              : 
     138              :     void GetWTGeneratorResults(EnergyPlusData &state,
     139              :                                GeneratorType GeneratorType, // Type of Generator
     140              :                                int GeneratorIndex,          // Generator number
     141              :                                Real64 &GeneratorPower,      // Electrical power
     142              :                                Real64 &GeneratorEnergy,     // Electrical energy
     143              :                                Real64 &ThermalPower,
     144              :                                Real64 &ThermalEnergy);
     145              : 
     146              :     void GetWindTurbineInput(EnergyPlusData &state);
     147              : 
     148              :     void InitWindTurbine(EnergyPlusData &state, int WindTurbineNum);
     149              : 
     150              :     void CalcWindTurbine(EnergyPlusData &state,
     151              :                          int WindTurbineNum, // System is on
     152              :                          bool RunFlag        // System is on
     153              :     );
     154              : 
     155              :     void ReportWindTurbine(EnergyPlusData &state, int WindTurbineNum);
     156              : 
     157              :     //*****************************************************************************************
     158              : 
     159              : } // namespace WindTurbine
     160              : 
     161              : struct WindTurbineData : BaseGlobalStruct
     162              : {
     163              : 
     164              :     bool GetInputFlag = true;
     165              :     bool MyOneTimeFlag = true;
     166              :     EPVector<WindTurbine::WindTurbineParams> WindTurbineSys;
     167              : 
     168         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     169              :     {
     170         2126 :     }
     171              : 
     172         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     173              :     {
     174         1152 :     }
     175              : 
     176         2100 :     void clear_state() override
     177              :     {
     178         2100 :         new (this) WindTurbineData();
     179         2100 :     }
     180              : };
     181              : 
     182              : } // namespace EnergyPlus
     183              : 
     184              : #endif
        

Generated by: LCOV version 2.0-1