Compare commits

...

2 Commits

Author SHA1 Message Date
benny 0977e9bd87 modify equations 2022-01-12 17:44:17 +08:00
benny 6203584a48 change DC_bias domain to 35001 2022-01-03 18:16:27 +08:00
2 changed files with 28 additions and 17 deletions
+27 -16
View File
@@ -1378,41 +1378,46 @@ class EISZeroOneDataDecoder(RecDataDecoder):
index = 20
for i in range(index, index+16, 8):
phase_para_a.append(struct.unpack('>I', cali_coeff[i+1:i+5])[0])
phase_para_a.append(struct.unpack('>i', cali_coeff[i+1:i+5])[0])
phase_para_b.append(struct.unpack('>i', cali_coeff[i+5:i+9])[0])
index = 40
for i in range(index, index+16, 8):
phase_para_a.append(struct.unpack('>I', cali_coeff[i+1:i+5])[0])
phase_para_a.append(struct.unpack('>i', cali_coeff[i+1:i+5])[0])
phase_para_b.append(struct.unpack('>i', cali_coeff[i+5:i+9])[0])
#Lv[0] 160k
index = 60
hsrtia_a.append(struct.unpack('>I', cali_coeff[index+1:index+5])[0]/1e8)
hsrtia_a.append(struct.unpack('>i', cali_coeff[index+1:index+5])[0]/1e8)
hsrtia_b.append(struct.unpack('>i', cali_coeff[index+5:index+9])[0]/1e8)
hsrtia_c.append(struct.unpack('>i', cali_coeff[index+9:index+13])[0]/1e4)
hsrtia_d.append(struct.unpack('>B', cali_coeff[index+13:index+14])[0])
#Lv[1] 20k
index = 80
hsrtia_a.append(struct.unpack('>I', cali_coeff[index+1:index+5])[0]/1e8)
hsrtia_a.append(struct.unpack('>i', cali_coeff[index+1:index+5])[0]/1e8)
hsrtia_b.append(struct.unpack('>i', cali_coeff[index+5:index+9])[0]/1e8)
hsrtia_c.append(struct.unpack('>I', cali_coeff[index+9:index+13])[0]/1e4)
hsrtia_c.append(struct.unpack('>i', cali_coeff[index+9:index+13])[0]/1e4)
hsrtia_d.append(struct.unpack('>B', cali_coeff[index+13:index+14])[0])
#Lv[2] 5k
index = 100
hsrtia_a.append(struct.unpack('>I', cali_coeff[index+1:index+5])[0]/1e8)
hsrtia_a.append(struct.unpack('>i', cali_coeff[index+1:index+5])[0]/1e8)
hsrtia_b.append(struct.unpack('>i', cali_coeff[index+5:index+9])[0]/1e8)
hsrtia_c.append(struct.unpack('>I', cali_coeff[index+9:index+13])[0]/1e4)
hsrtia_c.append(struct.unpack('>i', cali_coeff[index+9:index+13])[0]/1e4)
hsrtia_d.append(struct.unpack('>B', cali_coeff[index+13:index+14])[0])
#Lv[3] 200R
index = 120
hsrtia_a.append(struct.unpack('>I', cali_coeff[index+1:index+5])[0])
hsrtia_b.append(struct.unpack('>I', cali_coeff[index+5:index+9])[0]/1e6)
hsrtia_c.append(struct.unpack('>I', cali_coeff[index+9:index+13])[0]/1e5)
hsrtia_d.append(struct.unpack('>I', cali_coeff[index+13:index+17])[0]/1e6)
hsrtia_a.append(struct.unpack('>i', cali_coeff[index+1:index+5])[0]/1e8)
hsrtia_b.append(struct.unpack('>i', cali_coeff[index+5:index+9])[0]/1e8)
hsrtia_c.append(struct.unpack('>i', cali_coeff[index+9:index+13])[0]/1e4)
hsrtia_d.append(struct.unpack('>B', cali_coeff[index+13:index+14])[0])
# hsrtia_a.append(struct.unpack('>I', cali_coeff[index+1:index+5])[0])
# hsrtia_b.append(struct.unpack('>I', cali_coeff[index+5:index+9])[0]/1e6)
# hsrtia_c.append(struct.unpack('>I', cali_coeff[index+9:index+13])[0]/1e5)
# hsrtia_d.append(struct.unpack('>I', cali_coeff[index+13:index+17])[0]/1e6)
# print('cutoff_freq', cutoff_freq)
# print('hsrtia_a', hsrtia_a)
@@ -1492,13 +1497,19 @@ class EISZeroOneDataDecoder(RecDataDecoder):
voltage_mag = math.sqrt(img ** 2 + real ** 2) * (1 + freq ** 2 / cutoff_freq ** 2)
if (gain == 3):
current = hsrtia_a[gain] * math.exp(hsrtia_b[gain] * voltage_mag) + hsrtia_c[gain] * math.exp(hsrtia_d[gain] * voltage_mag)
else:
current = voltage_mag ** 2 * hsrtia_a[gain] + voltage_mag * hsrtia_b[gain] + hsrtia_c[gain]
# if (gain == 3):
# current = hsrtia_a[gain] * math.exp(hsrtia_b[gain] * voltage_mag) + hsrtia_c[gain] * math.exp(hsrtia_d[gain] * voltage_mag)
# else:
current = voltage_mag ** 2 * hsrtia_a[gain] + voltage_mag * hsrtia_b[gain] + hsrtia_c[gain]
# print(current)
# print(voltage_mag)
# print(hsrtia_a[gain])
# print(hsrtia_b[gain])
# print(hsrtia_c[gain])
if (current != 0):
impedance = voltage_amp * 1000000 / current
# impedance = voltage_amp * 1000_000 / 1.414213 / current
impedance = voltage_amp * 707106.78 / current
else:
impedance = 0
+1 -1
View File
@@ -102,7 +102,7 @@
"record_meta": true,
"initial": 0,
"domain": [
4096
35001
],
"value": {
"expression": "VALUE"