src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACLowTemperatureRadiantElectric.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/Model.hpp" | ||
| 8 | #include "../../model/Schedule.hpp" | ||
| 9 | #include "../../model/Schedule_Impl.hpp" | ||
| 10 | #include "../../model/ModelObject.hpp" | ||
| 11 | #include "../../model/ModelObject_Impl.hpp" | ||
| 12 | #include "../../model/Node.hpp" | ||
| 13 | #include "../../model/Node_Impl.hpp" | ||
| 14 | #include "../../model/ThermalZone.hpp" | ||
| 15 | #include "../../model/ThermalZone_Impl.hpp" | ||
| 16 | #include "../../model/Surface.hpp" | ||
| 17 | #include "../../model/Surface_Impl.hpp" | ||
| 18 | #include "../../model/Space.hpp" | ||
| 19 | #include "../../model/Space_Impl.hpp" | ||
| 20 | #include "../../model/ConstructionWithInternalSource.hpp" | ||
| 21 | #include "../../model/ConstructionWithInternalSource_Impl.hpp" | ||
| 22 | #include "../../model/Construction.hpp" | ||
| 23 | #include "../../model/Construction_Impl.hpp" | ||
| 24 | #include "../../model/ZoneHVACLowTemperatureRadiantElectric.hpp" | ||
| 25 | #include "../../model/ZoneHVACLowTemperatureRadiantElectric_Impl.hpp" | ||
| 26 | #include "../../model/ZoneHVACEquipmentList.hpp" | ||
| 27 | #include "../../model/ZoneHVACEquipmentList_Impl.hpp" | ||
| 28 | #include "../../model/StraightComponent.hpp" | ||
| 29 | #include "../../model/StraightComponent_Impl.hpp" | ||
| 30 | //#include <model/CoilHeatingLowTempRadiantVarFlow.hpp> | ||
| 31 | //#include <model/CoilHeatingLowTempRadiantVarFlow_Impl.hpp> | ||
| 32 | //#include <model/CoilCoolingLowTempRadiantVarFlow.hpp> | ||
| 33 | //#include <model/CoilCoolingLowTempRadiantVarFlow_Impl.hpp> | ||
| 34 | #include "../../model/ZoneHVACComponent.hpp" | ||
| 35 | #include "../../model/ZoneHVACComponent_Impl.hpp" | ||
| 36 | |||
| 37 | #include "../../utilities/core/Assert.hpp" | ||
| 38 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 39 | |||
| 40 | #include <utilities/idd/ZoneHVAC_LowTemperatureRadiant_Electric_FieldEnums.hxx> | ||
| 41 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 42 | #include <utilities/idd/IddEnums.hxx> | ||
| 43 | #include <utilities/idd/IddFactory.hxx> | ||
| 44 | |||
| 45 | using namespace openstudio::model; | ||
| 46 | |||
| 47 | namespace openstudio { | ||
| 48 | |||
| 49 | namespace energyplus { | ||
| 50 | |||
| 51 | 5 | boost::optional<IdfObject> ForwardTranslator::translateZoneHVACLowTemperatureRadiantElectric(ZoneHVACLowTemperatureRadiantElectric& modelObject) { | |
| 52 | 5 | boost::optional<std::string> s; | |
| 53 | 5 | boost::optional<double> value; | |
| 54 | 5 | boost::optional<ModelObject> temp; | |
| 55 | |||
| 56 | // If it doesn't have any surfaces, then don't bother translating it, E+ will crash | ||
| 57 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 1 time.
|
5 | if (modelObject.surfaces().empty()) { |
| 58 |
7/7✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 14 taken 4 times.
✓ Branch 17 taken 4 times.
✓ Branch 20 taken 4 times.
|
4 | LOG(Info, |
| 59 | modelObject.briefDescription() << " does not have any target surfaces with ConstructionWithInternalSource, it will not be translated"); | ||
| 60 | 4 | return boost::none; | |
| 61 | } | ||
| 62 | |||
| 63 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject idfObject(IddObjectType::ZoneHVAC_LowTemperatureRadiant_Electric); |
| 64 |
1/1✓ Branch 1 taken 1 time.
|
1 | m_idfObjects.push_back(idfObject); |
| 65 | |||
| 66 | // Field Name | ||
| 67 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | std::string baseName = modelObject.name().get(); |
| 68 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setName(baseName); |
| 69 | |||
| 70 | // Field Availability Schedule Name | ||
| 71 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
|
2 | if (boost::optional<Schedule> schedule = modelObject.availabilitySchedule()) { |
| 72 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
2 | if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule.get())) { |
| 73 |
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(ZoneHVAC_LowTemperatureRadiant_ElectricFields::AvailabilityScheduleName, _schedule->name().get()); |
| 74 | 1 | } | |
| 75 | 1 | } | |
| 76 | |||
| 77 | // Field Zone Name | ||
| 78 | 1 | boost::optional<std::string> thermalZoneName; | |
| 79 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<ThermalZone> zone = modelObject.thermalZone()) { |
| 80 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
|
2 | if ((s = zone->name())) { |
| 81 |
1/1✓ Branch 1 taken 1 time.
|
1 | thermalZoneName = s; |
| 82 | |||
| 83 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(ZoneHVAC_LowTemperatureRadiant_ElectricFields::ZoneName, thermalZoneName.get()); |
| 84 | } | ||
| 85 | 1 | } | |
| 86 | |||
| 87 | //field Surface Name or Radiant Surface Type | ||
| 88 | |||
| 89 | //create a new surface group object | ||
| 90 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject _surfaceGroup(IddObjectType::ZoneHVAC_LowTemperatureRadiant_SurfaceGroup); |
| 91 | |||
| 92 | //create a name for the surface group | ||
| 93 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | std::string sname = baseName + "" + modelObject.radiantSurfaceType().get(); |
| 94 |
1/1✓ Branch 1 taken 1 time.
|
1 | _surfaceGroup.setName(sname); |
| 95 | |||
| 96 | //attach the surface group to the zone low temp radiant object | ||
| 97 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setString(ZoneHVAC_LowTemperatureRadiant_ElectricFields::SurfaceNameorRadiantSurfaceGroupName, sname); |
| 98 | |||
| 99 | //get rid of any existing surface (just to be safe) | ||
| 100 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.clearExtensibleGroups(); |
| 101 | |||
| 102 | //aggregator for total area; will be used to create weighted area | ||
| 103 | 1 | double totalAreaOfSurfaces = 0; | |
| 104 | |||
| 105 | //loop through all surfaces, adding up their area | ||
| 106 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 7 taken 4 times.
✓ Branch 8 taken 1 time.
|
5 | for (const Surface& surface : modelObject.surfaces()) { |
| 107 |
1/1✓ Branch 1 taken 4 times.
|
4 | totalAreaOfSurfaces = totalAreaOfSurfaces + surface.grossArea(); |
| 108 | 1 | } | |
| 109 | |||
| 110 | //loop through all the surfaces, adding them and their flow fractions (weighted per-area) | ||
| 111 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 8 taken 4 times.
✓ Branch 9 taken 1 time.
|
5 | for (const Surface& surface : modelObject.surfaces()) { |
| 112 |
1/1✓ Branch 1 taken 4 times.
|
4 | IdfExtensibleGroup group = _surfaceGroup.pushExtensibleGroup(); |
| 113 |
2/4✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 6 not taken.
|
4 | OS_ASSERT(group.numFields() == 2); |
| 114 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | group.setString(0, surface.name().get()); |
| 115 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | group.setDouble(1, (surface.grossArea() / totalAreaOfSurfaces)); |
| 116 | 5 | } | |
| 117 | |||
| 118 | //add the surface group to the list of idf objects | ||
| 119 |
1/1✓ Branch 1 taken 1 time.
|
1 | m_idfObjects.push_back(_surfaceGroup); |
| 120 | |||
| 121 | // Field Maximum Electrical Power to Panel | ||
| 122 | // Maps to HeatingDesignCapacity in 8.2.0 and above | ||
| 123 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
1 | if (modelObject.isMaximumElectricalPowertoPanelAutosized()) { |
| 124 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | idfObject.setString(ZoneHVAC_LowTemperatureRadiant_ElectricFields::HeatingDesignCapacity, "Autosize"); |
| 125 | ✗ | } else if ((value = modelObject.maximumElectricalPowertoPanel())) { | |
| 126 | ✗ | idfObject.setDouble(ZoneHVAC_LowTemperatureRadiant_ElectricFields::HeatingDesignCapacity, value.get()); | |
| 127 | } | ||
| 128 | |||
| 129 | // Field Temperature Control Type | ||
| 130 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
|
2 | if (boost::optional<std::string> tempCtrlType = modelObject.temperatureControlType()) { |
| 131 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(ZoneHVAC_LowTemperatureRadiant_ElectricFields::TemperatureControlType, tempCtrlType.get()); |
| 132 | 1 | } | |
| 133 | |||
| 134 | // Field Setpoint Control Type | ||
| 135 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
|
2 | if (boost::optional<std::string> setpCtrlType = modelObject.setpointControlType()) { |
| 136 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(ZoneHVAC_LowTemperatureRadiant_ElectricFields::SetpointControlType, setpCtrlType.get()); |
| 137 | 1 | } | |
| 138 | |||
| 139 | // Field Heating Throttling Range | ||
| 140 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 8 not taken.
|
2 | if ((value = modelObject.heatingThrottlingRange())) { |
| 141 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(ZoneHVAC_LowTemperatureRadiant_ElectricFields::HeatingThrottlingRange, value.get()); |
| 142 | } | ||
| 143 | |||
| 144 | // Field Heating Setpoint Temperature Schedule Name | ||
| 145 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
|
2 | if (boost::optional<Schedule> schedule = modelObject.heatingSetpointTemperatureSchedule()) { |
| 146 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
2 | if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule.get())) { |
| 147 |
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(ZoneHVAC_LowTemperatureRadiant_ElectricFields::HeatingSetpointTemperatureScheduleName, _schedule->name().get()); |
| 148 | 1 | } | |
| 149 | 1 | } | |
| 150 | |||
| 151 |
1/1✓ Branch 1 taken 1 time.
|
1 | return idfObject; |
| 152 | 5 | } | |
| 153 | |||
| 154 | } // namespace energyplus | ||
| 155 | |||
| 156 | } // namespace openstudio | ||
| 157 |