GCC Code Coverage Report


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

src/energyplus/ForwardTranslator/ForwardTranslateExternalInterfaceFunctionalMockupUnitImportToSchedule.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/ModelObject.hpp"
10 #include "../../model/ExternalInterfaceFunctionalMockupUnitImportToSchedule.hpp"
11 #include "../../model/ExternalInterfaceFunctionalMockupUnitImportToSchedule_Impl.hpp"
12 #include "../../model/ExternalInterfaceFunctionalMockupUnitImport.hpp"
13 #include "../../model/ScheduleTypeLimits.hpp"
14
15 #include <utilities/idd/ExternalInterface_FunctionalMockupUnitImport_To_Schedule_FieldEnums.hxx>
16 #include "../../utilities/idd/IddEnums.hpp"
17 #include <utilities/idd/IddEnums.hxx>
18
19 using namespace openstudio::model;
20
21 using namespace std;
22
23 namespace openstudio {
24
25 namespace energyplus {
26
27 1 boost::optional<IdfObject> ForwardTranslator::translateExternalInterfaceFunctionalMockupUnitImportToSchedule(
28 ExternalInterfaceFunctionalMockupUnitImportToSchedule& modelObject) {
29 1 boost::optional<std::string> s;
30 1 boost::optional<double> d;
31
32
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 IdfObject idfObject(openstudio::IddObjectType::ExternalInterface_FunctionalMockupUnitImport_To_Schedule);
33
1/1
✓ Branch 1 taken 1 time.
1 m_idfObjects.push_back(idfObject);
34 //Name
35
1/1
✓ Branch 1 taken 1 time.
1 s = modelObject.name();
36
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (s) {
37
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setName(*s);
38 }
39
40
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<ScheduleTypeLimits> schedule = modelObject.scheduleTypeLimits();
41
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
1 if (schedule.is_initialized()) {
42 ✗ idfObject.setString(ExternalInterface_FunctionalMockupUnitImport_To_ScheduleFields::ScheduleTypeLimitsNames, schedule.get().nameString());
43 }
44
45
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 boost::optional<ExternalInterfaceFunctionalMockupUnitImport> file = modelObject.fMUFile();
46
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (file.is_initialized()) {
47
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(ExternalInterface_FunctionalMockupUnitImport_To_ScheduleFields::FMUFileName, file.get().fMUFileName());
48 }
49
50
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 s = modelObject.fMUInstanceName();
51
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (s.is_initialized()) {
52
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(ExternalInterface_FunctionalMockupUnitImport_To_ScheduleFields::FMUInstanceName, s.get());
53 }
54
55
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 s = modelObject.fMUVariableName();
56
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (s.is_initialized()) {
57
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(ExternalInterface_FunctionalMockupUnitImport_To_ScheduleFields::FMUVariableName, s.get());
58 }
59
60
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 d = modelObject.initialValue();
61
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (d.is_initialized()) {
62
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(ExternalInterface_FunctionalMockupUnitImport_To_ScheduleFields::InitialValue, d.get());
63 }
64
65
1/1
✓ Branch 1 taken 1 time.
2 return idfObject;
66 1 }
67
68 } // namespace energyplus
69
70 } // namespace openstudio
71