src/energyplus/ReverseTranslator/ReverseTranslateThermostatSetpointDualSetpoint.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/ThermostatSetpointDualSetpoint.hpp" | ||
| 9 | #include "../../model/ThermostatSetpointDualSetpoint_Impl.hpp" | ||
| 10 | #include "../../model/Schedule.hpp" | ||
| 11 | #include "../../model/Schedule_Impl.hpp" | ||
| 12 | |||
| 13 | #include <utilities/idd/ThermostatSetpoint_DualSetpoint_FieldEnums.hxx> | ||
| 14 | |||
| 15 | using namespace openstudio::model; | ||
| 16 | |||
| 17 | namespace openstudio { | ||
| 18 | |||
| 19 | namespace energyplus { | ||
| 20 | |||
| 21 | 49 | OptionalModelObject ReverseTranslator::translateThermostatSetpointDualSetpoint(const WorkspaceObject& workspaceObject) { | |
| 22 | 49 | OptionalModelObject result; | |
| 23 | 49 | OptionalModelObject temp; | |
| 24 | 49 | OptionalSchedule schedule; | |
| 25 | |||
| 26 |
1/1✓ Branch 1 taken 49 times.
|
49 | ThermostatSetpointDualSetpoint tsds(m_model); |
| 27 | |||
| 28 |
2/3✓ Branch 1 taken 49 times.
✓ Branch 3 taken 49 times.
✗ Branch 4 not taken.
|
98 | if (OptionalString os = workspaceObject.name()) { |
| 29 |
2/2✓ Branch 1 taken 49 times.
✓ Branch 4 taken 49 times.
|
49 | tsds.setName(*os); |
| 30 | 49 | } | |
| 31 | |||
| 32 |
1/1✓ Branch 1 taken 49 times.
|
49 | OptionalWorkspaceObject owo = workspaceObject.getTarget(ThermostatSetpoint_DualSetpointFields::HeatingSetpointTemperatureScheduleName); |
| 33 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 49 times.
|
49 | if (!owo) { |
| 34 | ✗ | LOG(Error, "Error importing object: " << workspaceObject.briefDescription() << " Can't find Schedule: "); | |
| 35 | ✗ | return result; | |
| 36 | } | ||
| 37 |
2/2✓ Branch 1 taken 49 times.
✓ Branch 4 taken 49 times.
|
49 | temp = translateAndMapWorkspaceObject(*owo); |
| 38 |
1/2✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
|
49 | if (temp) { |
| 39 |
2/2✓ Branch 1 taken 49 times.
✓ Branch 4 taken 49 times.
|
49 | schedule = temp->optionalCast<Schedule>(); |
| 40 |
1/2✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
|
49 | if (schedule) { |
| 41 |
2/2✓ Branch 1 taken 49 times.
✓ Branch 4 taken 49 times.
|
49 | tsds.setHeatingSchedule(*schedule); |
| 42 | } | ||
| 43 | } | ||
| 44 | |||
| 45 |
1/1✓ Branch 1 taken 49 times.
|
49 | owo = workspaceObject.getTarget(ThermostatSetpoint_DualSetpointFields::CoolingSetpointTemperatureScheduleName); |
| 46 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 49 times.
|
49 | if (!owo) { |
| 47 | ✗ | LOG(Error, "Error importing object: " << workspaceObject.briefDescription() << " Can't find Schedule: "); | |
| 48 | ✗ | return result; | |
| 49 | } | ||
| 50 |
2/2✓ Branch 1 taken 49 times.
✓ Branch 4 taken 49 times.
|
49 | temp = translateAndMapWorkspaceObject(*owo); |
| 51 |
1/2✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
|
49 | if (temp) { |
| 52 |
2/2✓ Branch 1 taken 49 times.
✓ Branch 4 taken 49 times.
|
49 | schedule = temp->optionalCast<Schedule>(); |
| 53 |
1/2✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
|
49 | if (schedule) { |
| 54 |
2/2✓ Branch 1 taken 49 times.
✓ Branch 4 taken 49 times.
|
49 | tsds.setCoolingSchedule(*schedule); |
| 55 | } | ||
| 56 | } | ||
| 57 | |||
| 58 |
1/1✓ Branch 1 taken 49 times.
|
49 | result = tsds; |
| 59 | 49 | return result; | |
| 60 | 49 | } | |
| 61 | |||
| 62 | } // namespace energyplus | ||
| 63 | |||
| 64 | } // namespace openstudio | ||
| 65 |