Compare commits

..

1 Commits

Author SHA1 Message Date
JayC319 ecd4b9325d [update] 2022-08-15 18:09:40 +08:00
14 changed files with 181 additions and 689 deletions
-2
View File
@@ -6,8 +6,6 @@ from datetime import datetime
from biopro.recording import RecordingData, RecordingFileDataFormat from biopro.recording import RecordingData, RecordingFileDataFormat
import numpy as np
# from biopro.util.console import hex_line # from biopro.util.console import hex_line
T = TypeVar('T') T = TypeVar('T')
+23 -64
View File
@@ -20,11 +20,6 @@ from statistics import mean
import random import random
# from numba import jit # from numba import jit
from .lttb import largest_triangle_three_buckets
import math
from scipy import signal
from copy import copy from copy import copy
def json_stringify(o) -> str: def json_stringify(o) -> str:
@@ -1020,7 +1015,7 @@ class RecordingFileWriter:
'_mini_scale_list', '_time_real_time', '_data_rl', '_data_db', '_mini_scale_list', '_time_real_time', '_data_rl', '_data_db',
'_raw_save', '_mini_save', '_data_time_ch', '_data_value_ch_for_rl', '_raw_save', '_mini_save', '_data_time_ch', '_data_value_ch_for_rl',
'_data_time_ch_for_rl', '_device_id', '_send_data', '_data_mqtt_ch', '_id_db_save', '_raw_create_not_done', '_data_time_ch_for_rl', '_device_id', '_send_data', '_data_mqtt_ch', '_id_db_save', '_raw_create_not_done',
'_mini_create_not_done', '_data_all') '_mini_create_not_done')
def __init__(self, meta: RecordingMetaFile, device_id, database = None): def __init__(self, meta: RecordingMetaFile, device_id, database = None):
self._meta = meta self._meta = meta
@@ -1080,8 +1075,6 @@ class RecordingFileWriter:
self._data_time_ch = {} self._data_time_ch = {}
self._id_db_save = {} self._id_db_save = {}
self._data_all = {}
# mini data # mini data
self._data_mini_ch = {} self._data_mini_ch = {}
@@ -1138,17 +1131,14 @@ class RecordingFileWriter:
self._splitting_size = 0 self._splitting_size = 0
return None return None
def close(self, mqtt_thread): def close(self):
# if self._recording_file is not None:
# self._recording_file.close()
# self._recording_file = None
print('close1')
self._close = True self._close = True
if len(self._recording_file_dict) > 0: if len(self._recording_file_dict) > 0:
for ch in self._data_db.keys(): for ch in self._data_db.keys():
if len(self._data_rl[ch]) > 0:
self._data_rl[ch].append(str(int(self._time_now)))
mes = ' '.join(self._data_rl[ch])
mqtt_thread[ch].on_message(mes)
self._data_rl[ch].clear()
self._send_data[ch] = False
if self._recording_file_dict[ch]._status: if self._recording_file_dict[ch]._status:
_data = ' '.join(self._data_db[ch]) _data = ' '.join(self._data_db[ch])
self._raw_save['data'][ch] = _data self._raw_save['data'][ch] = _data
@@ -1234,17 +1224,17 @@ class RecordingFileWriter:
def get_data_iter(self, d, mqtt_thread): def get_data_iter(self, d, mqtt_thread):
# print('****d size', d.data_size) # print('****d size', d.data_size)
for t, c, v in d.entry_iter(): for t, c, v in d.entry_iter():
# print(t,c,v)
if c in self._data_db: if c in self._data_db:
self._data_all[c].append([int(t), v])
### send real-time ### send real-time
if len(self._data_rl[c]) > 0 and self._send_data[c]: if len(self._data_rl[c]) > 0 and self._send_data[c]:
self._data_rl[c].append(str(int(t))) self._data_rl[c].append(str(int(t)))
mes = ' '.join(self._data_rl[c]) mes = ' '.join(self._data_rl[c])
# print('message1', mes) # self._data_mqtt_ch[c] = self._data_rl[c].copy()
# self._data_mqtt_ch[c].append(str(int(t)))
mqtt_thread[c].on_message(mes) mqtt_thread[c].on_message(mes)
self._data_rl[c].clear() self._data_rl[c].clear()
self._send_data[c] = False self._send_data[c] = False
### send real-time
sample_rate_rl = 1 sample_rate_rl = 1
# rec data # rec data
@@ -1257,35 +1247,40 @@ class RecordingFileWriter:
self._data_value_ch[c].append(int(v)) self._data_value_ch[c].append(int(v))
self._data_value_ch_for_rl[c].append(int(v)) self._data_value_ch_for_rl[c].append(int(v))
self._data_time_ch_for_rl[c].append(int(t)) self._data_time_ch_for_rl[c].append(int(t))
# print('self._data_value_ch[c]', self._data_value_ch[c]) # self._data_time_ch[c].append(int(t))
# print('self._data_value_ch_for_rl[c]', self._data_value_ch_for_rl[c])
# print('self._data_time_ch_for_rl[c]', self._data_time_ch_for_rl[c])
for scale in self._mini_scale_list: for scale in self._mini_scale_list:
if self._data_mini_ch[c][str(scale)]['start_time'] is None: if self._data_mini_ch[c][str(scale)]['start_time'] is None:
self._data_mini_ch[c][str(scale)]['start_time'] = str(int(t)) self._data_mini_ch[c][str(scale)]['start_time'] = str(int(t))
# print('len(self._data_value_ch_for_rl[c])', len(self._data_value_ch_for_rl[c]))
# print('sample_rate_rl:', sample_rate_rl)
if len(self._data_value_ch_for_rl[c]) >= sample_rate_rl: if len(self._data_value_ch_for_rl[c]) >= sample_rate_rl:
if len(self._data_value_ch_for_rl[c]) == 1: if len(self._data_value_ch_for_rl[c]) == 1:
if len(self._data_rl[c]) == 0: if len(self._data_rl[c]) == 0:
self._data_rl[c].append(str(int(t))) self._data_rl[c].append(str(int(t)))
# self._data_rl[c].append(str(self._data_time_ch_for_rl[c][0]))
self._data_rl[c].append(str(self._data_value_ch_for_rl[c][0])) self._data_rl[c].append(str(self._data_value_ch_for_rl[c][0]))
else: else:
if len(self._data_rl[c]) == 0: if len(self._data_rl[c]) == 0:
self._data_rl[c].append(str(int(t))) self._data_rl[c].append(str(int(t)))
# self._data_rl[c].append(str(self._data_time_ch_for_rl[c][0]))
# self._data_rl[c].append(str(self._data_value_ch_for_rl[c][0]))
_max = max(self._data_value_ch_for_rl[c]) _max = max(self._data_value_ch_for_rl[c])
_max_index = self._data_value_ch_for_rl[c].index(_max) _max_index = self._data_value_ch_for_rl[c].index(_max)
_min = min(self._data_value_ch_for_rl[c]) _min = min(self._data_value_ch_for_rl[c])
_min_index = self._data_value_ch_for_rl[c].index(_min) _min_index = self._data_value_ch_for_rl[c].index(_min)
# _mean = mean(self._data_value_ch_for_rl[c])
# print('_max, _max_index, _min, _min_index', _max, _max_index, _min, _min_index) # _first_time = self._data_time_ch_for_rl[c][0]
# _last_time = self._data_time_ch_for_rl[c][-1]
if _max_index < _min_index: if _max_index < _min_index:
# self._data_rl[c].append(str(_first_time))
self._data_rl[c].append(str(_max)) self._data_rl[c].append(str(_max))
# self._data_rl[c].append(str(_last_time))
self._data_rl[c].append(str(_min)) self._data_rl[c].append(str(_min))
else: else:
# self._data_rl[c].append(str(_first_time))
self._data_rl[c].append(str(_min)) self._data_rl[c].append(str(_min))
# self._data_rl[c].append(str(_last_time))
self._data_rl[c].append(str(_max)) self._data_rl[c].append(str(_max))
self._data_value_ch_for_rl[c].clear() self._data_value_ch_for_rl[c].clear()
@@ -1294,6 +1289,9 @@ class RecordingFileWriter:
# mini picture # mini picture
if len(self._data_value_ch[c]) >= 10: if len(self._data_value_ch[c]) >= 10:
self._data_mini_ch[c]['10']['mean'].append( int(mean(self._data_value_ch[c][0:9])) ) self._data_mini_ch[c]['10']['mean'].append( int(mean(self._data_value_ch[c][0:9])) )
# self._data_mini_ch[c]['10']['random'].append( str(self._data_value_ch[c][random.randint(0,9)]) )
# _bar = self.get_bar(self._data_value_ch[c], None)
# self._data_mini_ch[c]['10']['bar'].extend(_bar)
self._data_value_ch[c].clear() self._data_value_ch[c].clear()
if int(len(self._data_mini_ch[c]['10']['mean']) / 10) - self._data_mini_ch[c]['10']['dec'] > 0: if int(len(self._data_mini_ch[c]['10']['mean']) / 10) - self._data_mini_ch[c]['10']['dec'] > 0:
self._data_mini_ch[c]['100']['mean'].append( int(mean(self._data_mini_ch[c]['10']['mean'][-10:])) ) self._data_mini_ch[c]['100']['mean'].append( int(mean(self._data_mini_ch[c]['10']['mean'][-10:])) )
@@ -1315,13 +1313,6 @@ class RecordingFileWriter:
self._data_db[c].append(str(int(t))) self._data_db[c].append(str(int(t)))
self._data_db[c].append(str(v)) self._data_db[c].append(str(v))
self._time_now = int(t) self._time_now = int(t)
# print('self._data_rl',self._data_rl)
# print('self._data_db', self._data_db)
# print('self._data_value_ch', self._data_value_ch)
# print('self._data_value_ch_for_rl', self._data_value_ch_for_rl)
# print('self._data_time_ch_for_rl', self._data_time_ch_for_rl)
# print('self._data_time_ch', self._data_time_ch)
# print('self._id_db_save', self._id_db_save)
return return
# @calculate_time(1) # @calculate_time(1)
@@ -1369,7 +1360,6 @@ class RecordingFileWriter:
self._data_db[ch] = [] self._data_db[ch] = []
self._time[ch] = 0 self._time[ch] = 0
self._time_real_time[ch] = 0 self._time_real_time[ch] = 0
self._data_all[ch] = []
if len(self._data_mini_ch) == 0: if len(self._data_mini_ch) == 0:
for ch in self._channel_list: for ch in self._channel_list:
self._data_mini_ch[ch] = {} self._data_mini_ch[ch] = {}
@@ -1383,37 +1373,6 @@ class RecordingFileWriter:
} }
self.get_data_iter(d, mqtt_thread) self.get_data_iter(d, mqtt_thread)
print('data', len(self._data_all[0]))
test = []
# for ch in self._data_all:
# if len(self._data_all[ch]) <= 1000:
# print('math.ceil(len(self._data_all[ch]) / 10) + 1', math.ceil(len(self._data_all[ch]) / 10) + 1)
# test = largest_triangle_three_buckets(self._data_all[ch], math.ceil(len(self._data_all[ch]) / 10) + 1)
# else:
# self._data_all[ch] = largest_triangle_three_buckets(self._data_all[ch], 1000)
# test = self._data_all[ch]
# print('test', test)
# a = [' '.join(list(map(str, b))) for b in test]
# print('a', a)
# mes = ' '.join(a)
# mqtt_thread[50+ch].on_message(mes)
for ch in self._data_all:
if len(self._data_all[ch]) <= 1000:
self._data_all[ch] = signal.savgol_filter(self._data_all[ch], 32, 3)
else:
self._data_all[ch] = signal.savgol_filter(self._data_all[ch], 32, 3)
print('test', test)
a = [' '.join(list(map(str, b))) for b in self._data_all[ch]]
print('a', a)
mes = ' '.join(a)
mqtt_thread[50+ch].on_message(mes)
if len(self._recording_file_dict) > 0: if len(self._recording_file_dict) > 0:
for ch in self._data_db.keys(): for ch in self._data_db.keys():
-108
View File
@@ -1,108 +0,0 @@
"""
The MIT License (MIT)
Copyright (c) 2015 Olivier Devoisin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
import math
class LttbException(Exception):
pass
def largest_triangle_three_buckets(data, threshold):
"""
Return a downsampled version of data.
Parameters
----------
data: list of lists/tuples
data must be formated this way: [[x,y], [x,y], [x,y], ...]
or: [(x,y), (x,y), (x,y), ...]
threshold: int
threshold must be >= 2 and <= to the len of data
Returns
-------
data, but downsampled using threshold
"""
# Check if data and threshold are valid
if not isinstance(data, list):
raise LttbException("data is not a list")
if not isinstance(threshold, int) or threshold <= 2 or threshold >= len(data):
raise LttbException("threshold not well defined")
for i in data:
if not isinstance(i, (list, tuple)) or len(i) != 2:
raise LttbException("datapoints are not lists or tuples")
# Bucket size. Leave room for start and end data points
every = (len(data) - 2) / (threshold - 2)
a = 0 # Initially a is the first point in the triangle
next_a = 0
max_area_point = (0, 0)
sampled = [data[0]] # Always add the first point
for i in range(0, threshold - 2):
# Calculate point average for next bucket (containing c)
avg_x = 0
avg_y = 0
avg_range_start = int(math.floor((i + 1) * every) + 1)
avg_range_end = int(math.floor((i + 2) * every) + 1)
avg_rang_end = avg_range_end if avg_range_end < len(data) else len(data)
avg_range_length = avg_rang_end - avg_range_start
while avg_range_start < avg_rang_end:
avg_x += data[avg_range_start][0]
avg_y += data[avg_range_start][1]
avg_range_start += 1
avg_x /= avg_range_length
avg_y /= avg_range_length
# Get the range for this bucket
range_offs = int(math.floor((i + 0) * every) + 1)
range_to = int(math.floor((i + 1) * every) + 1)
# Point a
point_ax = data[a][0]
point_ay = data[a][1]
max_area = -1
while range_offs < range_to:
# Calculate triangle area over three buckets
area = math.fabs(
(point_ax - avg_x)
* (data[range_offs][1] - point_ay)
- (point_ax - data[range_offs][0])
* (avg_y - point_ay)
) * 0.5
if area > max_area:
max_area = area
max_area_point = data[range_offs]
next_a = range_offs # Next a is this b
range_offs += 1
sampled.append(max_area_point) # Pick this point from the bucket
a = next_a # This a is the next a (chosen b)
sampled.append(data[len(data) - 1]) # Always add last
return sampled
+21 -21
View File
@@ -229,12 +229,30 @@ class RecordingProcess(Process):
# except: # except:
# pass # pass
try:
time_duration = self._meta_file.configuration.get_parameter('TIME_DURATION')
if time_duration and time_duration is not 0 and time() - self._start_time >= time_duration:
self._queue_msg.put(['ds', self._device, 'interrupt'])
return None
if isinstance(self._decoder, I4V4Z4T4DataDecoder) or isinstance(self._decoder, EISZeroOneDataDecoder):
if self._decoder.isFinishMode is not None and self._decoder.isFinishMode() == 1:
self._queue_msg.put(['ds', self._device, 'interrupt'])
return None
# content = {}
# content['header'] = 'device_instruction/0'
# content['device'] = result.device
# content['instruction'] = 'interrupt'
# self._mqtt_thread.publish('device_instruction',json_stringify(content), True)
# self.server.stop_sync(self.device)
except RuntimeError as e:
print(e)
if result is not None: if result is not None:
## ##
if len(self._mqtt_send_data_ch_level) == 0: if len(self._mqtt_send_data_ch_level) == 0:
for ch in result.channels(): for ch in result.channels():
self._mqtt_send_data_ch_level[ch] = MqttDataMessageHandler(self._mqtt_thread, 'data_server/device_data_stream/' + str(result.device) + '/' + str(ch) ) self._mqtt_send_data_ch_level[ch] = MqttDataMessageHandler(self._mqtt_thread, 'data_server/device_data_stream/' + str(result.device) + '/' + str(ch) )
self._mqtt_send_data_ch_level[50+ch] = MqttDataMessageHandler(self._mqtt_thread, 'data_server/device_data_stream/' + str(result.device) + '/' + str(ch+50) )
ret.append(result) ret.append(result)
else: else:
continue continue
@@ -246,27 +264,9 @@ class RecordingProcess(Process):
self._writer.channels_update(ret[0].channels()) self._writer.channels_update(ret[0].channels())
self._writer.write(ret, self._mqtt_send_data_ch_level) self._writer.write(ret, self._mqtt_send_data_ch_level)
# print('write time: ', time() - ctime1) # print('write time: ', time() - ctime1)
# print(ret) # print(ret)
try:
time_duration = self._meta_file.configuration.get_parameter('TIME_DURATION')
if time_duration and time_duration is not 0 and time() - self._start_time >= time_duration:
self._queue_msg.put(['ds', self._device, 'interrupt'])
return None
if isinstance(self._decoder, I4V4Z4T4DataDecoder) or isinstance(self._decoder, EISZeroOneDataDecoder):
if self._decoder.isFinishMode is not None and self._decoder.isFinishMode() == 1:
self._queue_msg.put(['ds', self._device, 'interrupt'])
return None
# content = {}
# content['header'] = 'device_instruction/0'
# content['device'] = result.device
# content['instruction'] = 'interrupt'
# self._mqtt_thread.publish('device_instruction',json_stringify(content), True)
# self.server.stop_sync(self.device)
except RuntimeError as e:
print(e)
del ret del ret
del data del data
return return
@@ -607,7 +607,7 @@ class RecordingProcess(Process):
def final_write(self): def final_write(self):
if self._writer is not None: if self._writer is not None:
return self._writer.close(self._mqtt_send_data_ch_level) return self._writer.close()
else: else:
return False return False
@@ -1,5 +1,5 @@
{ {
"name": "Elite_BAT_1.0", "name": "EliteZM15",
"version": "1.2.30", "version": "1.2.30",
"match_rule": { "match_rule": {
"local_name_pattern": "Elite.*", "local_name_pattern": "Elite.*",
@@ -1,5 +1,5 @@
{ {
"name": "Elite_EDC_1.4", "name": "Elite_EDC1",
"version": "1.2.30", "version": "1.2.30",
"match_rule": { "match_rule": {
"local_name_pattern": "Elite.*", "local_name_pattern": "Elite.*",
@@ -1,5 +1,5 @@
{ {
"name": "Elite_EDC_1.5", "name": "EliteZM15",
"version": "1.2.30", "version": "1.2.30",
"match_rule": { "match_rule": {
"local_name_pattern": "Elite.*", "local_name_pattern": "Elite.*",
@@ -671,6 +671,17 @@
}, },
"on_change": "set_para_DAC_VOLT" "on_change": "set_para_DAC_VOLT"
}, },
"DAC_VOLT_SCROLL": {
"description": "DAC scroll output Voltage",
"record_meta": true,
"initial": 25000,
"domain": [
65536
],
"value": {
"expression": "VALUE"
}
},
"ADC_VALUE_I": { "ADC_VALUE_I": {
"description": "ADC value current value", "description": "ADC value current value",
"domain": "int" "domain": "int"
@@ -836,6 +847,17 @@
], ],
"on_change": "set_dac_gain_Vout" "on_change": "set_dac_gain_Vout"
}, },
"DAC_VOLT_BUTTON": {
"description": "DAC volt",
"record_meta": true,
"initial": 1,
"value": [
"10000",
"25000",
"50000",
"60000"
]
},
"CTRL_HIGH_Z_15": { "CTRL_HIGH_Z_15": {
"description": "ctrl highZ level", "description": "ctrl highZ level",
"record_meta": true, "record_meta": true,
@@ -851,7 +873,8 @@
"initial": 0, "initial": 0,
"value": [ "value": [
"Iin", "Iin",
"Vin" "Vin",
"Vout"
] ]
}, },
"BLE_WRITE": { "BLE_WRITE": {
@@ -912,11 +935,13 @@
"_notify(True)", "_notify(True)",
"set_adc_gain_I", "set_adc_gain_I",
"set_adc_gain_Vin", "set_adc_gain_Vin",
"set_dac_gain_Vout",
{ {
"expression": "ADC_DAC_CHANNEL_15", "expression": "ADC_DAC_CHANNEL_15",
"when": { "when": {
"0": "cali_Iin", "0": "cali_Iin",
"1": "cali_Vin" "1": "cali_Vin",
"2": "cali_Vout"
} }
}, },
"_sync(True)", "_sync(True)",
@@ -1007,12 +1032,6 @@
"XE0;2B>va" "XE0;2B>va"
] ]
}, },
"set_dac_gain_Vout": {
"type": "RIS",
"data": [
"XE1;X02;B>DAC_LEVEL_V_OUT_15"
]
},
"set_adc_gain_I": { "set_adc_gain_I": {
"type": "RIS", "type": "RIS",
"data": [ "data": [
@@ -1025,6 +1044,12 @@
"XE1;X01;B>ADC_LEVEL_V_IN_15" "XE1;X01;B>ADC_LEVEL_V_IN_15"
] ]
}, },
"set_dac_gain_Vout": {
"type": "RIS",
"data": [
"XE1;X02;B>DAC_LEVEL_V_OUT_15"
]
},
"set_ctrl_highZ": { "set_ctrl_highZ": {
"type": "RIS", "type": "RIS",
"data": [ "data": [
@@ -1052,6 +1077,15 @@
"XF1;B>ADC_DAC_CHANNEL_15;B>ADC_LEVEL_V_IN_15" "XF1;B>ADC_DAC_CHANNEL_15;B>ADC_LEVEL_V_IN_15"
] ]
}, },
"cali_Vout": {
"type": "RIS",
"parameter": {
"v": "DAC_VOLT_BUTTON"
},
"data": [
"XF1;B>ADC_DAC_CHANNEL_15;B>v"
]
},
"curve_iv": { "curve_iv": {
"type": "RIS", "type": "RIS",
"parameter": { "parameter": {
@@ -1,12 +1,12 @@
{ {
"name": "Elite_EDC_1.5r2", "name": "EliteZM15",
"version": "1.2.30", "version": "1.2.30",
"match_rule": { "match_rule": {
"local_name_pattern": "Elite.*", "local_name_pattern": "Elite.*",
"major_product_number": 0, "major_product_number": 0,
"minor_product_number": 2, "minor_product_number": 2,
"major_version_number": 1, "major_version_number": 1,
"minor_version_number": 8 "minor_version_number": 6
}, },
"constant": { "constant": {
"TIME_MAX": 100000, "TIME_MAX": 100000,
@@ -671,6 +671,17 @@
}, },
"on_change": "set_para_DAC_VOLT" "on_change": "set_para_DAC_VOLT"
}, },
"DAC_VOLT_SCROLL": {
"description": "DAC scroll output Voltage",
"record_meta": true,
"initial": 25000,
"domain": [
65536
],
"value": {
"expression": "VALUE"
}
},
"ADC_VALUE_I": { "ADC_VALUE_I": {
"description": "ADC value current value", "description": "ADC value current value",
"domain": "int" "domain": "int"
@@ -836,6 +847,17 @@
], ],
"on_change": "set_dac_gain_Vout" "on_change": "set_dac_gain_Vout"
}, },
"DAC_VOLT_BUTTON": {
"description": "DAC volt",
"record_meta": true,
"initial": 1,
"value": [
"10000",
"25000",
"50000",
"60000"
]
},
"CTRL_HIGH_Z_15": { "CTRL_HIGH_Z_15": {
"description": "ctrl highZ level", "description": "ctrl highZ level",
"record_meta": true, "record_meta": true,
@@ -851,7 +873,8 @@
"initial": 0, "initial": 0,
"value": [ "value": [
"Iin", "Iin",
"Vin" "Vin",
"Vout"
] ]
}, },
"BLE_WRITE": { "BLE_WRITE": {
@@ -912,11 +935,13 @@
"_notify(True)", "_notify(True)",
"set_adc_gain_I", "set_adc_gain_I",
"set_adc_gain_Vin", "set_adc_gain_Vin",
"set_dac_gain_Vout",
{ {
"expression": "ADC_DAC_CHANNEL_15", "expression": "ADC_DAC_CHANNEL_15",
"when": { "when": {
"0": "cali_Iin", "0": "cali_Iin",
"1": "cali_Vin" "1": "cali_Vin",
"2": "cali_Vout"
} }
}, },
"_sync(True)", "_sync(True)",
@@ -1007,12 +1032,6 @@
"XE0;2B>va" "XE0;2B>va"
] ]
}, },
"set_dac_gain_Vout": {
"type": "RIS",
"data": [
"XE1;X02;B>DAC_LEVEL_V_OUT_15"
]
},
"set_adc_gain_I": { "set_adc_gain_I": {
"type": "RIS", "type": "RIS",
"data": [ "data": [
@@ -1025,6 +1044,12 @@
"XE1;X01;B>ADC_LEVEL_V_IN_15" "XE1;X01;B>ADC_LEVEL_V_IN_15"
] ]
}, },
"set_dac_gain_Vout": {
"type": "RIS",
"data": [
"XE1;X02;B>DAC_LEVEL_V_OUT_15"
]
},
"set_ctrl_highZ": { "set_ctrl_highZ": {
"type": "RIS", "type": "RIS",
"data": [ "data": [
@@ -1052,6 +1077,15 @@
"XF1;B>ADC_DAC_CHANNEL_15;B>ADC_LEVEL_V_IN_15" "XF1;B>ADC_DAC_CHANNEL_15;B>ADC_LEVEL_V_IN_15"
] ]
}, },
"cali_Vout": {
"type": "RIS",
"parameter": {
"v": "DAC_VOLT_BUTTON"
},
"data": [
"XF1;B>ADC_DAC_CHANNEL_15;B>v"
]
},
"curve_iv": { "curve_iv": {
"type": "RIS", "type": "RIS",
"parameter": { "parameter": {
@@ -1,12 +1,12 @@
{ {
"name": "Elite_EDC_1.5re", "name": "EliteZM15",
"version": "1.2.30", "version": "1.2.30",
"match_rule": { "match_rule": {
"local_name_pattern": "Elite.*", "local_name_pattern": "Elite.*",
"major_product_number": 0, "major_product_number": 0,
"minor_product_number": 2, "minor_product_number": 2,
"major_version_number": 1, "major_version_number": 1,
"minor_version_number": 7 "minor_version_number": 6
}, },
"constant": { "constant": {
"TIME_MAX": 100000, "TIME_MAX": 100000,
@@ -671,6 +671,17 @@
}, },
"on_change": "set_para_DAC_VOLT" "on_change": "set_para_DAC_VOLT"
}, },
"DAC_VOLT_SCROLL": {
"description": "DAC scroll output Voltage",
"record_meta": true,
"initial": 25000,
"domain": [
65536
],
"value": {
"expression": "VALUE"
}
},
"ADC_VALUE_I": { "ADC_VALUE_I": {
"description": "ADC value current value", "description": "ADC value current value",
"domain": "int" "domain": "int"
@@ -836,6 +847,17 @@
], ],
"on_change": "set_dac_gain_Vout" "on_change": "set_dac_gain_Vout"
}, },
"DAC_VOLT_BUTTON": {
"description": "DAC volt",
"record_meta": true,
"initial": 1,
"value": [
"10000",
"25000",
"50000",
"60000"
]
},
"CTRL_HIGH_Z_15": { "CTRL_HIGH_Z_15": {
"description": "ctrl highZ level", "description": "ctrl highZ level",
"record_meta": true, "record_meta": true,
@@ -851,7 +873,8 @@
"initial": 0, "initial": 0,
"value": [ "value": [
"Iin", "Iin",
"Vin" "Vin",
"Vout"
] ]
}, },
"BLE_WRITE": { "BLE_WRITE": {
@@ -912,11 +935,13 @@
"_notify(True)", "_notify(True)",
"set_adc_gain_I", "set_adc_gain_I",
"set_adc_gain_Vin", "set_adc_gain_Vin",
"set_dac_gain_Vout",
{ {
"expression": "ADC_DAC_CHANNEL_15", "expression": "ADC_DAC_CHANNEL_15",
"when": { "when": {
"0": "cali_Iin", "0": "cali_Iin",
"1": "cali_Vin" "1": "cali_Vin",
"2": "cali_Vout"
} }
}, },
"_sync(True)", "_sync(True)",
@@ -1007,12 +1032,6 @@
"XE0;2B>va" "XE0;2B>va"
] ]
}, },
"set_dac_gain_Vout": {
"type": "RIS",
"data": [
"XE1;X02;B>DAC_LEVEL_V_OUT_15"
]
},
"set_adc_gain_I": { "set_adc_gain_I": {
"type": "RIS", "type": "RIS",
"data": [ "data": [
@@ -1025,6 +1044,12 @@
"XE1;X01;B>ADC_LEVEL_V_IN_15" "XE1;X01;B>ADC_LEVEL_V_IN_15"
] ]
}, },
"set_dac_gain_Vout": {
"type": "RIS",
"data": [
"XE1;X02;B>DAC_LEVEL_V_OUT_15"
]
},
"set_ctrl_highZ": { "set_ctrl_highZ": {
"type": "RIS", "type": "RIS",
"data": [ "data": [
@@ -1052,6 +1077,15 @@
"XF1;B>ADC_DAC_CHANNEL_15;B>ADC_LEVEL_V_IN_15" "XF1;B>ADC_DAC_CHANNEL_15;B>ADC_LEVEL_V_IN_15"
] ]
}, },
"cali_Vout": {
"type": "RIS",
"parameter": {
"v": "DAC_VOLT_BUTTON"
},
"data": [
"XF1;B>ADC_DAC_CHANNEL_15;B>v"
]
},
"curve_iv": { "curve_iv": {
"type": "RIS", "type": "RIS",
"parameter": { "parameter": {
@@ -1,5 +1,5 @@
{ {
"name": "Elite_EIS_1.0", "name": "EliteEIS",
"version": "1.2.30", "version": "1.2.30",
"match_rule": { "match_rule": {
"local_name_pattern": "Elite.*", "local_name_pattern": "Elite.*",
@@ -1,5 +1,5 @@
{ {
"name": "Elite_EIS_1.1", "name": "EliteEIS",
"version": "1.2.30", "version": "1.2.30",
"match_rule": { "match_rule": {
"local_name_pattern": "Elite.*", "local_name_pattern": "Elite.*",
@@ -1,5 +1,5 @@
{ {
"name": "Elite_MEGAFLY_0.1", "name": "Elite_MEGAFLY1",
"version": "1.2.30", "version": "1.2.30",
"match_rule": { "match_rule": {
"local_name_pattern": "Elite.*", "local_name_pattern": "Elite.*",
@@ -1,5 +1,5 @@
{ {
"name": "Elite_TRIG_0.1", "name": "Elite_TRIG1",
"version": "1.2.30", "version": "1.2.30",
"match_rule": { "match_rule": {
"local_name_pattern": "Trigger.*", "local_name_pattern": "Trigger.*",
@@ -1,459 +0,0 @@
{
"name": "Elite_EIS_MINI_1.0",
"version": "1.2.30",
"match_rule": {
"local_name_pattern": "Elite.*",
"major_product_number": 0,
"minor_product_number": 4,
"major_version_number": 1,
"minor_version_number": 2
},
"constant": {
"FREQ_MAX": 4294967296,
"VOLT_MAX": 65536,
"BLE_WRITE_MAX": 255,
"TIME_MAX": 100000
},
"parameters": {
"TIME_DURATION": {
"description": "Run duration",
"record_meta": true,
"initial": 0,
"domain": [
"TIME_MAX"
],
"value": {
"expression": "VALUE"
}
},
"CHANNEL": {
"derzteription": "record channels",
"record_meta": true,
"domain": "property",
"value": "[0, 1, 2]"
},
"CHANNEL_LABEL": {
"description": "channel label",
"record_meta": true,
"domain": "property",
"value": "['current', 'voltage', 'impedance']"
},
"SAMPLE_RATE": {
"description": "data sampling rate",
"record_meta": true,
"initial": 1000,
"domain": [
1001
],
"value": {
"expression": "VALUE"
},
"on_change": "set_sample_rate"
},
"AMP_GAIN": {
"description": "amp gain",
"record_meta": true,
"domain": "constant",
"value": 1
},
"MODE": {
"description": "working mode",
"record_meta": true,
"value": [
"EIS CURVE",
"Cyclic Voltammetry",
"Dev Mode"
]
},
"FREQ": {
"description": "DPV current recording period start",
"record_meta": true,
"initial": [
13422819,
7
],
"domain": {
"list": [
"FREQ_MAX"
]
},
"value": "VALUE"
},
"FREQ_START": {
"description": "Start of Freq Scan",
"record_meta": true,
"initial": 13422819,
"domain": [
"FREQ_MAX"
],
"value": {
"expression": "VALUE"
}
},
"FREQ_STOP": {
"description": "End of Freq Scan",
"record_meta": true,
"initial": 7,
"domain": [
"FREQ_MAX"
],
"value": {
"expression": "VALUE"
}
},
"DELAY": {
"description": "Wait x peroid before start taking measurements",
"record_meta": true,
"initial": 0,
"domain": [
101
],
"value": {
"expression": "VALUE"
}
},
"AVERAGE_NUM": {
"description": "Number of sample used for average funciton",
"record_meta": true,
"initial": 8,
"value": [
2,
4,
8,
16
]
},
"DC_BIAS": {
"description": "DC voltage bias in mV",
"record_meta": true,
"initial": 25000,
"domain": [
"VOLT_MAX"
],
"value": {
"expression": "VALUE"
}
},
"AC_AMP": {
"description": "AC Amplitude in mV",
"record_meta": true,
"initial": 25,
"domain": [
2048
]
},
"SCALE": {
"description": "Point spacing pattern",
"record_meta": true,
"initial": 0,
"value": [
0,
1
]
},
"PPD": {
"description": "Point per decades",
"record_meta": true,
"initial": 10,
"domain": [
11
]
},
"RTIA": {
"description": "High speed tia gain",
"record_meta": true,
"initial": 4,
"value": [
0,
1,
2,
3,
4
]
},
"ADC_VALUE_I": {
"description": "ADC value current value",
"domain": "int"
},
"Scan_Rate": {
"description": "Voltage Scan Rate",
"record_meta": true,
"initial": 10000,
"domain": [
100001
],
"value": {
"expression": "VALUE"
}
},
"CTRL_HIGH_Z_15": {
"description": "ctrl highZ level",
"record_meta": true,
"initial": 1,
"value": [
"On",
"Off"
],
"on_change": "set_ctrl_highZ"
},
"ADC_LEVEL_I_15": {
"description": "ADC level",
"record_meta": true,
"initial": 4,
"value": [
"0",
"1",
"2",
"3",
"auto"
],
"on_change": "set_adc_gain_I"
},
"ADC_LEVEL_V_IN_15": {
"description": "ADC level",
"record_meta": true,
"initial": 3,
"value": [
"0",
"1",
"2",
"auto"
],
"on_change": "set_adc_gain_Vin"
},
"VOLT_INITIAL": {
"description": "Initial Voltage of Scan",
"record_meta": true,
"initial": 25000,
"domain": [
"VOLT_MAX"
],
"value": {
"expression": "VALUE"
}
},
"VOLT_MAX": {
"description": "Max Voltage of Scan",
"record_meta": true,
"initial": 25000,
"domain": [
"VOLT_MAX"
],
"value": {
"expression": "VALUE"
}
},
"VOLT_MIN": {
"description": "Min Voltage of Scan",
"record_meta": true,
"initial": 25000,
"domain": [
"VOLT_MAX"
],
"value": {
"expression": "VALUE"
}
},
"CYCLE_NUMBER": {
"description": "CV cycle number",
"record_meta": true,
"initial": 1,
"domain": [
65536
],
"value": {
"expression": "VALUE"
}
},
"BLE_WRITE": {
"description": "send msg to elite",
"domain": {
"list": [
"BLE_WRITE_MAX"
]
},
"initial": "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]",
"value": "VALUE"
},
"BLE_READ": {
"description": "receive msg from elite",
"domain": "int"
}
},
"instruction": {
"start": [
{
"expression": "MODE",
"when": {
"*": "start_data"
}
}
],
"start_data": [
"data_format_cali",
"_notify(True)",
{
"expression": "MODE",
"when": {
"1": "set_adc_gain_I"
}
},
{
"expression": "MODE",
"when": {
"1": "set_adc_gain_Vin"
}
},
{
"expression": "MODE",
"when": {
"0": "curve_eis",
"1": "curve_cv3"
}
},
{
"expression": "MODE",
"when": {
"0": "curve_eis_para2",
"1": "curve_cv3_para2"
}
},
"_sync(True)",
"VIS_STI"
],
"data_format": [
"_data_format('EISZeroOne')",
{
"expression": "MODE",
"when": {
"0": "_disable_cache(True)",
"1": "_disable_cache(True)",
"*": "_disable_cache(False)"
}
}
],
"data_format_cali": [
"_data_format_cali('EISZeroOne')"
],
"set_sample_rate": {
"type": "RIS",
"parameter": {
"va": "SAMPLE_RATE"
},
"data": [
"XE0;2B>va"
]
},
"set_adc_gain_I": {
"type": "RIS",
"data": [
"XE1;X05;B>ADC_LEVEL_I_15"
]
},
"set_adc_gain_Vin": {
"type": "RIS",
"data": [
"XE1;X06;B>ADC_LEVEL_V_IN_15"
]
},
"set_ctrl_highZ": {
"type": "RIS",
"data": [
"XE1;X03;B>CTRL_HIGH_Z_15"
]
},
"curve_eis": {
"type": "RIS",
"parameter": {
"fa": "FREQ[0]",
"fb": "FREQ[1]",
"dp": "DELAY",
"dc": "DC_BIAS",
"am": "AC_AMP",
"an": "AVERAGE_NUM",
"rt": "RTIA",
"pp": "PPD",
"sp": "SCALE"
},
"data": [
"1XD1;1X01;4B>fa;4B>fb;2B>dp"
]
},
"curve_eis_para2": {
"type": "RIS",
"parameter": {
"fa": "FREQ[0]",
"fb": "FREQ[1]",
"dp": "DELAY",
"dc": "DC_BIAS",
"am": "AC_AMP",
"an": "AVERAGE_NUM",
"rt": "RTIA",
"pp": "PPD",
"sp": "SCALE"
},
"data": [
"1XD1;1X02;2B>dc;2B>am;B>an;B>rt;2B>pp;B>sp"
]
},
"curve_cv3": {
"type": "RIS",
"parameter": {
"va": "VOLT_INITIAL",
"vb": "VOLT_MAX",
"vc": "VOLT_MIN",
"ve": "Scan_Rate",
"vf": "SAMPLE_RATE",
"cn": "CYCLE_NUMBER"
},
"data": [
"1XD2;1X01;2B>va;2B>vb;2B>vc;"
]
},
"curve_cv3_para2": {
"type": "RIS",
"parameter": {
"va": "VOLT_INITIAL",
"vb": "VOLT_MAX",
"vc": "VOLT_MIN",
"ve": "Scan_Rate",
"vf": "SAMPLE_RATE",
"cn": "CYCLE_NUMBER"
},
"data": [
"1XD2;1X02;4B>ve;2B>vf;2B>cn"
]
},
"VIS_CC_ZERO": [
"_data_format('EISZeroOne')",
"_disable_cache(False)",
"_notify(True)",
"VIS_CC_ZERO",
"_sync(True)",
"VIS_STI"
],
"ble_instru_send": [
"ble_write",
"_cdr('20X>ADC_VALUE_I')"
],
"ble_write": {
"type": "RIS",
"data": [
"XFF;",
"1B>BLE_WRITE[0];1B>BLE_WRITE[1];1B>BLE_WRITE[2];1B>BLE_WRITE[3];",
"1B>BLE_WRITE[4];1B>BLE_WRITE[5];1B>BLE_WRITE[6];1B>BLE_WRITE[7];",
"1B>BLE_WRITE[8];1B>BLE_WRITE[9];1B>BLE_WRITE[10];1B>BLE_WRITE[11];",
"1B>BLE_WRITE[12];1B>BLE_WRITE[13];1B>BLE_WRITE[14];1B>BLE_WRITE[15];",
"1B>BLE_WRITE[16];"
]
},
"dev_version": [
"CIS_VERSION",
"_cdr('20X>ADC_VALUE_I')"
],
"dev_battery": [
"CIS_VOLT",
"_cdr('20X>ADC_VALUE_I')"
]
}
}