MEASUR-Tools-Suite v1.0.11
The MEASUR Tools Suite is a collection of industrial efficiency calculations written in C++ and with bindings for compilation to WebAssembly.
Loading...
Searching...
No Matches
steam_leak_survey.h
Go to the documentation of this file.
1#pragma once
2
17#include <cmath>
18#include <stdexcept>
19#include <string>
20
22#include "physics/constants.h"
23#include "steamModeler/SteamProperties.h"
24
26public:
27 enum class UtilityType { steam, electric, natural_gas };
28
30 SteamLeakSurveyResults(const double leakRate, const double steamLoss, const double energyLoss, const double leakCost)
31 : leakRate(leakRate), steamLoss(steamLoss), energyLoss(energyLoss), leakCost(leakCost) {}
32
33 const double leakRate, steamLoss, energyLoss, leakCost;
34 };
35
47 SteamLeakSurvey(const double operatingTime, const double steamTemp, const double steamPressure, const double costOfElectricity,
48 const double leakPressure, const double leakTemp, const double feedwaterTemp,
49 const double steamCost) :
50 SteamLeakSurvey(operatingTime, steamTemp, steamPressure, costOfElectricity,
51 leakPressure, leakTemp, feedwaterTemp,
52 0, 0, UtilityType::steam, 0, 1, steamCost) {}
53
66 SteamLeakSurvey(const double operatingTime, const double steamTemp, const double steamPressure, const double costOfElectricity,
67 const double leakPressure, const double leakTemp, const double feedwaterTemp,
68 const double boilerEfficiency, const double systemEfficiency) :
69 SteamLeakSurvey(operatingTime, steamTemp, steamPressure, costOfElectricity,
70 leakPressure, leakTemp, feedwaterTemp,
71 boilerEfficiency, systemEfficiency, UtilityType::electric){}
72
87 SteamLeakSurvey(const double operatingTime, const double steamTemp, const double steamPressure, const double costOfElectricity,
88 const double leakPressure, const double leakTemp, const double feedwaterTemp,
89 const double boilerEfficiency, const double systemEfficiency,
90 const double fuelCost, const double fuelEnergyFactor = 1) :
91 SteamLeakSurvey(operatingTime, steamTemp, steamPressure, costOfElectricity,
92 leakPressure, leakTemp, feedwaterTemp,
93 boilerEfficiency, systemEfficiency, UtilityType::natural_gas, fuelCost, fuelEnergyFactor){}
94
111 SteamLeakSurvey(const double operatingTime, const double steamTemp, const double steamPressure, const double costOfElectricity,
112 const double leakPressure, const double leakTemp, const double feedwaterTemp,
113 const double boilerEfficiency, const double systemEfficiency, const UtilityType utilityType,
114 const double fuelCost = 0, const double fuelEnergyFactor = 1, const double steamCost = 0) :
115 operatingTime(operatingTime), steamPressure(steamPressure), leakPressure(leakPressure), costOfElectricity(costOfElectricity) {
117 const auto steamPressureMPa = physics::conversions::psigToMPa(steamPressure);
118 const auto leakPressureMPa = physics::conversions::psigToMPa(leakPressure);
119 const auto steamTempK = physics::conversions::fahrenheitToKelvin(steamTemp);
120 const auto leakTempK = physics::conversions::fahrenheitToKelvin(leakTemp);
121 const auto feedwaterTempK = physics::conversions::fahrenheitToKelvin(feedwaterTemp);
122
123 const auto steamProperties = SteamProperties(steamPressureMPa, SteamProperties::ThermodynamicQuantity::TEMPERATURE, steamTempK).calculate();
124 specificHeatRatio = steamProperties.isentropicExponent;
125 steamSpecificEnthalpy = steamProperties.specificEnthalpy;
126 isentropicEnthalpy = SteamProperties(leakPressureMPa, SteamProperties::ThermodynamicQuantity::ENTROPY,steamProperties.specificEntropy).calculate().specificEnthalpy;
127 leakEnthalpy = SteamProperties(leakPressureMPa, SteamProperties::ThermodynamicQuantity::TEMPERATURE,leakTempK).calculate().specificEnthalpy;
128 feedwaterEnthalpy = SteamProperties(feedWaterPressureMPa, SteamProperties::ThermodynamicQuantity::TEMPERATURE, feedwaterTempK).calculate().specificEnthalpy;
129
130 double leakSpecificVolume = SteamProperties(leakPressureMPa, SteamProperties::ThermodynamicQuantity::TEMPERATURE, leakTempK).calculate().specificVolume;
131 leakSpecificVolume *= physics::conversions::kM3PerKgToFt3PerLb;
132 leakSpecificVolume *= physics::conversions::kFt3ToIn3;
133
134 feedwaterEnthalpy *= physics::conversions::kKJPerKgToBtuPerLb;
135 steamSpecificEnthalpy *= physics::conversions::kKJPerKgToBtuPerLb;
136 isentropicEnthalpy *= physics::conversions::kKJPerKgToBtuPerLb;
138 leakDensity = 1 / leakSpecificVolume; // lb/in3
139
140 switch (utilityType) {
141 case UtilityType::natural_gas:
142 this->steamCost = fuelCost * fuelEnergyFactor * (steamSpecificEnthalpy - feedwaterEnthalpy) / 1000000 / (boilerEfficiency/100) / (systemEfficiency/100);
143 break;
144 case UtilityType::electric:
145 this->steamCost = costOfElectricity * 293.071 * (steamSpecificEnthalpy - feedwaterEnthalpy) / 1000000 / (boilerEfficiency/100) / (systemEfficiency/100);
146 break;
147 case UtilityType::steam :
148 this->steamCost = steamCost;
149 break;
150 }
151 }
152
158 SteamLeakSurveyResults estimateMethodPRVCalc(const double leakRate) const {
159 return calculate(leakRate);
160 }
161
168 SteamLeakSurveyResults estimateMethodTurbineCalc(const double turbineEfficiency, const double leakRate) const {
169 return calculate(leakRate, turbineEfficiency);
170 }
171
180 SteamLeakSurveyResults orificeMethodCalc(const double turbineEfficiency, const double holeSize, const double dischargeCoef, const double atmPressure) const {
181 const double criticalPressureRatio = std::pow(2 / (specificHeatRatio+1), (specificHeatRatio+1) / (specificHeatRatio-1));
182 const double pressureRatio = atmPressure / (leakPressure + atmPressure);
183 const double minPressure = atmPressure / (criticalPressureRatio - atmPressure);
184
185 if (criticalPressureRatio <= pressureRatio) {
186 throw std::runtime_error("Steam Leak with Orifice method, Leak pressure (" + std::to_string(leakPressure) +
187 ") must be at least minimum pressure (" + std::to_string(minPressure) + ")");
188 }
189
190 const double leakRate = dischargeCoef * M_PI / 4 * holeSize * holeSize *
191 std::sqrt(specificHeatRatio * leakDensity * (leakPressure + atmPressure) * 32.2 * 12 * criticalPressureRatio) * 3600;
192
193 return calculate(leakRate, turbineEfficiency);
194 }
195
204 SteamLeakSurveyResults plumeMethodCalc(const double turbineEfficiency, const double plumeLength, const double ambTemp) const {
205 const double leakRate = QuantifySteamLeakByPlumeLength::estimate(steamPressure, plumeLength, ambTemp); // lb/hr
206
207 return calculate(leakRate, turbineEfficiency);
208 }
209
213 double costOfSteam(const double turbineEfficiency) const {
214 if (turbineEfficiency != 0) {
215 return steamCost - costOfElectricity * 293.071 * (steamSpecificEnthalpy - isentropicEnthalpy) / 1000000 * (turbineEfficiency/100);
216 }
217
218 return steamCost;
219 }
220
224 double costOfSteam() const {
225 return costOfSteam(0);
226 }
227
228 private:
229 SteamLeakSurveyResults calculate(const double leakRate, const double turbineEfficiency = 0) const {
230 const double steamLoss = operatingTime * leakRate / 1000;
231 const double energyLoss = leakEnthalpy * steamLoss / 1000;
232
233 const double leakCost = steamLoss * costOfSteam(turbineEfficiency) * 1000 *
234 (leakEnthalpy - feedwaterEnthalpy) / (steamSpecificEnthalpy - feedwaterEnthalpy);
235
236 return {leakRate, steamLoss, energyLoss, leakCost};
237 }
238
239 double operatingTime = 0, steamPressure = 0, leakPressure = 0, costOfElectricity = 0, steamCost = 0;
240 double steamSpecificEnthalpy = 1256.12; // btu/lb
241 double isentropicEnthalpy = 1220.35; // btu/lb
242 double feedwaterEnthalpy = 38.16; // btu/lb
243 double leakEnthalpy = 1208.07; // btu/lb
244 double leakDensity = 0; // lb/in3
245 double specificHeatRatio = 1.3;
246};
247
static double estimate(const double pressure, const double plumeLength, const double ambTemp)
SteamLeakSurveyResults estimateMethodTurbineCalc(const double turbineEfficiency, const double leakRate) const
double costOfSteam() const
SteamLeakSurveyResults orificeMethodCalc(const double turbineEfficiency, const double holeSize, const double dischargeCoef, const double atmPressure) const
SteamLeakSurvey(const double operatingTime, const double steamTemp, const double steamPressure, const double costOfElectricity, const double leakPressure, const double leakTemp, const double feedwaterTemp, const double boilerEfficiency, const double systemEfficiency, const double fuelCost, const double fuelEnergyFactor=1)
double costOfSteam(const double turbineEfficiency) const
SteamLeakSurveyResults estimateMethodPRVCalc(const double leakRate) const
SteamLeakSurveyResults plumeMethodCalc(const double turbineEfficiency, const double plumeLength, const double ambTemp) const
SteamLeakSurvey(const double operatingTime, const double steamTemp, const double steamPressure, const double costOfElectricity, const double leakPressure, const double leakTemp, const double feedwaterTemp, const double boilerEfficiency, const double systemEfficiency, const UtilityType utilityType, const double fuelCost=0, const double fuelEnergyFactor=1, const double steamCost=0)
SteamLeakSurvey(const double operatingTime, const double steamTemp, const double steamPressure, const double costOfElectricity, const double leakPressure, const double leakTemp, const double feedwaterTemp, const double steamCost)
SteamLeakSurvey(const double operatingTime, const double steamTemp, const double steamPressure, const double costOfElectricity, const double leakPressure, const double leakTemp, const double feedwaterTemp, const double boilerEfficiency, const double systemEfficiency)
SteamSystemModelerTool::SteamPropertiesOutput calculate()
Defines physical constants and unit conversions.
constexpr double kFt3ToIn3
convert ft3 -> in3.
Definition constants.h:173
constexpr double kWaterSurfacePressure
Surface pressure exerted by water @ sea level lb/in2.
Definition constants.h:179
constexpr double kKJPerKgToBtuPerLb
convert kJ/kg -> btu/lb.
Definition constants.h:176
constexpr double psigToMPa(const double psig)
convert psig to MPa.
Definition constants.h:167
constexpr double fahrenheitToKelvin(double fahrenheit)
Convert Fahrenheit to Kelvin.
Definition constants.h:164
constexpr double kM3PerKgToFt3PerLb
convert m3/kg -> ft3/lb.
Definition constants.h:170
Implementations of DOE's Quantify and Eliminate Steam Leaks.