Altitude diving depth and NITROX calculations

For several reasons I’ve found myself diving (with SCUBA) in inland lakes on altitude. Due to the lower atmospheric pressure, altitude diving requires different depth calculations. There are diving tables and computer software that help divers to plan a safe dive. Although, I’ve though of making my “quick and dirty” script for calculating the theoretical ocean depth of an altitude dive, the depth of the safety stop at altitude as well as the best NITROX mix at the given altitude for PO2 of 1.2, 1.4 and 1.6.

The scripts accepts only two parameters: the altitude and the depth. For instance, for a dive at 1350m altitude and 30m depth:

 ./calcDepth.sh 1350 30
=======================================================
Every individual diver is responsible for planning 
and conducting dives using SCUBA equipment up to the 
trained and certified qualification he or she holds.

The creator of this program does not have any 
responsibility for symptoms of Decompressions Sickness 
when the suggested values of this program are used 
for conducting a dive.
========================================================


Altitude: 	1350 m
Depth: 		30 mfw
Pressure: 	.86 atm
TOD: 		33.65900 msw
Safety Stop: 	4.45 mfw

Best NITROX mix with 1.2 PO2: 27.00
Best NITROX mix with 1.4 PO2: 32.00
Best NITROX mix with 1.6 PO2: 36.00

###########################################################################
# Copyright (C) 2011  Panagiotis Kritikakos <panoskrt@gmail.com>           #
#                                                                          #
#    This program is free software: you can redistribute it and/or modify  #
#    it under the terms of the GNU General Public License as published by  #
#    the Free Software Foundation, either version 3 of the License, or     #
#    (at your option) any later version.                                   #
#                                                                          #
#    This program is distributed in the hope that it will be useful,       #
#    but WITHOUT ANY WARRANTY; without even the implied warranty of        #
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         #
#    GNU General Public License for more details.                          #
#                                                                          #
#    You should have received a copy of the GNU General Public License     #
#    along with this program.  If not, see <http://www.gnu.org/licenses/>. #
############################################################################
#!/bin/bash
MSW=10.0584
MFW=10.3632
SSDSW=5
ALT=$1
Da=$2

disclaimer()
{
echo "
=======================================================
Every individual diver is responsible for planning
and conducting dives using SCUBA equipment up to the
trained and certified qualification he or she holds.

The creator of this program does not have any
responsibility for symptoms of Decompressions Sickness
when the suggested values of this program are used
for conducting a dive.
========================================================
"
}

if [ -z $ALT ] || [ -z $Da ]; then
  echo " Specify altitude and depth: ./calcDepth.sh 1350 24"
  exit 1
else
  clear
  Pa=`echo "100-(0.01*$ALT)" | bc`

  TOD=`echo "scale=5; ($Da*(1/$Pa)*($MSW/$MFW))*100" | bc`
  SSDA=`echo "scale=2; ($SSDSW*($Pa/1)*($MFW/$MSW))/100" | bc`

  PAatm=`echo "scale=2; $Pa/100" | bc`

  N1=`echo "scale=2; 100*(1.2/(($TOD/10)+1))" | bc`
  N2=`echo "scale=2; 100*(1.4/(($TOD/10)+1))" | bc`
  N3=`echo "scale=2; 100*(1.6/(($TOD/10)+1))" | bc`

  echo
  disclaimer
  echo

  printf "Altitude: \t$ALT m\n"
  printf "Depth: \t\t$Da mfw\n"
  printf "Pressure: \t$PAatm atm\n"
  printf "TOD: \t\t$TOD msw\n"
  printf "Safety Stop: \t$SSDA mfw\n\n"
  printf "Best NITROX mix with 1.2 PO2: $N1\n"
  printf "Best NITROX mix with 1.4 PO2: $N2\n"
  printf "Best NITROX mix with 1.6 PO2: $N3\n\n"
  exit 0
fi

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s