GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 17 / 0 / 17
Functions: 100.0% 1 / 0 / 1
Branches: 96.6% 28 / 0 / 29

src/energyplus/ForwardTranslator/ForwardTranslateAvailabilityManagerLowTemperatureTurnOff.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/AvailabilityManagerLowTemperatureTurnOff.hpp"
8 #include "../../model/Node.hpp"
9 #include "../../model/Schedule.hpp"
10 #include <utilities/idd/AvailabilityManager_LowTemperatureTurnOff_FieldEnums.hxx>
11 #include <utilities/idd/IddEnums.hxx>
12
13 using namespace openstudio::model;
14
15 namespace openstudio {
16
17 namespace energyplus {
18
19 boost::optional<IdfObject>
20 2 ForwardTranslator::translateAvailabilityManagerLowTemperatureTurnOff(AvailabilityManagerLowTemperatureTurnOff& modelObject) {
21
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 IdfObject idfObject(IddObjectType::AvailabilityManager_LowTemperatureTurnOff);
22
1/1
✓ Branch 1 taken 2 times.
2 m_idfObjects.push_back(idfObject);
23
24 // Name
25
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<std::string> s = modelObject.name()) {
26
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 idfObject.setName(*s);
27 2 }
28
29 // Sensor Node Name
30
3/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 1 time.
4 if (boost::optional<Node> node = modelObject.sensorNode()) {
31
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 idfObject.setString(AvailabilityManager_LowTemperatureTurnOffFields::SensorNodeName, node->name().get());
32 } else {
33 // E+ will crash if this is missing (tested on 8.8.0)
34
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)");
35 2 }
36
37 // Temperature
38 {
39
1/1
✓ Branch 1 taken 2 times.
2 double value = modelObject.temperature();
40
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setDouble(AvailabilityManager_LowTemperatureTurnOffFields::Temperature, value);
41 }
42
43 // ApplicabilityScheduleName
44 {
45
1/1
✓ Branch 1 taken 2 times.
2 Schedule sch = modelObject.applicabilitySchedule();
46
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 idfObject.setString(AvailabilityManager_LowTemperatureTurnOffFields::ApplicabilityScheduleName, sch.name().get());
47 2 }
48
49
1/1
✓ Branch 1 taken 2 times.
4 return idfObject;
50 2 }
51
52 } // namespace energyplus
53 } // namespace openstudio
54