src/energyplus/ReverseTranslator/ReverseTranslateEnergyManagementSystemInternalVariable.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 "../ReverseTranslator.hpp" | ||
| 7 | |||
| 8 | #include "../../model/EnergyManagementSystemInternalVariable.hpp" | ||
| 9 | #include "../../model/EnergyManagementSystemInternalVariable_Impl.hpp" | ||
| 10 | |||
| 11 | #include <utilities/idd/EnergyManagementSystem_InternalVariable_FieldEnums.hxx> | ||
| 12 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 13 | #include <utilities/idd/IddEnums.hxx> | ||
| 14 | |||
| 15 | using namespace openstudio::model; | ||
| 16 | |||
| 17 | namespace openstudio { | ||
| 18 | |||
| 19 | namespace energyplus { | ||
| 20 | |||
| 21 | 1 | OptionalModelObject ReverseTranslator::translateEnergyManagementSystemInternalVariable(const WorkspaceObject& workspaceObject) { | |
| 22 |
4/5✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 time.
|
1 | if (workspaceObject.iddObject().type() != IddObjectType::EnergyManagementSystem_InternalVariable) { |
| 23 | ✗ | LOG(Error, "WorkspaceObject is not IddObjectType: EnergyManagementSystem_InternalVariable"); | |
| 24 | ✗ | return boost::none; | |
| 25 | } | ||
| 26 | |||
| 27 |
1/1✓ Branch 1 taken 1 time.
|
1 | OptionalString s = workspaceObject.getString(EnergyManagementSystem_InternalVariableFields::Name); |
| 28 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
|
1 | if (!s) { |
| 29 | ✗ | LOG(Error, "WorkspaceObject EnergyManagementSystem_InternalVariable has no Name."); | |
| 30 | ✗ | return boost::none; | |
| 31 | } | ||
| 32 | |||
| 33 |
1/1✓ Branch 1 taken 1 time.
|
1 | openstudio::model::EnergyManagementSystemInternalVariable emsInternalVariable(m_model); |
| 34 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | emsInternalVariable.setName(*s); |
| 35 | |||
| 36 |
1/1✓ Branch 1 taken 1 time.
|
1 | s = workspaceObject.getString(EnergyManagementSystem_InternalVariableFields::InternalDataType); |
| 37 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (s) { |
| 38 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | emsInternalVariable.setInternalDataType(*s); |
| 39 | } | ||
| 40 |
1/1✓ Branch 1 taken 1 time.
|
1 | s = workspaceObject.getString(EnergyManagementSystem_InternalVariableFields::InternalDataIndexKeyName); |
| 41 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (s) { |
| 42 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | emsInternalVariable.setInternalDataIndexKeyName(*s); |
| 43 | } | ||
| 44 | |||
| 45 |
1/1✓ Branch 1 taken 1 time.
|
1 | return emsInternalVariable; |
| 46 | 1 | } | |
| 47 | |||
| 48 | } // namespace energyplus | ||
| 49 | |||
| 50 | } // namespace openstudio | ||
| 51 |