src/energyplus/ForwardTranslator/ForwardTranslateExternalInterface.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/ExternalInterface.hpp" | ||
| 11 | #include "../../model/ExternalInterface_Impl.hpp" | ||
| 12 | |||
| 13 | #include <utilities/idd/ExternalInterface_FieldEnums.hxx> | ||
| 14 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 15 | #include <utilities/idd/IddEnums.hxx> | ||
| 16 | |||
| 17 | using namespace openstudio::model; | ||
| 18 | |||
| 19 | using namespace std; | ||
| 20 | |||
| 21 | namespace openstudio { | ||
| 22 | |||
| 23 | namespace energyplus { | ||
| 24 | |||
| 25 | 1 | boost::optional<IdfObject> ForwardTranslator::translateExternalInterface(ExternalInterface& modelObject) { | |
| 26 | 1 | boost::optional<std::string> s; | |
| 27 | |||
| 28 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject idfObject(openstudio::IddObjectType::ExternalInterface); |
| 29 |
1/1✓ Branch 1 taken 1 time.
|
1 | m_idfObjects.push_back(idfObject); |
| 30 | //TODO check if this Name field exists in the unique object | ||
| 31 |
1/1✓ Branch 1 taken 1 time.
|
1 | s = modelObject.name(); |
| 32 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (s) { |
| 33 | ✗ | idfObject.setName(*s); | |
| 34 | } | ||
| 35 | |||
| 36 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | s = modelObject.nameofExternalInterface(); |
| 37 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (s.is_initialized()) { |
| 38 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(ExternalInterfaceFields::NameofExternalInterface, s.get()); |
| 39 | } | ||
| 40 | |||
| 41 |
1/1✓ Branch 1 taken 1 time.
|
2 | return idfObject; |
| 42 | 1 | } | |
| 43 | |||
| 44 | } // namespace energyplus | ||
| 45 | |||
| 46 | } // namespace openstudio | ||
| 47 |