dive
Various standard scuba diving algorithms, formulas, calculations and device management.
Getting Started
Install the module with: npm install scuba-dive
var dive = require('dive');
dive.feetToMeters();
dive.feetToMeters(33);
dive.metersToFeet(10);
dive.gravitySamples.current();
dive.gravitySamples.current(9.8);
dive.gravitySamples.current();
dive.surfacePressureSamples.current();
dive.surfacePressureSamples.current(1);
dive.liquidSamples.fresh.density();
dive.liquidSamples.salt.density();
dive.liquidSamples.mercury.density();
dive.constants.vapourPressure.lungsBreathing.current();
dive.constants.altitudePressure.current();
dive.constants.altitudePressure.current(0.6600);
dive.constants.altitudePressure.current(1);
dive.dac(2500, 1300, 50);
dive.sac(24, 10);
dive.rmv(25, 80, 3000);
dive.depthInMetersToBars(10);
dive.depthInMetersToAtm(10);
dive.atmToDepthInMeters(1);
dive.barToDepthInMeters(1);
dive.depthInMetersToBars(10, true);
dive.depthInMetersToAtm(10, true);
dive.atmToDepthInMeters(1, true);
dive.barToDepthInMeters(1, true);
var p = dive.depthInMetersToBars(10);
dive.partialPressure(p, 0.79);
dive.partialPressure(p, 0.21);
dive.partialPressureAtDepth(10, 0.79);
dive.partialPressureAtDepth(10, 0.21);
dive.partialPressureAtDepth(10, 0.79, true);
dive.partialPressureAtDepth(10, 0.21, true);
var mmHg = dive.waterVapourPressure(35.2);
var pascals = dive.mmHgToPascal(mmHg);
dive.pascalToBar(pascals);
dive.waterVapourPressureInBars(35.2);
dive.maxOperatingDepth(1.4, 0.21);
dive.maxOperatingDepth(1.4, 0.21, true);
dive.equivNarcoticDepth(0.12, 0.38, 0.50, 100);
dive.equivNarcoticDepth(0.12, 0.38, 0.50, 100, true);
dive.depthChangeInBarsPerMinute(0, 10, 0.5);
dive.depthChangeInBarsPerMinute(0, 10, 0.5, true);
dive.gasRateInBarsPerMinute(0, 10, 0.5, 0.79);
dive.gasRateInBarsPerMinute(0, 10, 0.5, 0.79,, true);
dive.gasPressureBreathingInBars(10, 0.79);
dive.gasPressureBreathingInBars(10, 0.79, true);
var pGas = dive.gasPressureBreathingInBars(20, 0.79);
dive.instantaneousEquation(0.79, pGas, 40, 4.0);
var buhlmannDeco = dive.deco.buhlmann();
var newPlan = new buhlmannDeco.plan(buhlmannDeco.ZH16ATissues);
newPlan.addDepthChange(0, 25, 0.79, 0.0, 2);
newPlan.addFlat(25, 0.79, 0.0, 20);
newPlan.addDepthChange(25, 35, 0.79, 0.0, 2);
newPlan.addFlat(35, 0.79, 0.0, 20);
newPlan.addDepthChange(35, 10, 0.79, 0.0, 2);
newPlan.calculateDecompression(0.79, 0.0);
TODO
- Need better test cases and validation for buhlmann implementation (needs review)
Notice of Use
This library was built for pure research and educational purposes only.
Use at your own risk. I am not responsible for any injuries that may
occur as a result of experimenting with this software. Always
use a backup dive computer when experimenting with educational tools like
this and others that may implement various diving algorithms. It would be
nice if other dive companies followed by publishing their implementations
so the research and dive community could improve on it and ultimately
protect more people.
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.
License
Copyright (c) 2013 Thomas Holloway
Licensed under the MIT license.