-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblending-old.html
199 lines (191 loc) · 6.5 KB
/
blending-old.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!-- saved from url=(0038)https://mudgej.github.io/blending.html -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>SSAC Gas Calculator</title><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><style>
form { display: table; }
p { display: table-row; }
label { display: table-cell; }
input { display: table-cell; }
#myDIV {
width: 100%;
#padding: 50px 0;
#text-align: center;
background-color: lightgrey;
margin-top: 20px;
}
</style>
</head>
<body>
<h1>Nitrox Bank / Compressor Blending Calculator</h1>
<br>
<p>Click the "Instructions" button to toggle between hiding and showing the instructions.</p>
<br>
<button onclick="myFunction()">Instructions</button>
<br>
<div id="myDIV" style="display:none">
Most nitrox calculators assume that the fill mix will always be 100% O2, however this is not the case when using the nitrox compressor or nitrox bank. This calculator is therefore designed to take any percentage of O2 as a fill mix; for example, if using the SSAC banked nitrox, ~36%. Top-off mixes usually will be air (20.9%). An example use of this calculator might therefore be wanting a 32% fill using the nitrox bank when your cylinders already have 32% in them and the bank is 36%.
<br>
<br>
Using this method, the maximum FO2 that can be achieved in the final / desired mix is of course the FO2 of the fill mix gas. Entering a desired mix greater than the fill mix will not stop the calculator from outputting answers, however they of course are not realistic answers. A future update will prevent the inputting of illogical numbers.
<br>
<br>
In some cases, a cylinder may need to be slightly drained to achieve the desired mix. If the 'top-off mix to add' field below gives a negative result, the cylinder must be drained to the specifed pressure BEFORE filling begins. If the top-off mix to add field is a positive number, the drain pressure field should be ignored. A future update will only display this field if required.
<br>
<br>
Finally, this calculator also allows you to calculate the cost of your fill. Simply enter the size of your cylinders that you are filling below (double it for twinsets, e.g 2x12 = 24) and press the second 'calculate' button.
</div>
<br>
<a href="/blendingnotes.html">View notes / known issues etc.</a>
<br>
<br>
<form>
<p>
<label for="n1">Start Pressure:</label>
<input id="n1" type="text">
<label for="n1"> bar</label>
</p>
<p>
<label for="n2">End Pressure:</label>
<input id="n2" type="text">
<label for="n1"> bar</label>
</p>
<p>
<label for="n3">Start Mix:</label>
<input id="n3" type="text">
<label for="n1"> %</label>
</p>
<p>
<label for="n4">Desired (End) Mix:</label>
<input id="n4" type="text">
<label for="n1"> %</label>
</p>
<p>
<label for="n5">Fill Mix:</label>
<input id="n5" type="text">
<label for="n1"> %</label>
</p>
<p>
<label for="n6">Top-off Mix:</label>
<input id="n6" type="text">
<label for="n1"> %</label>
</p>
<p>
<br>
<input type="button" value="Calculate" onclick="num1 = parseFloat(document.getElementById('n1').value);
num2 = parseFloat(document.getElementById('n2').value);
num3 = parseFloat(document.getElementById('n3').value);
num4 = parseFloat(document.getElementById('n4').value);
num5 = parseFloat(document.getElementById('n5').value);
num6 = parseFloat(document.getElementById('n6').value);
sum1 = (num2 * (num4 - num6) - num1 * (num3 - num6)) / (num5 - num6);
sum2 = (num2 - num1 - sum1);
sum3 = (num1 + sum2);
out1 = parseFloat( Math.round(sum1) )
out2 = parseFloat( Math.round(sum2) )
out3 = parseFloat( Math.round(sum3) )
document.getElementById('ans').value = out1;
document.getElementById('ans1').value = out1 + num1;
document.getElementById('ans2').value = out2;
if (out2 >= 0) {
document.getElementById('ans3').value = NaN;
} else {
document.getElementById('ans3').value = out3;
}
document.getElementById('ans4').value = out1 + out2 + num1;
if (n5 >= 100) {
document.getElementById('ans3').value = NaN;
} else {
document.getElementById('ans3').value = out3;}">
</p>
<br>
<p>
<label for="ans">Add</label>
<input id="ans" type="answer">
<label for="n1"> bar of Fill Mix</label>
</p>
<p>
<label for="ans1">(Fill from Start Pressure To  </label>
<input id="ans1" type="answer">
<label for="n1"> bar)</label>
</p>
<p>
<label for="ans2">Add</label>
<input id="ans2" type="answer">
<label for="n1"> bar of Top-off mix</label>
<p>
<label for="ans4">(Fill to</label>
<input id="ans4" type="answer">
<label for="n1"> bar)</label>
</p>
</p>
</form>
<br>
<br>
If top-off mix to add is negative, the cylinder must first be drained. If so the cylinder should be drained to the following:
<br>
<br>
<form>
<p>
<label for="ans3">Drain Pressure:</label>
<input id="ans3" type="answer">
<label for="n1"> bar</label>
</p>
</form>
<br>
<h2>Gas Filling Costs</h2>
<p>
<label for="n9">Cylinder Size:</label>
<input id="n9" type="text">
<label for="n1"> L</label>
</p>
<h3>Nitrox Price</h3>
The prefilled value below is the current SSAC nitrox price as of 28/04/2023. It can be ammended if required.
<br>
<br>
<form>
<p>
<label for="n7">Nitrox:</label>
<input id="n7" type="answer" value="0.210">
<label for="n1">p / litre</label>
</p>
<!--
<p>
<label for="n8">Oxygen: </label>
<input id="n8" type="answer" value="1.154">
<label for="n1">p / litre</label>
</p>
-->
<br>
<input type="button" value="Calculate" onclick="price = parseFloat(document.getElementById('n7').value);
size = parseFloat(document.getElementById('n9').value);
final_price=(price/100)*size*out1;
final_price = Math.round((final_price + Number.EPSILON) * 100) / 100;
document.getElementById('ans5').value = final_price;">
</p>
<br>
</form>
<h3>Final Cost for Above Fill</h3>
<form>
<p>
<label for="ans5">£</label>
<input id="ans5" type="answer">
<label for="n1"></label>
</p>
</form>
This tool comes with absolutely NO WARRANTY. Use of this tool is at your own risk.
<br>
<br>
ALWAYS ANALYSE YOUR CYLINDERS AFTER BLENDING
<br>
<br>
Version 0.4 - 20240610
<script>
function myFunction() {
var x = document.getElementById("myDIV");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
</script>
</body>
</html>