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: 84.9% 45 / 0 / 53

src/energyplus/ForwardTranslator/ForwardTranslateExternalInterfaceFunctionalMockupUnitImportToActuator.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/ExternalInterfaceFunctionalMockupUnitImportToActuator.hpp"
11 #include "../../model/ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl.hpp"
12 #include "../../model/ExternalInterfaceFunctionalMockupUnitImport.hpp"
13
14 #include <utilities/idd/ExternalInterface_FunctionalMockupUnitImport_To_Actuator_FieldEnums.hxx>
15 #include "../../utilities/idd/IddEnums.hpp"
16 #include <utilities/idd/IddEnums.hxx>
17
18 using namespace openstudio::model;
19
20 using namespace std;
21
22 namespace openstudio {
23
24 namespace energyplus {
25
26 1 boost::optional<IdfObject> ForwardTranslator::translateExternalInterfaceFunctionalMockupUnitImportToActuator(
27 ExternalInterfaceFunctionalMockupUnitImportToActuator& modelObject) {
28 1 boost::optional<std::string> s;
29 1 boost::optional<double> d;
30
31
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 IdfObject idfObject(openstudio::IddObjectType::ExternalInterface_FunctionalMockupUnitImport_To_Actuator);
32
1/1
✓ Branch 1 taken 1 time.
1 m_idfObjects.push_back(idfObject);
33 //Name
34
1/1
✓ Branch 1 taken 1 time.
1 s = modelObject.name();
35
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (s) {
36
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setName(*s);
37 }
38
39
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 const boost::optional<ModelObject> m = modelObject.actuatedComponentUnique();
40
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (m.is_initialized()) {
41
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::ActuatedComponentUniqueName, m.get().nameString());
42 }
43
44
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 s = modelObject.actuatedComponentType();
45
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (s.is_initialized()) {
46
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::ActuatedComponentType, s.get());
47 }
48
49
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 s = modelObject.actuatedComponentControlType();
50
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (s.is_initialized()) {
51
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::ActuatedComponentControlType, s.get());
52 }
53
54
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 boost::optional<ExternalInterfaceFunctionalMockupUnitImport> file = modelObject.fMUFile();
55
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (file.is_initialized()) {
56
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::FMUFileName, file.get().fMUFileName());
57 }
58
59
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 s = modelObject.fMUInstanceName();
60
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (s.is_initialized()) {
61
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::FMUInstanceName, s.get());
62 }
63
64
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 s = modelObject.fMUVariableName();
65
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (s.is_initialized()) {
66
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::FMUVariableName, s.get());
67 }
68
69
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 d = modelObject.initialValue();
70
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (d.is_initialized()) {
71
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::InitialValue, d.get());
72 }
73
74
1/1
✓ Branch 1 taken 1 time.
2 return idfObject;
75 1 }
76
77 } // namespace energyplus
78
79 } // namespace openstudio
80