1 #ifndef __RPK_PRESSURE_GAUGE_H__
2 #define __RPK_PRESSURE_GAUGE_H__
4 #include <boost/array.hpp>
5 #include <boost/circular_buffer.hpp>
10 const size_t PGAUGE_ORDER = 2;
12 typedef std::pair<double, double> TimeSeries;
23 #ifdef WINDOWED_PGAUGE
24 typedef std::deque<TimeSeries> BufferType;
26 typedef boost::circular_buffer<TimeSeries> BufferType;
39 void AddSample(
const double time,
const double pressure);
69 const double drdt)
const;
77 const double dpdt)
const;
87 void Serialize(FILE* file,
bool save =
true);
89 template <
typename Writer>
96 bool CanSample()
const;
98 void SetPressureStats(
const double t,
const double p,
const double dpdt);
105 boost::array<double, PGAUGE_ORDER> Coefficients;
113 double CurrentPressure;
120 template <
typename Writer>
123 writer.StartObject();
125 writer.String(
"LastPressure") , writer.Double(LastPressure);
126 writer.String(
"LastDpdt") , writer.Double(LastDpdt);
127 writer.String(
"LastTime") , writer.Double(LastTime);
128 writer.String(
"CurrentPressure") , writer.Double(CurrentPressure);
129 writer.String(
"CurrentDpdt") , writer.Double(CurrentDpdt);
130 writer.String(
"CurrentTime") , writer.Double(CurrentTime);
134 writer.String(
"Buffer");
136 std::for_each(Buffer.begin(), Buffer.end(), [&writer](
const TimeSeries& ts)
138 writer.BeginObject();
139 writer.String(
"first"), writer.Double(ts.first);
140 writer.String(
"second"), writer.Double(ts.second);
PressureGauge.h - pressure gauge class declaration Written by Alexander Bass, modified by Max I...
Definition: PressureGauge.h:19
void AddSample(const double time, const double pressure)
Add a sample to the pressure gauge.
Definition: PressureGauge.cpp:66
double PressureTime() const
Computes the time of the pressure sample that will be produced by a call to the SampleGauge function...
Definition: PressureGauge.cpp:125
double SampleGauge(const double radius)
Get the pressure at the given time.
Definition: PressureGauge.cpp:132
PressureGauge()
Default Constructor.
Definition: PressureGauge.cpp:56
void Serialize(FILE *file, bool save=true)
Serialize the pressure gauge to disk.
double ComputeDpdt(const double currentTime, const double radius, const double dpdt) const
Computes the rate of change of the pressure using the coefficients of the polynomial calculated from ...
Definition: PressureGauge.cpp:204
double ComputePressure(const double currentTime, const double radius, const double drdt) const
Compute the pressure at the given time.
Definition: PressureGauge.cpp:191