LCOV - code coverage report
Current view: top level - EnergyPlus - WindTurbine.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 2 5 40.0 %
Date: 2023-01-17 19:17:23 Functions: 5 8 62.5 %

          Line data    Source code
       1             : // EnergyPlus, Copyright (c) 1996-2023, 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          10 :     struct WindTurbineParams
      86             :     {
      87             :         // Members
      88             :         std::string Name;                               // The component name
      89             :         std::string Schedule;                           // Available schedule
      90             :         RotorType rotorType = RotorType::Invalid;       // Rotor type (HAWT or VAWT)
      91             :         ControlType controlType = ControlType::Invalid; // Control type
      92             :         int SchedPtr = 0;                               // Schedule
      93             :         int NumOfBlade = 0;                             // Blade number
      94             :         Real64 RatedRotorSpeed = 0.0;                   // Rated rotor speed in m/s
      95             :         Real64 RotorDiameter = 0.0;                     // Diameter of rotor in m
      96             :         Real64 RotorHeight = 0.0;                       // Overall height of the rotor in m
      97             :         Real64 RatedPower = 0.0;                        // Nominal average power output at the rated wind speed in Watts
      98             :         Real64 RatedWindSpeed = 0.0;                    // Rated wind speed showing maximum power output in Watts
      99             :         Real64 CutInSpeed = 0.0;                        // Minimum wind speed for system operation in m/s
     100             :         Real64 CutOutSpeed = 0.0;                       // Maximum wind speed for system operation in m/s
     101             :         Real64 SysEfficiency = 0.0;                     // Overall system efficiency including subsystems and losses
     102             :         Real64 MaxTipSpeedRatio = 0.0;                  // Maximum tip speed ratio
     103             :         Real64 MaxPowerCoeff = 0.0;                     // Maximum power coefficient
     104             :         Real64 LocalAnnualAvgWS = 0.0;                  // Annual average wind speed locally measured in m/s
     105             :         Real64 AnnualTMYWS = 0.0;                       // Annual average wind speed from stat file in m/s
     106             :         Real64 HeightForLocalWS = 0.0;                  // Height of the local station in m
     107             :         Real64 ChordArea = 0.0;                         // Chord area of a single blade for VAWTs in m2
     108             :         Real64 DragCoeff = 0.0;                         // Empirical blade drag coefficient for VAWTs
     109             :         Real64 LiftCoeff = 0.0;                         // Empirical blade lift coefficient for VAWTs
     110             :         std::array<Real64, 6> PowerCoeffs = {0.0};      // Empirical power coefficients for analytical calculation
     111             :         Real64 TotPower = 0.0;                          // Maximum power produced from the wind in Watts
     112             :         Real64 Power = 0.0;                             // Actual power wind turbine supplies to the building in Watts
     113             :         Real64 TotEnergy = 0.0;                         // Maximum energy produced from the wind in Joules
     114             :         Real64 Energy = 0.0;                            // Actual energy wind turbine supplies to the building in Joules
     115             :         Real64 LocalWindSpeed = 0.0;                    // Local wind speed estimated at the particular height in m/s
     116             :         Real64 LocalAirDensity = 0.0;                   // Local air density estimated at the particular height kg/m3
     117             :         Real64 PowerCoeff = 0.0;                        // Power coefficient determined
     118             :         Real64 ChordalVel = 0.0;                        // Chordal velocity for VAWTs in m/s
     119             :         Real64 NormalVel = 0.0;                         // Normal velocity for VAWTs in m/s
     120             :         Real64 RelFlowVel = 0.0;                        // Relative flow velocity for VAWTs in m/s
     121             :         Real64 TipSpeedRatio = 0.0;                     // Relative flow velocity for VAWTs in m/s
     122             :         Real64 WSFactor = 0.0;                          // Relative flow velocity for VAWTs in m/s
     123             :         Real64 AngOfAttack = 0.0;                       // Angle of attack in degree
     124             :         Real64 IntRelFlowVel = 0.0;                     // Integral of relative flow velocity
     125             :         Real64 TanForce = 0.0;                          // Tangential force
     126             :         Real64 NorForce = 0.0;                          // Normal force in N.m
     127             :         Real64 TotTorque = 0.0;                         // Total torque in N.m
     128             :         Real64 AzimuthAng = 0.0;                        // Azimuth angle between blades
     129             :     };
     130             : 
     131             :     void SimWindTurbine(EnergyPlusData &state,
     132             :                         GeneratorType GeneratorType,      // Type of Generator
     133             :                         std::string const &GeneratorName, // User specified name of Generator
     134             :                         int &GeneratorIndex,              // Generator index
     135             :                         bool RunFlag,                     // ON or OFF
     136             :                         Real64 WTLoad                     // Electrical load on WT (not used)
     137             :     );
     138             : 
     139             :     void GetWTGeneratorResults(EnergyPlusData &state,
     140             :                                GeneratorType GeneratorType, // Type of Generator
     141             :                                int GeneratorIndex,          // Generator number
     142             :                                Real64 &GeneratorPower,      // Electrical power
     143             :                                Real64 &GeneratorEnergy,     // Electrical energy
     144             :                                Real64 &ThermalPower,
     145             :                                Real64 &ThermalEnergy);
     146             : 
     147             :     void GetWindTurbineInput(EnergyPlusData &state);
     148             : 
     149             :     void InitWindTurbine(EnergyPlusData &state, int WindTurbineNum);
     150             : 
     151             :     void CalcWindTurbine(EnergyPlusData &state,
     152             :                          int WindTurbineNum, // System is on
     153             :                          bool RunFlag        // System is on
     154             :     );
     155             : 
     156             :     void ReportWindTurbine(EnergyPlusData &state, int WindTurbineNum);
     157             : 
     158             :     //*****************************************************************************************
     159             : 
     160             : } // namespace WindTurbine
     161             : 
     162        1542 : struct WindTurbineData : BaseGlobalStruct
     163             : {
     164             : 
     165             :     bool GetInputFlag = true;
     166             :     bool MyOneTimeFlag = true;
     167             :     EPVector<WindTurbine::WindTurbineParams> WindTurbineSys;
     168             : 
     169           0 :     void clear_state() override
     170             :     {
     171           0 :         *this = WindTurbineData();
     172           0 :     }
     173             : };
     174             : 
     175             : } // namespace EnergyPlus
     176             : 
     177             : #endif

Generated by: LCOV version 1.13