From 77725ecfe94e47cedabb2cc19afed402df8e1f40 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 19 Jun 2013 14:36:48 -0700 Subject: [PATCH] Replace wet_volume calculation with straight forward pressure formula Since no one else approximates gas volumes at higher pressures, we shouldn't do that either when converting imperial tank names (cuft @ working pressure) into wet volumes. Signed-off-by: Dirk Hohndel --- qt-ui/models.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index 3b2940a6c..1b882f3bf 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -678,22 +678,17 @@ QVariant TankInfoModel::data(const QModelIndex& index, int role) const if (role == Qt::FontRole){ return defaultModelFont(); } - - struct tank_info *info = &tank_info[index.row()]; - - int ml = info->ml; - - int bar = ((info->psi) ? psi_to_bar(info->psi) : info->bar) * 1000 + 0.5; - - if (info->cuft && info->psi) { - pressure_t p; - p.mbar = psi_to_mbar(info->psi); - ml = wet_volume(info->cuft, p); - } if (role == Qt::DisplayRole || role == Qt::EditRole) { + struct tank_info *info = &tank_info[index.row()]; + int ml = info->ml; + double bar = (info->psi) ? psi_to_bar(info->psi) : info->bar; + + if (info->cuft && info->psi) + ml = cuft_to_l(info->cuft) * 1000 / bar_to_atm(bar); + switch(index.column()) { case BAR: - ret = bar; + ret = bar * 1000; break; case ML: ret = ml;