that's easy ..... just repeat the computations below for each compartment (16 times) every secondUnless people can do the math in their heads as accurately and quickly as a dive computer.......

Of course you also need to remember all the values for the set of variables associated to each compartment ... and ... if any one of the 16 ndt is zero then you need also to calculate the deco plan (ceilings, stops depths, stops times, total ascent time) :depressed:
pn2i = Pamb*N2mix;
N2cmpt.pn2i = pn2i;
ppci0 = N2cmpt.ppci;
ppci = N2cmpt.ppci + ((pn2i - N2cmpt.ppci)*(1-pow(2 (tconst/N2cmpt.ht))));
N2cmpt.ppci = ppci;
pcm0 = N2cmpt.pcm0;
if (ppci > pcm0) {
cld = 1+ ((ppci - pcm0) / ((Pamb * N2cmpt.dm + N2cmpt.a) - pcm0));
} else {
cld = (ppci - PPN2) / (pcm0 - PPN2);
}
N2cmpt[].cload = cld;
N2cmpt.ndt = -ndct/N2cmpt.k;
good luck
