scalc is a Web tool for interactive calculations needed for planning technical scuba dives.
You can open the application here at GitHub pages by clicking this line
SCALC is currently work in progress and under active development. The existing and planned calculation tools include:
- MOD calculation: working
- gas blending: working, needs improvement
- dive planner: simple prototype, has many bugs and issues
There is a working sample of the tool running at: https://scalc.ianleiman.com/
This sample may not be as up to date as the github.io instance that syncs directly from this repo: https://eianlei.github.io/scalc/index.html
This is a web application so it needs to be served by a web server to a web browser. You can either install it to a "real" web server (such Apache, nginx) or use some local development solution such as VS Code Live Server extension.
It is possible to make this app run on electron so it can run like a normal desktop application.
Just copy all the files in source folder to a web site server root. Or git clone this repo to the server. The web server will serve index.html, which will call out all the modules. Usually a web browser will cache the entire application as it so small.
Assuming you have a standard linux server and apache is installed and running, and you use certbot for SSL.
ssh yoursever
cd /var/www
sudo mkdir scalc
sudo chown www-data:www-data scalc
sudo git clone https://github.com/eianlei/scalc.git
cd scalc
ls -l
# check that you have all you need
cd /etc/apache2/sites-available
nano scalc.yourdomain.conf
# edit the virtual host file, save and exit
# see example below
sudo a2ensite scalc.yourdomain.conf
sudo systemctl restart apache2
# http://scalc.yourdomain
# now get SSL cert using certbot
sudo certbot --apache
# https://scalc.yourdomainscalc.yourdomain.conf
UseCanonicalName On
<VirtualHost *:80>
ServerAdmin you@yourdomain
ServerName scalc.yourdomain
DocumentRoot /var/www/scalc
<Directory /var/www/scalc/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
If you have Visual Studio Code installed, then it is really easy to run any web app using the Live Server extension.
In Visual Studio Code clone this repository. Install "Live Server" extension. Now you can launch the app from editor to your browser using a local server with live reload.
If you have git and python3 installed, you can clone this application and use python built-in web server. To git clone and start a webserver using Python run the commands below:
cd some_directory
git clone https://github.com/eianlei/scalc.git
cd scalc
python3 -m http.server
That will open a webserver on port 8000. You can then open your browser at http://127.0.0.1:8000/.
After the app has loaded on your browser you can actually kill the web server (Ctrl-C) beacause it is now running on your browser and no longer needs a server.
scalc is made from plain vanilla HTML, CSS, Javascript and does not use any fancy JS frameworks (such as Angular, React, Vue, Svelte etc...). The UI uses plain HTML5 elements and canvas. Calculations are done by pure and simple Javascript functions running on your browser. There is no back-end, nothing is calculated at the server end.
jQuery
The Javascript used in calculations is refactored (manually transpiled) from following Python and C# projects that I have published previously:
The UI is a web (HTML5, CSS, JS) implementation of the respective GUIs done previously in Qt5 or WPF/.NET 4.8/XAML.
The application is intended for certified technical divers and Trimix gas blenders, who blend gases and make plans for technical scuba diving.
It is assumed that anyone daring to use this application knows what they are doing.
Use this application at your own risk, the author provides no guarantees about the correctness of the application, and assumes no liability for the use of it for any purpose!
- In no event should you consider blending breathing gases without proper training!
- In no event should you consider scuba diving with mixed gases without proper training!
- Ignoring these warnings can cause your death or serious and permanent injuries!
- 2021-11-03 published to github a quickly hacked up demo, that needs lot of TLC
- 2021-11-08 added the dive planner prototype
- 2021-11-12 most of essential functionality in place
- 2021-11-21 big cleaning up & refactoring of very messy code in planner
- 2021-11-23 implemented Van Der Waals gas law calculation to blender
- some cleanup, proper structuring and commentting to the sources
- make UI mobile friendly (CSS)
- do a proper favicon
- add user documentation
- to Blender: bring up all the same functionality that exists in FillCalcWin
- new feature: use gas temperatures in calculations
- Planner implementation,
- Bühlmann: have manually transpiled Python code to Javascript from pydplan, but the code still need some fine tuning
- improvements on graphical web UI
- desktop version will run on electron and include Windows installer
- Android and iOS mobile versions using Cordova
Copyright (C) 2021 Ian Leiman
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, version 3 of the License.
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.
