GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 31 / 0 / 31
Functions: 100.0% 1 / 0 / 1
Branches: 92.2% 59 / 0 / 64

src/energyplus/ForwardTranslator/ForwardTranslateScheduleTypeLimits.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/ScheduleTypeLimits.hpp"
9 #include <utilities/idd/OS_ScheduleTypeLimits_FieldEnums.hxx>
10
11 #include <utilities/idd/ScheduleTypeLimits_FieldEnums.hxx>
12 #include "../../utilities/idd/IddEnums.hpp"
13 #include <utilities/idd/IddEnums.hxx>
14
15 using namespace openstudio::model;
16
17 namespace openstudio {
18
19 namespace energyplus {
20
21 3228 boost::optional<IdfObject> ForwardTranslator::translateScheduleTypeLimits(ScheduleTypeLimits& modelObject) {
22
2/2
✓ Branch 1 taken 3228 times.
✓ Branch 4 taken 3228 times.
3228 IdfObject idfObject(openstudio::IddObjectType::ScheduleTypeLimits);
23
1/1
✓ Branch 1 taken 3228 times.
3228 m_idfObjects.push_back(idfObject);
24
25
3/3
✓ Branch 1 taken 3228 times.
✓ Branch 4 taken 3228 times.
✓ Branch 7 taken 3228 times.
3228 idfObject.setString(ScheduleTypeLimitsFields::Name, modelObject.name().get());
26
27
1/1
✓ Branch 1 taken 3228 times.
3228 OptionalDouble d = modelObject.getDouble(OS_ScheduleTypeLimitsFields::LowerLimitValue, false);
28
2/2
✓ Branch 0 taken 3087 times.
✓ Branch 1 taken 141 times.
3228 if (d) {
29
2/2
✓ Branch 1 taken 3087 times.
✓ Branch 4 taken 3087 times.
3087 idfObject.setDouble(ScheduleTypeLimitsFields::LowerLimitValue, *d);
30 }
31
32
1/1
✓ Branch 1 taken 3228 times.
3228 d = modelObject.getDouble(OS_ScheduleTypeLimitsFields::UpperLimitValue, false);
33
2/2
✓ Branch 0 taken 3008 times.
✓ Branch 1 taken 220 times.
3228 if (d) {
34
2/2
✓ Branch 1 taken 3008 times.
✓ Branch 4 taken 3008 times.
3008 idfObject.setDouble(ScheduleTypeLimitsFields::UpperLimitValue, *d);
35 }
36
37
1/1
✓ Branch 1 taken 3228 times.
3228 OptionalString s = modelObject.getString(OS_ScheduleTypeLimitsFields::NumericType, false, true);
38
2/2
✓ Branch 0 taken 3207 times.
✓ Branch 1 taken 21 times.
3228 if (s) {
39
2/2
✓ Branch 1 taken 3207 times.
✓ Branch 4 taken 3207 times.
3207 idfObject.setString(ScheduleTypeLimitsFields::NumericType, *s);
40 }
41
42
1/1
✓ Branch 1 taken 3228 times.
3228 s = modelObject.getString(OS_ScheduleTypeLimitsFields::UnitType, false, true);
43
2/2
✓ Branch 0 taken 2190 times.
✓ Branch 1 taken 1038 times.
3228 if (s) {
44
2/2
✓ Branch 1 taken 2190 times.
✓ Branch 4 taken 2190 times.
2190 std::string unitType = *s;
45
1/1
✓ Branch 2 taken 2190 times.
2190 boost::to_lower(unitType);
46
8/10
✓ Branch 1 taken 2190 times.
✓ Branch 4 taken 2187 times.
✓ Branch 6 taken 2180 times.
✓ Branch 7 taken 7 times.
✓ Branch 9 taken 2180 times.
✓ Branch 11 taken 2180 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 2180 times.
✓ Branch 16 taken 2180 times.
✗ Branch 17 not taken.
4377 if ((unitType == "clothinginsulation") || (unitType == "controlmode") || (unitType == "linearpowerdensity") || (unitType == "massflowrate")
47
13/16
✓ Branch 0 taken 2187 times.
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 2180 times.
✓ Branch 5 taken 2180 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 2180 times.
✓ Branch 10 taken 2180 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 2180 times.
✓ Branch 15 taken 2180 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 2180 times.
✓ Branch 20 taken 3 times.
✓ Branch 21 taken 2177 times.
✓ Branch 22 taken 13 times.
✓ Branch 23 taken 2177 times.
4377 || (unitType == "pressure") || (unitType == "rotationsperminute") || (unitType == "solarenergy") || (unitType == "volumetricflowrate")) {
48 // unit type key is unsupported in EnergyPlus--fall back on 'Any Number'
49 13 m_idfObjects.pop_back();
50
2/2
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 1 time.
13 if (!m_anyNumberScheduleTypeLimits) {
51
2/2
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
12 IdfObject anyNumberLimits(IddObjectType::ScheduleTypeLimits);
52
1/1
✓ Branch 1 taken 12 times.
12 m_idfObjects.push_back(anyNumberLimits);
53
2/2
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
12 anyNumberLimits.setName("Any Number");
54
1/1
✓ Branch 1 taken 12 times.
12 m_anyNumberScheduleTypeLimits = anyNumberLimits;
55 12 }
56
1/1
✓ Branch 1 taken 13 times.
13 return m_anyNumberScheduleTypeLimits;
57 }
58
1/1
✓ Branch 1 taken 2177 times.
2177 idfObject.setString(ScheduleTypeLimitsFields::UnitType, unitType);
59 2190 }
60
61
1/1
✓ Branch 1 taken 3215 times.
3215 return boost::optional<IdfObject>(idfObject);
62 3228 }
63
64 } // namespace energyplus
65
66 } // namespace openstudio
67