GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 75.0% 15 / 0 / 20
Functions: 100.0% 1 / 0 / 1
Branches: 67.6% 23 / 0 / 34

src/energyplus/ForwardTranslator/ForwardTranslateGeneratorPVWatts.cpp
Line Branch Exec Source
1 /***********************************************************************************************************************
2 * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC.
3 * See also https://openstudio.net/license
4 ***********************************************************************************************************************/
5
6 #include "../ForwardTranslator.hpp"
7
8 #include "../../model/Model.hpp"
9 #include "../../model/GeneratorPVWatts.hpp"
10 #include "../../model/GeneratorPVWatts_Impl.hpp"
11 #include "../../model/PlanarSurface.hpp"
12
13 #include <utilities/idd/Generator_PVWatts_FieldEnums.hxx>
14 #include "../../utilities/idd/IddEnums.hpp"
15 #include <utilities/idd/IddEnums.hxx>
16
17 using namespace openstudio::model;
18
19 using namespace std;
20
21 namespace openstudio {
22
23 namespace energyplus {
24
25 1 boost::optional<IdfObject> ForwardTranslator::translateGeneratorPVWatts(model::GeneratorPVWatts& modelObject) {
26
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Generator_PVWatts, modelObject);
27
28
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(Generator_PVWattsFields::PVWattsVersion, modelObject.pvWattsVersion());
29
30
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(Generator_PVWattsFields::DCSystemCapacity, modelObject.dcSystemCapacity());
31
32
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(Generator_PVWattsFields::ModuleType, modelObject.moduleType());
33
34
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(Generator_PVWattsFields::ArrayType, modelObject.arrayType());
35
36
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(Generator_PVWattsFields::SystemLosses, modelObject.systemLosses());
37
38
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<PlanarSurface> surface = modelObject.surface();
39
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (surface) {
40 ✗ boost::optional<IdfObject> surfaceIdf = translateAndMapModelObject(*surface);
41 ✗ if (surfaceIdf) {
42 ✗ idfObject.setString(Generator_PVWattsFields::ArrayGeometryType, "Surface");
43 ✗ idfObject.setString(Generator_PVWattsFields::SurfaceName, surfaceIdf->name().get());
44 }
45 ✗ } else {
46
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(Generator_PVWattsFields::ArrayGeometryType, "TiltAzimuth");
47
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(Generator_PVWattsFields::TiltAngle, modelObject.tiltAngle());
48
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(Generator_PVWattsFields::AzimuthAngle, modelObject.azimuthAngle());
49 }
50
51
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(Generator_PVWattsFields::GroundCoverageRatio, modelObject.groundCoverageRatio());
52
53
1/1
✓ Branch 1 taken 1 time.
2 return idfObject;
54 1 }
55
56 } // namespace energyplus
57
58 } // namespace openstudio
59