GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 69.0% 20 / 0 / 29
Functions: 100.0% 1 / 0 / 1
Branches: 56.9% 33 / 0 / 58

src/energyplus/ForwardTranslator/ForwardTranslateScheduleFile.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/ScheduleTypeLimits.hpp"
10 #include "../../model/ScheduleFile.hpp"
11 #include "../../model/ScheduleFile_Impl.hpp"
12 #include "../../model/ExternalFile.hpp"
13 #include "../../model/ExternalFile_Impl.hpp"
14
15 #include "../../utilities/data/TimeSeries.hpp"
16
17 #include <utilities/idd/Schedule_File_FieldEnums.hxx>
18
19 #include "../../utilities/idd/IddEnums.hpp"
20 #include <utilities/idd/IddEnums.hxx>
21 #include <utilities/idd/IddFactory.hxx>
22
23 using namespace openstudio::model;
24
25 using namespace std;
26
27 namespace openstudio {
28
29 namespace energyplus {
30
31 5 boost::optional<IdfObject> ForwardTranslator::translateScheduleFile(ScheduleFile& modelObject) {
32
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 IdfObject idfObject(openstudio::IddObjectType::Schedule_File);
33
34
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
5 idfObject.setName(modelObject.name().get());
35
36
1/1
✓ Branch 1 taken 5 times.
5 boost::optional<ScheduleTypeLimits> scheduleTypeLimits = modelObject.scheduleTypeLimits();
37
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (scheduleTypeLimits) {
38 ✗ boost::optional<IdfObject> idfScheduleTypeLimits = translateAndMapModelObject(*scheduleTypeLimits);
39 ✗ if (idfScheduleTypeLimits) {
40 ✗ idfObject.setString(openstudio::Schedule_FileFields::ScheduleTypeLimitsName, idfScheduleTypeLimits->name().get());
41 }
42 ✗ }
43 // DLM: this path is going to be in the temp dir, might want to fix it up when saving model temp dir
44
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
5 idfObject.setString(openstudio::Schedule_FileFields::FileName, toString(modelObject.translatedFilePath()));
45
46
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 idfObject.setInt(openstudio::Schedule_FileFields::ColumnNumber, modelObject.columnNumber());
47
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 idfObject.setInt(openstudio::Schedule_FileFields::RowstoSkipatTop, modelObject.rowstoSkipatTop());
48
49
2/3
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
5 if (!modelObject.isNumberofHoursofDataDefaulted()) {
50 ✗ idfObject.setInt(openstudio::Schedule_FileFields::NumberofHoursofData, modelObject.numberofHoursofData().get());
51 }
52
53
1/1
✓ Branch 1 taken 5 times.
5 std::string columnSeparator = modelObject.columnSeparator();
54
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 5 times.
10 if (istringEqual("Fixed", columnSeparator)) {
55 ✗ columnSeparator = "Space";
56 }
57
1/1
✓ Branch 1 taken 5 times.
5 idfObject.setString(openstudio::Schedule_FileFields::ColumnSeparator, columnSeparator);
58
59
2/3
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
5 if (modelObject.interpolatetoTimestep()) {
60 ✗ idfObject.setString(openstudio::Schedule_FileFields::InterpolatetoTimestep, "Yes");
61 } else {
62
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
10 idfObject.setString(openstudio::Schedule_FileFields::InterpolatetoTimestep, "No");
63 }
64
65
2/3
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
5 if (!modelObject.isMinutesperItemDefaulted()) {
66 ✗ idfObject.setString(openstudio::Schedule_FileFields::MinutesperItem, modelObject.minutesperItem().get());
67 }
68
69
2/3
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
5 if (modelObject.adjustScheduleforDaylightSavings()) {
70
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
10 idfObject.setString(openstudio::Schedule_FileFields::AdjustScheduleforDaylightSavings, "Yes");
71 } else {
72 ✗ idfObject.setString(openstudio::Schedule_FileFields::AdjustScheduleforDaylightSavings, "No");
73 }
74
75
1/1
✓ Branch 1 taken 5 times.
5 m_idfObjects.push_back(idfObject);
76
1/1
✓ Branch 1 taken 5 times.
10 return idfObject;
77 5 }
78
79 } // namespace energyplus
80
81 } // namespace openstudio
82