GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 0.0% 0 / 0 / 44
Functions: 0.0% 0 / 0 / 1
Branches: 0.0% 0 / 0 / 77

src/energyplus/ReverseTranslator/ReverseTranslateCoilHeatingGas.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
8 #include "../../model/CoilHeatingGas.hpp"
9 #include "../../model/CoilHeatingGas_Impl.hpp"
10 #include "../../model/Schedule.hpp"
11 #include "../../model/Schedule_Impl.hpp"
12
13 #include <utilities/idd/Coil_Heating_Fuel_FieldEnums.hxx>
14
15 using namespace openstudio::model;
16
17 namespace openstudio {
18
19 namespace energyplus {
20
21 ✗ OptionalModelObject ReverseTranslator::translateCoilHeatingGas(const WorkspaceObject& workspaceObject) {
22 ✗ OptionalModelObject result;
23 ✗ OptionalModelObject temp;
24
25 ✗ OptionalSchedule schedule;
26
27 //get the Schedule
28 ✗ OptionalWorkspaceObject owo = workspaceObject.getTarget(Coil_Heating_FuelFields::AvailabilityScheduleName);
29 ✗ if (!owo) {
30 ✗ LOG(Error, "Error importing object: " << workspaceObject.briefDescription() << " Can't find Schedule.");
31 ✗ return result;
32 }
33 ✗ temp = translateAndMapWorkspaceObject(*owo);
34 ✗ if (temp) {
35 ✗ schedule = temp->optionalCast<Schedule>();
36 }
37
38 ✗ if (!schedule) {
39 ✗ LOG(Error, "Error importing object: " << workspaceObject.briefDescription()
40 << "Failed to convert iddObject (schedule) into ModelObject. Maybe it does not exist in model yet");
41 ✗ return result;
42 }
43
44 try {
45
46 ✗ openstudio::model::CoilHeatingGas coil(m_model, *schedule);
47 ✗ OptionalString optS = workspaceObject.name();
48 ✗ if (optS) {
49 ✗ coil.setName(*optS);
50 }
51 ✗ OptionalDouble d;
52 ✗ d = workspaceObject.getDouble(openstudio::Coil_Heating_FuelFields::BurnerEfficiency);
53 ✗ if (d) {
54 ✗ coil.setGasBurnerEfficiency(*d);
55 }
56 ✗ d = workspaceObject.getDouble(openstudio::Coil_Heating_FuelFields::NominalCapacity);
57 ✗ if (d) {
58 ✗ coil.setNominalCapacity(*d);
59 }
60 //skip inlet and outlet node names. That should be done FOR us by the AirLoop Translator.
61 ✗ d = workspaceObject.getDouble(openstudio::Coil_Heating_FuelFields::BurnerEfficiency);
62 ✗ if (d) {
63 ✗ coil.setGasBurnerEfficiency(*d);
64 }
65
66 ✗ d = workspaceObject.getDouble(openstudio::Coil_Heating_FuelFields::NominalCapacity);
67 ✗ if (d) {
68 ✗ coil.setNominalCapacity(*d);
69 }
70
71 ✗ d = workspaceObject.getDouble(openstudio::Coil_Heating_FuelFields::OnCycleParasiticElectricLoad);
72 ✗ if (d) {
73 ✗ coil.setOnCycleParasiticElectricLoad(*d);
74 }
75 ✗ d = workspaceObject.getDouble(openstudio::Coil_Heating_FuelFields::OffCycleParasiticFuelLoad);
76 ✗ if (d) {
77 ✗ coil.setOffCycleParasiticGasLoad(*d);
78 }
79 ✗ result = coil;
80 ✗ } catch (std::exception& e) {
81 ✗ LOG(Error, "Unable to reverse translate " << workspaceObject.briefDescription() << ", because " << e.what() << ".");
82 ✗ return boost::none;
83 ✗ }
84
85 ✗ return result;
86 ✗ }
87
88 } // namespace energyplus
89
90 } // namespace openstudio
91