import math

BAR_PER_METER = 1/10.
DEFAULT_ASC_RATE = 5
DEFAULT_DECO_INCR = 3
DEFAULT_STOP_RES = 1

P_AMB = 1
P_WATER = 0.0627

R_N2 = 0.79
LOG2 = math.log(2)

ZHL16C_COEFF = [(5.0, 1.1696, 0.5578),
(8.0, 1.0, 0.6514),
(12.5, 0.8618, 0.7222),
(18.5, 0.7562, 0.7825),
(27.0, 0.62, 0.8126),
(38.3, 0.5043, 0.8434),
(54.3, 0.441, 0.8693),
(77.0, 0.4, 0.891),
(109.0, 0.375, 0.9092),
(146.0, 0.35, 0.9222),
(187.0, 0.3295, 0.9319),
(239.0, 0.3065, 0.9403),
(305.0, 0.2835, 0.9477),
(390.0, 0.261, 0.9544),
(498.0, 0.248, 0.9602),
(635.0, 0.2327, 0.9653)]

I_SAMPLING_INTERVAL = 10.0

IP_AMB = 10**8
IP_WATER = int(P_WATER*IP_AMB)

PRESSURE_FACTOR = IP_AMB
INVFACT_MULTIPLIER = 10**5

IF_N2 = int(INVFACT_MULTIPLIER*R_N2)
METER_PER_BAR = 10
I_INIT_LOADING = int(((P_AMB-P_WATER)*R_N2)*PRESSURE_FACTOR)

ZHL16_INT = {5.0: (0x08ec, 0x06f8ab00, 0xd9e3),
8.0: (0x0599, 0x05f5e100, 0xfe74),
12.5: (0x0397, 0x052300a0, 0x11a1c),
18.5: (0x026e, 0x0481dea0, 0x131aa),
27.0: (0x01aa, 0x03b20b80, 0x13d6c),
38.3: (0x012d, 0x03018030, 0x14974),
54.3: (0x00d4, 0x02a0e9a0, 0x15392),
77.0: (0x0095, 0x02625a00, 0x15c0c),
109.0: (0x0069, 0x023c3460, 0x16328),
146.0: (0x004f, 0x02160ec0, 0x1683c),
187.0: (0x003d, 0x01f6c6f0, 0x16c06),
239.0: (0x0030, 0x01d3ae90, 0x16f4e),
305.0: (0x0025, 0x01b0962f, 0x17232),
390.0: (0x001d, 0x018e4120, 0x174d0),
498.0: (0x0017, 0x017a6b00, 0x17714),
635.0: (0x0012, 0x01631270, 0x17912),}