src/energyplus/ReverseTranslator/ReverseTranslateSiteLocation.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/Site.hpp" | ||
| 9 | #include "../../model/Site_Impl.hpp" | ||
| 10 | |||
| 11 | #include <utilities/idd/Site_Location_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 | 12 | OptionalModelObject ReverseTranslator::translateSiteLocation(const WorkspaceObject& workspaceObject) { | |
| 22 |
4/5✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 12 times.
|
12 | if (workspaceObject.iddObject().type() != IddObjectType::Site_Location) { |
| 23 | ✗ | LOG(Error, "WorkspaceObject is not IddObjectType: Site:Location"); | |
| 24 | ✗ | return boost::none; | |
| 25 | } | ||
| 26 | |||
| 27 |
1/1✓ Branch 1 taken 12 times.
|
12 | Site site = m_model.getUniqueModelObject<Site>(); |
| 28 |
1/1✓ Branch 1 taken 12 times.
|
12 | OptionalString optS = workspaceObject.name(); |
| 29 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | if (optS) { |
| 30 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
|
12 | site.setName(*optS); |
| 31 | } | ||
| 32 | |||
| 33 |
1/1✓ Branch 1 taken 12 times.
|
12 | OptionalDouble od = workspaceObject.getDouble(Site_LocationFields::Latitude); |
| 34 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | if (od) { |
| 35 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
|
12 | site.setLatitude(*od); |
| 36 | } | ||
| 37 | |||
| 38 |
1/1✓ Branch 1 taken 12 times.
|
12 | od = workspaceObject.getDouble(Site_LocationFields::Longitude); |
| 39 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | if (od) { |
| 40 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
|
12 | site.setLongitude(*od); |
| 41 | } | ||
| 42 | |||
| 43 |
1/1✓ Branch 1 taken 12 times.
|
12 | od = workspaceObject.getDouble(Site_LocationFields::TimeZone); |
| 44 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | if (od) { |
| 45 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
|
12 | site.setTimeZone(*od); |
| 46 | } | ||
| 47 | |||
| 48 |
1/1✓ Branch 1 taken 12 times.
|
12 | od = workspaceObject.getDouble(Site_LocationFields::Elevation); |
| 49 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | if (od) { |
| 50 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
|
12 | site.setElevation(*od); |
| 51 | } | ||
| 52 | |||
| 53 |
1/1✓ Branch 1 taken 12 times.
|
12 | optS = workspaceObject.getString(openstudio::Site_LocationFields::KeepSiteLocationInformation); |
| 54 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if (optS) { |
| 55 | ✗ | if (istringEqual("Yes", *optS)) { | |
| 56 | ✗ | site.setKeepSiteLocationInformation(true); | |
| 57 | } else { | ||
| 58 | ✗ | site.setKeepSiteLocationInformation(false); | |
| 59 | } | ||
| 60 | } | ||
| 61 | |||
| 62 |
1/1✓ Branch 1 taken 12 times.
|
12 | return site; |
| 63 | 12 | } | |
| 64 | |||
| 65 | } // namespace energyplus | ||
| 66 | |||
| 67 | } // namespace openstudio | ||
| 68 |