Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Rock Bottom Table Generator
#!/usr/bin/perl
# mod-ead-calc
# By: John C. Place
# http://www.unixsage.com
print <<EOT
Assumptions:
<ul>
<li>Stressed diver SAC rate 1cf/min
<li>1 min to sort out problem at depth
<li>30ft/min assent rate from depth to 15fsw
<li>3min Saftey stop at 15fsw
</ul>
Example:
<pre>
If at 132 feet one diver has a problem starts sharing air:
1 Min to sort out the problem
((132/32.8)+1)*1=5cf
3.9 Minutes to assend from 132fsw to 15fsw average depth 73.5fsw
((73.5/32.8)+1)*3.9=12.6cf
3 Min safety stop at 15fsw
((15/32.8)+1)*3=4.3cf
</pre>
So one diver needs 5+12.6+4.3=21.9cf<br>
So for two divers to do a safe assent from 132fsw would need 44cf<br>
on a 3000psi 80cf tank the turn pressure would be 1600psi<br>
2100psi if you add 500psi on top<br>
<hr>
EOT
;
print <<EOT
<table border>
<caption>Turn Pressure Chart</caption>
<tr><th colspan="2"></th><th colspan="12">Pressure (psi)<br>Volume (ft<sup>3</sup>)</th></tr>
<tr><th colspan="2"></th><th colspan="5">2640</th><th>3000</th><th colspan="2">3300</th><th colspan="4">3442</th></tr>
<tr><th>fsw</th><th>ft<sup>3</sup></th><th>80</th><th>95</th><th>104</th><th>108</th><th>120</th><th>77</th><th>80</th><th>100</th><th>80</th><th>100</th><th>120</th><th>130</th></tr>
EOT
;
@tanklist=qw(
2640:80
2640:95
2640:104
2640:108
2640:120
3000:77
3300:80
3300:100
3442:80
3442:100
3442:120
3442:130
);
for($fsw=30; $fsw <= 180; $fsw+=10){
$rock_bottom=sprintf("%0.f",((($fsw/32.8)+1)+((((($fsw+15)/2)/32.8)+1)*(($fsw-15)/30))+(((15/32.8)+1)*3))*2);
# print "<tr><td>$fsw</td><td>".sprintf("%0.f",$rock_bottom)."</td>";
print "<tr><th>$fsw</th><th>$rock_bottom</th>";
foreach(@tanklist) {
($psi,$volume)=split(/:/);
print "<td>".sprintf("%0.f",($psi/$volume)*$rock_bottom)."</td>"
}
print "</tr>\n";
}
print "</table>\n";
print "Created with <a href=\"https://gist.github.com/UnixSage/be7979c47c5005aa6d1beff4e98dcad1\">rock-bottom-calc.pl</a>\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment