Skip to content

VPM -B Gradient Factors #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
a4c0a5a
Update readme.md
archis-polyverse Jan 29, 2016
0e2928b
Committing the scuba-dive library, browserified
Jan 29, 2016
74683a3
It works\! Now to hosting it\!
Jan 29, 2016
3563d44
Allegedly this deploys to heroku automatically.
Jan 29, 2016
f341741
Added Google Analytics
Jan 29, 2016
63bd358
Adding API documentation
Jan 29, 2016
18c01ef
Added a javascript editor and evaluator
Jan 30, 2016
fd87ad3
Beginnings on a GUI
Jan 30, 2016
9d943cc
Added a rich UI to generate javascript from
Jan 31, 2016
dd7348c
Added console back in
Jan 31, 2016
0c39082
Fixed a message on a modal dialog
Jan 31, 2016
b59328b
Beautified tables and added ability to remove entries
Jan 31, 2016
ab5497b
Update readme.md
archis-polyverse Feb 4, 2016
39aa4af
Merged scuba-dive library with VPM support.
Feb 5, 2016
19e389a
Added UI for Buhlmann vs VPM selection
Feb 5, 2016
49b357f
Fixed a problem upstream to sort deco gasses.
Feb 5, 2016
33f2c71
Improved messaging a bit
Feb 5, 2016
cd2e9ec
Fixes: https://github.com/archisgore/online-deco-console/issues/1
Feb 6, 2016
3965082
Moved UI around a bit
Feb 6, 2016
f18861e
Update readme.md
archis-polyverse Feb 9, 2016
fe01ea3
Update readme.md
archis-polyverse Feb 9, 2016
12ae290
Update readme.md
archis-polyverse Feb 9, 2016
07ef48e
Table of contents
Feb 9, 2016
2b2ed60
Update readme.md
archis-polyverse Feb 9, 2016
3b5b626
Added the entire readme into the page.
Feb 9, 2016
09d1f7f
Updated metadata a bit
Feb 9, 2016
110c939
Improved help docs
Feb 10, 2016
aecffc8
Added more keywords
Feb 11, 2016
a22dc84
Picked up a bug-fixed version of the dive library
Feb 13, 2016
c50f93f
Fixed a NDL bug
Feb 15, 2016
899d5da
Pick up some NDL changes
Feb 15, 2016
e32b6b6
Gas rate can now be negative, rewarding you for ascents.
Feb 15, 2016
e650bdc
Updated NDL examples
Feb 15, 2016
fce8846
Readme fix
Feb 15, 2016
94fd590
Updated help and examples
Feb 15, 2016
bce6fc6
Prep to use github pages
archis-polyverse Jun 18, 2020
df14309
Create CNAME
archis-polyverse Jun 18, 2020
0cee017
Make index.html load instead of readme
archis-polyverse Jun 18, 2020
666fa0c
Pull in all dependencies and make everything HTTPS
archis-polyverse Jun 18, 2020
834ac1f
Use CDN-based AUI/Bootstrap
archis-polyverse Jun 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deco-planner.archisgore.com
1,208 changes: 950 additions & 258 deletions index.html

Large diffs are not rendered by default.

