src/energyplus/ForwardTranslator/ForwardTranslateAvailabilityManagerLowTemperatureTurnOn.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 | #include "../../model/AvailabilityManagerLowTemperatureTurnOn.hpp" | ||
| 8 | #include "../../model/Node.hpp" | ||
| 9 | #include <utilities/idd/AvailabilityManager_LowTemperatureTurnOn_FieldEnums.hxx> | ||
| 10 | #include <utilities/idd/IddEnums.hxx> | ||
| 11 | |||
| 12 | using namespace openstudio::model; | ||
| 13 | |||
| 14 | namespace openstudio { | ||
| 15 | |||
| 16 | namespace energyplus { | ||
| 17 | |||
| 18 | boost::optional<IdfObject> | ||
| 19 | 2 | ForwardTranslator::translateAvailabilityManagerLowTemperatureTurnOn(AvailabilityManagerLowTemperatureTurnOn& modelObject) { | |
| 20 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject idfObject(IddObjectType::AvailabilityManager_LowTemperatureTurnOn); |
| 21 |
1/1✓ Branch 1 taken 2 times.
|
2 | m_idfObjects.push_back(idfObject); |
| 22 | |||
| 23 | // Name | ||
| 24 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<std::string> s = modelObject.name()) { |
| 25 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | idfObject.setName(*s); |
| 26 | 2 | } | |
| 27 | |||
| 28 | // Sensor Node Name | ||
| 29 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 1 time.
|
4 | if (boost::optional<Node> node = modelObject.sensorNode()) { |
| 30 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | idfObject.setString(AvailabilityManager_LowTemperatureTurnOnFields::SensorNodeName, node->name().get()); |
| 31 | } else { | ||
| 32 | // E+ will crash if this is missing (tested on 8.8.0) | ||
| 33 |
7/7✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 14 taken 1 time.
✓ Branch 17 taken 1 time.
✓ Branch 20 taken 1 time.
|
1 | LOG(Error, modelObject.briefDescription() << " doesn't have a 'Sensor Node' (required)"); |
| 34 | 2 | } | |
| 35 | |||
| 36 | // Temperature | ||
| 37 | { | ||
| 38 |
1/1✓ Branch 1 taken 2 times.
|
2 | double value = modelObject.temperature(); |
| 39 |
1/1✓ Branch 1 taken 2 times.
|
2 | idfObject.setDouble(AvailabilityManager_LowTemperatureTurnOnFields::Temperature, value); |
| 40 | } | ||
| 41 | |||
| 42 |
1/1✓ Branch 1 taken 2 times.
|
4 | return idfObject; |
| 43 | 2 | } | |
| 44 | |||
| 45 | } // namespace energyplus | ||
| 46 | } // namespace openstudio | ||
| 47 |