Skip to content
Snippets Groups Projects
Verified Commit ec06e567 authored by Tobias Triffterer's avatar Tobias Triffterer :house_with_garden:
Browse files

Add Conversion from hPa to Torr

The software uses Pascal internally as this is the SI unit, but the old
guide to the real experiment uses Torr, so we add a conversion function
to display both in the GUI.
parent 6ae1df6a
No related branches found
No related tags found
No related merge requests found
Pipeline #2916 passed with stage
in 19 seconds
......@@ -31,3 +31,8 @@ using namespace Fp311Online;
ExperimentState::ExperimentState(const uint64_t experimentId)
: id(experimentId)
{}
ExperimentState::PressureTorr ExperimentState::convertHectoPascalToTorr(const PressureHectoPascal& pressure)
{
return pressure*76000.0/101325.0;
}
......@@ -53,6 +53,7 @@ public:
static const constexpr uint16_t NumberOfAdcChannels = 4096;
using PressureHectoPascal = UInt32BoundedDouble<0, 1500>;
using PressureTorr = UInt32BoundedDouble<0, 1130>; // 1500 hPa ≈ 1125 Torr, so 1130 Torr as upper limit should make sure that the conversion from hPa to Torr never fails
using TargetPositionMilliMeter = UInt32BoundedDouble<14, 200>;
using AdcConversion = GenericBoundedNumeral<uint16_t, uint16_t, 0, NumberOfAdcChannels - 1>;
......@@ -63,6 +64,8 @@ public:
TargetPositionMilliMeter targetPosition = TargetPositionMilliMeter::minimum;
AdcConversion adcThreshold = AdcConversion::minimum;
static PressureTorr convertHectoPascalToTorr(const PressureHectoPascal& pressure);
ExperimentState() = default;
ExperimentState(const uint64_t experimentId);
~ExperimentState() = default;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment