GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 14 / 0 / 14
Functions: 100.0% 1 / 0 / 1
Branches: 100.0% 22 / 0 / 22

src/energyplus/ForwardTranslator/ForwardTranslateOutputEnvironmentalImpactFactors.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
9 #include "../../model/OutputEnvironmentalImpactFactors.hpp"
10
11 #include "../../model/EnvironmentalImpactFactors.hpp"
12 #include "../../model/EnvironmentalImpactFactors_Impl.hpp"
13 #include "../../model/FuelFactors.hpp"
14 #include "../../model/FuelFactors_Impl.hpp"
15
16 #include <utilities/idd/Output_EnvironmentalImpactFactors_FieldEnums.hxx>
17 #include <utilities/idd/IddEnums.hxx>
18
19 using namespace openstudio::model;
20
21 namespace openstudio {
22
23 namespace energyplus {
24
25 5 boost::optional<IdfObject> ForwardTranslator::translateOutputEnvironmentalImpactFactors(model::OutputEnvironmentalImpactFactors& modelObject) {
26
27 // This is the object that triggers the translation of the two others. Also, at **least** on FuelFactor should be present (for Electricity...)
28 // or you KNOW E+ is going to crash
29
30
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 auto fuelFactors = modelObject.model().getConcreteModelObjects<FuelFactors>();
31
2/2
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 4 times.
5 if (fuelFactors.empty()) {
32
5/5
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
1 LOG(Error, "Your object of type 'OutputEnvironmentalImpactFactors' will not be translated since you have zero FuelFactors, "
33 "which are actually required for each fuel you use");
34 1 return boost::none;
35 }
36
37 // It doesn't have a name
38
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 IdfObject idfObject = createAndRegisterIdfObject(openstudio::IddObjectType::Output_EnvironmentalImpactFactors, modelObject);
39
40
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 idfObject.setString(Output_EnvironmentalImpactFactorsFields::ReportingFrequency, modelObject.reportingFrequency());
41
42
2/2
✓ Branch 4 taken 5 times.
✓ Branch 5 taken 4 times.
9 for (auto& fuelFactor : fuelFactors) {
43
1/1
✓ Branch 1 taken 5 times.
5 translateAndMapModelObject(fuelFactor);
44 }
45
46
4/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 11 taken 2 times.
✓ Branch 12 taken 4 times.
6 for (auto& environmentalImpactFactor : modelObject.model().getConcreteModelObjects<EnvironmentalImpactFactors>()) {
47
1/1
✓ Branch 1 taken 2 times.
2 translateAndMapModelObject(environmentalImpactFactor);
48 4 }
49
50
1/1
✓ Branch 1 taken 4 times.
4 return idfObject;
51 5 } // End of translate function
52
53 } // end namespace energyplus
54 } // end namespace openstudio
55