-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #157 from ORNL-AMO/fsat-add-second-calc
Add Fan algorithms
- Loading branch information
Showing
11 changed files
with
1,304 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
#ifndef AMO_TOOLS_SUITE_FAN_H | ||
#define AMO_TOOLS_SUITE_FAN_H | ||
|
||
#include <string> | ||
#include <unordered_map> | ||
#include <cmath> | ||
#include <vector> | ||
#include <stdexcept> | ||
#include <functional> | ||
#include "Planar.h" | ||
#include "FanShaftPower.h" | ||
|
||
class FanRatedInfo; | ||
class Planar; | ||
class FanInletFlange; | ||
class FanOrEvaseOutletFlange; | ||
class FlowTraverse; | ||
class AddlTravPlane; | ||
class InletMstPlane; | ||
class OutletMstPlane; | ||
|
||
class BaseGasDensity { | ||
public: | ||
|
||
enum class GasType { | ||
AIR, | ||
STANDARDAIR, | ||
OTHERGAS | ||
}; | ||
|
||
enum class InputType { | ||
DEW, | ||
RH, | ||
WET | ||
}; | ||
|
||
// used for method 1 | ||
BaseGasDensity(double tdo, double pso, double pbo, double po, GasType gasType); | ||
|
||
// TODO ensure correctness | ||
// BaseGasDensity(double tdo, double pso, double pbo, double relativeHumidityOrDewPointTempOrHumidityRatio, | ||
// GasType gasType, InputType inputType, double specificGravity); | ||
// | ||
// BaseGasDensity(double tdo, double pso, double pbo, double wetBulbTemp, | ||
// GasType gasType, InputType inputType, double specificGravity, double cpGas); | ||
|
||
private: | ||
|
||
double calculateSaturationPressure(double dryBulbTemp) const; | ||
|
||
double calculateRatioRH(double dryBulbTemp, double relativeHumidity, double barometricPressure, | ||
double specificGravity) const; | ||
|
||
double calculateRelativeHumidityFromWetBulb(double dryBulbTemp, double wetBulbTemp, double cpGas) const; | ||
|
||
// dry bulb temp, reference static pressure, reference barometric pressure, gas density respectively | ||
const double tdo, pso, pbo; | ||
|
||
// gasDensity, specificGravity | ||
double po, g; | ||
const GasType gasType; | ||
|
||
friend class PlaneData; | ||
friend class Fan; | ||
}; | ||
|
||
|
||
class PlaneData { | ||
public: | ||
PlaneData(FanInletFlange & fanInletFlange, FanOrEvaseOutletFlange & fanOrEvaseOutletFlange, | ||
FlowTraverse & flowTraverse, std::vector<AddlTravPlane> & addlTravPlanes, InletMstPlane & inletMstPlane, | ||
OutletMstPlane & outletMstPlane, bool variationsInPlanarBarometricPressure, | ||
bool estimatePlaneTemp, double totalPressureLossBtwnPlanes1and4, | ||
double totalPressureLossBtwnPlanes2and5, bool plane5upstreamOfPlane2); | ||
|
||
private: | ||
|
||
void establishFanInletOrOutletDensity(Planar & plane, | ||
std::function<double (Planar const &, const double)> const & calcDensity, | ||
double mTotal, double assumedDensity); | ||
|
||
void calculate(BaseGasDensity const & bgd); | ||
|
||
FanInletFlange fanInletFlange; | ||
FanOrEvaseOutletFlange fanOrEvaseOutletFlange; | ||
FlowTraverse flowTraverse; | ||
std::vector<AddlTravPlane> addlTravPlanes; | ||
InletMstPlane inletMstPlane; | ||
OutletMstPlane outletMstPlane; | ||
|
||
bool const variationsInPlanarBarometricPressure, estimatePlaneTemp, plane5upstreamOfPlane2; | ||
const double totalPressureLossBtwnPlanes1and4, totalPressureLossBtwnPlanes2and5; | ||
|
||
friend class Fan; | ||
}; | ||
|
||
|
||
class Fan { | ||
public: | ||
Fan(FanRatedInfo & fanRatedInfo, PlaneData & planeData, BaseGasDensity & baseGasDensity, | ||
FanShaftPower & fanShaftPower); | ||
|
||
std::unordered_map<std::string, double> calculate(); | ||
|
||
private: | ||
|
||
double calculateCompressibilityFactor(double x, double z, double isentropicExponent); | ||
|
||
FanRatedInfo const fanRatedInfo; | ||
PlaneData planeData; | ||
BaseGasDensity const baseGasDensity; | ||
FanShaftPower const fanShaftPower; | ||
}; | ||
|
||
#endif //AMO_TOOLS_SUITE_FAN_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
#ifndef AMO_TOOLS_SUITE_FANCURVE_H | ||
#define AMO_TOOLS_SUITE_FANCURVE_H | ||
|
||
#include <vector> | ||
|
||
//class CurveConditions { | ||
//public: | ||
// CurveConditions(double density, double rpm, double barometricPressure, double isentropicExponent); | ||
// | ||
//private: | ||
// double density, rpm, barometricPressure, isentropicExponent; | ||
//}; | ||
|
||
enum class FanCurveType { | ||
FanStaticPressure, | ||
FanTotalPressure, | ||
StaticPressureRise | ||
}; | ||
|
||
class ResultData { | ||
public: | ||
ResultData(const double flow, const double pressure, const double power, const double efficiency) | ||
: flow(flow), | ||
pressure(pressure), | ||
power(power), | ||
efficiency(efficiency) | ||
{}; | ||
|
||
const double flow, pressure, power, efficiency; | ||
}; | ||
|
||
class FanCurveData { | ||
public: | ||
enum class CalculationType { | ||
BaseCurve, | ||
RatedPoint, | ||
BaseOperatingPoint | ||
}; | ||
|
||
class BaseCurve { | ||
public: | ||
// pressure here is pressureBox, determined by Curve Type | ||
BaseCurve(const double flow, const double pressure, const double power) | ||
: flow(flow), | ||
pressure(pressure), | ||
power(power) | ||
{}; | ||
|
||
const double flow, pressure, power; | ||
friend class FanCurveData; | ||
}; | ||
|
||
class RatedPoint : public BaseCurve { | ||
public: | ||
// pressure here is pressureBox, determined by Curve Type | ||
RatedPoint(const double flow, const double pressure, const double power, const double density, | ||
const double speed, const double speedCorrected) | ||
: BaseCurve(flow, pressure, power), | ||
density(density), | ||
speed(speed), | ||
speedCorrected(speedCorrected) | ||
{}; | ||
|
||
const double density, speed, speedCorrected; | ||
friend class FanCurveData; | ||
}; | ||
|
||
class BaseOperatingPoint : public RatedPoint { | ||
public: | ||
// pressure here is pressureBox, determined by Curve Type | ||
BaseOperatingPoint(const double flow, const double pressure, const double power, const double density, | ||
const double speed, const double speedCorrected, const double pressureBarometric, | ||
const bool usePt1Factor, const double pt1 = 0) | ||
: RatedPoint(flow, pressure, power, density, speed, speedCorrected), | ||
pressureBarometric(pressureBarometric), usePt1Factor(usePt1Factor), pt1(pt1) | ||
{}; | ||
|
||
const double pressureBarometric; | ||
bool usePt1Factor; | ||
const double pt1; | ||
friend class FanCurveData; | ||
}; | ||
|
||
FanCurveData(FanCurveType const curveType, std::vector<BaseCurve> baseCurveData) | ||
: curveType(curveType), | ||
baseCurveData(std::move(baseCurveData)), | ||
calcType(CalculationType::BaseCurve) | ||
{} | ||
|
||
FanCurveData(FanCurveType const curveType, std::vector<RatedPoint> ratedPointData) | ||
: curveType(curveType), | ||
ratedPointData(std::move(ratedPointData)), | ||
calcType(CalculationType::RatedPoint) | ||
{} | ||
|
||
FanCurveData(FanCurveType const curveType, std::vector<BaseOperatingPoint> baseOperatingPointData) | ||
: curveType(curveType), | ||
baseOperatingPointData(std::move(baseOperatingPointData)), | ||
calcType(CalculationType::BaseOperatingPoint) | ||
{} | ||
|
||
private: | ||
FanCurveType curveType; | ||
std::vector<BaseCurve> baseCurveData; | ||
std::vector<RatedPoint> ratedPointData; | ||
std::vector<BaseOperatingPoint> baseOperatingPointData; | ||
|
||
CalculationType calcType; | ||
|
||
friend class FanCurve; | ||
}; | ||
|
||
class FanCurve { | ||
public: | ||
FanCurve(const double density, const double densityCorrected, const double speed, const double speedCorrected, | ||
const double pressureBarometric, const double pressureBarometricCorrected, const double pt1Factor, | ||
const double gamma, const double gammaCorrected, const double area1, const double area2, FanCurveData data) | ||
: density(density), | ||
densityCorrected(densityCorrected), | ||
speed(speed), | ||
speedCorrected(speedCorrected), | ||
pressureBarometric(pressureBarometric), | ||
pressureBarometricCorrected(pressureBarometricCorrected), | ||
pt1Factor(pt1Factor), | ||
gamma(gamma), | ||
gammaCorrected(gammaCorrected), | ||
area1(area1), | ||
area2(area2), | ||
curveData(std::move(data)) | ||
{}; | ||
|
||
std::vector<ResultData> calculate(); | ||
|
||
private: | ||
std::vector<ResultData> calculateBaseCurve(); | ||
std::vector<ResultData> calculateBaseOperatingPoint(); | ||
std::vector<ResultData> calculateRatedPoint(); | ||
|
||
double density, densityCorrected, speed, speedCorrected, pressureBarometric, pressureBarometricCorrected; | ||
double pt1Factor, gamma, gammaCorrected, area1, area2; | ||
|
||
FanCurveData curveData; | ||
}; | ||
|
||
//class FanCurve { | ||
//public: | ||
// enum class FanCurveType { | ||
// FanStaticPressure, | ||
// FanTotalPressure, | ||
// StaticPressureRise | ||
// }; | ||
// FanCurve(double flow, double pressure, double horsepower, double density, double rpm, FanCurveType curveType); | ||
// | ||
//private: | ||
// CurveConditions base, optimized; | ||
// double flow, pressure, horsepower, density, rpm, isentropicExponent; | ||
//}; | ||
|
||
#endif //AMO_TOOLS_SUITE_FANCURVE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#ifndef AMO_TOOLS_SUITE_FANSHAFTPOWER_H | ||
#define AMO_TOOLS_SUITE_FANSHAFTPOWER_H | ||
|
||
class FanRatedInfo { | ||
public: | ||
enum class DriveType { | ||
DIRECT, | ||
BELT | ||
}; | ||
|
||
// this currently does not take the field SystemDamperPosition, as it is used "only for reference purposes" as per | ||
// page 8 in the algorithm document | ||
FanRatedInfo(double fanDamperPosition, double fanSpeed, double motorSpeed, double nc, | ||
double pc, double pbc, DriveType driveType); | ||
|
||
private: | ||
double const fanDamperPosition, fanSpeed, motorSpeed, nc, pc, pbc; | ||
DriveType const driveType; | ||
friend class Fan; | ||
}; | ||
|
||
class FanShaftPower { | ||
public: | ||
// method 1 | ||
FanShaftPower(bool fanEquippedWithVFD, bool mainsVoltageDataAvailable, double ratedHp, | ||
double synchronousSpeed, double npv, double fla, double hi, | ||
double efficiencyMotor, double efficiencyVFD, double efficiencyBelt, | ||
FanRatedInfo::DriveType driveType, double sumSEF); | ||
|
||
// method 2 | ||
FanShaftPower(bool fanEquippedWithVFD, bool mainsVoltageDataAvailable, double ratedHp, | ||
double synchronousSpeed, double npv, double fla, double voltage, | ||
double amps, double powerFactorAtLoad, double efficiencyMotor, | ||
double efficiencyVFD, double efficiencyBelt, FanRatedInfo::DriveType driveType, double sumSEF); | ||
|
||
double getFanShaftPower() const { return hFi; } | ||
|
||
double getSEF() const { return sumSEF; } | ||
|
||
private: | ||
const bool fanEquippedWithVFD, mainsVoltageDataAvailable; | ||
const double ratedHp, synchronousSpeed, npv, fla; | ||
const double voltage = 0, amps = 0, powerFactorAtLoad = 0; | ||
const double hi = 0; | ||
const double efficiencyMotor, efficiencyVFD, efficiencyBelt, powerFactor = 0; | ||
const FanRatedInfo::DriveType driveType; | ||
const double sumSEF; | ||
|
||
double hMo, hFi; | ||
}; | ||
|
||
|
||
#endif //AMO_TOOLS_SUITE_FANSHAFTPOWER_H |
Oops, something went wrong.