Need some help with this question. I did not find anything in the search, but that can be because I am not entirely sure on what to ask or define the problem.
I will try to do this here.
So I wanted to make a SAC Calculator for scuba diving. That is in lamens terms a calculator to calculate air consumption basically.
The formula for metric is VT x VC / T / P = SAC More info here https://www.divein.com/guide/know-your-air-consumption/
I ran into some issues when calculating the air consumption as it seems I need to convert in somehow the input from the user into a value.
- The user answers the question, how deep was your dive in meters(or feet)? Well this is pretty straight forward as the user would answer i.e. 30 meters / 100 feet.
However for the calculator to work correctly, I would need to calculate using the ATM model. As depth increases under water, the atmospheric pressure also increases as seen in this image:
So if the user enters a value of 30 meters, I need to know the ATM value for this answer.
I tried to make an if statement to fix this, but I do not belive this might be the better approach.
Here is the code so far
#SAC Rate Calculator
#This program will calculate your air consumption rate for scuba diving
#Made by Tom Knudsen - post@tknudsen.com
#License is open source
import os
import time
os.system('clear')
print('***********************************')
print('***********************************')
print('**********SAC Calculator***********')
print('****************by*****************')
print('************Tom Knudsen************')
print('***********************************')
print('***********************************')
print('')
print('')
print('Welcome to the SAC calculator')
time.sleep(1)
# This code is to first determain the air consumption in bar)
print('First we need to calculate your air consumption in bar')
tankVolum = input('How large is your tank in litres? :')
startBar = input('Please enter your start pressure in BAR: ') #starting pressure with full cooled tank
endBar = input('Please enter your end pressure in BAR: ') #ending pressure with cooled tank
totalBar = startBar - endBar
time.sleep(2)
print('Thank you, your total pressure used is: ') #feedback to the user
print(totalBar)
time.sleep(3)
os.system('clear')
# Input to calculate air consumption in litres
print("Let's now see how much Surface Air Concumption in litre you used!")
time.sleep(2)
print('First we need to know a little bit about your dive :')
time.sleep(2)
depth = input('How deep was your dive in meter? :')
time.sleep(2)
diveTime = input('How long was your dive in minutes? :')
time.sleep(2)
print('Let me calculate, please wait...')
#this is my test, I do not know how to get "depthTotal" as this calue equals ATM pressure and P in the equation formula above.
if depth <= 10:
a = 2
elif depth >10 and <= 20:
b = 3
elif depath >20 and <= 30:
c = 4
else:
print('You need to enter a depth between 0 and 40 meter')
sacResults = tankVolum x totalBar / diveTime / depthTotal
# Example = 12 Liter x 150 bar used / 46 minutes dive time / 30 meter depth
# sacResults = 12 * 150 / 46 / 3