src/energyplus/ForwardTranslator/ForwardTranslateThermalStorageIceDetailed.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/ThermalStorageIceDetailed.hpp" | ||
| 8 | #include "../../model/ThermalStorageIceDetailed_Impl.hpp" | ||
| 9 | #include "../../model/Model.hpp" | ||
| 10 | #include "../../model/Node.hpp" | ||
| 11 | #include "../../model/Node_Impl.hpp" | ||
| 12 | #include "../../model/Curve.hpp" | ||
| 13 | #include "../../model/Curve_Impl.hpp" | ||
| 14 | #include "../../model/Schedule.hpp" | ||
| 15 | #include "../../model/Schedule_Impl.hpp" | ||
| 16 | #include "../../utilities/core/Assert.hpp" | ||
| 17 | #include <utilities/idd/ThermalStorage_Ice_Detailed_FieldEnums.hxx> | ||
| 18 | #include <utilities/idd/IddEnums.hxx> | ||
| 19 | |||
| 20 | using namespace openstudio::model; | ||
| 21 | using namespace std; | ||
| 22 | |||
| 23 | namespace openstudio { | ||
| 24 | |||
| 25 | namespace energyplus { | ||
| 26 | |||
| 27 | 1 | boost::optional<IdfObject> ForwardTranslator::translateThermalStorageIceDetailed(ThermalStorageIceDetailed& modelObject) { | |
| 28 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject idfObject(IddObjectType::ThermalStorage_Ice_Detailed); |
| 29 |
1/1✓ Branch 1 taken 1 time.
|
1 | m_idfObjects.push_back(idfObject); |
| 30 | |||
| 31 | // Name | ||
| 32 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto s = modelObject.name()) { |
| 33 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setName(*s); |
| 34 | 1 | } | |
| 35 | |||
| 36 | // InletNodeName | ||
| 37 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto mo = modelObject.inletModelObject()) { |
| 38 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
2 | if (auto node = mo->optionalCast<Node>()) { |
| 39 |
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(ThermalStorage_Ice_DetailedFields::InletNodeName, node->name().get()); |
| 40 | 1 | } | |
| 41 | 1 | } | |
| 42 | |||
| 43 | // OutletNodeName | ||
| 44 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto mo = modelObject.outletModelObject()) { |
| 45 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
2 | if (auto node = mo->optionalCast<Node>()) { |
| 46 |
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(ThermalStorage_Ice_DetailedFields::OutletNodeName, node->name().get()); |
| 47 | 1 | } | |
| 48 | 1 | } | |
| 49 | |||
| 50 | // AvailabilityScheduleName | ||
| 51 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
|
2 | if (auto schedule = modelObject.availabilitySchedule()) { |
| 52 | ✗ | idfObject.setString(ThermalStorage_Ice_DetailedFields::AvailabilityScheduleName, schedule->name().get()); | |
| 53 | 1 | } | |
| 54 | |||
| 55 | // Capacity | ||
| 56 | { | ||
| 57 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto value = modelObject.capacity(); |
| 58 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setDouble(ThermalStorage_Ice_DetailedFields::Capacity, value); |
| 59 | } | ||
| 60 | |||
| 61 | // DischargingCurveObjectType | ||
| 62 | // DischargingCurveName | ||
| 63 | { | ||
| 64 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto curve = modelObject.dischargingCurve(); |
| 65 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto idf = translateAndMapModelObject(curve); |
| 66 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
|
1 | OS_ASSERT(idf); |
| 67 | |||
| 68 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setString(ThermalStorage_Ice_DetailedFields::DischargingCurveVariableSpecifications, |
| 69 |
1/1✓ Branch 1 taken 1 time.
|
2 | modelObject.dischargingCurveVariableSpecifications()); |
| 70 |
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(ThermalStorage_Ice_DetailedFields::DischargingCurveName, idf->name().get()); |
| 71 | 1 | } | |
| 72 | |||
| 73 | // ChargingCurveObjectType | ||
| 74 | // ChargingCurveName | ||
| 75 | { | ||
| 76 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto curve = modelObject.chargingCurve(); |
| 77 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto idf = translateAndMapModelObject(curve); |
| 78 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
|
1 | OS_ASSERT(idf); |
| 79 | |||
| 80 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(ThermalStorage_Ice_DetailedFields::ChargingCurveVariableSpecifications, modelObject.chargingCurveVariableSpecifications()); |
| 81 |
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(ThermalStorage_Ice_DetailedFields::ChargingCurveName, idf->name().get()); |
| 82 | 1 | } | |
| 83 | |||
| 84 | // TimestepoftheCurveData | ||
| 85 | { | ||
| 86 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto value = modelObject.timestepoftheCurveData(); |
| 87 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setDouble(ThermalStorage_Ice_DetailedFields::TimestepoftheCurveData, value); |
| 88 | } | ||
| 89 | |||
| 90 | // ParasiticElectricLoadDuringDischarging | ||
| 91 | { | ||
| 92 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto value = modelObject.parasiticElectricLoadDuringDischarging(); |
| 93 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setDouble(ThermalStorage_Ice_DetailedFields::ParasiticElectricLoadDuringDischarging, value); |
| 94 | } | ||
| 95 | |||
| 96 | // ParasiticElectricLoadDuringCharging | ||
| 97 | { | ||
| 98 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto value = modelObject.parasiticElectricLoadDuringCharging(); |
| 99 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setDouble(ThermalStorage_Ice_DetailedFields::ParasiticElectricLoadDuringCharging, value); |
| 100 | } | ||
| 101 | |||
| 102 | // TankLossCoefficient | ||
| 103 | { | ||
| 104 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto value = modelObject.tankLossCoefficient(); |
| 105 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setDouble(ThermalStorage_Ice_DetailedFields::TankLossCoefficient, value); |
| 106 | } | ||
| 107 | |||
| 108 | // FreezingTemperatureofStorageMedium | ||
| 109 | { | ||
| 110 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto value = modelObject.freezingTemperatureofStorageMedium(); |
| 111 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setDouble(ThermalStorage_Ice_DetailedFields::FreezingTemperatureofStorageMedium, value); |
| 112 | } | ||
| 113 | |||
| 114 | // ThawProcessIndicator | ||
| 115 | { | ||
| 116 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto value = modelObject.thawProcessIndicator(); |
| 117 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setString(ThermalStorage_Ice_DetailedFields::ThawProcessIndicator, value); |
| 118 | 1 | } | |
| 119 | |||
| 120 |
1/1✓ Branch 1 taken 1 time.
|
2 | return idfObject; |
| 121 | 1 | } | |
| 122 | |||
| 123 | } // namespace energyplus | ||
| 124 | } // namespace openstudio | ||
| 125 |