GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 98.0% 50 / 0 / 51
Functions: 100.0% 1 / 0 / 1
Branches: 72.0% 59 / 0 / 82

src/energyplus/ForwardTranslator/ForwardTranslateElectricLoadCenterStorageLiIonNMCBattery.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/ElectricLoadCenterStorageLiIonNMCBattery.hpp"
10 #include "../../model/ElectricLoadCenterStorageLiIonNMCBattery_Impl.hpp"
11
12 #include "../../model/Schedule.hpp"
13 #include "../../model/Schedule_Impl.hpp"
14 #include "../../model/ThermalZone.hpp"
15 #include "../../model/ThermalZone_Impl.hpp"
16
17 #include <utilities/idd/ElectricLoadCenter_Storage_LiIonNMCBattery_FieldEnums.hxx>
18 #include "../../utilities/idd/IddEnums.hpp"
19 #include <utilities/idd/IddEnums.hxx>
20
21 using namespace openstudio::model;
22
23 using namespace std;
24
25 namespace openstudio {
26
27 namespace energyplus {
28
29 boost::optional<IdfObject>
30 2 ForwardTranslator::translateElectricLoadCenterStorageLiIonNMCBattery(model::ElectricLoadCenterStorageLiIonNMCBattery& modelObject) {
31
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::ElectricLoadCenter_Storage_LiIonNMCBattery, modelObject);
32
33 // Name
34
2/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
4 if (modelObject.name()) {
35
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 idfObject.setString(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::Name, modelObject.name().get());
36 }
37
38 // Availability Schedule Name
39
1/1
✓ Branch 1 taken 2 times.
2 Schedule schedule = modelObject.availabilitySchedule();
40
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule);
41
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (_schedule) {
42
4/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
2 idfObject.setString(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::AvailabilityScheduleName, _schedule->name().get());
43 }
44
45 // Zone Name
46
6/22
✓ Branch 1 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 2 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 2 times.
✓ Branch 24 taken 2 times.
✗ Branch 25 not taken.
✗ Branch 27 not taken.
✓ Branch 28 taken 2 times.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
4 if (modelObject.thermalZone() && modelObject.thermalZone().get().name()) {
47 ✗ idfObject.setString(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::ZoneName, modelObject.thermalZone().get().name().get());
48 }
49
50 // Radiative Fraction
51 {
52
1/1
✓ Branch 1 taken 2 times.
2 double value = modelObject.radiativeFraction();
53
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setDouble(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::RadiativeFraction, value);
54 }
55
56 // Lifetime Model
57 {
58
1/1
✓ Branch 1 taken 2 times.
2 std::string value = modelObject.lifetimeModel();
59
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setString(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::LifetimeModel, value);
60 2 }
61
62 // Number of Cells in Series
63 {
64
1/1
✓ Branch 1 taken 2 times.
2 int value = modelObject.numberofCellsinSeries();
65
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setInt(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::NumberofCellsinSeries, value);
66 }
67
68 // Number of Strings in Parallel
69 {
70
1/1
✓ Branch 1 taken 2 times.
2 int value = modelObject.numberofStringsinParallel();
71
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setInt(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::NumberofStringsinParallel, value);
72 }
73
74 // Initial Fractional State of Charge
75 {
76
1/1
✓ Branch 1 taken 2 times.
2 double value = modelObject.initialFractionalStateofCharge();
77
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setDouble(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::InitialFractionalStateofCharge, value);
78 }
79
80 // DC to DC Charging Efficiency
81 {
82
1/1
✓ Branch 1 taken 2 times.
2 double value = modelObject.dctoDCChargingEfficiency();
83
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setDouble(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::DCtoDCChargingEfficiency, value);
84 }
85
86 // Battery Mass
87 {
88
1/1
✓ Branch 1 taken 2 times.
2 double value = modelObject.batteryMass();
89
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setDouble(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::BatteryMass, value);
90 }
91
92 // Battery Surface Area
93 {
94
1/1
✓ Branch 1 taken 2 times.
2 double value = modelObject.batterySurfaceArea();
95
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setDouble(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::BatterySurfaceArea, value);
96 }
97
98 // Battery Specific Heat Capacity
99 {
100
1/1
✓ Branch 1 taken 2 times.
2 double value = modelObject.batterySpecificHeatCapacity();
101
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setDouble(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::BatterySpecificHeatCapacity, value);
102 }
103
104 // Heat Transfer Coefficient Between Battery and Ambient
105 {
106
1/1
✓ Branch 1 taken 2 times.
2 double value = modelObject.heatTransferCoefficientBetweenBatteryandAmbient();
107
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setDouble(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::HeatTransferCoefficientBetweenBatteryandAmbient, value);
108 }
109
110 // Fully Charged Cell Voltage
111 {
112
1/1
✓ Branch 1 taken 2 times.
2 double value = modelObject.fullyChargedCellVoltage();
113
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setDouble(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::FullyChargedCellVoltage, value);
114 }
115
116 // Cell Voltage at End of Exponential Zone
117 {
118
1/1
✓ Branch 1 taken 2 times.
2 double value = modelObject.cellVoltageatEndofExponentialZone();
119
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setDouble(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::CellVoltageatEndofExponentialZone, value);
120 }
121
122 // Cell Voltage at End of Nominal Zone
123 {
124
1/1
✓ Branch 1 taken 2 times.
2 double value = modelObject.cellVoltageatEndofNominalZone();
125
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setDouble(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::CellVoltageatEndofNominalZone, value);
126 }
127
128 // Default Nominal Cell Voltage
129 {
130
1/1
✓ Branch 1 taken 2 times.
2 double value = modelObject.defaultNominalCellVoltage();
131
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setDouble(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::DefaultNominalCellVoltage, value);
132 }
133
134 // Fully Charged Cell Capacity
135 {
136
1/1
✓ Branch 1 taken 2 times.
2 double value = modelObject.fullyChargedCellCapacity();
137
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setDouble(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::FullyChargedCellCapacity, value);
138 }
139
140 // Fraction of Cell Capacity Removed at the End of Exponential Zone
141 {
142
1/1
✓ Branch 1 taken 2 times.
2 double value = modelObject.fractionofCellCapacityRemovedattheEndofExponentialZone();
143
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setDouble(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::FractionofCellCapacityRemovedattheEndofExponentialZone, value);
144 }
145
146 // Fraction of Cell Capacity Removed at the End of Nominal Zone
147 {
148
1/1
✓ Branch 1 taken 2 times.
2 double value = modelObject.fractionofCellCapacityRemovedattheEndofNominalZone();
149
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setDouble(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::FractionofCellCapacityRemovedattheEndofNominalZone, value);
150 }
151
152 // Charge Rate at Which Voltage vs Capacity Cruve Was Generated
153 {
154
1/1
✓ Branch 1 taken 2 times.
2 double value = modelObject.chargeRateatWhichVoltagevsCapacityCurveWasGenerated();
155
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setDouble(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::ChargeRateatWhichVoltagevsCapacityCurveWasGenerated, value);
156 }
157
158 // Battery Cell Internal Electrical Resistance
159 {
160
1/1
✓ Branch 1 taken 2 times.
2 double value = modelObject.batteryCellInternalElectricalResistance();
161
1/1
✓ Branch 1 taken 2 times.
2 idfObject.setDouble(ElectricLoadCenter_Storage_LiIonNMCBatteryFields::BatteryCellInternalElectricalResistance, value);
162 }
163
164
1/1
✓ Branch 1 taken 2 times.
4 return idfObject;
165 2 }
166
167 } // namespace energyplus
168
169 } // namespace openstudio
170