124 changes: 101 additions & 23 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,114 @@
# JavaScript Sandbox Console
Online Web-based Dive Planning
========================================================================
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**
- [Online Web-based Dive Planning](#online-web-based-dive-planning)
- [Can I run it NOW?](#can-i-run-it-now)
- [What is this tool?](#what-is-this-tool)
- [Examples!](#examples)
- [Buhlmann decompression profile](#buhlmann-decompression-profile)
- [VPM-B decompression profile](#vpm-b-decompression-profile)
- [Calculate the NDLs for different depths, on different gasses (No-deco limit)](#calculate-the-ndls-for-different-depths-on-different-gasses-no-deco-limit)
- [Calculate NDL remaining (remaining No-Deco time)](#calculate-ndl-remaining-remaining-no-deco-time)
- [How it all works - the technical mumbo jumbo.](#how-it-all-works---the-technical-mumbo-jumbo)

![js sandbox console screenshot](https://raw.githubusercontent.com/openexchangerates/javascript-sandbox-console/master/demo-resources/img/js-sandbox-console.png)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->

a javascript playground to enhance demos and homepages for javascript libraries, plugins and scripts, giving visitors an easy and chilled-out way to test-drive functionality.
## Can I run it NOW?
You should find this hosted on: http://deco-planner.archisgore.com/

see the **[project homepage](http://openexchangerates.github.io/javascript-sandbox-console/)** for a live demo, features, installation guide and more info.
## What is this tool?
This is a tool meant for executing the **Buhlmann-GF** (*with Gradient Factors*) and ZHL tissues (A, B and C) and the **Variable Permeability Model** *B* (*VPM-B*) (*by Erik Baker*) algorithms in your browser. I have compared the numbers to GUE's Deco Planner and they are more or less identical (a couple of minutes difference here and there.)

maintained by [Open Exchange Rates](https://openexchangerates.org) (see it in action on the **[money.js](http://openexchangerates.github.com/money.js)** homepage).
The A, B, and C tissues in Buhlmann are used for different scenarios, I think - I could be wrong. I believe you use A tissues for computing NDLs. You use B tissues for Open Circuit (OC), and C tissues for CCRs (Closed Circuit Rebreathers.)

The VPM-B model is code picked up from Erik Baker's repository. I have not extensively tested it for comparison/accuracy. I will spend a lot of time with Deco Planner's VPM comparison as well as V Planner, to see how it compares/fares. The VPM implementation behind-the-scenes has support for just about every configuration imaginable. This tool hides it for brevity and for the "get it out to market" aspect. However, if you dig in, you can build complex and rich plans for CCRs with set-point ppO2s and different sizes for bubble nuclei, and just a whole host of things.

## Changelog
This tool requires no installation, and if you cloned the repo and opened the HTML file, it would open fine. Or you can find it hosted http://deco-planner.archisgore.com/.

**0.2**
* Now maintained by Open Exchange Rates
* Improved documentation
The real power of this tool is:
* **Share, edit and modify dive plans**: because they are stored as programmatic statements. I can easily copy my program, and share it to my buddy, who can then edit or modify it, and send it back to me. This allows a collaborative back-and-forth dive plan to be generated.
* **Rapidly generate hundreds of dive plans**: with different profiles, or some small modification to study and compare. For instance you can quickly compare thousands of VPM vs Buhlmann dives by increasing bottom time by a minute at each step, and see when and HOW they begin to diverge.
* **Interactively study tissue loading**: You can add bottom time by one minute and then get tissue loads. Graph it, charge it, whatever. This allows you to understand how tissues load over time, and generate animations.
* **Figure out "corrections"**: for exceeding planned time or depth. I use this tool to generate my core plan, and then generate deco times for each 10 feet below planned depth, and each 5 minutes past planned time. It gives me a general "sense" of what and how the game changes. It tells me what my bottom line is (no pun intended.) So if I knew adding five minutes is going to increase deco time exponentially, I know where to add my focus.
* **Recreational multi-level plans possible**: At any point in the buhlmanPlann, you can call getCeiling() to get what your ascent ceiling is (how high you can go - optionally with a conservativism factor passed into it), or you can ask how long you can stay at a depth while maintaining a ceiling of zero feet (also called a No-Deco Limit, often abbreviated to NDL). There are some examples below that explain how to do that.
* **Free and online**: You don't pay money for using it, but moreover, you don't have to install something. You can use it RIGHT NOW in your browser.
* **Open-source**: so you can study and understand WHAT is happening, and WHY it is making the decisions that it is. You are not beholden to a "trust-me" dive, which is arguably the worst type of dive, no matter where you stand on the philosophy and religion of diving.

**0.1.5**
* Added `setValue` method, to programmatically set the value inside the sandbox
## Examples!

**0.1.4**
* Added an `iframe` setting on the Sandbox Model that creates a hidden `iframe` and evaluates all commands inside its 'sandboxed' scope - effectively blocking access to global variables.
* Added a script loader method `sandbox.model.load` to inject a script into the page (or the `iframe`).
* Added `:load` special command, available from the sandbox command line, to bootstrap any script into the global context (most useful in `iframe` mode. E.g.: `:load http://code.jquery.com/jquery-1.6.4.js`
### Buhlmann decompression profile
<pre>
var buhlmannDeco = dive.deco.buhlmann();
var newPlan = new buhlmannDeco.plan(buhlmannDeco.ZH16ATissues); // 1 abs pressure in fresh water
newPlan.addBottomGas("2135", 0.21, 0.35);
newPlan.addDecoGas("50%", 0.5, 0.0);
newPlan.addDepthChange(0, 50, "2135", 5);
newPlan.addFlat(50, "2135", 25);
var decoPlan = plan.calculateDecompression(false, 0.2, 0.8, 1.6, 30); //gradientFactorLow = 0.2, gradientFactorHigh=0.8, deco ppO2 = 1.6, and max END allowed: 30 meters.
</pre>

**0.1.3**
* Added very basic stringification for objects. If `JSON.stringify(obj)` works, it prints the result, otherwise it's `obj.toString()`
### VPM-B decompression profile

**0.1.2**
* Mirrored gh-pages and master branches
<pre>
var vpmDeco = dive.deco.vpm();
var newPlan = new vpm.plan(); // 1 abs pressure in fresh water
newPlan.addBottomGas("2135", 0.21, 0.35);
newPlan.addDecoGas("50%", 0.5, 0.0);
newPlan.addDepthChange(0, 50, "2135", 5);
newPlan.addFlat(50, "2135", 25);
var decoPlan = plan.calculateDecompression(false, 0.2, 0.8, 1.6, 30); //gradientFactorLow = 0.2, gradientFactorHigh=0.8, deco ppO2 = 1.6, and max END allowed: 30 meters.
</pre>

**0.1.1**
* Added view.toEscaped() method to escape HTML strings for safe output templating

**0.1**
* First release
### Calculate the NDLs for different depths, on different gasses (No-deco limit)
<pre>
var buhlmann = dive.deco.buhlmann();
var newPlan = new buhlmann.plan(buhlmann.ZH16BTissues);
newPlan.addBottomGas("air", 0.21, 0.0);
newPlan.ndl(dive.feetToMeters(100), "air");
</pre>

### Calculate NDL remaining (remaining No-Deco time)
<pre>
var buhlmann = dive.deco.buhlmann();
var newPlan = new buhlmann.plan(buhlmann.ZH16BTissues);
newPlan.addBottomGas("air", 0.21, 0.0);
newPlan.addDepthChange(0, 30, "air", 3); //went to 100 feet from surface in 3 minutes
newPlan.addFlat(30, "air", 10); //Stayed at 100 feet for 10 minutes
newPlan.ndl(30, "air"); //How long do I have left so I can surface without a mandatory deco obligation?
</pre>

### Plan a multi-level recreational dive
<pre>
var buhlmann = dive.deco.buhlmann();
var newPlan = new buhlmann.plan(buhlmann.ZH16BTissues);
newPlan.addBottomGas("air", 0.21, 0.0);
newPlan.addDepthChange(0, 30, "air", 3); //went to 100 feet from surface in 3 minutes
newPlan.addFlat(30, "air", 10); //Stayed at 100 feet for 10 minutes
newPlan.addDepthChange(30, 15, "air", 3); //Went from 100 feet to 50 feet in 3 minutes
newPlan.ndl(15, "air"); //How long do I have left so I can surface without a mandatory deco obligation?
</pre>

You can configure things like gradient factor, ppO2 exposure, and maximum END.

## How it all works - the technical mumbo jumbo.

The purpose of the tool is to have an online dive planning tool that combines all the open source tools out there, to build a responsive, fast, efficient and install-free planning tool. You can share dive plans with others, and more importantly, you can script dive plans, to generate profiles difficult or cumbersome to generate manually.

This repo combines maby public-domain repos. The main reason behind this forked franken-repo is to provide an integration point for stuff that makes no sense in the individual repos on-it's-own (for instance browserifying a script in an npm repo looks ugly, or javascript-converting a python script, looks ugly and makes no sense there.)

First we start with a browserified (using the browserify tool) version of this Node.js module:
https://github.com/nyxtom/dive

This exposes the entire module in the browser (under a global object called dive, declared thus:)
var dive = require("/scuba-dive.js");

Secondly, there's a GUI built using AlloyUI (alloyyu.com), that allows you to construct dive plans graphically.

Third, these dive plans are converted into Javascript code, which is displayed in a syntax-highlighting editor, again provided by alloyUI (alloyui.com)

Finally there's a REPL-console to run individual commands, taken from: https://github.com/openexchangerates/javascript-sandbox-console

All the scripts are executed in your browser's main window object. So if you opened your developer tools and your own javascript console, you should be able to walk the entire object graph and use that if you'd like!
Binary file added src/api/fonts/OpenSans-Bold-webfont.eot
Binary file not shown.
Loading