src/energyplus/ForwardTranslator/ForwardTranslateElectricLoadCenterTransformer.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/ElectricLoadCenterTransformer.hpp" | ||
| 10 | #include "../../model/ElectricLoadCenterTransformer_Impl.hpp" | ||
| 11 | #include "../../model/ThermalZone.hpp" | ||
| 12 | #include "../../model/Schedule.hpp" | ||
| 13 | |||
| 14 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 15 | |||
| 16 | #include <utilities/idd/ElectricLoadCenter_Transformer_FieldEnums.hxx> | ||
| 17 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 18 | #include <utilities/idd/IddEnums.hxx> | ||
| 19 | |||
| 20 | using namespace openstudio::model; | ||
| 21 | |||
| 22 | using namespace std; | ||
| 23 | |||
| 24 | namespace openstudio { | ||
| 25 | |||
| 26 | namespace energyplus { | ||
| 27 | |||
| 28 | 4 | boost::optional<IdfObject> ForwardTranslator::translateElectricLoadCenterTransformer(model::ElectricLoadCenterTransformer& modelObject) { | |
| 29 | 4 | boost::optional<double> optD; | |
| 30 | 4 | std::string s; | |
| 31 | 4 | boost::optional<std::string> optS; | |
| 32 | 4 | boost::optional<Schedule> schedule; | |
| 33 | 4 | boost::optional<ThermalZone> zone; | |
| 34 | |||
| 35 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::ElectricLoadCenter_Transformer, modelObject); |
| 36 | |||
| 37 |
1/1✓ Branch 1 taken 4 times.
|
4 | schedule = modelObject.availabilitySchedule(); |
| 38 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (schedule) { |
| 39 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | boost::optional<IdfObject> scheduleIdf = translateAndMapModelObject(*schedule); |
| 40 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (scheduleIdf) { |
| 41 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
|
4 | idfObject.setString(ElectricLoadCenter_TransformerFields::AvailabilityScheduleName, scheduleIdf->name().get()); |
| 42 | } | ||
| 43 | 4 | } | |
| 44 | |||
| 45 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setString(ElectricLoadCenter_TransformerFields::TransformerUsage, modelObject.transformerUsage()); |
| 46 | |||
| 47 |
1/1✓ Branch 1 taken 4 times.
|
4 | zone = modelObject.zone(); |
| 48 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 3 times.
|
4 | if (zone) { |
| 49 |
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(ElectricLoadCenter_TransformerFields::ZoneName, zone->name().get()); |
| 50 | } | ||
| 51 | |||
| 52 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setDouble(ElectricLoadCenter_TransformerFields::RadiativeFraction, modelObject.radiativeFraction()); |
| 53 | |||
| 54 |
1/1✓ Branch 1 taken 4 times.
|
4 | optD = modelObject.ratedCapacity(); |
| 55 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (optD) { |
| 56 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setDouble(ElectricLoadCenter_TransformerFields::RatedCapacity, optD.get()); |
| 57 | } | ||
| 58 | |||
| 59 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setString(ElectricLoadCenter_TransformerFields::Phase, modelObject.phase()); |
| 60 | |||
| 61 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setString(ElectricLoadCenter_TransformerFields::ConductorMaterial, modelObject.conductorMaterial()); |
| 62 | |||
| 63 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setDouble(ElectricLoadCenter_TransformerFields::FullLoadTemperatureRise, modelObject.fullLoadTemperatureRise()); |
| 64 | |||
| 65 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setDouble(ElectricLoadCenter_TransformerFields::FractionofEddyCurrentLosses, modelObject.fractionofEddyCurrentLosses()); |
| 66 | |||
| 67 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setString(ElectricLoadCenter_TransformerFields::PerformanceInputMethod, modelObject.performanceInputMethod()); |
| 68 | |||
| 69 |
1/1✓ Branch 1 taken 4 times.
|
4 | optD = modelObject.ratedNoLoadLoss(); |
| 70 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if (optD) { |
| 71 | ✗ | idfObject.setDouble(ElectricLoadCenter_TransformerFields::RatedNoLoadLoss, optD.get()); | |
| 72 | } | ||
| 73 | |||
| 74 |
1/1✓ Branch 1 taken 4 times.
|
4 | optD = modelObject.ratedLoadLoss(); |
| 75 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if (optD) { |
| 76 | ✗ | idfObject.setDouble(ElectricLoadCenter_TransformerFields::RatedLoadLoss, optD.get()); | |
| 77 | } | ||
| 78 | |||
| 79 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setDouble(ElectricLoadCenter_TransformerFields::NameplateEfficiency, modelObject.nameplateEfficiency()); |
| 80 | |||
| 81 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setDouble(ElectricLoadCenter_TransformerFields::PerUnitLoadforNameplateEfficiency, modelObject.perUnitLoadforNameplateEfficiency()); |
| 82 | |||
| 83 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setDouble(ElectricLoadCenter_TransformerFields::ReferenceTemperatureforNameplateEfficiency, |
| 84 | modelObject.referenceTemperatureforNameplateEfficiency()); | ||
| 85 | |||
| 86 |
1/1✓ Branch 1 taken 4 times.
|
4 | optD = modelObject.perUnitLoadforMaximumEfficiency(); |
| 87 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if (optD) { |
| 88 | ✗ | idfObject.setDouble(ElectricLoadCenter_TransformerFields::PerUnitLoadforMaximumEfficiency, optD.get()); | |
| 89 | } | ||
| 90 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
4 | if (modelObject.considerTransformerLossforUtilityCost()) { |
| 91 |
1/1✓ Branch 1 taken 4 times.
|
4 | s = "Yes"; |
| 92 | } else { | ||
| 93 | ✗ | s = "No"; | |
| 94 | } | ||
| 95 |
1/1✓ Branch 1 taken 4 times.
|
4 | idfObject.setString(ElectricLoadCenter_TransformerFields::ConsiderTransformerLossforUtilityCost, s); |
| 96 | |||
| 97 | //meters | ||
| 98 |
1/1✓ Branch 1 taken 4 times.
|
4 | std::vector<std::string> meters = modelObject.meters(); |
| 99 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 3 times.
|
4 | if (!meters.empty()) { |
| 100 |
2/2✓ Branch 5 taken 3 times.
✓ Branch 6 taken 1 time.
|
4 | for (const auto& meter : meters) { |
| 101 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto eg = idfObject.pushExtensibleGroup(); |
| 102 |
1/1✓ Branch 1 taken 3 times.
|
3 | eg.setString(ElectricLoadCenter_TransformerExtensibleFields::MeterName, meter); |
| 103 | 3 | } | |
| 104 | } | ||
| 105 | |||
| 106 |
1/1✓ Branch 1 taken 4 times.
|
8 | return idfObject; |
| 107 | 4 | } | |
| 108 | |||
| 109 | } // namespace energyplus | ||
| 110 | |||
| 111 | } // namespace openstudio | ||
| 112 |