src/energyplus/ForwardTranslator/ForwardTranslateExteriorLights.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 | |||
| 8 | #include "../../model/Model.hpp" | ||
| 9 | #include "../../model/ExteriorLights.hpp" | ||
| 10 | #include "../../model/ExteriorLightsDefinition.hpp" | ||
| 11 | #include "../../model/Schedule.hpp" | ||
| 12 | |||
| 13 | #include <utilities/idd/Exterior_Lights_FieldEnums.hxx> | ||
| 14 | #include <utilities/idd/IddEnums.hxx> | ||
| 15 | |||
| 16 | #include "../../utilities/core/Assert.hpp" | ||
| 17 | |||
| 18 | namespace openstudio { | ||
| 19 | namespace energyplus { | ||
| 20 | |||
| 21 | 2 | boost::optional<IdfObject> ForwardTranslator::translateExteriorLights(model::ExteriorLights& modelObject) { | |
| 22 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject idfObject(IddObjectType::Exterior_Lights); |
| 23 | |||
| 24 |
1/1✓ Branch 1 taken 2 times.
|
2 | m_idfObjects.push_back(idfObject); |
| 25 | |||
| 26 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | idfObject.setString(Exterior_LightsFields::Name, modelObject.name().get()); |
| 27 | |||
| 28 | 2 | OptionalIdfObject relatedIdfObject; | |
| 29 | |||
| 30 | 2 | boost::optional<model::Schedule> schedule; | |
| 31 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (auto t_schedule = modelObject.schedule()) { |
| 32 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | schedule = t_schedule.get(); |
| 33 | } else { | ||
| 34 | ✗ | schedule = modelObject.model().alwaysOnDiscreteSchedule(); | |
| 35 | 2 | } | |
| 36 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
|
2 | OS_ASSERT(schedule); |
| 37 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | relatedIdfObject = translateAndMapModelObject(schedule.get()); |
| 38 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
|
2 | OS_ASSERT(relatedIdfObject); |
| 39 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
2 | idfObject.setString(Exterior_LightsFields::ScheduleName, relatedIdfObject->name().get()); |
| 40 | |||
| 41 |
1/1✓ Branch 1 taken 2 times.
|
2 | model::ExteriorLightsDefinition definition = modelObject.exteriorLightsDefinition(); |
| 42 | |||
| 43 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | double designLevel = definition.designLevel() * modelObject.multiplier(); |
| 44 |
1/1✓ Branch 1 taken 2 times.
|
2 | idfObject.setDouble(Exterior_LightsFields::DesignLevel, designLevel); |
| 45 | |||
| 46 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
2 | if (!modelObject.isControlOptionDefaulted()) { |
| 47 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | idfObject.setString(Exterior_LightsFields::ControlOption, modelObject.controlOption()); |
| 48 | } | ||
| 49 | |||
| 50 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
2 | if (!modelObject.isEndUseSubcategoryDefaulted()) { |
| 51 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | idfObject.setString(Exterior_LightsFields::EndUseSubcategory, modelObject.endUseSubcategory()); |
| 52 | } | ||
| 53 | |||
| 54 |
1/1✓ Branch 1 taken 2 times.
|
4 | return idfObject; |
| 55 | 2 | } | |
| 56 | |||
| 57 | } // namespace energyplus | ||
| 58 | } // namespace openstudio | ||
| 59 |