Compare commits

..

3 Commits

Author SHA1 Message Date
peterlu14 2bea9f25a4 [update] add eis mini short instruction 2022-11-10 15:02:34 +08:00
Roy 2f00375e4f [update] short instruction for RT mode 2022-11-10 14:53:06 +08:00
peterlu14 f02aedafa7 [update] eis mini add old rt mode 2022-11-10 14:15:47 +08:00
23 changed files with 636 additions and 1257 deletions
-1
View File
@@ -7,4 +7,3 @@
/.vscode
/media
python/biopro/sever/_identify.py
*.log
-22
View File
@@ -78,8 +78,6 @@ add ssh.txt in boot folder
###### Install dependencies
sudo apt-get install vim git wiringpi build-essential libi2c-dev i2c-tools python-dev libffi-dev python3-pip postgresql npm
sudo apt-get install libatlas-base-dev
sudo apt-get install python3-numpy
###### wiringpi conflict
need to install wiringpi: https://github.com/WiringPi/WiringPi
@@ -96,7 +94,6 @@ git clone https://gitlab.com/wisetop/controller/wisetopdataserver.git
```
cd ~/wisetopdataserver
pip3 install -r requirements.txt
pip3 install SQLAlchemy
```
##### Packages version
```
@@ -361,22 +358,3 @@ $sudo vim ./sites-available/000-default.conf
##### raspberry website document:
> https://www.raspberrypi.org/documentation/configuration/wireless/access-point-routed.md
# ChangeLog
[2022.11.16]
add python package SQLAlchemy
add new column project(int4) in postgresSQL table recording_meta_datas
add new postgresSQL table project_report
add new postgresSQL table meta_project_info
[2022.10.18]
socektTimeout from 1s -> 5s
socketListen from 3 -> 20
[2022.09.30]
add new column cycle(jsonb) in postgresSQL table projects
[2022.9.28]
add python package numpy
+3 -5
View File
@@ -87,8 +87,7 @@ class DataAPI(metaclass=abc.ABCMeta):
def update_device_configuration(self,
device: Union[int, Device],
meta_file: Union[str, Path, RecordingMetaFile],
data_format: Union[AnyStr, DataDecodeFormat],
project_info: str):
data_format: Union[AnyStr, DataDecodeFormat]):
"""set device configuration.
:param device: device ID
@@ -155,8 +154,7 @@ class DataClient(SocketClient, DataAPI, metaclass=SocketClientMacro(DataAPI)):
def update_device_configuration(self,
device: Union[int, Device],
meta_file: Union[str, Path, RecordingMetaFile],
data_format: Union[AnyStr, DataDecodeFormat],
project_info: str):
data_format: Union[AnyStr, DataDecodeFormat]):
# meta file
if isinstance(meta_file, str):
@@ -188,7 +186,7 @@ class DataClient(SocketClient, DataAPI, metaclass=SocketClientMacro(DataAPI)):
raise TypeError('not a data decode format : ' + data_format.__class__.__name__)
# send
self.send_command('update_device_configuration', device, meta_file, data_format, project_info)
self.send_command('update_device_configuration', device, meta_file, data_format)
def is_sync(self, device: Union[None, int, Device] = None) -> bool:
if isinstance(device, Device):
-10
View File
@@ -1,10 +0,0 @@
from sqlalchemy import create_engine
# from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, declarative_base
SQLALCHEMY_DATABASE_URL = "postgresql://biopro:BioProControlBox@127.0.0.1:5432/postgres"
engine = create_engine(SQLALCHEMY_DATABASE_URL)
Session = sessionmaker(bind=engine)
Base = declarative_base()
-21
View File
@@ -1,21 +0,0 @@
from sqlalchemy import Table, Column, String, MetaData, ForeignKey, JSON
from sqlalchemy.sql import select, func
from sqlalchemy.types import Integer, BigInteger, String, Boolean, TIMESTAMP, Numeric
from sqlalchemy.dialects.postgresql import JSONB
from .base import Base
class MetaProjectInfo(Base):
__tablename__ = "meta_project_info"
id = Column(Integer, primary_key=True)
project = Column(String(36))
cycle = Column(String)
task = Column(JSONB)
serial_number = Column(Integer)
deleted = Column(Boolean, default = False)
created_at = Column(TIMESTAMP(timezone=True), server_default=func.now())
updated_at = Column(TIMESTAMP(timezone=True), onupdate=func.now())
# def __repr__(self):
# return f"User(id={self.id!r}, name={self.name!r}, fullname={self.task!r})"
-24
View File
@@ -1,24 +0,0 @@
from sqlalchemy import Table, Column, String, MetaData, ForeignKey, JSON
from sqlalchemy.sql import select, func
from sqlalchemy.types import Integer, BigInteger, String, Boolean, TIMESTAMP, Numeric
from sqlalchemy.dialects.postgresql import JSONB
from .base import Base
class ProjectReport(Base):
__tablename__ = "project_report"
id = Column(Integer, primary_key=True)
name = Column(String)
desc = Column(String)
task = Column(JSONB)
cycle = Column(JSONB)
device = Column(JSONB)
uuid = Column(String(36))
user_auth = Column(JSONB)
deleted = Column(Boolean, default = False)
created_at = Column(TIMESTAMP(timezone=True), server_default=func.now())
updated_at = Column(TIMESTAMP(timezone=True), onupdate=func.now())
# def __repr__(self):
# return f"User(id={self.id!r}, name={self.name!r}, fullname={self.task!r})"
+12 -23
View File
@@ -574,23 +574,20 @@ class DeviceManager(MasterDevice, Synchronized):
:param device: device ID or response info
:return: CompletedDevice, None if not found.
"""
try:
if isinstance(device, int):
for slave in self._device:
if slave.device_id == device:
return slave
if isinstance(device, int):
for slave in self._device:
if slave.device_id == device:
return slave
elif isinstance(device, str):
for slave in self._device:
if ':'.join('{:02x}'.format(b) for b in slave.mac_address) == device.lower():
return slave
elif isinstance(device, str):
for slave in self._device:
if ':'.join('{:02x}'.format(b) for b in slave.mac_address) == device.lower():
return slave
elif isinstance(device, DeviceInfo):
for slave in self._device:
if device.match(slave):
return slave
except BaseException as e:
self.log_error('device not found', str(device))
elif isinstance(device, DeviceInfo):
for slave in self._device:
if device.match(slave):
return slave
return None
@@ -832,9 +829,6 @@ class DeviceManager(MasterDevice, Synchronized):
elif func == InternalInstruction.PREDEFINED_DISABLE_CACHE:
self._device_disable_cache(device, *para)
elif func == InternalInstruction.PREDEFINED_IDLE:
self._idle(device, *para)
elif isinstance(device, DebugDevice):
if func == InternalInstruction.PREDEFINED_NOTIFY:
@@ -854,11 +848,6 @@ class DeviceManager(MasterDevice, Synchronized):
InternalInstruction.PREDEFINED_DATA_FORMAT,
f)
def _idle(self, device: Device, expr: AnyStr):
self._handler.device_internal_command(device.device_id,
InternalInstruction.PREDEFINED_IDLE,
None)
def _device_data_format_cali(self, device: Device, expr: str, cali: bytes = None):
if cali is None:
cali = device.calibration_info(expr)
+23 -22
View File
@@ -1346,8 +1346,8 @@ class EISZeroOneDataDecoder(RecDataDecoder):
__slots__ = ('_message', '_cycle_number', '_start_return_data', '_time_stamp',
'_total_time_stamp', '_mode', '_cycle_start_time',
'_mode_stop', '_last_time_stamp', '_last_delta', '_cali_coeff',
'cali_coeff', '_ac_amp', '_mode',
'_last_phase', '_first_phase_flag', '_show_data')
'cali_coeff', '_ac_amp', '_mode', '_freq_start', '_freq_stop',
'_freq_direction', '_last_phase', '_first_phase_flag', '_show_data')
def __init__(self, cali_coeff: bytes = None):
super().__init__()
@@ -1362,6 +1362,9 @@ class EISZeroOneDataDecoder(RecDataDecoder):
self._cycle_start_time = []
self._ac_amp: int = 0
self._mode: int = 0
self._freq_start: int = 0
self._freq_stop: int = 0
self._freq_direction = 0
self._last_phase = 0
self._first_phase_flag = 1
@@ -1426,25 +1429,25 @@ class EISZeroOneDataDecoder(RecDataDecoder):
index = 60
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])
hsrtia_c.append(struct.unpack('>i', cali_coeff[index+9:index+13])[0]/1e4)
#Lv[1] 20k
index = 80
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])
hsrtia_c.append(struct.unpack('>i', cali_coeff[index+9:index+13])[0]/1e4)
#Lv[2] 5k
index = 100
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])
hsrtia_c.append(struct.unpack('>i', cali_coeff[index+9:index+13])[0]/1e4)
#Lv[3] 200R
index = 120
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])
hsrtia_c.append(struct.unpack('>i', cali_coeff[index+9:index+13])[0]/1e4)
index = 140
g = 1
@@ -1527,7 +1530,7 @@ class EISZeroOneDataDecoder(RecDataDecoder):
time_stamp: float = struct.unpack('<I', data[13+3:17+3])[0] # unit: ms
cycle_number = struct.unpack('>H', data[17+3:19+3])[0]
d19 = data[19+3]
gain = data[20+3]
gain = (d19 & 0x0F)
finishMode = (d19 & 0x80) >> 7
if time_stamp == 0:
@@ -1537,7 +1540,7 @@ class EISZeroOneDataDecoder(RecDataDecoder):
return None
if time_stamp != 0 and self._start_return_data == True:
if (self._mode == 0 or self._mode == 5):
if (self._mode == 0):
time_stamp, delta, ret_get_time_stamp = self.eis_get_time_stamp(time_stamp)
else:
time_stamp, delta, ret_get_time_stamp = self.get_time_stamp(time_stamp)
@@ -1546,7 +1549,7 @@ class EISZeroOneDataDecoder(RecDataDecoder):
print("error timeStamp full data:", list(data), datetime.now(), '\n')
return None
else:
if self.cali_coeff is not None and (self._mode == 0 or self._mode == 5):
if self.cali_coeff is not None and self._mode == 0:
hsrtia_a = []
hsrtia_b = []
hsrtia_c = []
@@ -1554,25 +1557,23 @@ class EISZeroOneDataDecoder(RecDataDecoder):
cutoff_freq, phase_coeff, phase_offset, hsrtia_a, hsrtia_b, hsrtia_c, hsrtia_d = self.cali_coeff[0]
voltage_amp = round(self._ac_amp * 800 / 2047) # use UI value
if (self._freq_start > self._freq_stop):
self._freq_direction = 0
else:
self._freq_direction = 1
if (self._mode == 0 or self._mode == 5):
if (self._mode == 0):
img = ch1
real = ch2
freq = ch3
fre_idx = 0
# rolloff_cali = cutoff_freq/1e5
rolloff_cali = hsrtia_c[gain]
voltage_mag = math.sqrt(img ** 2 + real ** 2) * (1 + freq ** 2 / rolloff_cali ** 2 / 1e4)
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]
# current = voltage_mag ** 2 * hsrtia_a[gain] + voltage_mag * hsrtia_b[gain] + hsrtia_c[gain]
current = voltage_mag ** 2 * hsrtia_a[gain] + voltage_mag * hsrtia_b[gain] + hsrtia_c[gain]
# print(current)
# print(voltage_mag)
# print(hsrtia_a[gain])
@@ -1616,7 +1617,7 @@ class EISZeroOneDataDecoder(RecDataDecoder):
real_after_cal = impedance * math.cos(round(phase) * math.pi / 180)
if self._show_data:
if (self._mode == 0 or self._mode == 5):
if (self._mode == 0):
print('|', '{:10}'.format(time_stamp),
'|', '{:5}'.format(delta),
'|', '{:6}'.format(ch1),
@@ -1630,7 +1631,7 @@ class EISZeroOneDataDecoder(RecDataDecoder):
'|', '{:5}'.format(round(current, 3)),
'|', '{:1}'.format(gain),
'|', '{:1}'.format(finishMode),
'@', str(self.device), '|', flush = True)
'@', str(self.device), '|')
pass
else:
print('|', '{:10}'.format(time_stamp),
@@ -1641,7 +1642,7 @@ class EISZeroOneDataDecoder(RecDataDecoder):
'|', '{:5}'.format(cycle_number),
'|', '{:1}'.format(gain),
'|', '{:1}'.format(finishMode),
'@', str(self.device), '|', flush = True)
'@', str(self.device), '|')
pass
if finishMode == True:
@@ -1651,7 +1652,7 @@ class EISZeroOneDataDecoder(RecDataDecoder):
self._mode_stop = 0
ret = RecordingData(self.device, int(time_stamp * 1000 / 2), 0)
if self._mode == 0 or self._mode == 5: #EIS Mode
if (self._mode == 0): #EIS Mode
ret.append_data(0, ch1) #Raw Imag
ret.append_data(1, ch2) #Raw Real
ret.append_data(2, ch3 * 10) #Frequency [mHz]
+1 -1
View File
@@ -738,7 +738,7 @@ class DeviceCommonInstruction:
elif instruction == cls.START:
return '_data_format("TDC4VAF2")', '_notify(True)', 'VIS_STI', '_sync(True)'
elif instruction == cls.INTERRUPT:
return '_notify(False)', 'VIS_INT', '_sync(False)'
return '_sync(False)', '_notify(False)', 'VIS_INT'
elif instruction == cls.CLOSE:
return '_sync(False)', '_notify(False)', 'VIS_INT'
elif instruction == cls.CALL:
-2
View File
@@ -283,7 +283,6 @@ class InternalInstruction(SingleInstruction):
PREDEFINED_SET = '_set'
PREDEFINED_CDR = '_cdr'
PREDEFINED_DISABLE_CACHE = '_disable_cache'
PREDEFINED_IDLE = '_idle'
PREDEFINED = (
PREDEFINED_SLEEP,
@@ -295,7 +294,6 @@ class InternalInstruction(SingleInstruction):
PREDEFINED_SET,
PREDEFINED_CDR,
PREDEFINED_DISABLE_CACHE,
PREDEFINED_IDLE,
)
__slots__ = ('_expr', '_para')
+2 -13
View File
@@ -968,7 +968,7 @@ class CompletedDevice(Device):
"""
__slots__ = ('_master', '_device_id', '_device', '_library', '_context',
'_parameter', '_configuration', '_lock', '_feature_mask',
'_cache_battery', '_cache_battery_timestamp', '_coeff', '_status', '_occupied_by_project')
'_cache_battery', '_cache_battery_timestamp', '_coeff', '_status')
def __init__(self, master: MasterDevice, library: DeviceLibrary, device_id: int, device: Device):
"""
@@ -986,8 +986,6 @@ class CompletedDevice(Device):
# device status ( 0: idle, 1: working, 2: error, 3: power off)
self._status = 0
# device be occupied by project
self._occupied_by_project = None
# context
s1 = library.constant
@@ -1084,14 +1082,6 @@ class CompletedDevice(Device):
def status(self, new_status):
self._status = new_status
@property
def occupied_by_project(self) -> str:
return self._occupied_by_project
@occupied_by_project.setter
def occupied_by_project(self, new_occupied_by_project):
self._occupied_by_project = new_occupied_by_project
# device parameter getter/setter
def parameters(self) -> List[str]:
@@ -1141,7 +1131,7 @@ class CompletedDevice(Device):
# raise RuntimeError('illegal parameter value : ' + value) from e
else:
if name == 'MODE':
if self.library_name.startswith('Elite_EDC') or 'EIS' in self.library_name:
if self.library_name.startswith('Elite_EDC'):
self.set_parameter('CTRL_HIGH_Z_15', self.get_parameter('HIGHZ_TABLE')[value])
self.set_parameter('TIME_DURATION', 0)
@@ -1313,7 +1303,6 @@ class CompletedDevice(Device):
'recording_file_name': self.recording_file_name,
'library_name': self._library.name,
'library_version': str(self._library.version),
'occupied_by_project': self._occupied_by_project,
'configuration': self.configuration.as_json(list_hide=True),
}
+4 -58
View File
@@ -1,7 +1,6 @@
import sys
import json
import threading
import logging
from time import time, sleep
from datetime import datetime
@@ -47,20 +46,10 @@ class Project(threading.Thread):
self._count = 1 #流水號
self.log_verbose = log_verbose
self._logger = logging.getLogger('project')
self._logger.setLevel('DEBUG')
self._formatter = logging.Formatter('[%(asctime)s.%(msecs)03d] %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
self._formatter_with_nothing = logging.Formatter('%(message)s')
self.setup_project(project)
self.setup_device(self._device)
# create log file handler
fh = logging.FileHandler(f'{self.uuid}.log', mode="w")
fh.setFormatter(self._formatter)
self._logger.addHandler(fh)
def setup_project(self, project):
for (key, value) in project.items():
if key in key_list.keys():
@@ -77,7 +66,6 @@ class Project(threading.Thread):
for device in device_list:
mac_address = device_list[device]['pair']
complete_device = self._device_manager.get_device(mac_address)
complete_device.occupied_by_project = self._uuid
self._complete_device[device] = complete_device
@property
@@ -148,23 +136,9 @@ class Project(threading.Thread):
def running_task(self):
return self._task_manager.running_task
def get_device_parameter_set(self, device_address):
parameter_set = self._task_manager.running_task.parameter_set
return next((x for x in parameter_set if parameter_set[x]['target'] == device_address), None)
def get_cycle(self, task):
for index, _cycle in enumerate(self.cycle):
if task.uuid in _cycle['range']:
return _cycle
def run(self):
# project status change running (1)
self._status = 1
# save start time
self._start_time = time()
# saving & broadcast message
self._logger.info('Project ' + self.name + ' start')
self.log_verbose('Project ' + self.name + ' start')
self.mqtt_thread.broadcast_command('project:' + self._name + ' start at ' + datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3])
@@ -187,17 +161,12 @@ class Project(threading.Thread):
for condition in match_condition_list:
match_action_list = task.get_match_action(condition.id)
print('match_action_list', match_action_list, match_action_list)
for action in match_action_list:
if action.type == 'cycle' and condition.type == 'previous_task_done':
self.mqtt_thread.broadcast_command('project:task ' + task.name + ' start at ' + datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3])
self._task_manager.set_running_task(task)
cycle_info = self.get_cycle(task)
if cycle_info['useID'] == False:
self._logger.info(f'---------- Cycle {task.name} Round {cycle_info["count"]} -----------')
if action.type == 'cycle' and condition.type == 'until_button_trigger':
self._task_manager.running_task.stop()
self._logger.info(f'---------- Cycle {cycle_info["id"]} Round {cycle_info["count"]} -----------')
if self._task_manager.running_task != None:
if self._task_manager.running_task.uuid == task.uuid and action.type == 'cycle' and condition.type == 'after_task_run':
@@ -206,7 +175,6 @@ class Project(threading.Thread):
if action.type == 'start':
if task.status != 1:
self._task_manager.set_running_task(task)
self._logger.info(f'Task {str(self._task_manager.running_task.name)} start')
self.mqtt_thread.broadcast_command('project:task ' + task.name + ' start at ' + datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3])
# elif action.type == 'stop':
# self.mqtt_thread.broadcast_command('project:task ' + str(self._task_manager.running_task.name) + ' stop at ' + datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3])
@@ -216,15 +184,12 @@ class Project(threading.Thread):
elif action.type == 'idle':
self._task_manager.running_task.stop()
# elif action.type == 'stop':
# self._task_manager.running_task.stop()
instruction_set = None
if action.target is not None:
device = self._complete_device[action.target]
if ((action.type == 'start' and device.status == 0) or (action.type == 'stop' and device.status == 1)):
self._logger.info(f'Device {device.mac_address_in_str} {action.type}')
self.log_verbose('Project' + self.name + 'Task ' + task.name + ' match_condition ' + condition.type + ' trigger_action ' + action.type + ' ' + str(action.target))
task_info = task.get_task_info(action)
instruction_set = getattr(self._instruction_set, action.type, None)
@@ -258,7 +223,7 @@ class Project(threading.Thread):
task_info['file_name'] += '#' + str(cycle_info['name']) + '-' + str(cycle_info['count'])
self.log_verbose('file name ' + task_info['file_name'])
if instruction_set != None and self.get_device_parameter_set(action.target) != None:
if instruction_set != None and len(task.parameter_set) > 0:
if action.type == 'start':
self._count += 1
for instruction in instruction_set:
@@ -271,16 +236,14 @@ class Project(threading.Thread):
# check task not running then stop
if self.check_running_task_not_run() == True:
# self._logger.info(f'taskType {self._task_manager.running_task.name} {self._task_manager.running_task.type}')
if self._task_manager.running_task.type == '':
self._logger.info(f'Task {self._task_manager.running_task.name} stop')
self.mqtt_thread.broadcast_command('project:task ' + str(self._task_manager.running_task.name) + ' stop at ' + datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3])
self._task_manager.running_task.stop()
# check project done then close project
if self.check_project_done() == True:
print('project stop at', datetime.now())
self.stop()
self.close()
if self._time_interval - delay_time > 0:
sleep(self._time_interval - delay_time)
@@ -290,19 +253,14 @@ class Project(threading.Thread):
pass
def stop(self):
for device in self._complete_device:
self._complete_device[device].occupied_by_project = None
self._task_manager.running_task.stop()
self.mqtt_thread.broadcast_command('project:task ' + str(self._task_manager.running_task.name) + ' stop at ' + datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3])
self._status = 2
self._end_time = time()
self._stop_flag = True
self._logger.info('Project ' + self.name + ' stop')
self.mqtt_thread.broadcast_command('project:project ' + str(self._name) + ' stop at ' + datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3])
def close(self):
for device in self._complete_device:
self._complete_device[device].occupied_by_project = None
self._status = 2
self._end_time = time()
self._stop_flag = True
@@ -361,18 +319,6 @@ class Project(threading.Thread):
'device': self._device,
'task': self.task_list,
'running_task': running_task,
'cycle': self._cycle,
'count': self._count,
}
return data
def info_pass_data_server(self):
if self._task_manager.running_task is not None:
running_task = self._task_manager.running_task.as_json()
data = {
'project': self._uuid,
'task': running_task,
'cycle': self._cycle,
'serial_number': self._count,
'cycle': self._cycle
}
return data
+2 -15
View File
@@ -56,11 +56,6 @@ class TaskManager():
def get_index_by_uuid(self, uuid):
return next((i for i, x in enumerate(self.task_list) if x.uuid == uuid), None)
def check_task_is_cycle_start(self, task):
for index, cycle in enumerate(self._cycle_list):
if cycle['range'][0] == task.uuid:
return index
def check_task_is_cycle_end(self, task):
for index, cycle in enumerate(self._cycle_list):
@@ -126,7 +121,6 @@ class TaskManager():
if self._prev_task.status == 1:
self._prev_task.stop()
# if reach cycle end, count < max, then go to cycle start
cycle_start_index = self.check_task_is_cycle_start(task)
cycle_index = self.check_task_is_cycle_end(task)
if cycle_index is None:
# print('next', self._running_task.name, self._running_task.next)
@@ -141,21 +135,14 @@ class TaskManager():
cycle = self._cycle_list[cycle_index]
if int(cycle['count']) < int(cycle['max']):
self._next_task.append(self.get_task_by_uuid(cycle['range'][0]))
# cycle['count'] += 1
cycle['count'] += 1
else:
for task_uuid in self._running_task.next:
_task = next((task for task in self._task_list if task.uuid == task_uuid), None)
if _task != None:
_task.reset()
self._next_task.append(_task)
# cycle['count'] = 1
if cycle_start_index != None:
cycle = self._cycle_list[cycle_start_index]
if int(cycle['count']) < int(cycle['max']):
cycle['count'] += 1
else:
cycle['count'] = 1
cycle['count'] = 1
except RuntimeError as e:
print(e)
+4 -15
View File
@@ -118,7 +118,7 @@ class RecordingMetaFile(JsonSerialize):
'_dirty', '_last_modify_time', '_file_size_cache',
'_recording_file_ch', '_recording_sub_file', '_size',
'_parameter', '_parent', '_recording_file_name', '_recording_sub_mini', '_recording_mini_ch',
'_raw_serial_number', '_mini_serial_number', '_device_id', '_project_id')
'_raw_serial_number', '_mini_serial_number', '_device_id')
def __init__(self, filepath: Union[str, Path], data_format: bytes = None, id_db = 0, database = None):
if isinstance(filepath, str):
@@ -153,7 +153,6 @@ class RecordingMetaFile(JsonSerialize):
self._parent = ''
self._recording_file_name = ''
self._device_id = -1
self._project_id = None
# recording parameter
self._configuration = None
@@ -298,7 +297,6 @@ class RecordingMetaFile(JsonSerialize):
'uuid': str(self._file_uuid),
'data_format': 'rec',
'device': self._device,
'project': self._project_id,
}
if len(self._parent) > 0:
@@ -464,7 +462,7 @@ class RecordingMetaFile(JsonSerialize):
def parameter(self) -> str:
return self._parameter
@parameter.setter
@device.setter
def parameter(self, parameter):
self._parameter = parameter
return None
@@ -473,7 +471,7 @@ class RecordingMetaFile(JsonSerialize):
def parent(self) -> str:
return self._parent
@parent.setter
@device.setter
def parent(self, parent):
self._parent = parent
@@ -481,7 +479,7 @@ class RecordingMetaFile(JsonSerialize):
def recording_file_name(self) -> str:
return self._recording_file_name
@recording_file_name.setter
@device.setter
def recording_file_name(self, recording_file_name):
self._recording_file_name = recording_file_name
@@ -494,15 +492,6 @@ class RecordingMetaFile(JsonSerialize):
self._configuration = conf
self._dirty = True
return None
@property
def project_id(self) -> int:
return self._project_id
@project_id.setter
def project_id(self, project: int):
self._project_id = project
return None
@property
def channels(self) -> List[int]:
+10 -18
View File
@@ -4,6 +4,7 @@ from time import time, sleep
from typing import Iterable
from datetime import datetime
import gc
import base64
from biopro.data import *
@@ -26,6 +27,7 @@ from .mqtt import MqttDataMessageHandler, MqttThread
from .database import DataBaseProcess
from .recording import RecordingProcess
from multiprocessing import Queue
import queue
from json import loads as json_parse, dumps as _json_stringify
import json
@@ -315,8 +317,7 @@ class DataServer(SocketServer, DataAPI):
def update_device_configuration(self,
device: str,
meta_file: Union[str, Path, RecordingMetaFile],
data_format: Union[AnyStr, DataDecodeFormat],
project_info: str):
data_format: Union[AnyStr, DataDecodeFormat]):
# meta file
device_id = -1
@@ -344,8 +345,6 @@ class DataServer(SocketServer, DataAPI):
_parent = json_stringify(_device['parent'])
_recording_file_name = _device['recording_file_name']
mac_address = json.loads(device)['device_address']
device_id = _device['device_id']
del _device['configuration']
del _device['parent']
del _device['recording_file_name']
@@ -355,22 +354,13 @@ class DataServer(SocketServer, DataAPI):
# meta_file.parameter = _parameter
# meta_file.parent = _parent
# meta_file.recording_file_name = _recording_file_name
device_id = int(json.loads(device)['device_id'])
if device_id < 0:
raise ValueError('illegal device ID : ' + str(device_id))
self.log_verbose('device ID', device_id)
# project binding meta file
project_id = None
_project = None
if project_info != None:
_project = json.loads(project_info)
self.database_process.put_queue(['project_insert', device_id, _project])
result = self._queue_ds_dict[int(device_id)].get()
if result[0] == 'project_id':
project_id = result[1]
# while len(self._configurations) <= device_id:
# self._configurationsappend(None)
@@ -390,6 +380,8 @@ class DataServer(SocketServer, DataAPI):
else:
data_format = data_format.name
# self.log_verbose('device data format', data_format)
self.log_verbose('device meta file', meta_file)
# data runtime
@@ -414,15 +406,15 @@ class DataServer(SocketServer, DataAPI):
c.shutdown()
c.join()
self._spi.set_wait_flag(c._device, True)
data_runtime_process = RecordingProcess('data_server', self.log_verbose, device_id,
Queue(), self._queue_ds_dict[int(device_id)], self._queue_msg, meta_file,
json_stringify(_device), _parameter, _parent, _recording_file_name,
data_format, self.socket_mqtt_ip, self.socket_mqtt_port,
project_id = project_id,
database = self.database_process)
data_format, self.socket_mqtt_ip, self.socket_mqtt_port,
database = self.database_process )
# data_runtime_process.start()
# check channel
if isinstance(data_runtime_process, RecordingProcess) and device_id not in self._available_channel:
raise RuntimeError('set device configuration on un-available channel', device_id)
+1 -30
View File
@@ -550,33 +550,4 @@ class DataBaseProcess(Process):
except psycopg2.Error as e:
print('e', e)
return True
def project_insert(self, device_id, _data):
sql_str = 'INSERT INTO "public"."meta_project_info" ('
sql_set = []
for item in _data.keys():
sql_str = sql_str + str(item) + ', '
if isinstance(_data[item], dict) or isinstance(_data[item], list):
sql_set.append(json_stringify(_data[item]))
else:
sql_set.append(_data[item])
sql_str = sql_str[0:-2] + ') VALUES ('
for item in _data.keys():
sql_str = sql_str + '%s, '
sql_str = sql_str[0:-2] + ') RETURNING id'
sql_cursor = self._psql_conn.cursor()
try:
sql_cursor.execute(sql_str, sql_set)
except BaseException as e:
print('insert error', e)
self._psql_conn.commit()
sql_cursor.close()
self._queue_error.put()
finally:
self._queue_ds[int(device_id)].put(['project_id', int(sql_cursor.fetchone()[0])])
self._psql_conn.commit()
sql_cursor.close()
return True
+17 -43
View File
@@ -1,7 +1,6 @@
from time import sleep
from typing import Iterable
from datetime import datetime
import json
import biopro.impl.vcgencmd as vcg
from biopro.data import DataServerOptions, DataAPI
@@ -32,10 +31,8 @@ from biopro.api.auth import AuthAPI
from biopro.api.controller import ControllerAPI
from biopro.api.device import DeviceAPI
from biopro.project.project_manager import ProjectManager
from biopro.db.base import Base, Session, engine
from biopro.db.project_report import ProjectReport
from biopro.db.meta_project_info import MetaProjectInfo
### do not import Websocket mode
###from .websocket import WebsocketThread
_RUNTIME_COMPILE = False
@@ -120,8 +117,8 @@ class ControlServer(SocketServer, ControlServerAPI):
self.ups_thread = UPSDetectThread(self, c.flag_ups_wait_time)
# user session
# self._session = {}
# self._user_session_expire = c.user_session_expire_days * 24 * 60 * 60 # sec
self._session = {}
self._user_session_expire = c.user_session_expire_days * 24 * 60 * 60 # sec
# indicate those device together
self._device_instruction_group = None
@@ -132,10 +129,6 @@ class ControlServer(SocketServer, ControlServerAPI):
# _api request build
self._api = ApiRequests()
# sqlalchemy
Base.metadata.create_all(engine)
self._session = Session()
# init method
def _init_file_manager(self, option: ControlServerOptions) -> FileManager:
@@ -827,19 +820,16 @@ class ControlServer(SocketServer, ControlServerAPI):
@logging_info
def device_battery(self, device:int) -> List[int]:
try:
battery = {}
if device == 'all':
device_list = self.device_manager.list_device()
if len(device_list) > 0:
battery = list(map(lambda x: {"device": x.memory_board, "battery":self.device_manager.get_device(x).battery}, device_list))
else:
battery = {
"device": device,
"battery": self.device_manager.get_device(device).battery
}
except AttributeError as e:
print('device_battery', device, 'not found', e)
battery = {}
if device == 'all':
device_list = self.device_manager.list_device()
if len(device_list) > 0:
battery = list(map(lambda x: {"device": x.memory_board, "battery":self.device_manager.get_device(x).battery}, device_list))
else:
battery = {
"device": device,
"battery": self.device_manager.get_device(device).battery
}
return battery
@logging_info
@@ -1031,17 +1021,8 @@ class ControlServer(SocketServer, ControlServerAPI):
@logging_info
def run_project(self, project) -> bool:
if project is not None:
# print(project)
project = self._project_manager.create(project)
with self._session as session:
project_report = ProjectReport(
name = project.name,
uuid = project.uuid,
cycle = project.cycle,
task = project.task_list,
device = project.device
)
session.add(project_report)
session.commit()
self._project_manager.run_project(project)
return project.as_json()
@@ -1083,10 +1064,6 @@ class ControlServer(SocketServer, ControlServerAPI):
elif oper == InternalInstruction.PREDEFINED_DISABLE_CACHE:
return True
elif oper == InternalInstruction.PREDEFINED_IDLE:
device.status = 1
return True
else:
return False
@@ -1101,7 +1078,6 @@ class ControlServer(SocketServer, ControlServerAPI):
self.log_verbose('update data format', value)
client = self.data_server.client()
project = None
if client is not None:
info = self.file_manager.use(device)
@@ -1112,12 +1088,9 @@ class ControlServer(SocketServer, ControlServerAPI):
filename = self._file_save_cache.get(device.device_id, self.TEMP_FILENAME_EXPR)
filename = format_filename(filename, device)
info = self.file_manager.save(device, filename)
if device.occupied_by_project != None:
project = json.dumps(self.project_manager.get(device.occupied_by_project).info_pass_data_server())
with client:
client.update_device_configuration(device, info.meta_file, value, project)
client.update_device_configuration(device, info.meta_file, value)
def _device_set_disable_cache(self, device: CompletedDevice, disable):
if disable:
@@ -1151,6 +1124,7 @@ class ControlServer(SocketServer, ControlServerAPI):
filename = format_filename(self.TEMP_FILENAME_EXPR, device)
info = self.file_manager.save(device, filename)
client.update_device_configuration(device, info.meta_file, RawDataDecoder())
if self._device_instruction_group is None:
client.start_sync(device)
+4 -5
View File
@@ -44,9 +44,7 @@ class RecordingProcess(Process):
def __init__(self, client_id: str, log_verbose, device_id, queue_rec, queue_ds, queue_msg, meta_path,
device_info, parameter, parent, recording_file_name, data_format,
mqtt_ip, mqtt_port,
name = 'Recording-Process',
project_id = None,
database = None):
name = 'Recording-Process', database = None):
super(RecordingProcess, self).__init__(name = name)
self._database = database
@@ -59,7 +57,6 @@ class RecordingProcess(Process):
self._meta_file._parent = parent
self._meta_file._recording_file_name = recording_file_name
self._meta_file._device_id = device_id
self._meta_file._project_id = project_id
print(self._meta_file._device, self._meta_file._parameter, self._meta_file._parent, self._meta_file._filepath)
self._meta_file.write(self._database)
@@ -158,7 +155,9 @@ class RecordingProcess(Process):
elif isinstance(decoder, EISZeroOneDataDecoder):
# get amp_gain from meta file
decoder._mode = self._meta_file.configuration.get_parameter('MODE')
decoder._ac_amp = self._meta_file.configuration.get_parameter('EIS_AC_AMP')
decoder._ac_amp = self._meta_file.configuration.get_parameter('AC_AMP')
decoder._freq_start = self._meta_file.configuration.get_parameter('FREQ_START')
decoder._freq_stop = self._meta_file.configuration.get_parameter('FREQ_STOP')
return decoder
@@ -33,7 +33,6 @@
0,
1,
1,
1,
1
],
"domain": {
@@ -618,8 +617,7 @@
"Open Circuit Potential",
"Pulse Sensing",
"Differential Pulse Voltammetry (DPV)",
"Chronopotentiometry",
"Idle"
"Chronopotentiometry"
]
},
"VOLT_ORIGIN": {
@@ -951,7 +949,6 @@
"10": "cali_dac_test",
"11": "cali_adc_test",
"12": "",
"17": "idle",
"*": "start_data"
}
}
@@ -979,9 +976,6 @@
"VIS_STI",
"_cdr('1X;4X>ADC_VALUE_I')"
],
"idle": [
"_idle()"
],
"start_data": [
"data_format",
"_notify(True)",
+176 -338
View File
@@ -9,7 +9,7 @@
"minor_version_number": 0
},
"constant": {
"FREQ_MAX": 13333334,
"FREQ_MAX": 4294967296,
"VOLT_MAX": 65536,
"BLE_WRITE_MAX": 255,
"TIME_MAX": 100000
@@ -26,43 +26,17 @@
"expression": "VALUE"
}
},
"HIGHZ_TABLE": {
"initial": [
1,
1,
1,
0,
1,
1,
1
],
"domain": {
"list": [
100
]
},
"value": "VALUE"
},
"CTRL_HIGH_Z_15": {
"description": "ctrl highZ level",
"CHANNEL": {
"derzteription": "record channels",
"record_meta": true,
"initial": 1,
"value": [
"On",
"Off"
],
"on_change": "set_ctrl_highZ"
"domain": "property",
"value": "[0, 1, 2]"
},
"CYCLE_NUMBER": {
"description": "CV cycle number",
"CHANNEL_LABEL": {
"description": "channel label",
"record_meta": true,
"initial": 1,
"domain": [
65536
],
"value": {
"expression": "VALUE"
}
"domain": "property",
"value": "['current', 'voltage', 'impedance']"
},
"SAMPLE_RATE": {
"description": "data sampling rate",
@@ -76,12 +50,6 @@
},
"on_change": "set_sample_rate"
},
"CHANNEL": {
"derzteription": "record channels",
"record_meta": true,
"domain": "property",
"value": "[0, 1, 2]"
},
"AMP_GAIN": {
"description": "amp gain",
"record_meta": true,
@@ -95,59 +63,11 @@
"EIS CURVE",
"Cyclic Voltammetry",
"Chronoamperometric",
"V-T Graph",
"R-T Graph",
"EIS constant frequency",
"Dev Mode"
]
},
"GENERAL_HS_RTIA": {
"description": "High speed rtia gain",
"record_meta": true,
"initial": 4,
"value": [
0,
1,
2,
3,
4
],
"on_change": "set_general_hs_rtia"
},
"GENERAL_LP_RTIA": {
"description": "Low power rtia gain",
"record_meta": true,
"initial": 4,
"value": [
"0",
"1",
"2",
"3",
"auto"
],
"on_change": "set_general_lp_rtia"
},
"EIS_DC_BIAS": {
"description": "DC voltage bias",
"record_meta": true,
"initial": 25000,
"domain": [
"VOLT_MAX"
],
"value": {
"expression": "VALUE"
}
},
"EIS_AC_AMP": {
"description": "AC Amplitude",
"record_meta": true,
"initial": 25,
"domain": [
2048
]
},
"EIS_FREQ": {
"description": "[start, stop] of frequency scan",
"FREQ": {
"description": "DPV current recording period start",
"record_meta": true,
"initial": [
13333333,
@@ -160,24 +80,29 @@
},
"value": "VALUE"
},
"EIS_PPD": {
"description": "Point per decades",
"FREQ_START": {
"description": "Start of Freq Scan",
"record_meta": true,
"initial": 10,
"initial": 13422819,
"domain": [
11
]
"FREQ_MAX"
],
"value": {
"expression": "VALUE"
}
},
"EIS_SCALE": {
"description": "Point spacing pattern",
"FREQ_STOP": {
"description": "End of Freq Scan",
"record_meta": true,
"initial": 0,
"value": [
0,
1
]
"initial": 7,
"domain": [
"FREQ_MAX"
],
"value": {
"expression": "VALUE"
}
},
"EIS_DELAY": {
"DELAY": {
"description": "Wait x peroid before start taking measurements",
"record_meta": true,
"initial": 0,
@@ -188,19 +113,19 @@
"expression": "VALUE"
}
},
"EIS_AVERAGE_NUM": {
"AVERAGE_NUM": {
"description": "Number of sample used for average funciton",
"record_meta": true,
"initial": 8,
"value": [
2,
4,
6,
8
8,
16
]
},
"CF_DC_BIAS": {
"description": "DC voltage bias",
"DC_BIAS": {
"description": "DC voltage bias in mV",
"record_meta": true,
"initial": 25000,
"domain": [
@@ -210,34 +135,15 @@
"expression": "VALUE"
}
},
"CF_AC_AMP": {
"description": "AC Amplitude",
"AC_AMP": {
"description": "AC Amplitude in mV",
"record_meta": true,
"initial": 25,
"domain": [
2048
]
},
"CF_FREQ": {
"description": "frequency of cf",
"record_meta": true,
"initial": 13333333,
"domain": [
"FREQ_MAX"
],
"value": {
"expression": "VALUE"
}
},
"CF_PPD": {
"description": "Point per decades",
"record_meta": true,
"initial": 10,
"domain": [
11
]
},
"CF_SCALE": {
"SCALE": {
"description": "Point spacing pattern",
"record_meta": true,
"initial": 0,
@@ -246,29 +152,77 @@
1
]
},
"CF_DELAY": {
"description": "Wait x peroid before start taking measurements",
"PPD": {
"description": "Point per decades",
"record_meta": true,
"initial": 0,
"initial": 10,
"domain": [
101
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"
}
},
"CF_AVERAGE_NUM": {
"description": "Number of sample used for average funciton",
"CTRL_HIGH_Z_15": {
"description": "ctrl highZ level",
"record_meta": true,
"initial": 8,
"initial": 1,
"value": [
2,
4,
6,
8
]
"On",
"Off"
],
"on_change": "set_ctrl_highZ"
},
"CV_E_INITIAL": {
"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,
@@ -279,8 +233,8 @@
"expression": "VALUE"
}
},
"CV_E1": {
"description": "First voltage of Scan",
"VOLT_MAX": {
"description": "Max Voltage of Scan",
"record_meta": true,
"initial": 25000,
"domain": [
@@ -290,8 +244,8 @@
"expression": "VALUE"
}
},
"CV_E2": {
"description": "Second voltage of Scan",
"VOLT_MIN": {
"description": "Min Voltage of Scan",
"record_meta": true,
"initial": 25000,
"domain": [
@@ -301,54 +255,27 @@
"expression": "VALUE"
}
},
"CV_SCAN_RATE": {
"description": "Voltage scan rate",
"CYCLE_NUMBER": {
"description": "CV cycle number",
"record_meta": true,
"initial": 10000,
"domain": [
100001
],
"value": {
"expression": "VALUE"
}
},
"CA_VOLT": {
"description": "Voltage of ca",
"record_meta": true,
"initial": 25000,
"domain": [
"VOLT_MAX"
],
"value": {
"expression": "VALUE"
}
},
"VT_MEASURE_VIN_RANGE": {
"description": "measure range of Vin",
"record_meta": true,
"initial": 0,
"value": [
"0",
"1",
"2",
"auto"
]
},
"RT_VOLT_SET": {
"description": "DAC output Voltage",
"record_meta": true,
"initial": 37500,
"initial": 1,
"domain": [
65536
],
"value": {
"expression": "VALUE"
},
"on_change": "set_para_RT_VOLT_SET"
}
},
"ADC_VALUE_I": {
"description": "ADC value current value",
"domain": "int"
"VOLT_VSCAN": {
"description": "Voltage of VScan",
"record_meta": true,
"initial": 25000,
"domain": [
"VOLT_MAX"
],
"value": {
"expression": "VALUE"
}
},
"BLE_WRITE": {
"description": "send msg to elite",
@@ -380,12 +307,15 @@
{
"expression": "MODE",
"when": {
"0": "set_general_hs_rtia",
"1": "set_general_lp_rtia",
"2": "set_general_lp_rtia",
"3": "set_general_lp_rtia",
"4": "set_general_lp_rtia",
"5": "set_general_hs_rtia"
"1": "set_adc_gain_I",
"2": "set_adc_gain_I"
}
},
{
"expression": "MODE",
"when": {
"1": "set_adc_gain_Vin",
"2": "set_adc_gain_Vin"
}
},
{
@@ -393,25 +323,14 @@
"when": {
"0": "curve_eis",
"1": "curve_cv3",
"2": "curve_ca",
"3": "curve_vt",
"4": "curve_rt",
"5": "curve_cf"
"2": "curve_const_vscan"
}
},
{
"expression": "MODE",
"when": {
"0": "curve_eis_para2",
"1": "curve_cv3_para2",
"5": "curve_cf_para2"
}
},
{
"expression": "MODE",
"when": {
"0": "curve_eis_mode",
"5": "curve_cf_mode"
"1": "curve_cv3_para2"
}
},
"_sync(True)",
@@ -431,18 +350,6 @@
"data_format_cali": [
"_data_format_cali('EISZeroOne')"
],
"set_general_hs_rtia": {
"type": "RIS",
"data": [
"1XFF;1X70;1B>GENERAL_HS_RTIA"
]
},
"set_general_lp_rtia": {
"type": "RIS",
"data": [
"1XFF;1X71;1B>GENERAL_LP_RTIA"
]
},
"set_sample_rate": {
"type": "RIS",
"parameter": {
@@ -452,172 +359,103 @@
"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": [
"1XFF;1X72;1B>CTRL_HIGH_Z_15"
"XE1;X03;B>CTRL_HIGH_Z_15"
]
},
"curve_eis": {
"type": "RIS",
"parameter": {
"fa": "EIS_FREQ[0]",
"fb": "EIS_FREQ[1]",
"dp": "EIS_DELAY",
"dc": "EIS_DC_BIAS",
"am": "EIS_AC_AMP",
"an": "EIS_AVERAGE_NUM",
"rt": "GENERAL_HS_RTIA",
"pp": "EIS_PPD",
"sp": "EIS_SCALE"
"fa": "FREQ[0]",
"fb": "FREQ[1]",
"dp": "DELAY",
"dc": "DC_BIAS",
"am": "AC_AMP",
"an": "AVERAGE_NUM",
"rt": "RTIA",
"pp": "PPD",
"sp": "SCALE"
},
"data": [
"1X12;1X01;4B>fa;4B>fb;2B>dp"
"1XD1;1X01;4B>fa;4B>fb;2B>dp"
]
},
"curve_eis_para2": {
"type": "RIS",
"parameter": {
"fa": "EIS_FREQ[0]",
"fb": "EIS_FREQ[1]",
"dp": "EIS_DELAY",
"dc": "EIS_DC_BIAS",
"am": "EIS_AC_AMP",
"an": "EIS_AVERAGE_NUM",
"rt": "GENERAL_HS_RTIA",
"pp": "EIS_PPD",
"sp": "EIS_SCALE"
"fa": "FREQ[0]",
"fb": "FREQ[1]",
"dp": "DELAY",
"dc": "DC_BIAS",
"am": "AC_AMP",
"an": "AVERAGE_NUM",
"rt": "RTIA",
"pp": "PPD",
"sp": "SCALE"
},
"data": [
"1X12;1X02;2B>dc;2B>am;B>an;B>rt;2B>pp;B>sp"
]
},
"curve_eis_mode": {
"type": "RIS",
"data": [
"1X12;1XFF"
]
},
"curve_cf": {
"type": "RIS",
"parameter": {
"fa": "CF_FREQ",
"dp": "CF_DELAY",
"dc": "CF_DC_BIAS",
"am": "CF_AC_AMP",
"an": "CF_AVERAGE_NUM",
"rt": "GENERAL_HS_RTIA",
"pp": "CF_PPD",
"sp": "CF_SCALE"
},
"data": [
"1X13;1X01;4B>fa;4B>0;2B>dp"
]
},
"curve_cf_para2": {
"type": "RIS",
"parameter": {
"fa": "CF_FREQ",
"dp": "CF_DELAY",
"dc": "CF_DC_BIAS",
"am": "CF_AC_AMP",
"an": "CF_AVERAGE_NUM",
"rt": "GENERAL_HS_RTIA",
"pp": "CF_PPD",
"sp": "CF_SCALE"
},
"data": [
"1X13;1X02;2B>dc;2B>am;B>an;B>rt;2B>pp;B>sp"
]
},
"curve_cf_mode": {
"type": "RIS",
"data": [
"1X13;1XFF"
"1XD1;1X02;2B>dc;2B>am;B>an;B>rt;2B>pp;B>sp"
]
},
"curve_cv3": {
"type": "RIS",
"parameter": {
"va": "CV_E_INITIAL",
"vb": "CV_E1",
"vc": "CV_E2",
"ve": "CV_SCAN_RATE",
"va": "VOLT_INITIAL",
"vb": "VOLT_MAX",
"vc": "VOLT_MIN",
"ve": "Scan_Rate",
"vf": "SAMPLE_RATE",
"cn": "CYCLE_NUMBER"
},
"data": [
"1X09;1X01;2B>va;2B>vb;2B>vc;"
"1XD2;1X01;2B>va;2B>vb;2B>vc;"
]
},
"curve_cv3_para2": {
"type": "RIS",
"parameter": {
"va": "CV_E_INITIAL",
"vb": "CV_E1",
"vc": "CV_E2",
"ve": "CV_SCAN_RATE",
"va": "VOLT_INITIAL",
"vb": "VOLT_MAX",
"vc": "VOLT_MIN",
"ve": "Scan_Rate",
"vf": "SAMPLE_RATE",
"cn": "CYCLE_NUMBER"
},
"data": [
"1X09;1X02;4B>ve;2B>vf;2B>cn"
"1XD2;1X02;4B>ve;2B>vf;2B>cn"
]
},
"curve_ca": {
"curve_const_vscan": {
"type": "RIS",
"parameter": {
"va": "CA_VOLT",
"pa": "GENERAL_LP_RTIA",
"va": "VOLT_VSCAN",
"pa": "ADC_LEVEL_I_15",
"pb": "ADC_LEVEL_V_IN_15",
"pd": "CTRL_HIGH_Z_15",
"pe": "SAMPLE_RATE"
},
"data": [
"1X0B;",
"1XD3;",
"2B>va;",
"4b>pa;4b>0;",
"4b>pa;4b>pb;",
"4b>0;4b>pd;",
"2B>pe"
]
},
"curve_rt": {
"type": "RIS",
"parameter": {
"va": "RT_VOLT_SET",
"pa": "GENERAL_LP_RTIA",
"pd": "CTRL_HIGH_Z_15",
"pe": "SAMPLE_RATE"
},
"data": [
"X04;",
"2B>va;",
"4b>pa;4b>0;",
"4b>0;4b>pd;",
"2B>pe"
]
},
"curve_vt": {
"type": "RIS",
"parameter": {
"pa": "GENERAL_LP_RTIA",
"pd": "CTRL_HIGH_Z_15",
"pe": "SAMPLE_RATE",
"va": "VT_MEASURE_VIN_RANGE"
},
"data": [
"X05;",
"4b>pa;4b>0;",
"4b>0;4b>pd;",
"2B>pe;",
"1B>va"
]
},
"set_para_RT_VOLT_SET": {
"type": "RIS",
"data": [
"XE2;X01;2B>RT_VOLT_SET"
]
},
"ble_instru_send": [
"ble_write",
"_cdr('20X>ADC_VALUE_I')"
+188 -285
View File
@@ -9,7 +9,7 @@
"minor_version_number": 1
},
"constant": {
"FREQ_MAX": 13333334,
"FREQ_MAX": 4294967296,
"VOLT_MAX": 65536,
"BLE_WRITE_MAX": 255,
"TIME_MAX": 100000
@@ -26,44 +26,17 @@
"expression": "VALUE"
}
},
"HIGHZ_TABLE": {
"initial": [
1,
1,
1,
0,
1,
1,
1,
1
],
"domain": {
"list": [
100
]
},
"value": "VALUE"
},
"CTRL_HIGH_Z_15": {
"description": "ctrl highZ level",
"CHANNEL": {
"derzteription": "record channels",
"record_meta": true,
"initial": 1,
"value": [
"On",
"Off"
],
"on_change": "set_ctrl_highZ"
"domain": "property",
"value": "[0, 1, 2]"
},
"CYCLE_NUMBER": {
"description": "CV cycle number",
"CHANNEL_LABEL": {
"description": "channel label",
"record_meta": true,
"initial": 1,
"domain": [
65536
],
"value": {
"expression": "VALUE"
}
"domain": "property",
"value": "['current', 'voltage', 'impedance']"
},
"SAMPLE_RATE": {
"description": "data sampling rate",
@@ -77,12 +50,6 @@
},
"on_change": "set_sample_rate"
},
"CHANNEL": {
"derzteription": "record channels",
"record_meta": true,
"domain": "property",
"value": "[0, 1, 2]"
},
"AMP_GAIN": {
"description": "amp gain",
"record_meta": true,
@@ -98,58 +65,11 @@
"Chronoamperometric",
"V-T Graph",
"R-T Graph",
"EIS constant frequency",
"Dev Mode",
"Idle"
"Dev Mode"
]
},
"GENERAL_HS_RTIA": {
"description": "High speed rtia gain",
"record_meta": true,
"initial": 4,
"value": [
0,
1,
2,
3,
4
],
"on_change": "set_general_hs_rtia"
},
"GENERAL_LP_RTIA": {
"description": "Low power rtia gain",
"record_meta": true,
"initial": 4,
"value": [
"0",
"1",
"2",
"3",
"auto"
],
"on_change": "set_general_lp_rtia"
},
"EIS_DC_BIAS": {
"description": "DC voltage bias",
"record_meta": true,
"initial": 25000,
"domain": [
"VOLT_MAX"
],
"value": {
"expression": "VALUE"
}
},
"EIS_AC_AMP": {
"description": "AC Amplitude",
"record_meta": true,
"initial": 25,
"domain": [
2048
]
},
"EIS_FREQ": {
"description": "[start, stop] of frequency scan",
"FREQ": {
"description": "DPV current recording period start",
"record_meta": true,
"initial": [
13333333,
@@ -162,24 +82,29 @@
},
"value": "VALUE"
},
"EIS_PPD": {
"description": "Point per decades",
"FREQ_START": {
"description": "Start of Freq Scan",
"record_meta": true,
"initial": 10,
"initial": 13422819,
"domain": [
11
]
"FREQ_MAX"
],
"value": {
"expression": "VALUE"
}
},
"EIS_SCALE": {
"description": "Point spacing pattern",
"FREQ_STOP": {
"description": "End of Freq Scan",
"record_meta": true,
"initial": 0,
"value": [
0,
1
]
"initial": 7,
"domain": [
"FREQ_MAX"
],
"value": {
"expression": "VALUE"
}
},
"EIS_DELAY": {
"DELAY": {
"description": "Wait x peroid before start taking measurements",
"record_meta": true,
"initial": 0,
@@ -190,19 +115,19 @@
"expression": "VALUE"
}
},
"EIS_AVERAGE_NUM": {
"AVERAGE_NUM": {
"description": "Number of sample used for average funciton",
"record_meta": true,
"initial": 8,
"value": [
2,
4,
6,
8
8,
16
]
},
"CF_DC_BIAS": {
"description": "DC voltage bias",
"DC_BIAS": {
"description": "DC voltage bias in mV",
"record_meta": true,
"initial": 25000,
"domain": [
@@ -212,34 +137,15 @@
"expression": "VALUE"
}
},
"CF_AC_AMP": {
"description": "AC Amplitude",
"AC_AMP": {
"description": "AC Amplitude in mV",
"record_meta": true,
"initial": 25,
"domain": [
2048
]
},
"CF_FREQ": {
"description": "frequency of cf",
"record_meta": true,
"initial": 13333333,
"domain": [
"FREQ_MAX"
],
"value": {
"expression": "VALUE"
}
},
"CF_PPD": {
"description": "Point per decades",
"record_meta": true,
"initial": 10,
"domain": [
11
]
},
"CF_SCALE": {
"SCALE": {
"description": "Point spacing pattern",
"record_meta": true,
"initial": 0,
@@ -248,29 +154,77 @@
1
]
},
"CF_DELAY": {
"description": "Wait x peroid before start taking measurements",
"PPD": {
"description": "Point per decades",
"record_meta": true,
"initial": 0,
"initial": 10,
"domain": [
101
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"
}
},
"CF_AVERAGE_NUM": {
"description": "Number of sample used for average funciton",
"CTRL_HIGH_Z_15": {
"description": "ctrl highZ level",
"record_meta": true,
"initial": 8,
"initial": 1,
"value": [
2,
4,
6,
8
]
"On",
"Off"
],
"on_change": "set_ctrl_highZ"
},
"CV_E_INITIAL": {
"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,
@@ -281,8 +235,8 @@
"expression": "VALUE"
}
},
"CV_E1": {
"description": "First voltage of Scan",
"VOLT_MAX": {
"description": "Max Voltage of Scan",
"record_meta": true,
"initial": 25000,
"domain": [
@@ -292,8 +246,8 @@
"expression": "VALUE"
}
},
"CV_E2": {
"description": "Second voltage of Scan",
"VOLT_MIN": {
"description": "Min Voltage of Scan",
"record_meta": true,
"initial": 25000,
"domain": [
@@ -303,19 +257,19 @@
"expression": "VALUE"
}
},
"CV_SCAN_RATE": {
"description": "Voltage scan rate",
"CYCLE_NUMBER": {
"description": "CV cycle number",
"record_meta": true,
"initial": 10000,
"initial": 1,
"domain": [
100001
65536
],
"value": {
"expression": "VALUE"
}
},
"CA_VOLT": {
"description": "Voltage of ca",
"VOLT_VSCAN": {
"description": "Voltage of VScan",
"record_meta": true,
"initial": 25000,
"domain": [
@@ -325,7 +279,7 @@
"expression": "VALUE"
}
},
"VT_MEASURE_VIN_RANGE": {
"MEASURE_VIN_RANGE": {
"description": "measure range of Vin",
"record_meta": true,
"initial": 0,
@@ -336,7 +290,7 @@
"auto"
]
},
"RT_VOLT_SET": {
"DAC_VOLT": {
"description": "DAC output Voltage",
"record_meta": true,
"initial": 37500,
@@ -346,11 +300,7 @@
"value": {
"expression": "VALUE"
},
"on_change": "set_para_RT_VOLT_SET"
},
"ADC_VALUE_I": {
"description": "ADC value current value",
"domain": "int"
"on_change": "set_para_RT_DAC_VOLT"
},
"BLE_WRITE": {
"description": "send msg to elite",
@@ -372,26 +322,29 @@
{
"expression": "MODE",
"when": {
"7": "idle",
"*": "start_data"
}
}
],
"idle": [
"_idle()"
],
"start_data": [
"data_format_cali",
"_notify(True)",
{
"expression": "MODE",
"when": {
"0": "set_general_hs_rtia",
"1": "set_general_lp_rtia",
"2": "set_general_lp_rtia",
"3": "set_general_lp_rtia",
"4": "set_general_lp_rtia",
"5": "set_general_hs_rtia"
"1": "set_adc_gain_I",
"2": "set_adc_gain_I",
"3": "set_adc_gain_I",
"4": "set_adc_gain_I"
}
},
{
"expression": "MODE",
"when": {
"1": "set_adc_gain_Vin",
"2": "set_adc_gain_Vin",
"3": "set_adc_gain_Vin",
"4": "set_adc_gain_Vin"
}
},
{
@@ -399,25 +352,16 @@
"when": {
"0": "curve_eis",
"1": "curve_cv3",
"2": "curve_ca",
"2": "curve_const_vscan",
"3": "curve_vt",
"4": "curve_rt",
"5": "curve_cf"
"4": "curve_zt"
}
},
{
"expression": "MODE",
"when": {
"0": "curve_eis_para2",
"1": "curve_cv3_para2",
"5": "curve_cf_para2"
}
},
{
"expression": "MODE",
"when": {
"0": "curve_eis_mode",
"5": "curve_cf_mode"
"1": "curve_cv3_para2"
}
},
"_sync(True)",
@@ -437,18 +381,6 @@
"data_format_cali": [
"_data_format_cali('EISZeroOne')"
],
"set_general_hs_rtia": {
"type": "RIS",
"data": [
"1XFF;1X70;1B>GENERAL_HS_RTIA"
]
},
"set_general_lp_rtia": {
"type": "RIS",
"data": [
"1XFF;1X71;1B>GENERAL_LP_RTIA"
]
},
"set_sample_rate": {
"type": "RIS",
"parameter": {
@@ -458,146 +390,116 @@
"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": [
"1XFF;1X72;1B>CTRL_HIGH_Z_15"
"XE1;X03;B>CTRL_HIGH_Z_15"
]
},
"curve_eis": {
"type": "RIS",
"parameter": {
"fa": "EIS_FREQ[0]",
"fb": "EIS_FREQ[1]",
"dp": "EIS_DELAY",
"dc": "EIS_DC_BIAS",
"am": "EIS_AC_AMP",
"an": "EIS_AVERAGE_NUM",
"rt": "GENERAL_HS_RTIA",
"pp": "EIS_PPD",
"sp": "EIS_SCALE"
"fa": "FREQ[0]",
"fb": "FREQ[1]",
"dp": "DELAY",
"dc": "DC_BIAS",
"am": "AC_AMP",
"an": "AVERAGE_NUM",
"rt": "RTIA",
"pp": "PPD",
"sp": "SCALE"
},
"data": [
"1X12;1X01;4B>fa;4B>fb;2B>dp"
"1XD1;1X01;4B>fa;4B>fb;2B>dp"
]
},
"curve_eis_para2": {
"type": "RIS",
"parameter": {
"fa": "EIS_FREQ[0]",
"fb": "EIS_FREQ[1]",
"dp": "EIS_DELAY",
"dc": "EIS_DC_BIAS",
"am": "EIS_AC_AMP",
"an": "EIS_AVERAGE_NUM",
"rt": "GENERAL_HS_RTIA",
"pp": "EIS_PPD",
"sp": "EIS_SCALE"
"fa": "FREQ[0]",
"fb": "FREQ[1]",
"dp": "DELAY",
"dc": "DC_BIAS",
"am": "AC_AMP",
"an": "AVERAGE_NUM",
"rt": "RTIA",
"pp": "PPD",
"sp": "SCALE"
},
"data": [
"1X12;1X02;2B>dc;2B>am;B>an;B>rt;2B>pp;B>sp"
]
},
"curve_eis_mode": {
"type": "RIS",
"data": [
"1X12;1XFF"
]
},
"curve_cf": {
"type": "RIS",
"parameter": {
"fa": "CF_FREQ",
"dp": "CF_DELAY",
"dc": "CF_DC_BIAS",
"am": "CF_AC_AMP",
"an": "CF_AVERAGE_NUM",
"rt": "GENERAL_HS_RTIA",
"pp": "CF_PPD",
"sp": "CF_SCALE"
},
"data": [
"1X13;1X01;4B>fa;4B>0;2B>dp"
]
},
"curve_cf_para2": {
"type": "RIS",
"parameter": {
"fa": "CF_FREQ",
"dp": "CF_DELAY",
"dc": "CF_DC_BIAS",
"am": "CF_AC_AMP",
"an": "CF_AVERAGE_NUM",
"rt": "GENERAL_HS_RTIA",
"pp": "CF_PPD",
"sp": "CF_SCALE"
},
"data": [
"1X13;1X02;2B>dc;2B>am;B>an;B>rt;2B>pp;B>sp"
]
},
"curve_cf_mode": {
"type": "RIS",
"data": [
"1X13;1XFF"
"1XD1;1X02;2B>dc;2B>am;B>an;B>rt;2B>pp;B>sp"
]
},
"curve_cv3": {
"type": "RIS",
"parameter": {
"va": "CV_E_INITIAL",
"vb": "CV_E1",
"vc": "CV_E2",
"ve": "CV_SCAN_RATE",
"va": "VOLT_INITIAL",
"vb": "VOLT_MAX",
"vc": "VOLT_MIN",
"ve": "Scan_Rate",
"vf": "SAMPLE_RATE",
"cn": "CYCLE_NUMBER"
},
"data": [
"1X09;1X01;2B>va;2B>vb;2B>vc;"
"1XD2;1X01;2B>va;2B>vb;2B>vc;"
]
},
"curve_cv3_para2": {
"type": "RIS",
"parameter": {
"va": "CV_E_INITIAL",
"vb": "CV_E1",
"vc": "CV_E2",
"ve": "CV_SCAN_RATE",
"va": "VOLT_INITIAL",
"vb": "VOLT_MAX",
"vc": "VOLT_MIN",
"ve": "Scan_Rate",
"vf": "SAMPLE_RATE",
"cn": "CYCLE_NUMBER"
},
"data": [
"1X09;1X02;4B>ve;2B>vf;2B>cn"
"1XD2;1X02;4B>ve;2B>vf;2B>cn"
]
},
"curve_ca": {
"curve_const_vscan": {
"type": "RIS",
"parameter": {
"va": "CA_VOLT",
"pa": "GENERAL_LP_RTIA",
"va": "VOLT_VSCAN",
"pa": "ADC_LEVEL_I_15",
"pb": "ADC_LEVEL_V_IN_15",
"pd": "CTRL_HIGH_Z_15",
"pe": "SAMPLE_RATE"
},
"data": [
"1X0B;",
"1XD3;",
"2B>va;",
"4b>pa;4b>0;",
"4b>pa;4b>pb;",
"4b>0;4b>pd;",
"2B>pe"
]
},
"curve_rt": {
"curve_zt": {
"type": "RIS",
"parameter": {
"va": "RT_VOLT_SET",
"pa": "GENERAL_LP_RTIA",
"va": "DAC_VOLT",
"pa": "ADC_LEVEL_I_15",
"pb": "ADC_LEVEL_V_IN_15",
"pd": "CTRL_HIGH_Z_15",
"pe": "SAMPLE_RATE"
},
"data": [
"X04;",
"2B>va;",
"4b>pa;4b>0;",
"4b>pa;4b>pb;",
"4b>0;4b>pd;",
"2B>pe"
]
@@ -605,23 +507,24 @@
"curve_vt": {
"type": "RIS",
"parameter": {
"pa": "GENERAL_LP_RTIA",
"pa": "ADC_LEVEL_I_15",
"pb": "ADC_LEVEL_V_IN_15",
"pd": "CTRL_HIGH_Z_15",
"pe": "SAMPLE_RATE",
"va": "VT_MEASURE_VIN_RANGE"
"va": "MEASURE_VIN_RANGE"
},
"data": [
"X05;",
"4b>pa;4b>0;",
"4b>pa;4b>pb;",
"4b>0;4b>pd;",
"2B>pe;",
"1B>va"
]
},
"set_para_RT_VOLT_SET": {
"set_para_RT_DAC_VOLT": {
"type": "RIS",
"data": [
"XE2;X01;2B>RT_VOLT_SET"
"XE2;X01;2B>DAC_VOLT"
]
},
"ble_instru_send": [
@@ -9,7 +9,7 @@
"minor_version_number": 2
},
"constant": {
"FREQ_MAX": 13333334,
"FREQ_MAX": 4294967296,
"VOLT_MAX": 65536,
"BLE_WRITE_MAX": 255,
"TIME_MAX": 100000
@@ -26,44 +26,17 @@
"expression": "VALUE"
}
},
"HIGHZ_TABLE": {
"initial": [
1,
1,
1,
0,
1,
1,
1,
1
],
"domain": {
"list": [
100
]
},
"value": "VALUE"
},
"CTRL_HIGH_Z_15": {
"description": "ctrl highZ level",
"CHANNEL": {
"derzteription": "record channels",
"record_meta": true,
"initial": 1,
"value": [
"On",
"Off"
],
"on_change": "set_ctrl_highZ"
"domain": "property",
"value": "[0, 1, 2]"
},
"CYCLE_NUMBER": {
"description": "CV cycle number",
"CHANNEL_LABEL": {
"description": "channel label",
"record_meta": true,
"initial": 1,
"domain": [
65536
],
"value": {
"expression": "VALUE"
}
"domain": "property",
"value": "['current', 'voltage', 'impedance']"
},
"SAMPLE_RATE": {
"description": "data sampling rate",
@@ -77,12 +50,6 @@
},
"on_change": "set_sample_rate"
},
"CHANNEL": {
"derzteription": "record channels",
"record_meta": true,
"domain": "property",
"value": "[0, 1, 2]"
},
"AMP_GAIN": {
"description": "amp gain",
"record_meta": true,
@@ -98,58 +65,11 @@
"Chronoamperometric",
"V-T Graph",
"R-T Graph",
"EIS constant frequency",
"Dev Mode",
"Idle"
"Dev Mode"
]
},
"GENERAL_HS_RTIA": {
"description": "High speed rtia gain",
"record_meta": true,
"initial": 4,
"value": [
0,
1,
2,
3,
4
],
"on_change": "set_general_hs_rtia"
},
"GENERAL_LP_RTIA": {
"description": "Low power rtia gain",
"record_meta": true,
"initial": 4,
"value": [
"0",
"1",
"2",
"3",
"auto"
],
"on_change": "set_general_lp_rtia"
},
"EIS_DC_BIAS": {
"description": "DC voltage bias",
"record_meta": true,
"initial": 25000,
"domain": [
"VOLT_MAX"
],
"value": {
"expression": "VALUE"
}
},
"EIS_AC_AMP": {
"description": "AC Amplitude",
"record_meta": true,
"initial": 25,
"domain": [
2048
]
},
"EIS_FREQ": {
"description": "[start, stop] of frequency scan",
"FREQ": {
"description": "DPV current recording period start",
"record_meta": true,
"initial": [
13333333,
@@ -162,24 +82,29 @@
},
"value": "VALUE"
},
"EIS_PPD": {
"description": "Point per decades",
"FREQ_START": {
"description": "Start of Freq Scan",
"record_meta": true,
"initial": 10,
"initial": 13422819,
"domain": [
11
]
"FREQ_MAX"
],
"value": {
"expression": "VALUE"
}
},
"EIS_SCALE": {
"description": "Point spacing pattern",
"FREQ_STOP": {
"description": "End of Freq Scan",
"record_meta": true,
"initial": 0,
"value": [
0,
1
]
"initial": 7,
"domain": [
"FREQ_MAX"
],
"value": {
"expression": "VALUE"
}
},
"EIS_DELAY": {
"DELAY": {
"description": "Wait x peroid before start taking measurements",
"record_meta": true,
"initial": 0,
@@ -190,19 +115,19 @@
"expression": "VALUE"
}
},
"EIS_AVERAGE_NUM": {
"AVERAGE_NUM": {
"description": "Number of sample used for average funciton",
"record_meta": true,
"initial": 8,
"value": [
2,
4,
6,
8
8,
16
]
},
"CF_DC_BIAS": {
"description": "DC voltage bias",
"DC_BIAS": {
"description": "DC voltage bias in mV",
"record_meta": true,
"initial": 25000,
"domain": [
@@ -212,34 +137,15 @@
"expression": "VALUE"
}
},
"CF_AC_AMP": {
"description": "AC Amplitude",
"AC_AMP": {
"description": "AC Amplitude in mV",
"record_meta": true,
"initial": 25,
"domain": [
2048
]
},
"CF_FREQ": {
"description": "frequency of cf",
"record_meta": true,
"initial": 13333333,
"domain": [
"FREQ_MAX"
],
"value": {
"expression": "VALUE"
}
},
"CF_PPD": {
"description": "Point per decades",
"record_meta": true,
"initial": 10,
"domain": [
11
]
},
"CF_SCALE": {
"SCALE": {
"description": "Point spacing pattern",
"record_meta": true,
"initial": 0,
@@ -248,29 +154,77 @@
1
]
},
"CF_DELAY": {
"description": "Wait x peroid before start taking measurements",
"PPD": {
"description": "Point per decades",
"record_meta": true,
"initial": 0,
"initial": 10,
"domain": [
101
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"
}
},
"CF_AVERAGE_NUM": {
"description": "Number of sample used for average funciton",
"CTRL_HIGH_Z_15": {
"description": "ctrl highZ level",
"record_meta": true,
"initial": 8,
"initial": 1,
"value": [
2,
4,
6,
8
]
"On",
"Off"
],
"on_change": "set_ctrl_highZ"
},
"CV_E_INITIAL": {
"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,
@@ -281,8 +235,8 @@
"expression": "VALUE"
}
},
"CV_E1": {
"description": "First voltage of Scan",
"VOLT_MAX": {
"description": "Max Voltage of Scan",
"record_meta": true,
"initial": 25000,
"domain": [
@@ -292,8 +246,8 @@
"expression": "VALUE"
}
},
"CV_E2": {
"description": "Second voltage of Scan",
"VOLT_MIN": {
"description": "Min Voltage of Scan",
"record_meta": true,
"initial": 25000,
"domain": [
@@ -303,19 +257,19 @@
"expression": "VALUE"
}
},
"CV_SCAN_RATE": {
"description": "Voltage scan rate",
"CYCLE_NUMBER": {
"description": "CV cycle number",
"record_meta": true,
"initial": 10000,
"initial": 1,
"domain": [
100001
65536
],
"value": {
"expression": "VALUE"
}
},
"CA_VOLT": {
"description": "Voltage of ca",
"VOLT_VSCAN": {
"description": "Voltage of VScan",
"record_meta": true,
"initial": 25000,
"domain": [
@@ -325,7 +279,7 @@
"expression": "VALUE"
}
},
"VT_MEASURE_VIN_RANGE": {
"MEASURE_VIN_RANGE": {
"description": "measure range of Vin",
"record_meta": true,
"initial": 0,
@@ -336,7 +290,7 @@
"auto"
]
},
"RT_VOLT_SET": {
"DAC_VOLT": {
"description": "DAC output Voltage",
"record_meta": true,
"initial": 37500,
@@ -346,11 +300,7 @@
"value": {
"expression": "VALUE"
},
"on_change": "set_para_RT_VOLT_SET"
},
"ADC_VALUE_I": {
"description": "ADC value current value",
"domain": "int"
"on_change": "set_para_RT_DAC_VOLT"
},
"BLE_WRITE": {
"description": "send msg to elite",
@@ -372,26 +322,29 @@
{
"expression": "MODE",
"when": {
"7": "idle",
"*": "start_data"
}
}
],
"idle": [
"_idle()"
],
"start_data": [
"data_format_cali",
"_notify(True)",
{
"expression": "MODE",
"when": {
"0": "set_general_hs_rtia",
"1": "set_general_lp_rtia",
"2": "set_general_lp_rtia",
"3": "set_general_lp_rtia",
"4": "set_general_lp_rtia",
"5": "set_general_hs_rtia"
"1": "set_adc_gain_I",
"2": "set_adc_gain_I",
"3": "set_adc_gain_I",
"4": "set_adc_gain_I"
}
},
{
"expression": "MODE",
"when": {
"1": "set_adc_gain_Vin",
"2": "set_adc_gain_Vin",
"3": "set_adc_gain_Vin",
"4": "set_adc_gain_Vin"
}
},
{
@@ -399,25 +352,16 @@
"when": {
"0": "curve_eis",
"1": "curve_cv3",
"2": "curve_ca",
"2": "curve_const_vscan",
"3": "curve_vt",
"4": "curve_rt",
"5": "curve_cf"
"4": "curve_zt"
}
},
{
"expression": "MODE",
"when": {
"0": "curve_eis_para2",
"1": "curve_cv3_para2",
"5": "curve_cf_para2"
}
},
{
"expression": "MODE",
"when": {
"0": "curve_eis_mode",
"5": "curve_cf_mode"
"1": "curve_cv3_para2"
}
},
"_sync(True)",
@@ -437,18 +381,6 @@
"data_format_cali": [
"_data_format_cali('EISZeroOne')"
],
"set_general_hs_rtia": {
"type": "RIS",
"data": [
"1XFF;1X70;1B>GENERAL_HS_RTIA"
]
},
"set_general_lp_rtia": {
"type": "RIS",
"data": [
"1XFF;1X71;1B>GENERAL_LP_RTIA"
]
},
"set_sample_rate": {
"type": "RIS",
"parameter": {
@@ -458,146 +390,116 @@
"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": [
"1XFF;1X72;1B>CTRL_HIGH_Z_15"
"XE1;X03;B>CTRL_HIGH_Z_15"
]
},
"curve_eis": {
"type": "RIS",
"parameter": {
"fa": "EIS_FREQ[0]",
"fb": "EIS_FREQ[1]",
"dp": "EIS_DELAY",
"dc": "EIS_DC_BIAS",
"am": "EIS_AC_AMP",
"an": "EIS_AVERAGE_NUM",
"rt": "GENERAL_HS_RTIA",
"pp": "EIS_PPD",
"sp": "EIS_SCALE"
"fa": "FREQ[0]",
"fb": "FREQ[1]",
"dp": "DELAY",
"dc": "DC_BIAS",
"am": "AC_AMP",
"an": "AVERAGE_NUM",
"rt": "RTIA",
"pp": "PPD",
"sp": "SCALE"
},
"data": [
"1X12;1X01;4B>fa;4B>fb;2B>dp"
"1XD1;1X01;4B>fa;4B>fb;2B>dp"
]
},
"curve_eis_para2": {
"type": "RIS",
"parameter": {
"fa": "EIS_FREQ[0]",
"fb": "EIS_FREQ[1]",
"dp": "EIS_DELAY",
"dc": "EIS_DC_BIAS",
"am": "EIS_AC_AMP",
"an": "EIS_AVERAGE_NUM",
"rt": "GENERAL_HS_RTIA",
"pp": "EIS_PPD",
"sp": "EIS_SCALE"
"fa": "FREQ[0]",
"fb": "FREQ[1]",
"dp": "DELAY",
"dc": "DC_BIAS",
"am": "AC_AMP",
"an": "AVERAGE_NUM",
"rt": "RTIA",
"pp": "PPD",
"sp": "SCALE"
},
"data": [
"1X12;1X02;2B>dc;2B>am;B>an;B>rt;2B>pp;B>sp"
]
},
"curve_eis_mode": {
"type": "RIS",
"data": [
"1X12;1XFF"
]
},
"curve_cf": {
"type": "RIS",
"parameter": {
"fa": "CF_FREQ",
"dp": "CF_DELAY",
"dc": "CF_DC_BIAS",
"am": "CF_AC_AMP",
"an": "CF_AVERAGE_NUM",
"rt": "GENERAL_HS_RTIA",
"pp": "CF_PPD",
"sp": "CF_SCALE"
},
"data": [
"1X13;1X01;4B>fa;4B>0;2B>dp"
]
},
"curve_cf_para2": {
"type": "RIS",
"parameter": {
"fa": "CF_FREQ",
"dp": "CF_DELAY",
"dc": "CF_DC_BIAS",
"am": "CF_AC_AMP",
"an": "CF_AVERAGE_NUM",
"rt": "GENERAL_HS_RTIA",
"pp": "CF_PPD",
"sp": "CF_SCALE"
},
"data": [
"1X13;1X02;2B>dc;2B>am;B>an;B>rt;2B>pp;B>sp"
]
},
"curve_cf_mode": {
"type": "RIS",
"data": [
"1X13;1XFF"
"1XD1;1X02;2B>dc;2B>am;B>an;B>rt;2B>pp;B>sp"
]
},
"curve_cv3": {
"type": "RIS",
"parameter": {
"va": "CV_E_INITIAL",
"vb": "CV_E1",
"vc": "CV_E2",
"ve": "CV_SCAN_RATE",
"va": "VOLT_INITIAL",
"vb": "VOLT_MAX",
"vc": "VOLT_MIN",
"ve": "Scan_Rate",
"vf": "SAMPLE_RATE",
"cn": "CYCLE_NUMBER"
},
"data": [
"1X09;1X01;2B>va;2B>vb;2B>vc;"
"1XD2;1X01;2B>va;2B>vb;2B>vc;"
]
},
"curve_cv3_para2": {
"type": "RIS",
"parameter": {
"va": "CV_E_INITIAL",
"vb": "CV_E1",
"vc": "CV_E2",
"ve": "CV_SCAN_RATE",
"va": "VOLT_INITIAL",
"vb": "VOLT_MAX",
"vc": "VOLT_MIN",
"ve": "Scan_Rate",
"vf": "SAMPLE_RATE",
"cn": "CYCLE_NUMBER"
},
"data": [
"1X09;1X02;4B>ve;2B>vf;2B>cn"
"1XD2;1X02;4B>ve;2B>vf;2B>cn"
]
},
"curve_ca": {
"curve_const_vscan": {
"type": "RIS",
"parameter": {
"va": "CA_VOLT",
"pa": "GENERAL_LP_RTIA",
"va": "VOLT_VSCAN",
"pa": "ADC_LEVEL_I_15",
"pb": "ADC_LEVEL_V_IN_15",
"pd": "CTRL_HIGH_Z_15",
"pe": "SAMPLE_RATE"
},
"data": [
"1X0B;",
"1XD3;",
"2B>va;",
"4b>pa;4b>0;",
"4b>pa;4b>pb;",
"4b>0;4b>pd;",
"2B>pe"
]
},
"curve_rt": {
"curve_zt": {
"type": "RIS",
"parameter": {
"va": "RT_VOLT_SET",
"pa": "GENERAL_LP_RTIA",
"va": "DAC_VOLT",
"pa": "ADC_LEVEL_I_15",
"pb": "ADC_LEVEL_V_IN_15",
"pd": "CTRL_HIGH_Z_15",
"pe": "SAMPLE_RATE"
},
"data": [
"X04;",
"2B>va;",
"4b>pa;4b>0;",
"4b>pa;4b>pb;",
"4b>0;4b>pd;",
"2B>pe"
]
@@ -605,23 +507,24 @@
"curve_vt": {
"type": "RIS",
"parameter": {
"pa": "GENERAL_LP_RTIA",
"pa": "ADC_LEVEL_I_15",
"pb": "ADC_LEVEL_V_IN_15",
"pd": "CTRL_HIGH_Z_15",
"pe": "SAMPLE_RATE",
"va": "VT_MEASURE_VIN_RANGE"
"va": "MEASURE_VIN_RANGE"
},
"data": [
"X05;",
"4b>pa;4b>0;",
"4b>pa;4b>pb;",
"4b>0;4b>pd;",
"2B>pe;",
"1B>va"
]
},
"set_para_RT_VOLT_SET": {
"set_para_RT_DAC_VOLT": {
"type": "RIS",
"data": [
"XE2;X01;2B>RT_VOLT_SET"
"XE2;X01;2B>DAC_VOLT"
]
},
"ble_instru_send": [
-14
View File
@@ -1,14 +0,0 @@
#!/bin/bash
# install python module numpy
sudo apt-get install libatlas-base-dev
sudo apt-get install python3-numpy
# install python module SQLAlchemy
pip3 install SQLAlchemy
# add column cycle in projects
sudo su -c "psql -d postgres -c \"ALTER TABLE projects ADD COLUMN IF NOT EXISTS cycle JSONB;\"" postgres
# add column project in recording_data_metas
sudo su -c "psql -d postgres -c \"ALTER TABLE recording_data_metas ADD COLUMN IF NOT EXISTS project Int4;\"" postgres