src/energyplus/ReverseTranslator/ReverseTranslateAirTerminalSingleDuctConstantVolumeNoReheat.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 | #include "../../model/AirTerminalSingleDuctConstantVolumeNoReheat.hpp" | ||
| 8 | #include "../../model/AirTerminalSingleDuctConstantVolumeNoReheat_Impl.hpp" | ||
| 9 | #include "../../model/Schedule.hpp" | ||
| 10 | #include "../../model/Schedule_Impl.hpp" | ||
| 11 | #include <utilities/idd/AirTerminal_SingleDuct_ConstantVolume_NoReheat_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 | 20 | OptionalModelObject ReverseTranslator::translateAirTerminalSingleDuctConstantVolumeNoReheat(const WorkspaceObject& workspaceObject) { | |
| 22 |
4/5✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 20 times.
|
20 | if ((workspaceObject.iddObject().type() != IddObjectType::AirTerminal_SingleDuct_ConstantVolume_NoReheat)) { |
| 23 | ✗ | LOG(Error, "WorkspaceObject is not IddObjectType: AirTerminal_SingleDuct_ConstantVolume_NoReheat"); | |
| 24 | ✗ | return boost::none; | |
| 25 | } | ||
| 26 | |||
| 27 |
1/1✓ Branch 1 taken 20 times.
|
20 | boost::optional<WorkspaceObject> wo = workspaceObject.getTarget(AirTerminal_SingleDuct_ConstantVolume_NoReheatFields::AvailabilityScheduleName); |
| 28 | 20 | boost::optional<Schedule> schedule; | |
| 29 | 20 | boost::optional<AirTerminalSingleDuctConstantVolumeNoReheat> airTerminal; | |
| 30 | 20 | boost::optional<double> value; | |
| 31 | |||
| 32 |
1/2✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
|
20 | if (wo) { |
| 33 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get()); |
| 34 |
1/2✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
|
20 | if (mo) { |
| 35 |
3/4✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 20 times.
|
20 | if (!(schedule = mo->optionalCast<Schedule>())) { |
| 36 | ✗ | LOG(Error, workspaceObject.briefDescription() << " does not have an associated availability schedule"); | |
| 37 | |||
| 38 | ✗ | return boost::none; | |
| 39 | } | ||
| 40 | } | ||
| 41 | 20 | } | |
| 42 | |||
| 43 |
1/2✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
|
20 | if (schedule) { |
| 44 |
3/3✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
|
20 | airTerminal = AirTerminalSingleDuctConstantVolumeNoReheat(m_model, schedule.get()); |
| 45 | } | ||
| 46 | |||
| 47 |
1/2✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
|
20 | if (airTerminal) { |
| 48 |
1/1✓ Branch 1 taken 20 times.
|
20 | boost::optional<std::string> s = workspaceObject.getString(AirTerminal_SingleDuct_ConstantVolume_NoReheatFields::Name); |
| 49 |
1/2✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
|
20 | if (s) { |
| 50 |
3/3✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
|
20 | airTerminal->setName(s.get()); |
| 51 | } | ||
| 52 | |||
| 53 |
1/1✓ Branch 1 taken 20 times.
|
20 | s = workspaceObject.getString(AirTerminal_SingleDuct_ConstantVolume_NoReheatFields::MaximumAirFlowRate); |
| 54 |
8/17✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
✓ Branch 10 taken 20 times.
✓ Branch 12 taken 20 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 20 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 20 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 20 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
|
80 | if (s && istringEqual(s.get(), "AutoSize")) { |
| 55 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | airTerminal->autosizeMaximumAirFlowRate(); |
| 56 | ✗ | } else if ((value = workspaceObject.getDouble(AirTerminal_SingleDuct_ConstantVolume_NoReheatFields::MaximumAirFlowRate))) { | |
| 57 | ✗ | airTerminal->setMaximumAirFlowRate(value.get()); | |
| 58 | } | ||
| 59 | |||
| 60 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | return airTerminal.get(); |
| 61 | 20 | } else { | |
| 62 | ✗ | LOG(Error, "Unknown error translating " << workspaceObject.briefDescription()); | |
| 63 | |||
| 64 | ✗ | return boost::none; | |
| 65 | } | ||
| 66 | 20 | } | |
| 67 | |||
| 68 | } // namespace energyplus | ||
| 69 | |||
| 70 | } // namespace openstudio | ||
| 71 |