GCC Code Coverage Report


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

src/energyplus/ReverseTranslator/ReverseTranslateFanConstantVolume.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/FanConstantVolume.hpp"
9 #include "../../model/FanConstantVolume_Impl.hpp"
10 #include "../../model/Schedule.hpp"
11 #include "../../model/Schedule_Impl.hpp"
12
13 #include <utilities/idd/Fan_ConstantVolume_FieldEnums.hxx>
14 #include "../../utilities/idd/IddEnums.hpp"
15 #include <utilities/idd/IddEnums.hxx>
16
17 using namespace openstudio::model;
18
19 namespace openstudio {
20
21 namespace energyplus {
22
23 ✗ OptionalModelObject ReverseTranslator::translateFanConstantVolume(const WorkspaceObject& workspaceObject) {
24 ✗ OptionalModelObject result;
25 ✗ OptionalModelObject temp;
26 ✗ OptionalSchedule schedule;
27
28 ✗ OptionalWorkspaceObject owo = workspaceObject.getTarget(Fan_ConstantVolumeFields::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.name().get()
40 << "Failed to convert iddObjects into model Objects. Maybe they do not exist in model yet");
41
42 ✗ return result;
43 }
44
45 ✗ openstudio::model::FanConstantVolume fan(m_model, *schedule);
46 ✗ OptionalString optS = workspaceObject.name();
47 ✗ if (optS) {
48 ✗ fan.setName(*optS);
49 }
50 //inlet and outlet nodes are set my the HVACAirLoop
51 ✗ OptionalDouble d;
52 ✗ d = workspaceObject.getDouble(openstudio::Fan_ConstantVolumeFields::FanTotalEfficiency);
53 ✗ if (d) {
54 ✗ fan.setFanEfficiency(*d);
55 }
56 ✗ d = workspaceObject.getDouble(openstudio::Fan_ConstantVolumeFields::PressureRise);
57 ✗ if (d) {
58 ✗ fan.setPressureRise(*d);
59 }
60 ✗ d = workspaceObject.getDouble(openstudio::Fan_ConstantVolumeFields::MaximumFlowRate);
61 ✗ if (d) {
62 ✗ fan.setMaximumFlowRate(*d);
63 }
64 ✗ d = workspaceObject.getDouble(openstudio::Fan_ConstantVolumeFields::MotorEfficiency);
65 ✗ if (d) {
66 ✗ fan.setMotorEfficiency(*d);
67 }
68 ✗ d = workspaceObject.getDouble(openstudio::Fan_ConstantVolumeFields::MotorInAirstreamFraction);
69 ✗ if (d) {
70 ✗ fan.setMotorInAirstreamFraction(*d);
71 }
72
73 ✗ optS = workspaceObject.getString(openstudio::Fan_ConstantVolumeFields::EndUseSubcategory);
74 ✗ if (optS) {
75 ✗ fan.setEndUseSubcategory(*optS);
76 }
77
78 ✗ result = fan;
79 ✗ return result;
80 ✗ }
81
82 } // namespace energyplus
83
84 } // namespace openstudio
85