Skip to content

Commit

Permalink
Merge pull request #216 from Denzo77/master
Browse files Browse the repository at this point in the history
notes and a bounds check
  • Loading branch information
Denzo77 authored Jul 4, 2019
2 parents 12dce53 + d9bc95e commit bb6b2d9
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions portableUnitTests/OTRadValve/ThermalPhysicsModels.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,15 @@ inline double heatTransfer(const double conductance, const double temp1, const d

struct ValveTempParameters
{
const double conductanceRad;
// This must be less than 0.05.
// It represents a fraction of the total energy output from the radiator
// that heats the TRV.
const double radToAirFraction;
const double conductanceRoom;
const double capacitanceValve;
};

static constexpr ValveTempParameters valveTempParameters_DEFAULT { 0.05, 10.0, 5000.0 };
static constexpr ValveTempParameters valveTempParameters_DEFAULT {0.05, 10.0, 5000.0 };

/**
* @brief Calculate temp seen by valve this interval.
Expand All @@ -100,14 +103,15 @@ static constexpr ValveTempParameters valveTempParameters_DEFAULT { 0.05, 10.0, 5
*/
inline double calcValveTemp(const double airTemp, const double valveTemp, const double heatFlowFromRad, ValveTempParameters params = valveTempParameters_DEFAULT)
{
// static constexpr double thermalConductanceRad {0.05}; // fixme literal is starting estimate for thermal resistance
// static constexpr double thermalConductanceRoom {10.0};
// static constexpr double thermalCapacitanceValve {5000.0}; // fixme literal is starting estimate for thermal capacitance

const double heatIn = heatFlowFromRad * params.conductanceRad;
// if this is not small, the rad valve will get too hot compared to the rest of the room.
assert(params.radToAirFraction < 0.05);
// FIXME: Switch to using temperatures to calculate heatflows like a normal person
const double heatIn = heatFlowFromRad * params.radToAirFraction;
const double heatOut = heatTransfer(params.conductanceRoom, valveTemp, airTemp);
const double valveHeatFlow = heatIn - heatOut;
const double newValveTemp = valveTemp + (valveHeatFlow / params.capacitanceValve);

// std::cerr << "X" << heatIn << " - " << heatOut << " = " << valveHeatFlow << "\n";

return (newValveTemp);
}
Expand Down

0 comments on commit bb6b2d9

Please sign in to comment.