GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 14 / 0 / 14
Functions: 100.0% 1 / 0 / 1
Branches: 96.0% 24 / 0 / 25

src/energyplus/ForwardTranslator/ForwardTranslateAvailabilityManagerHighTemperatureTurnOff.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 #include "../../model/AvailabilityManagerHighTemperatureTurnOff.hpp"
8 #include "../../model/Node.hpp"
9 #include <utilities/idd/AvailabilityManager_HighTemperatureTurnOff_FieldEnums.hxx>
10 #include <utilities/idd/IddEnums.hxx>
11
12 using namespace openstudio::model;
13
14 namespace openstudio {
15
16 namespace energyplus {
17
18 boost::optional<IdfObject>
19 3 ForwardTranslator::translateAvailabilityManagerHighTemperatureTurnOff(AvailabilityManagerHighTemperatureTurnOff& modelObject) {
20
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 IdfObject idfObject(IddObjectType::AvailabilityManager_HighTemperatureTurnOff);
21
1/1
✓ Branch 1 taken 3 times.
3 m_idfObjects.push_back(idfObject);
22
23 // Name
24
2/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
6 if (boost::optional<std::string> s = modelObject.name()) {
25
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 idfObject.setName(*s);
26 3 }
27
28 // Sensor Node Name
29
3/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 1 time.
6 if (boost::optional<Node> node = modelObject.sensorNode()) {
30
4/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
2 idfObject.setString(AvailabilityManager_HighTemperatureTurnOffFields::SensorNodeName, node->name().get());
31 } else {
32 // E+ will crash if this is missing (tested on 8.8.0)
33
7/7
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 14 taken 1 time.
✓ Branch 17 taken 1 time.
✓ Branch 20 taken 1 time.
1 LOG(Error, modelObject.briefDescription() << " doesn't have a 'Sensor Node' (required)");
34 3 }
35
36 // Temperature
37 {
38
1/1
✓ Branch 1 taken 3 times.
3 double value = modelObject.temperature();
39
1/1
✓ Branch 1 taken 3 times.
3 idfObject.setDouble(AvailabilityManager_HighTemperatureTurnOffFields::Temperature, value);
40 }
41
42
1/1
✓ Branch 1 taken 3 times.
6 return idfObject;
43 3 }
44
45 } // namespace energyplus
46 } // namespace openstudio
47