diff --git a/change-note.md b/change-note.md new file mode 100644 index 0000000..6924a98 --- /dev/null +++ b/change-note.md @@ -0,0 +1,16 @@ +### 2022.12.30 + +- file system + +### 2022.12.06 + +- e-chart +- mqtt +- new page data-analysis + +### 2022.11.30 + +- setup environment +- vite config add path +- import windicss +- add vue-shim.d.ts file (TS2307) diff --git a/package-lock.json b/package-lock.json index 8314769..6e3d29b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2781,9 +2781,9 @@ "dev": true }, "follow-redirects": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", - "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==" + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" }, "form-data": { "version": "4.0.0", diff --git a/src/components/data-analysis/FileContainer.vue b/src/components/data-analysis/FileContainer.vue new file mode 100644 index 0000000..433a783 --- /dev/null +++ b/src/components/data-analysis/FileContainer.vue @@ -0,0 +1,31 @@ + + + diff --git a/src/components/data-analysis/FileModal.vue b/src/components/data-analysis/FileModal.vue new file mode 100644 index 0000000..c676d4d --- /dev/null +++ b/src/components/data-analysis/FileModal.vue @@ -0,0 +1,212 @@ + + + diff --git a/src/data/axios/index.ts b/src/data/axios/index.ts new file mode 100644 index 0000000..2cf0a67 --- /dev/null +++ b/src/data/axios/index.ts @@ -0,0 +1,13 @@ +import axios, { Axios } from 'axios' + +export const setBaseURL = function (baseURL: string) { + if (baseURL) { + axios.defaults.baseURL = `http://${baseURL}:3000` + } +} + +setBaseURL(location.href.split('/')[2].split(':')[0]) + +export const getAxios = function (): Axios { + return axios +} diff --git a/src/data/config-table/Common/Idle.js b/src/data/config-table/Common/Idle.js new file mode 100644 index 0000000..33fc61f --- /dev/null +++ b/src/data/config-table/Common/Idle.js @@ -0,0 +1,20 @@ +export default { + name: 'Idle', + parameter: [], // 這個mode用到的參數 + showParameter: [], // 有要秀給user看的參數 + headerParameter: () => [], // export header的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: {}, + charts: {}, +} diff --git a/src/data/config-table/EliteEDC/CaliADC.js b/src/data/config-table/EliteEDC/CaliADC.js new file mode 100644 index 0000000..2c1bad8 --- /dev/null +++ b/src/data/config-table/EliteEDC/CaliADC.js @@ -0,0 +1,94 @@ +export default { + name: 'Cali Mode - test', + parameter: ['ADC_DAC_CHANNEL_15', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'DAC_LEVEL_V_OUT_15', 'DAC_VOLT_BUTTON'], // 這個mode用到的參數 + showParameter: ['ADC_DAC_CHANNEL_15', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'DAC_LEVEL_V_OUT_15', 'DAC_VOLT_BUTTON'], // 有要秀給user看的參數 + headerParameter: () => [ + 'ADC_DAC_CHANNEL_15', + 'ADC_LEVEL_I_15', + 'ADC_LEVEL_V_IN_15', + 'DAC_LEVEL_V_OUT_15', + 'DAC_VOLT_BUTTON', + ], // export header的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + m: 60 * 1e6, + h: 60 * 60 * 1e6, + auto: 1, + }, + defaultUnit: 'us', + }, + 0: { + name: 'I_in', + unit: { + nA: 1, + }, + defaultUnit: 'nA', + }, + 1: { + name: 'V_in/V_out', + unit: { + uV: 1, + }, + defaultUnit: 'uV', + }, + 2: { + name: 'Gain', + unit: { + default: 1, + }, + defaultUnit: 'default', + }, + }, + charts: { + default: [ + { + name: 'Cali Mode - test', + description: '', + subplot: [ + { + x1: { + type: 'time', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'ADC', + x1: { + channel: 'time', + }, + y1: { + channel: 0, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEDC/CaliDAC.js b/src/data/config-table/EliteEDC/CaliDAC.js new file mode 100644 index 0000000..785c2f8 --- /dev/null +++ b/src/data/config-table/EliteEDC/CaliDAC.js @@ -0,0 +1,87 @@ +export default { + name: 'Cali DAC - test', + parameter: ['CTRL_HIGH_Z_15', 'DAC_VOLT'], // 這個mode用到的參數 + showParameter: ['CTRL_HIGH_Z_15', 'DAC_VOLT'], // 有要秀給user看的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + m: 60 * 1e6, + h: 60 * 60 * 1e6, + auto: 1, + }, + defaultUnit: 'us', + }, + 0: { + name: 'I_in', + unit: { + nA: 1, + }, + defaultUnit: 'nA', + }, + 1: { + name: 'V_in/V_out', + unit: { + uV: 1, + }, + defaultUnit: 'uV', + }, + 2: { + name: 'Gain', + unit: { + default: 1, + }, + defaultUnit: 'default', + }, + }, + charts: { + default: [ + { + name: 'Cali DAC - test', + description: '', + subplot: [ + { + x1: { + type: 'time', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'DAC', + x1: { + channel: 'time', + }, + y1: { + channel: 0, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEDC/Chronoamperometry.js b/src/data/config-table/EliteEDC/Chronoamperometry.js new file mode 100644 index 0000000..f5d90db --- /dev/null +++ b/src/data/config-table/EliteEDC/Chronoamperometry.js @@ -0,0 +1,97 @@ +export default { + name: 'Chronoamperometry', + parameter: ['CA_VOLT', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'TIME_DURATION'], // 這個mode用到的參數 + showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'CA_VOLT', 'SAMPLE_RATE', 'TIME_DURATION'], // 有要秀給user看的參數 + headerParameter: () => ['CA_VOLT', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'TIME_DURATION'], // 有要秀給user看的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + minute: 60 * 1e6, + hour: 60 * 60 * 1e6, + }, + defaultUnit: 'ms', + downloadUnit: 'ms', + }, + 0: { + name: 'I_in', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + defaultUnit: 'mA', + downloadUnit: 'mA', + }, + 1: { + name: 'Potential', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 2: { + name: 'V_out', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + }, + charts: { + default: [ + { + name: 'Chronoamperometric', + description: '', + subplot: [ + { + x1: { + type: 'time', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'chrono', + x1: { + channel: 'time', + }, + y1: { + channel: 0, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEDC/Chronopotentiometry.js b/src/data/config-table/EliteEDC/Chronopotentiometry.js new file mode 100644 index 0000000..b08470e --- /dev/null +++ b/src/data/config-table/EliteEDC/Chronopotentiometry.js @@ -0,0 +1,167 @@ +export default { + name: 'Chronopotentiometry', + parameter: [ + 'Charge', + 'Const_Current_value', + 'SAMPLE_RATE', + 'VOLTSTOP_MAX', + 'VOLTSTOP_MIN', + 'CC_CP_SPEED', + 'ADC_LEVEL_I_15', + 'ADC_LEVEL_V_IN_15', + 'TIME_DURATION', + ], // 這個mode用到的參數 + showParameter: [ + 'ADC_LEVEL_I_15', + 'ADC_LEVEL_V_IN_15', + 'CTRL_HIGH_Z_15', + 'SAMPLE_RATE', + 'Charge', + 'Const_Current_value', + 'VOLTSTOP_MAX', + 'VOLTSTOP_MIN', + 'TIME_DURATION', + ], // 有要秀給user看的參數 + headerParameter: () => [ + 'Charge', + 'Const_Current_value', + 'SAMPLE_RATE', + 'VOLTSTOP_MAX', + 'VOLTSTOP_MIN', + 'CC_CP_SPEED', + 'ADC_LEVEL_I_15', + 'ADC_LEVEL_V_IN_15', + 'TIME_DURATION', + ], // 有要秀給user看的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + minute: 60 * 1e6, + hour: 60 * 60 * 1e6, + }, + defaultUnit: 'ms', + downloadUnit: 'ms', + }, + 0: { + name: 'I_in', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + defaultUnit: 'mA', + downloadUnit: 'mA', + }, + 1: { + name: 'Potential', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 2: { + name: 'V_out', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 3: { + name: 'sum_cnt', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'uV', + }, + 4: { + name: 'sum_adc_delta_Iin', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'uV', + }, + 5: { + name: 'sum_adc_delta_Voutin', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'uV', + }, + 6: { + name: 'resis', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'uV', + }, + }, + charts: { + default: [ + { + name: 'Chronopotentiometry', + description: '', + subplot: [ + { + x1: { + type: 'time', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'CP', + x1: { + channel: 'time', + }, + y1: { + channel: 1, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEDC/ConstantCurrent.js b/src/data/config-table/EliteEDC/ConstantCurrent.js new file mode 100644 index 0000000..2bee80e --- /dev/null +++ b/src/data/config-table/EliteEDC/ConstantCurrent.js @@ -0,0 +1,127 @@ +export default { + name: 'Constant Current', + parameter: [ + 'Charge', + 'Const_Current_value', + 'SAMPLE_RATE', + 'VOLTSTOP_MAX', + 'VOLTSTOP_MIN', + 'CC_CP_SPEED', + 'ADC_LEVEL_I_15', + 'ADC_LEVEL_V_IN_15', + 'TIME_DURATION', + ], // 這個mode用到的參數 + showParameter: [ + 'ADC_LEVEL_I_15', + 'ADC_LEVEL_V_IN_15', + 'CTRL_HIGH_Z_15', + 'SAMPLE_RATE', + 'Charge', + 'Const_Current_value', + 'VOLTSTOP_MAX', + 'VOLTSTOP_MIN', + 'TIME_DURATION', + ], // 有要秀給user看的參數 + headerParameter: () => [ + 'Charge', + 'Const_Current_value', + 'SAMPLE_RATE', + 'VOLTSTOP_MAX', + 'VOLTSTOP_MIN', + 'CC_CP_SPEED', + 'ADC_LEVEL_I_15', + 'ADC_LEVEL_V_IN_15', + 'TIME_DURATION', + ], // 有要秀給user看的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + minute: 60 * 1e6, + hour: 60 * 60 * 1e6, + }, + defaultUnit: 'ms', + downloadUnit: 'ms', + }, + 0: { + name: 'I_in', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + defaultUnit: 'mA', + downloadUnit: 'mA', + }, + 1: { + name: 'V_in', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 2: { + name: 'V_out', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + }, + charts: { + default: [ + { + name: 'Constant Current', + description: '', + subplot: [ + { + x1: { + type: 'time', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'CC', + x1: { + channel: 'time', + }, + y1: { + channel: 1, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEDC/CycleIV.js b/src/data/config-table/EliteEDC/CycleIV.js new file mode 100644 index 0000000..c03123c --- /dev/null +++ b/src/data/config-table/EliteEDC/CycleIV.js @@ -0,0 +1,134 @@ +export default { + name: 'Cycle I-V', + parameter: [ + 'VOLT_ORIGIN', + 'VOLT_FINAL', + 'VOLT_STEP', + 'STEP_TIME', + 'SAMPLE_RATE', + 'CYCLE_NUMBER', + 'ADC_LEVEL_I_15', + 'ADC_LEVEL_V_IN_15', + 'CTRL_HIGH_Z_15', + ], // 這個mode用到的參數 + showParameter: [ + 'ADC_LEVEL_I_15', + 'ADC_LEVEL_V_IN_15', + 'CTRL_HIGH_Z_15', + 'VOLT_ORIGIN', + 'VOLT_FINAL', + 'VOLT_STEP', + 'STEP_TIME', + 'SAMPLE_RATE', + 'CYCLE_NUMBER', + ], // 有要秀給user看的參數 + headerParameter: () => [ + 'VOLT_ORIGIN', + 'VOLT_FINAL', + 'VOLT_STEP', + 'STEP_TIME', + 'SAMPLE_RATE', + 'CYCLE_NUMBER', + 'ADC_LEVEL_I_15', + 'ADC_LEVEL_V_IN_15', + ], // export header的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + minute: 60 * 1e6, + hour: 60 * 60 * 1e6, + }, + defaultUnit: 'ms', + downloadUnit: 'ms', + }, + 0: { + name: 'I_in', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + defaultUnit: 'mA', + downloadUnit: 'mA', + }, + 1: { + name: 'V_out', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 2: { + name: 'V_in', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 3: { + name: 'Cycle number', + unit: { + cycle: 1, + }, + defaultUnit: 'cycle', + downloadUnit: null, + }, + }, + charts: { + default: [ + { + name: 'Cycle I-V', + description: '', + subplot: [ + { + x1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'CycleIV', + x1: { + channel: 1, + }, + y1: { + channel: 0, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEDC/CyclicVoltammetry.js b/src/data/config-table/EliteEDC/CyclicVoltammetry.js new file mode 100644 index 0000000..c14fe66 --- /dev/null +++ b/src/data/config-table/EliteEDC/CyclicVoltammetry.js @@ -0,0 +1,134 @@ +export default { + name: 'Cyclic Voltammetry', + parameter: [ + 'VOLT_INITIAL', + 'VOLT_MAX', + 'VOLT_MIN', + 'Scan_Rate', + 'SAMPLE_RATE', + 'CYCLE_NUMBER', + 'ADC_LEVEL_I_15', + 'ADC_LEVEL_V_IN_15', + 'CTRL_HIGH_Z_15', + ], // 這個mode用到的參數 + showParameter: [ + 'ADC_LEVEL_I_15', + 'ADC_LEVEL_V_IN_15', + 'CTRL_HIGH_Z_15', + 'VOLT_INITIAL', + 'VOLT_MAX', + 'VOLT_MIN', + 'Scan_Rate', + 'SAMPLE_RATE', + 'CYCLE_NUMBER', + ], // 有要秀給user看的參數 + headerParameter: () => [ + 'VOLT_INITIAL', + 'VOLT_MAX', + 'VOLT_MIN', + 'Scan_Rate', + 'SAMPLE_RATE', + 'CYCLE_NUMBER', + 'ADC_LEVEL_I_15', + 'ADC_LEVEL_V_IN_15', + ], // 有要秀給user看的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + m: 60 * 1e6, + h: 60 * 60 * 1e6, + }, + defaultUnit: 'ms', + downloadUnit: 'ms', + }, + 0: { + name: 'I_in', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + defaultUnit: 'mA', + downloadUnit: 'mA', + }, + 1: { + name: 'Potential', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 2: { + name: 'V_out', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 3: { + name: 'Cycle number', + unit: { + cycle: 1, + }, + defaultUnit: 'cycle', + downloadUnit: null, + }, + }, + charts: { + default: [ + { + name: 'Cyclic Voltammetry', + description: '', + subplot: [ + { + x1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'CV', + x1: { + channel: 1, + }, + y1: { + channel: 0, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEDC/DPV.js b/src/data/config-table/EliteEDC/DPV.js new file mode 100644 index 0000000..9abf37a --- /dev/null +++ b/src/data/config-table/EliteEDC/DPV.js @@ -0,0 +1,135 @@ +export default { + name: 'Differential Pulse Voltammetry', + parameter: ['DPV_e_init', 'DPV_e_final', 'DPV_increment', 'DPV_amp', 'DPV_pul_width', 'DPV_step_time'], // 這個mode用到的參數 + parameterInMode: { + 0: ['DPV_e_init', 'DPV_e_final', 'DPV_increment', 'DPV_amp', 'DPV_pul_width', 'DPV_step_time'], + 1: [ + 'DPV_e_init', + 'DPV_e_1', + 'DPV_e_2', + 'DPV_e_final', + 'DPV_increment', + 'DPV_amp', + 'DPV_pul_width', + 'DPV_step_time', + 'CYCLE_NUMBER', + 'DPV_pulse_option', + 'DPV_curr_rec', + ], + 2: [ + 'DPV_e_init', + 'DPV_e_final', + 'DPV_increment', + 'DPV_amp', + 'DPV_pul_width', + 'DPV_step_time', + 'CYCLE_NUMBER', + 'DPV_notify_rate', + 'DPV_engineering_enable', + 'DPV_e_1', + 'DPV_e_2', + 'DPV_pulse_option', + ], + }, // 這個mode用到的參數 + showParameter: [], // 有要秀給user看的參數 + headerParameter: () => [], // export header的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + minute: 60 * 1e6, + hour: 60 * 60 * 1e6, + }, + defaultUnit: 'ms', + downloadUnit: 'ms', + }, + 0: { + name: 'I_in', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + defaultUnit: 'mA', + downloadUnit: 'mA', + }, + 1: { + name: 'Potential', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 2: { + name: 'V_out', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 3: { + name: 'Cycle number', + unit: { + cycle: 1, + }, + defaultUnit: 'cycle', + downloadUnit: null, + }, + }, + charts: { + default: [ + { + name: 'Open Circuit Potential', + description: '', + subplot: [ + { + x1: { + type: 'time', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'OCP', + x1: { + channel: 'time', + }, + y1: { + channel: 1, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEDC/DevMode.js b/src/data/config-table/EliteEDC/DevMode.js new file mode 100644 index 0000000..d9932e2 --- /dev/null +++ b/src/data/config-table/EliteEDC/DevMode.js @@ -0,0 +1,93 @@ +export default { + name: 'Dev Mode', + parameter: ['ADC_VALUE_I'], + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + m: 60 * 1e6, + h: 60 * 60 * 1e6, + auto: 1, + }, + defaultUnit: 'auto', + }, + 0: { + name: '0', + unit: { + default: 1, + }, + defaultUnit: 'default', + }, + 1: { + name: '1', + unit: { + default: 1, + }, + defaultUnit: 'default', + }, + 2: { + name: '2', + unit: { + default: 1, + }, + defaultUnit: 'default', + }, + 3: { + name: '3', + unit: { + default: 1, + }, + defaultUnit: 'default', + }, + }, + charts: { + default: [ + { + name: 'Dev Mode', + description: '', + subplot: [ + { + x1: { + type: 'time', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'dev', + x1: { + channel: 'time', + }, + y1: { + channel: 1, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEDC/FunctionGenerator.js b/src/data/config-table/EliteEDC/FunctionGenerator.js new file mode 100644 index 0000000..84b6ebd --- /dev/null +++ b/src/data/config-table/EliteEDC/FunctionGenerator.js @@ -0,0 +1,97 @@ +export default { + name: 'Function Generator', + parameter: ['DAC_VOLT', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'TIME_DURATION'], // 這個mode用到的參數 + showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'DAC_VOLT', 'SAMPLE_RATE', 'TIME_DURATION'], // 有要秀給user看的參數 + headerParameter: () => ['DAC_VOLT', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'TIME_DURATION'], // export header的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + minute: 60 * 1e6, + hour: 60 * 60 * 1e6, + }, + defaultUnit: 'ms', + downloadUnit: 'ms', + }, + 0: { + name: 'I_in', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + defaultUnit: 'mA', + downloadUnit: 'mA', + }, + 1: { + name: 'V_out', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 2: { + name: 'V_in', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + }, + charts: { + default: [ + { + name: 'Function Generator', + description: '', + subplot: [ + { + x1: { + type: 'time', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'FuncGen', + x1: { + channel: 'time', + }, + y1: { + channel: 1, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEDC/IT.js b/src/data/config-table/EliteEDC/IT.js new file mode 100644 index 0000000..8952e47 --- /dev/null +++ b/src/data/config-table/EliteEDC/IT.js @@ -0,0 +1,97 @@ +export default { + name: 'I-T Graph', + parameter: ['DAC_VOLT', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'TIME_DURATION'], // 這個mode用到的參數 + showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'DAC_VOLT', 'SAMPLE_RATE', 'TIME_DURATION'], // 有要秀給user看的參數 + headerParameter: () => ['DAC_VOLT', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'TIME_DURATION'], // export header的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + minute: 60 * 1e6, + hour: 60 * 60 * 1e6, + }, + defaultUnit: 'ms', + downloadUnit: 'ms', + }, + 0: { + name: 'I_in', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + defaultUnit: 'mA', + downloadUnit: 'mA', + }, + 1: { + name: 'V_in', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 2: { + name: 'V_out', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + }, + charts: { + default: [ + { + name: 'I-T Graph', + description: '', + subplot: [ + { + x1: { + type: 'time', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'IT', + x1: { + channel: 'time', + }, + y1: { + channel: 0, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEDC/IV.js b/src/data/config-table/EliteEDC/IV.js new file mode 100644 index 0000000..8a334b6 --- /dev/null +++ b/src/data/config-table/EliteEDC/IV.js @@ -0,0 +1,123 @@ +export default { + name: 'I-V Curve', + parameter: [ + 'VOLT_ORIGIN', + 'VOLT_FINAL', + 'VOLT_STEP', + 'STEP_TIME', + 'SAMPLE_RATE', + 'ADC_LEVEL_I_15', + 'ADC_LEVEL_V_IN_15', + 'CTRL_HIGH_Z_15', + ], // 這個mode用到的參數 + showParameter: [ + 'ADC_LEVEL_I_15', + 'ADC_LEVEL_V_IN_15', + 'CTRL_HIGH_Z_15', + 'VOLT_ORIGIN', + 'VOLT_FINAL', + 'VOLT_STEP', + 'STEP_TIME', + 'SAMPLE_RATE', + ], // 有要秀給user看的參數 + headerParameter: () => [ + 'VOLT_ORIGIN', + 'VOLT_FINAL', + 'VOLT_STEP', + 'STEP_TIME', + 'SAMPLE_RATE', + 'ADC_LEVEL_I_15', + 'ADC_LEVEL_V_IN_15', + ], // export header的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + minute: 60 * 1e6, + hour: 60 * 60 * 1e6, + }, + defaultUnit: 'ms', + downloadUnit: 'ms', + }, + 0: { + name: 'I_in', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + defaultUnit: 'mA', + downloadUnit: 'mA', + }, + 1: { + name: 'V_out', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 2: { + name: 'V_in', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + }, + charts: { + default: [ + { + name: 'I-V Curve', + description: '', + subplot: [ + { + x1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'IV', + x1: { + channel: 1, + }, + y1: { + channel: 0, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEDC/LinearSweep.js b/src/data/config-table/EliteEDC/LinearSweep.js new file mode 100644 index 0000000..1e89b80 --- /dev/null +++ b/src/data/config-table/EliteEDC/LinearSweep.js @@ -0,0 +1,120 @@ +export default { + name: 'Linear Sweep Voltammetry', + parameter: [ + 'VOLT_INITIAL', + 'VOLT_EFINAL', + 'Scan_Rate', + 'SAMPLE_RATE', + 'ADC_LEVEL_I_15', + 'ADC_LEVEL_V_IN_15', + 'CTRL_HIGH_Z_15', + ], // 這個mode用到的參數 + showParameter: [ + 'ADC_LEVEL_I_15', + 'ADC_LEVEL_V_IN_15', + 'CTRL_HIGH_Z_15', + 'VOLT_INITIAL', + 'VOLT_EFINAL', + 'Scan_Rate', + 'SAMPLE_RATE', + ], // 有要秀給user看的參數 + headerParameter: () => [ + 'VOLT_INITIAL', + 'VOLT_EFINAL', + 'Scan_Rate', + 'SAMPLE_RATE', + 'ADC_LEVEL_I_15', + 'ADC_LEVEL_V_IN_15', + ], // 有要秀給user看的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + minute: 60 * 1e6, + hour: 60 * 60 * 1e6, + }, + defaultUnit: 'ms', + downloadUnit: 'ms', + }, + 0: { + name: 'I_in', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + defaultUnit: 'mA', + downloadUnit: 'mA', + }, + 1: { + name: 'Potential', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 2: { + name: 'V_out', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + }, + charts: { + default: [ + { + name: 'Linear Sweep Voltammetry', + description: '', + subplot: [ + { + x1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'LSV', + x1: { + channel: 1, + }, + y1: { + channel: 0, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEDC/OCP.js b/src/data/config-table/EliteEDC/OCP.js new file mode 100644 index 0000000..26d6fd1 --- /dev/null +++ b/src/data/config-table/EliteEDC/OCP.js @@ -0,0 +1,97 @@ +export default { + name: 'Open Circuit Potential', + parameter: ['SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'TIME_DURATION'], // 這個mode用到的參數 + showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'SAMPLE_RATE', 'TIME_DURATION'], // 有要秀給user看的參數 + headerParameter: () => ['SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'TIME_DURATION'], // export header的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + minute: 60 * 1e6, + hour: 60 * 60 * 1e6, + }, + defaultUnit: 'ms', + downloadUnit: 'ms', + }, + 0: { + name: 'I_in', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + defaultUnit: 'mA', + downloadUnit: 'mA', + }, + 1: { + name: 'Potential', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 2: { + name: 'V_in', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + }, + charts: { + default: [ + { + name: 'Open Circuit Potential', + description: '', + subplot: [ + { + x1: { + type: 'time', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'OCP', + x1: { + channel: 'time', + }, + y1: { + channel: 1, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEDC/PulseSensing.js b/src/data/config-table/EliteEDC/PulseSensing.js new file mode 100644 index 0000000..56d9c8d --- /dev/null +++ b/src/data/config-table/EliteEDC/PulseSensing.js @@ -0,0 +1,103 @@ +export default { + name: 'Pulse Sensing', + parameter: ['V_initial', 't_pulse', 'CURR_REC'], + // parameter: ['V_initial', 't_pulse', 'CURR_REC_START', 'CURR_REC_END', 'segment_ui_order', 'segment_order', 'DATA_OUTPUT', 'CYCLE_NUMBER'], // 這個mode用到的參數 + showParameter: ['V_initial', 't_pulse', 'CURR_REC'], // 有要秀給user看的參數 + headerParameter: (parameterSet) => { + // [ + // 'V_initial_0', 't_pulse_0', 'CURR_REC_START_0', 'CURR_REC_END_0', + // 'V_initial_1', 't_pulse_1', 'CURR_REC_START_1', 'CURR_REC_END_1', + // 'V_initial_2', 't_pulse_2', 'CURR_REC_START_2', 'CURR_REC_END_2', + // 'V_initial_3', 't_pulse_3', 'CURR_REC_START_3', 'CURR_REC_END_3', + // ] + const defaultParameter = ['V_initial', 't_pulse', 'CURR_REC'] + const ret = [] + for (let index = 0; index < 4; index++) { + if (parameterSet.segment_order[index] !== -1) { + ret.push(...defaultParameter.map((ele) => [ele, index])) + } + } + return ret + }, // export header的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + minute: 60 * 1e6, + hour: 60 * 60 * 1e6, + }, + defaultUnit: 'ms', + downloadUnit: 'ms', + }, + 0: { + name: 'I_in_pul1', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + defaultUnit: 'mA', + downloadUnit: 'mA', + }, + 1: { + name: 'I_in_pul2', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + defaultUnit: 'mA', + downloadUnit: 'mA', + }, + }, + charts: { + default: [ + { + name: 'Pulse Sensing', + description: '', + subplot: [ + { + x1: { + type: 'time', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'PulseSensing', + x1: { + channel: 'time', + }, + y1: { + channel: 1, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEDC/RT.js b/src/data/config-table/EliteEDC/RT.js new file mode 100644 index 0000000..6b866c2 --- /dev/null +++ b/src/data/config-table/EliteEDC/RT.js @@ -0,0 +1,102 @@ +export default { + name: 'R-T Graph', + parameter: ['DAC_VOLT', 'SAMPLE_RATE', 'CTRL_HIGH_Z_15', 'TIME_DURATION'], // 這個mode用到的參數 + showParameter: ['CTRL_HIGH_Z_15', 'DAC_VOLT', 'SAMPLE_RATE', 'TIME_DURATION'], // 有要秀給user看的參數 + headerParameter: () => ['DAC_VOLT', 'SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'TIME_DURATION'], // export header的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + minute: 60 * 1e6, + hour: 60 * 60 * 1e6, + }, + defaultUnit: 'ms', + downloadUnit: 'ms', + }, + 0: { + name: 'I_in', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + defaultUnit: 'mA', + downloadUnit: 'mA', + }, + 1: { + name: 'V_out', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 2: { + name: 'Resistor', + unit: { + mΩ: 1, + mohm: 1, + Ω: 1e3, + ohm: 1e3, + kΩ: 1e6, + kohm: 1e6, + MΩ: 1e9, + Mohm: 1e9, + }, + defaultUnit: 'Ω', + downloadUnit: 'ohm', + }, + }, + charts: { + default: [ + { + name: 'R-T Graph', + description: '', + subplot: [ + { + x1: { + type: 'time', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'RT', + x1: { + channel: 'time', + }, + y1: { + channel: 2, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEDC/VT.js b/src/data/config-table/EliteEDC/VT.js new file mode 100644 index 0000000..98b838b --- /dev/null +++ b/src/data/config-table/EliteEDC/VT.js @@ -0,0 +1,87 @@ +export default { + name: 'V-T Graph', + parameter: ['SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'TIME_DURATION'], // 這個mode用到的參數 + showParameter: ['ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'CTRL_HIGH_Z_15', 'SAMPLE_RATE', 'TIME_DURATION'], // 有要秀給user看的參數 + headerParameter: () => ['SAMPLE_RATE', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'TIME_DURATION'], // export header的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + minute: 60 * 1e6, + hour: 60 * 60 * 1e6, + }, + defaultUnit: 'ms', + downloadUnit: 'ms', + }, + 0: { + name: 'I_in', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + defaultUnit: 'mA', + downloadUnit: 'mA', + }, + 1: { + name: 'V_in', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + }, + charts: { + default: [ + { + name: 'V-T Graph', + description: '', + subplot: [ + { + x1: { + type: 'time', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'VT', + x1: { + channel: 'time', + }, + y1: { + channel: 1, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEDC/index.js b/src/data/config-table/EliteEDC/index.js new file mode 100644 index 0000000..aef0a2f --- /dev/null +++ b/src/data/config-table/EliteEDC/index.js @@ -0,0 +1,1067 @@ +import Idle from '../Common/Idle' +import IV from './IV' +import CycleIV from './CycleIV' +import FunctionGenerator from './FunctionGenerator' +import RT from './RT' +import VT from './VT' +import IT from './IT' +import ConstantCurrent from './ConstantCurrent' +import CyclicVoltammetry from './CyclicVoltammetry' +import LinearSweep from './LinearSweep' +import Chronoamperometry from './Chronoamperometry' +import Chronopotentiometry from './Chronopotentiometry' +import CaliDAC from './CaliDAC' +import CaliADC from './CaliADC' +import DevMode from './DevMode' +import OCP from './OCP' +import PulseSensing from './PulseSensing' +import DPV from './DPV' + +/** + * Number-type-parameter + * PARAMETER_TITLE :{ + * @param type value-type + * @param showName name + * @param componentType component-type + * @param range component-range + * @param defaultValue default-value + * @param defaultUnit default-unit + * @param downloadUnit download-unit + * @param unit unit-table + * @param outputRawData function return raw data + * @param outputReadabilityData function return user data + * } + */ + +/** + * Array-type-parameter + * PARAMETER_TITLE :{ + * @param type value-type + * @param showName name + * @param componentType component-type + * @param options select-options + * @param range select-range + * @param defaultValue default-value + * @param outputRawData function return raw data + * @param outputReadabilityData function return user data + * } + */ + +const EliteZM15 = { + ADC_VALUE_I: { + type: 'none', + showName: 'Instruction', + componentType: 'dev-mode', + }, + TIME_DURATION: { + type: 'number', + showName: 'Time duration', + componentType: 'input-range', + range: Object.freeze({ min: 0, max: 86400 }), // UI上能輸入的最大最小值 + defaultValue: 0, + defaultUnit: 's', + downloadUnit: 's', + unit: { + ms: 1e-3, + s: 1, + m: 60, + h: 3600, + }, + outputRawData: (val) => { + return parseInt(parseFloat(val)) + }, + outputReadabilityData: (val) => { + return parseInt(parseFloat(val)) + }, + }, + CC_CP_SPEED: { + type: 'array', + showName: 'Response speed', + componentType: 'input-button-toggle', + options: [ + { value: 0, label: 'Slow' }, + { value: 1, label: 'Normal' }, + { value: 2, label: 'Fast' }, + ], + range: ['Slow', 'Normal', 'Fast'], + defaultValue: 1, + outputRawData: (val) => { + const speedArr = ['Slow', 'Normal', 'Fast'] + return speedArr.indexOf(val.toString()) + }, + outputReadabilityData: (idx) => { + const speedArr = ['Slow', 'Normal', 'Fast'] + return speedArr[parseInt(idx)] + }, + }, + ADC_LEVEL_I_15: { + type: 'array', + showName: 'Current range', + componentType: 'input-button-toggle', + options: [ + { value: 0, label: '<4 uA' }, + { value: 1, label: '2.5-100 uA' }, + { value: 2, label: '85-2050 uA' }, + { value: 3, label: '1800 uA' }, + { value: 4, label: 'Auto' }, + ], + range: ['<4 uA', '2.5-100 uA', '85-2050 uA', '1800 uA', 'Auto'], + defaultValue: 4, + outputRawData: (val) => { + const currentRangeArr = ['<4 uA', '2.5-100 uA', '85-2050 uA', '1800 uA', 'Auto'] + return currentRangeArr.indexOf(val.toString()) + }, + outputReadabilityData: (idx) => { + const currentRangeArr = ['<4 uA', '2.5-100 uA', '85-2050 uA', '1800 uA', 'Auto'] + return currentRangeArr[parseInt(idx)] + }, + }, + ADC_LEVEL_V_IN_15: { + type: 'array', + showName: 'Voltage range', + componentType: 'input-button-toggle', + options: [ + { value: 0, label: '<7 mV' }, + { value: 1, label: '5-300 mV' }, + { value: 2, label: '>250 mV' }, + { value: 3, label: 'Auto' }, + ], + range: ['<7 mV', '5-300 mV', '>250 mV', 'Auto'], + defaultValue: 3, + outputRawData: (val) => { + const voltageInRangeArr = ['<7 mV', '5-300 mV', '>250 mV', 'Auto'] + return voltageInRangeArr.indexOf(val.toString()) + }, + outputReadabilityData: (idx) => { + const voltageInRangeArr = ['<7 mV', '5-300 mV', '>250 mV', 'Auto'] + return voltageInRangeArr[parseInt(idx)] + }, + }, + CTRL_HIGH_Z_15: { + type: 'array', + showName: 'HighZ', + componentType: 'input-button-toggle', + options: [ + { value: 0, label: 'On' }, + { value: 1, label: 'Off' }, + ], + range: ['On', 'Off'], + defaultValue: 1, + outputRawData: (val) => { + const highzArr = ['On', 'Off'] + return highzArr.indexOf(val.toString()) + }, + outputReadabilityData: (idx) => { + const highzArr = ['On', 'Off'] + return highzArr[parseInt(idx)] + }, + }, + ADC_DAC_CHANNEL_15: { + type: 'array', + showName: 'Cali Channel', + componentType: 'input-button-toggle', + options: [ + { value: 0, label: 'Iin' }, + { value: 1, label: 'Vin' }, + { value: 2, label: 'Vout' }, + ], + range: ['Iin', 'Vin', 'Vout'], + defaultValue: 0, + outputRawData: (val) => { + const caliChannelArr = ['Iin', 'Vin', 'Vout'] + return caliChannelArr.indexOf(val.toString()) + }, + outputReadabilityData: (idx) => { + const caliChannelArr = ['Iin', 'Vin', 'Vout'] + return caliChannelArr[parseInt(idx)] + }, + + syncParameter: { + 0: [ + ['ADC_LEVEL_V_IN_15', 3], + ['ADC_LEVEL_I_15', 0], + ['DAC_LEVEL_V_OUT_15', 2], + ], + 1: [ + ['ADC_LEVEL_V_IN_15', 0], + ['ADC_LEVEL_I_15', 0], + ['DAC_LEVEL_V_OUT_15', 2], + ], + 2: [ + ['ADC_LEVEL_V_IN_15', 3], + ['ADC_LEVEL_I_15', 4], + ['DAC_LEVEL_V_OUT_15', 0], + ], + }, + }, + VOLT_ORIGIN: { + type: 'number', + showName: 'Volt start', + componentType: 'input-range', + range: Object.freeze({ min: 0, max: 50000 }), // UI上能輸入的最大最小值 + defaultValue: 25000, + defaultUnit: 'V', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 5) / scale + }, + }, + VOLT_FINAL: { + type: 'number', + showName: 'Volt stop', + componentType: 'input-range', + range: Object.freeze({ min: 0, max: 50000 }), + defaultValue: 25000, + defaultUnit: 'V', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 5) / scale + }, + }, + VOLT_STEP: { + type: 'number', + showName: 'Volt step', + componentType: 'input-range', + range: Object.freeze({ min: 1, max: 1000 }), + defaultValue: 1000, + defaultUnit: 'mV', + downloadUnit: 'mV', + unit: { + mV: 1, + }, + outputRawData: (val) => { + if ((parseFloat(val) * 10) % 2 !== 0) { + // odd number + return parseFloat(val) * 10 + 1 + } else { + return parseFloat(val) * 10 + } + }, + outputReadabilityData: (val) => { + return parseFloat(val) / 10 + }, + }, + STEP_TIME: { + type: 'array', + showName: 'Step time', + componentType: 'input-button-toggle', + options: [ + { value: 0, label: '0.5s' }, + { value: 1, label: '1.0s' }, + { value: 2, label: '2.0s' }, + ], + range: ['0.5s', '1.0s', '2.0s'], + defaultValue: 1, + outputRawData: (val) => { + const stepTimeArr = ['0.5s', '1.0s', '2.0s'] + return stepTimeArr.indexOf(val.toString()) + }, + outputReadabilityData: (idx) => { + const stepTimeArr = ['0.5s', '1.0s', '2.0s'] + return stepTimeArr[parseInt(idx)] + }, + downloadUnit: 's', + }, + DAC_LEVEL_V_OUT_15: { + type: 'array', + showName: 'DAC range', + componentType: 'input-button-toggle', + options: [ + { value: 0, label: '0' }, + { value: 1, label: '1' }, + { value: 2, label: 'Auto' }, + ], + range: ['0', '1', 'Auto'], + defaultValue: 2, + outputRawData: (val) => { + const caliChannelArr = ['0', '1', 'Auto'] + return caliChannelArr.indexOf(val.toString()) + }, + outputReadabilityData: (idx) => { + const caliChannelArr = ['0', '1', 'Auto'] + return caliChannelArr[parseInt(idx)] + }, + }, + DAC_VOLT: { + type: 'number', + showName: 'Volt out', + componentType: 'input-range', + range: Object.freeze({ min: 0, max: 50000 }), + defaultValue: 25000, + defaultUnit: 'V', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 5) / scale + }, + }, + DAC_VOLT_SCROLL: { + type: 'number', + showName: 'DAC code', + componentType: 'input-range', + range: Object.freeze({ min: 0, max: 60000 }), + defaultValue: 25000, + defaultUnit: '', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val)) + }, + outputReadabilityData: (val, scale = 0) => { + return parseInt(parseFloat(val)) + }, + }, + DAC_VOLT_BUTTON: { + type: 'array', + showName: 'DAC code', + componentType: 'input-button-toggle', + options: [ + { value: 0, label: '10000' }, + { value: 1, label: '25000' }, + { value: 2, label: '50000' }, + { value: 3, label: '60000' }, + ], + range: ['10000', '25000', '50000', '60000'], + defaultValue: 1, + outputRawData: (val) => { + const caliChannelArr = ['10000', '25000', '50000', '60000'] + return caliChannelArr.indexOf(val.toString()) + }, + outputReadabilityData: (idx) => { + const caliChannelArr = ['10000', '25000', '50000', '60000'] + return caliChannelArr[parseInt(idx)] + }, + }, + SAMPLE_RATE: { + type: 'number', + componentType: 'input-range', + showName: (mode) => { + const nameObj = { 'Sample rate': [0, 1, 2, 3, 4, 5, 6, 9, 13, 16], Resolution: [7, 8] } + for (const key of Object.keys(nameObj)) { + if (nameObj[key].includes(mode)) { + return key + } + } + return 'Sample rate' + }, + range: Object.freeze({ min: 1, max: 1000 }), + defaultValue: 1000, + defaultUnit: 'sps', + downloadUnit: 'sps', + unit: { + sps: 1, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * 10) + }, + outputReadabilityData: (val, scale = 1) => { + return parseFloat(val) / 10 + }, + }, + Charge: { + type: 'array', + showName: 'Charge', + componentType: 'input-button-toggle', + options: [ + { value: 1, label: 'Charge' }, + { value: 0, label: 'Discharge' }, + ], + range: ['Charge', 'Discharge'], + defaultValue: 1, + outputRawData: (val) => { + const chargeArr = ['DisCharge', 'Charge'] + return chargeArr.indexOf(val.toString()) + }, + outputReadabilityData: (val) => { + const chargeArr = ['DisCharge', 'Charge'] + return chargeArr[parseInt(val)] + }, + }, + Const_Current_value: { + type: 'number', + showName: 'Current', + componentType: 'input-range', + range: Object.freeze({ min: 0, max: 1500000 }), + defaultValue: 0, + defaultUnit: 'uA', + downloadUnit: 'uA', + unit: { + uA: 1, + mA: 1e3, + }, + outputRawData: (val) => { + return parseInt(parseFloat(val) * 100) + }, + outputReadabilityData: (val) => { + return parseFloat(val) / 100 + }, + }, + VOLTSTOP_MAX: { + type: 'number', + showName: 'Volt max', + componentType: 'input-range', + range: Object.freeze({ min: 0, max: 50000 }), + defaultValue: 50000, + defaultUnit: 'V', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 5) / scale + }, + }, + VOLTSTOP_MIN: { + type: 'number', + showName: 'Volt min stop', + componentType: 'input-range', + range: Object.freeze({ min: 0, max: 50000 }), + defaultValue: 0, + defaultUnit: 'V', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 5) / scale + }, + }, + VOLT_INITIAL: { + type: 'number', + showName: 'E-Initial', + componentType: 'input-range', + range: Object.freeze({ min: 0, max: 50000 }), + defaultValue: 25000, + defaultUnit: 'V', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 5) / scale + }, + }, + VOLT_MAX: { + type: 'number', + showName: 'E1', + componentType: 'input-range', + range: Object.freeze({ min: 0, max: 50000 }), + defaultValue: 27500, + defaultUnit: 'V', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 5) / scale + }, + }, + VOLT_MIN: { + type: 'number', + showName: 'E2', + componentType: 'input-range', + range: Object.freeze({ min: 0, max: 50000 }), + defaultValue: 22500, + defaultUnit: 'V', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 5) / scale + }, + }, + VOLT_EFINAL: { + type: 'number', + showName: 'E-Final', + componentType: 'input-range', + range: Object.freeze({ min: 0, max: 50000 }), + defaultValue: 25000, + defaultUnit: 'V', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 5) / scale + }, + }, + VOLT_VSCAN: { + type: 'number', + showName: 'Volt (v.s. ref)', + componentType: 'input-range', + range: Object.freeze({ min: 0, max: 50000 }), + defaultValue: 25000, + defaultUnit: 'V', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 5) / scale + }, + }, + Scan_Rate: { + type: 'number', + showName: 'ScanRate', + componentType: 'input-range', + range: Object.freeze({ min: 1, max: 100000 }), + defaultValue: 10000, + defaultUnit: 'mV/s', + downloadUnit: 'mV/s', + unit: { + 'mV/s': 1, + }, + outputRawData: (val) => { + return parseInt(parseFloat(val) * 100) + }, + outputReadabilityData: (val) => { + return parseFloat(val) / 100 + }, + }, + CYCLE_NUMBER: { + type: 'number', + showName: 'Cycle number', + componentType: 'input-range', + range: Object.freeze({ min: 1, max: 50000 }), + defaultValue: 1, + defaultUnit: 'cycle', + unit: { + cycle: 1, + }, + outputRawData: (val) => { + return parseInt(val) + }, + outputReadabilityData: (val) => { + return parseInt(val) + }, + }, + V_initial: { + type: 'number-array', + showName: 'Segment Voltage', + componentType: 'input-field', + range: Object.freeze({ min: 0, max: 50000 }), + defaultValue: [50000, 25000, 25000, 25000], + defaultUnit: 'V', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + outputRawData: (val, scale = 1, index = -1) => { + if (index === -1) { + return parseInt(parseFloat(val) * scale * 5 + 25000) + } else { + return parseInt(parseFloat(val[index]) * scale * 5 + 25000) + } + }, + outputReadabilityData: (val, scale = 1, index = -1) => { + if (index === -1) { + return parseInt((parseFloat(val) - 25000) / 5) / scale + } else { + return parseInt((parseFloat(val[index]) - 25000) / 5) / scale + } + }, + }, + t_pulse: { + type: 'number-array', + showName: 'Segment Duration', + componentType: 'input-field', + range: Object.freeze({ min: 0, max: 1e6 }), + defaultValue: [750, 9250, 1000, 1000], + defaultUnit: 'ms', + downloadUnit: 'ms', + unit: { + ms: 1, + s: 1e3, + }, + outputRawData: (val, scale = 1, index = -1) => { + if (index >= 0) { + val = val[index] + } + let _val = parseInt(val) * scale + // 5 ms a step + const remainder = parseInt(_val) % 5 + if (remainder !== 0) { + _val = parseInt(_val) + (5 - remainder) + } + return _val * 10 + }, + outputReadabilityData: (val, scale = 1, index = -1) => { + if (index >= 0) { + val = val[index] + } + return parseFloat(val) / 10 / scale + }, + }, + CURR_REC: { + type: 'number-array', + showName: 'Current Recording Period', + componentType: 'input-range-slider', + range: Object.freeze({ min: 0, max: 100 }), + defaultValue: [ + [35, 90], + [35, 99], + [35, 95], + [35, 95], + ], + defaultUnit: '%', + unit: { + '%': 1, + }, + outputRawData: (val, scale = 1, index = -1) => { + if (index >= 0) { + val = val[index] + } + return val + }, + outputReadabilityData: (val, scale = 1, index = -1) => { + if (index >= 0) { + val = val[index] + } + return val + }, + sliderStep: 5, + }, + segment_order: { + type: 'number-array', + range: Object.freeze({ min: -1, max: 3 }), + defaultValue: [0, 1, -1, -1], + outputRawData: (val, scale = 1, index = -1) => { + if (index === -1) { + return val + } else { + return val[index] + } + }, + outputReadabilityData: (val, scale = 1, index = -1) => { + if (index === -1) { + return val + } else { + return val[index] + } + }, + }, + DATA_OUTPUT: { + type: 'array', + showName: 'Data Output', + range: ['Average', 'Raw Data'], + defaultValue: 0, + func: (val) => { + const outputArr = ['Average', 'Raw Data'] + return outputArr.indexOf(val.toString()) + }, + rev_func: (idx) => { + const outputArr = ['Average', 'Raw Data'] + return outputArr[parseInt(idx)] + }, + }, + DPV_mode: { + type: 'array', + showName: 'DPV-mode', + componentType: 'None', + options: [ + { value: 0, label: 'AUTO' }, + { value: 1, label: 'ADVANCED' }, + { value: 2, label: 'ENGINEERING' }, + ], + range: ['AUTO', 'ADVANCED', 'ENGINEERING'], + defaultValue: 1, + outputRawData: (val) => { + const speedArr = ['AUTO', 'ADVANCED', 'ENGINEERING'] + return speedArr.indexOf(val.toString()) + }, + outputReadabilityData: (idx) => { + const speedArr = ['AUTO', 'ADVANCED', 'ENGINEERING'] + return speedArr[parseInt(idx)] + }, + }, + DPV_e_init: { + type: 'number', + showName: 'E-Initial', + componentType: 'input-field', + range: Object.freeze({ min: 0, max: 50000 }), + defaultValue: 20000, + defaultUnit: 'mV', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 5) / scale + }, + }, + + DPV_e_1: { + type: 'number', + showName: 'E1', + componentType: 'input-field', + range: Object.freeze({ min: 0, max: 50000 }), + defaultValue: 35000, + defaultUnit: 'mV', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 5) / scale + }, + }, + + DPV_e_2: { + type: 'number', + showName: 'E2', + componentType: 'input-field', + range: Object.freeze({ min: 0, max: 50000 }), + defaultValue: 15000, + defaultUnit: 'mV', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 5) / scale + }, + }, + + DPV_e_final: { + type: 'number', + showName: 'E-Final', + componentType: 'input-field', + range: Object.freeze({ min: 0, max: 50000 }), + defaultValue: 30000, + defaultUnit: 'mV', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 5) / scale + }, + }, + + DPV_increment: { + type: 'number', + showName: 'Increment', + componentType: 'input-field', + range: Object.freeze({ min: 0, max: 50000 }), + defaultValue: 25025, + defaultUnit: 'mV', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 5) / scale + }, + }, + + DPV_amp: { + type: 'number', + showName: 'Pulse Amplitude', + componentType: 'input-field', + range: Object.freeze({ min: 0, max: 50000 }), + defaultValue: 25125, + defaultUnit: 'mV', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 5) / scale + }, + }, + + DPV_pul_width: { + type: 'number', + showName: 'Pulse Width', + componentType: 'input-field', + range: Object.freeze({ min: 0, max: 1e6 }), + defaultValue: 50, + defaultUnit: 'ms', + downloadUnit: 'ms', + unit: { + ms: 1, + s: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt(parseFloat(val)) / scale + }, + }, + + DPV_step_time: { + type: 'number', + showName: 'Period', + componentType: 'input-field', + range: Object.freeze({ min: 0, max: 1e6 }), + defaultValue: 500, + defaultUnit: 'ms', + downloadUnit: 'ms', + unit: { + ms: 1, + s: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt(parseFloat(val)) / scale + }, + }, + + DPV_pulse_option: { + type: 'boolean', + showName: 'Pulse Option', + componentType: 'input-option', + description: 'Invert pulses during E1 to E2', + defaultValue: false, + }, + + DPV_curr_rec: { + type: 'array', + showName: 'Pre- / Post-Pulse Width', + componentType: 'input-double-range', + range: Object.freeze({ min: 0, max: 100 }), + defaultValue: [25, 100], + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt(parseFloat(val)) / scale + }, + }, + + DPV_notify_rate: { + type: 'number', + showName: 'Sample Rate', + componentType: 'input-field', + range: Object.freeze({ min: 0, max: 1000 }), + defaultValue: 1000, + defaultUnit: 'sps', + downloadUnit: 'sps', + unit: { + sps: 1, + }, + outputRawData: (val, scale = 1) => { + return parseFloat(val) * 10 + }, + outputReadabilityData: (val, scale = 1) => { + return parseFloat(val) / 10 + }, + }, + + DPV_engineering_enable: { + type: 'boolean', + showName: '', + componentType: 'input-toggle', + defaultValue: false, + }, + + MODE_OPTIONS: [ + { + id: 17, + description: 'Idle', + img_src: 'IV-Wire', + highz: 1, + }, + { + id: 0, + description: 'I-V Curve', + img_src: 'IV-Wire', + highz: 1, + }, + { + id: 1, + description: 'Cycle I-V', + img_src: 'CIV-Wire', + highz: 1, + }, + { + id: 2, + description: 'Function Generator', + img_src: 'FG-Wire', + highz: 1, + }, + { + id: 3, + description: 'R-T Graph', + img_src: 'RT-Wire', + highz: 1, + }, + { + id: 4, + description: 'V-T Graph', + img_src: 'VT-Wire', + highz: 0, + }, + { + id: 5, + description: 'I-T Graph', + img_src: 'IT-Wire', + highz: 1, + }, + { + id: 6, + description: 'Constant Current', + img_src: 'CC-Wire', + highz: 1, + }, + { + id: 13, + description: 'Open Circuit Potential', + img_src: 'OCP-Wire', + highz: 0, + }, + { + id: 7, + description: 'Cyclic Voltammetry', + img_src: 'CV-Wire', + highz: 1, + }, + { + id: 8, + description: 'Linear Sweep Voltammetry', + img_src: 'LSV-Wire', + highz: 1, + }, + { + id: 9, + description: 'Chronoamperometry', + img_src: 'CG-Wire', + highz: 1, + }, + { + id: 16, + description: 'Chronopotentiometry', + img_src: 'CC-Wire', + highz: 1, + }, + { + id: 14, + description: 'Pulse Sensing', + img_src: 'PS-Wire', + highz: 1, + }, + { + id: 15, + description: 'Differential Pulse Voltammetry (DPV)', + img_src: 'DPV-Wire', + highz: 1, + }, + { + id: 12, + description: 'Dev Mode', + img_src: 'DevM-Wire', + }, + { + id: 10, + description: 'Cali DAC - test', + img_src: 'CDAC-Wire', + }, + { + id: 11, + description: 'Cali Mode - test', + img_src: 'CADC-Wire', + }, + ], + MODE: { + 0: IV, + 1: CycleIV, + 2: FunctionGenerator, + 3: RT, + 4: VT, + 5: IT, + 6: ConstantCurrent, + 7: CyclicVoltammetry, + 8: LinearSweep, + 9: Chronoamperometry, + 10: CaliDAC, + 11: CaliADC, + 12: DevMode, + 13: OCP, + 14: PulseSensing, + 15: DPV, + 16: Chronopotentiometry, + 17: Idle, + }, +} + +export default EliteZM15 diff --git a/src/data/config-table/EliteEIS/Chronoamperometry.js b/src/data/config-table/EliteEIS/Chronoamperometry.js new file mode 100644 index 0000000..a9ec724 --- /dev/null +++ b/src/data/config-table/EliteEIS/Chronoamperometry.js @@ -0,0 +1,97 @@ +export default { + name: 'Chronoamperometry', + parameter: ['CA_VOLT', 'SAMPLE_RATE', 'GENERAL_LP_RTIA', 'CTRL_HIGH_Z_15', 'TIME_DURATION'], // 這個mode用到的參數 + showParameter: ['GENERAL_LP_RTIA', 'CTRL_HIGH_Z_15', 'CA_VOLT', 'SAMPLE_RATE', 'TIME_DURATION'], // 有要秀給user看的參數 + headerParameter: () => ['CA_VOLT', 'SAMPLE_RATE', 'GENERAL_LP_RTIA', 'TIME_DURATION'], // 有要秀給user看的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + minute: 60 * 1e6, + hour: 60 * 60 * 1e6, + }, + defaultUnit: 'ms', + downloadUnit: 'ms', + }, + 0: { + name: 'I_in', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + defaultUnit: 'mA', + downloadUnit: 'mA', + }, + 1: { + name: 'Potential', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 2: { + name: 'V_out', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + }, + charts: { + default: [ + { + name: 'Chronoamperometric', + description: '', + subplot: [ + { + x1: { + type: 'time', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'chrono', + x1: { + channel: 'time', + }, + y1: { + channel: 0, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEIS/ConstantFrequency.js b/src/data/config-table/EliteEIS/ConstantFrequency.js new file mode 100644 index 0000000..8ac1181 --- /dev/null +++ b/src/data/config-table/EliteEIS/ConstantFrequency.js @@ -0,0 +1,273 @@ +export default { + name: 'Constant Frequency', + parameter: [ + 'CF_DC_BIAS', + 'CF_AC_AMP', + 'CF_FREQ', + 'CF_PPD', + 'CF_SCALE', + 'CF_DELAY', + 'CF_AVERAGE_NUM', + 'GENERAL_HS_RTIA', + ], // 這個mode用到的參數 + showParameter: [ + 'CF_DC_BIAS', + 'CF_AC_AMP', + 'CF_FREQ', + 'CF_PPD', + 'CF_SCALE', + 'CF_DELAY', + 'CF_AVERAGE_NUM', + 'GENERAL_HS_RTIA', + ], // 有要秀給user看的參數 + headerParameter: () => [ + 'CF_DC_BIAS', + 'CF_AC_AMP', + 'CF_FREQ', + 'CF_PPD', + 'CF_SCALE', + 'CF_DELAY', + 'CF_AVERAGE_NUM', + 'GENERAL_HS_RTIA', + ], // 有要秀給user看的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + m: 60 * 1e6, + h: 60 * 60 * 1e6, + auto: 1, + }, + defaultUnit: 'auto', + downloadUnit: 'ms', + }, + 0: { + name: 'Z_Imag_Raw', + unit: { + ohm: 1, + }, + downloadUnit: 'ohm', + defaultUnit: 'ohm', + }, + 1: { + name: 'Z_Real_Raw', + unit: { + default: 1, + }, + downloadUnit: 'ohm', + defaultUnit: 'ohm', + }, + 2: { + name: 'Frequency', + unit: { + mHz: 1, + Hz: 1e3, + kHz: 1e6, + }, + downloadUnit: 'mHz', + defaultUnit: 'mHz', + }, + // 3: { + // name: 'Cycle', + // unit: { + // cycle: 1, + // }, + // defaultUnit: 'cycle', + // downloadUnit: null, + // }, + 4: { + name: 'Z_Imag', + unit: { + mohm: 1e-3, + mΩ: 1e-3, + ohm: 1, + Ω: 1, + kohm: 1e3, + kΩ: 1e3, + Mohm: 1e6, + MΩ: 1e6, + }, + downloadUnit: 'ohm', + defaultUnit: 'Ω', + }, + 5: { + name: 'Z_Real', + unit: { + mohm: 1e-3, + mΩ: 1e-3, + ohm: 1, + Ω: 1, + kohm: 1e3, + kΩ: 1e3, + Mohm: 1e6, + MΩ: 1e6, + }, + downloadUnit: 'ohm', + defaultUnit: 'Ω', + }, + 6: { + name: 'Impedance', + unit: { + mohm: 1e-3, + mΩ: 1e-3, + ohm: 1, + Ω: 1, + kohm: 1e3, + kΩ: 1e3, + Mohm: 1e6, + MΩ: 1e6, + }, + downloadUnit: 'ohm', + defaultUnit: 'Ω', + }, + 7: { + name: 'Phase', + unit: { + millidegree: 1, + '°': 1e3, + }, + downloadUnit: 'millidegree', + defaultUnit: '°', + }, + 8: { + name: 'Current', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + downloadUnit: 'nA', + defaultUnit: 'nA', + }, + 9: { + name: 'Level gain', + unit: { + default: 1, + }, + downloadUnit: null, + defaultUnit: 'default', + }, + 10: { + name: 'notify_one', + unit: { + default: 1, + }, + downloadUnit: null, + defaultUnit: 'default', + }, + 11: { + name: 'notify_two', + unit: { + default: 1, + }, + downloadUnit: null, + defaultUnit: 'default', + }, + 12: { + name: 'notify_three', + unit: { + default: 1, + }, + downloadUnit: null, + defaultUnit: 'default', + }, + 13: { + name: 'debug_amp[mV]', + unit: { + default: 1, + }, + downloadUnit: null, + defaultUnit: 'default', + }, + }, + charts: { + default: [ + { + name: 'Nyquist', + description: '', + subplot: [ + { + x1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'Nyquist', + x1: { + channel: 5, + }, + y1: { + channel: 4, + }, + }, + ], + }, + ], + }, + { + name: 'Bode', + description: '', + subplot: [ + { + x1: { + type: 'value', + valScale: 'log', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y2: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'Bode', + x1: { + channel: 2, + }, + y1: { + channel: 6, + }, + y2: { + channel: 7, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEIS/CyclicVoltammetry.js b/src/data/config-table/EliteEIS/CyclicVoltammetry.js new file mode 100644 index 0000000..a7dd7d1 --- /dev/null +++ b/src/data/config-table/EliteEIS/CyclicVoltammetry.js @@ -0,0 +1,123 @@ +export default { + name: 'Cyclic Voltammetry', + parameter: ['CV_E_INITIAL', 'CV_E1', 'CV_E2', 'CV_SCAN_RATE', 'SAMPLE_RATE', 'CYCLE_NUMBER', 'GENERAL_LP_RTIA'], // 這個mode用到的參數 + showParameter: [ + 'GENERAL_LP_RTIA', + 'CTRL_HIGH_Z_15', + 'CV_E_INITIAL', + 'CV_E1', + 'CV_E2', + 'CV_SCAN_RATE', + 'SAMPLE_RATE', + 'CYCLE_NUMBER', + ], // 有要秀給user看的參數 + headerParameter: () => [ + 'CV_E_INITIAL', + 'CV_E1', + 'CV_E2', + 'CV_SCAN_RATE', + 'SAMPLE_RATE', + 'CYCLE_NUMBER', + 'GENERAL_LP_RTIA', + ], // 有要秀給user看的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + m: 60 * 1e6, + h: 60 * 60 * 1e6, + auto: 1, + }, + defaultUnit: 'auto', + downloadUnit: 'ms', + }, + 0: { + name: 'I_in', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + defaultUnit: 'uA', + downloadUnit: 'mA', + }, + 1: { + name: 'V_out-V_in', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 2: { + name: 'V_out', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 3: { + name: 'Cycle', + unit: { + cycle: 1, + }, + defaultUnit: 'cycle', + downloadUnit: null, + }, + }, + charts: { + default: [ + { + name: 'Cyclic Voltammetry', + description: '', + subplot: [ + { + x1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'CV', + x1: { + channel: 1, + }, + y1: { + channel: 0, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEIS/DevMode.js b/src/data/config-table/EliteEIS/DevMode.js new file mode 100644 index 0000000..7c317bb --- /dev/null +++ b/src/data/config-table/EliteEIS/DevMode.js @@ -0,0 +1,93 @@ +export default { + name: 'Dev Mode', + parameter: ['ADC_VALUE_I'], + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + m: 60 * 1e6, + h: 60 * 60 * 1e6, + auto: 1, + }, + defaultUnit: 'us', + }, + 0: { + name: '0', + unit: { + default: 1, + }, + defaultUnit: 'default', + }, + 1: { + name: '1', + unit: { + default: 1, + }, + defaultUnit: 'default', + }, + 2: { + name: '2', + unit: { + default: 1, + }, + defaultUnit: 'default', + }, + 3: { + name: '3', + unit: { + default: 1, + }, + defaultUnit: 'default', + }, + }, + charts: { + default: [ + { + name: 'Dev Mode', + description: '', + subplot: [ + { + x1: { + type: 'time', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'dev', + x1: { + channel: 'time', + }, + y1: { + channel: 1, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEIS/PotentiostaticEIS.js b/src/data/config-table/EliteEIS/PotentiostaticEIS.js new file mode 100644 index 0000000..72f926e --- /dev/null +++ b/src/data/config-table/EliteEIS/PotentiostaticEIS.js @@ -0,0 +1,275 @@ +export default { + name: 'EIS', + parameter: [ + 'EIS_DC_BIAS', + 'EIS_AC_AMP', + 'EIS_FREQ', + 'EIS_PPD', + 'EIS_SCALE', + 'EIS_DELAY', + 'EIS_AVERAGE_NUM', + 'GENERAL_HS_RTIA', + ], // 這個mode用到的參數 + showParameter: [ + 'EIS_DC_BIAS', + 'EIS_AC_AMP', + 'EIS_FREQ', + 'EIS_PPD', + 'EIS_SCALE', + 'EIS_DELAY', + 'EIS_AVERAGE_NUM', + 'GENERAL_HS_RTIA', + ], // 有要秀給user看的參數 + headerParameter: () => [ + 'EIS_DC_BIAS', + 'EIS_AC_AMP', + 'EIS_FREQ', + 'EIS_PPD', + 'EIS_SCALE', + 'EIS_DELAY', + 'EIS_AVERAGE_NUM', + 'GENERAL_HS_RTIA', + ], // 有要秀給user看的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + m: 60 * 1e6, + h: 60 * 60 * 1e6, + auto: 1, + }, + defaultUnit: 'auto', + downloadUnit: 'ms', + }, + 0: { + name: 'Z_Imag_Raw', + unit: { + ohm: 1, + }, + downloadUnit: 'ohm', + defaultUnit: 'ohm', + }, + 1: { + name: 'Z_Real_Raw', + unit: { + default: 1, + }, + downloadUnit: 'ohm', + defaultUnit: 'ohm', + }, + 2: { + name: 'Frequency', + unit: { + mHz: 1, + Hz: 1e3, + kHz: 1e6, + }, + downloadUnit: 'mHz', + defaultUnit: 'mHz', + }, + // 3: { + // name: 'Cycle', + // unit: { + // cycle: 1, + // }, + // defaultUnit: 'cycle', + // downloadUnit: null, + // }, + 4: { + name: 'Z_Imag', + unit: { + mohm: 1e-3, + mΩ: 1e-3, + ohm: 1, + Ω: 1, + kohm: 1e3, + kΩ: 1e3, + Mohm: 1e6, + MΩ: 1e6, + }, + downloadUnit: 'ohm', + defaultUnit: 'Ω', + }, + 5: { + name: 'Z_Real', + unit: { + mohm: 1e-3, + mΩ: 1e-3, + ohm: 1, + Ω: 1, + kohm: 1e3, + kΩ: 1e3, + Mohm: 1e6, + MΩ: 1e6, + }, + downloadUnit: 'ohm', + defaultUnit: 'Ω', + }, + 6: { + name: 'Impedance', + unit: { + mohm: 1e-3, + mΩ: 1e-3, + ohm: 1, + Ω: 1, + kohm: 1e3, + kΩ: 1e3, + Mohm: 1e6, + MΩ: 1e6, + }, + downloadUnit: 'ohm', + defaultUnit: 'Ω', + }, + 7: { + name: 'Phase', + unit: { + millidegree: 1, + '°': 1e3, + }, + downloadUnit: 'millidegree', + defaultUnit: '°', + }, + 8: { + name: 'Current', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + downloadUnit: 'nA', + defaultUnit: 'nA', + }, + 9: { + name: 'Level gain', + unit: { + default: 1, + }, + downloadUnit: null, + defaultUnit: 'default', + }, + 10: { + name: 'notify_one', + unit: { + default: 1, + }, + downloadUnit: null, + defaultUnit: 'default', + }, + 11: { + name: 'notify_two', + unit: { + default: 1, + }, + downloadUnit: null, + defaultUnit: 'default', + }, + 12: { + name: 'notify_three', + unit: { + default: 1, + }, + downloadUnit: null, + defaultUnit: 'default', + }, + 13: { + name: 'debug_amp[mV]', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + }, + charts: { + default: [ + { + name: 'Nyquist', + description: '', + subplot: [ + { + x1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'Nyquist', + x1: { + channel: 5, + }, + y1: { + channel: 4, + }, + }, + ], + }, + ], + }, + { + name: 'Bode', + description: '', + subplot: [ + { + x1: { + type: 'value', + valScale: 'log', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y2: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'Bode', + x1: { + channel: 2, + }, + y1: { + channel: 6, + }, + y2: { + channel: 7, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEIS/RT.js b/src/data/config-table/EliteEIS/RT.js new file mode 100644 index 0000000..6ba8578 --- /dev/null +++ b/src/data/config-table/EliteEIS/RT.js @@ -0,0 +1,102 @@ +export default { + name: 'R-T Graph', + parameter: ['RT_VOLT_SET', 'SAMPLE_RATE', 'CTRL_HIGH_Z_15', 'TIME_DURATION'], // 這個mode用到的參數 + showParameter: ['RT_VOLT_SET', 'SAMPLE_RATE', 'CTRL_HIGH_Z_15', 'TIME_DURATION'], // 有要秀給user看的參數 + headerParameter: () => ['RT_VOLT_SET', 'SAMPLE_RATE', 'GENERAL_LP_RTIA', 'TIME_DURATION'], // export header的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + minute: 60 * 1e6, + hour: 60 * 60 * 1e6, + }, + defaultUnit: 'ms', + downloadUnit: 'ms', + }, + 0: { + name: 'I_in', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + defaultUnit: 'mA', + downloadUnit: 'mA', + }, + 1: { + name: 'V_out', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + 2: { + name: 'Resistor', + unit: { + mΩ: 1, + mohm: 1, + Ω: 1e3, + ohm: 1e3, + kΩ: 1e6, + kohm: 1e6, + MΩ: 1e9, + Mohm: 1e9, + }, + defaultUnit: 'Ω', + downloadUnit: 'ohm', + }, + }, + charts: { + default: [ + { + name: 'R-T Graph', + description: '', + subplot: [ + { + x1: { + type: 'time', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'RT', + x1: { + channel: 'time', + }, + y1: { + channel: 2, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEIS/VT.js b/src/data/config-table/EliteEIS/VT.js new file mode 100644 index 0000000..592d2c8 --- /dev/null +++ b/src/data/config-table/EliteEIS/VT.js @@ -0,0 +1,87 @@ +export default { + name: 'V-T Graph', + parameter: ['SAMPLE_RATE', 'VT_MEASURE_VIN_RANGE', 'GENERAL_LP_RTIA', 'CTRL_HIGH_Z_15', 'TIME_DURATION'], // 這個mode用到的參數 + showParameter: ['SAMPLE_RATE', 'VT_MEASURE_VIN_RANGE', 'GENERAL_LP_RTIA', 'CTRL_HIGH_Z_15', 'TIME_DURATION'], // 有要秀給user看的參數 + headerParameter: () => ['SAMPLE_RATE', 'VT_MEASURE_VIN_RANGE', 'GENERAL_LP_RTIA', 'TIME_DURATION'], // export header的參數 + valScales: { + linear: { + func: (val) => { + return val + }, + }, + log: { + func: (val) => { + return Math.log10(Math.abs(val)) + }, + }, + }, + channels: { + time: { + name: 'Time', + unit: { + us: 1, + ms: 1e3, + s: 1e6, + minute: 60 * 1e6, + hour: 60 * 60 * 1e6, + }, + defaultUnit: 'ms', + downloadUnit: 'ms', + }, + 0: { + name: 'I_in', + unit: { + nA: 1, + uA: 1e3, + mA: 1e6, + }, + defaultUnit: 'mA', + downloadUnit: 'mA', + }, + 1: { + name: 'V_in', + unit: { + uV: 1, + mV: 1e3, + V: 1e6, + }, + defaultUnit: 'mV', + downloadUnit: 'mV', + }, + }, + charts: { + default: [ + { + name: 'V-T Graph', + description: '', + subplot: [ + { + x1: { + type: 'time', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + y1: { + type: 'value', + valScale: 'linear', + min: 'dataMin', + max: 'dataMax', + }, + data: [ + { + legend: 'VT', + x1: { + channel: 'time', + }, + y1: { + channel: 1, + }, + }, + ], + }, + ], + }, + ], + }, +} diff --git a/src/data/config-table/EliteEIS/index.js b/src/data/config-table/EliteEIS/index.js new file mode 100644 index 0000000..cdd9df4 --- /dev/null +++ b/src/data/config-table/EliteEIS/index.js @@ -0,0 +1,579 @@ +import PotentiostaticEIS from './PotentiostaticEIS' +import CyclicVoltammetry from './CyclicVoltammetry' +import DevMode from './DevMode' +import Chronoamperometry from './Chronoamperometry' +import VT from './VT' +import RT from './RT' +import ConstantFrequency from './ConstantFrequency' +import Idle from '../Common/Idle' + +const EliteEIS = { + TIME_DURATION: { + type: 'number', + showName: 'Time duration', + componentType: 'input-range', + range: Object.freeze({ min: 0, max: 86400 }), // UI上能輸入的最大最小值 + defaultValue: 0, + defaultUnit: 's', + downloadUnit: 's', + unit: { + ms: 1e-3, + s: 1, + m: 60, + h: 3600, + }, + outputRawData: (val) => { + return parseInt(parseFloat(val)) + }, + outputReadabilityData: (val) => { + return parseInt(parseFloat(val)) + }, + }, + CTRL_HIGH_Z_15: { + type: 'array', + showName: 'HighZ', + componentType: 'input-button-toggle', + options: [ + { value: 0, label: 'On' }, + { value: 1, label: 'Off' }, + ], + range: ['On', 'Off'], + defaultValue: 1, + outputRawData: (val) => { + const highzArr = ['On', 'Off'] + return highzArr.indexOf(val.toString()) + }, + outputReadabilityData: (idx) => { + const highzArr = ['On', 'Off'] + return highzArr[parseInt(idx)] + }, + }, + CYCLE_NUMBER: { + type: 'number', + showName: 'Cycle', + componentType: 'input-range', + range: Object.freeze({ min: 1, max: 50000 }), + outputRawData: (val) => { + return parseInt(val) + }, + outputReadabilityData: (val) => { + return parseInt(val) + }, + defaultValue: 1, + defaultUnit: 'cycle', + downloadUnit: null, + unit: { + cycle: 1, + }, + }, + SAMPLE_RATE: { + type: 'number', + showName: 'Sample rate', + componentType: 'input-range', + range: Object.freeze({ min: 1, max: 1000 }), + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * 10) + }, + outputReadabilityData: (val, scale = 1) => { + return parseFloat(val) / 10 + }, + defaultValue: 1000, + defaultUnit: 'sps', + downloadUnit: 'sps', + unit: { + sps: 1, + }, + }, + GENERAL_HS_RTIA: { + type: 'array', + showName: 'Current range', + componentType: 'input-button-toggle', + options: [ + { value: 0, label: '1' }, + { value: 1, label: '2' }, + { value: 2, label: '3' }, + { value: 3, label: '4' }, + { value: 4, label: 'Auto' }, + ], + range: ['1', '2', '3', '4', 'Auto'], + defaultValue: 4, + outputRawData: (val) => { + const numArr = ['1', '2', '3', '4', 'Auto'] + return numArr.indexOf(val.toString()) + }, + outputReadabilityData: (idx) => { + const numArr = ['1', '2', '3', '4', 'Auto'] + return numArr[parseInt(idx)] + }, + }, + GENERAL_LP_RTIA: { + type: 'array', + showName: 'Current Range', + componentType: 'input-button-toggle', + options: [ + { value: 0, label: '<1.5 uA' }, + { value: 1, label: '1-60 uA' }, + { value: 2, label: '40-175 uA' }, + { value: 3, label: '>120 uA' }, + { value: 4, label: 'Auto' }, + ], + range: ['<1.5 uA', '1-60 uA', '40-175 uA', '>120 uA', 'Auto'], + defaultValue: 4, + outputRawData: (val) => { + const currentRangeArr = ['<1.5 uA', '1-60 uA', '40-175 uA', '>120 uA', 'Auto'] + return currentRangeArr.indexOf(val.toString()) + }, + outputReadabilityData: (idx) => { + const currentRangeArr = ['<1.5 uA', '1-60 uA', '40-175 uA', '>120 uA', 'Auto'] + return currentRangeArr[parseInt(idx)] + }, + }, + EIS_DC_BIAS: { + type: 'number', + showName: 'DC Volt', + componentType: 'input-field', + range: Object.freeze({ min: 2500, max: 50000 }), // UI上能輸入的最大最小值 + outputRawData: (val, scale = 1) => { + return Math.round(parseInt(val) * 12.5 * scale + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return Math.round(parseInt(val - 25000) / 12.5) / scale + }, + defaultValue: 25000, + defaultUnit: 'mV', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + }, + EIS_AC_AMP: { + type: 'number', + showName: 'AC Amp', + componentType: 'input-field', + range: Object.freeze({ min: 0, max: 2047 }), + outputRawData: (val, scale = 1) => { + return Math.round((parseInt(val * scale) / 800) * 2047) + }, + outputReadabilityData: (val, scale = 1) => { + return Math.round((parseInt(val) / 2047) * 800) / scale + }, + defaultValue: 25, + defaultUnit: 'mV', + downloadUnit: 'mV', + unit: { + mV: 1, + }, + }, + EIS_FREQ: { + type: 'array', + showName: 'Frequency', + componentType: 'multi-input-field', + range: Object.freeze({ min: 1, max: 13333333 }), + outputRawData: (val) => { + return parseFloat(val) < 0.1 ? Math.round(0.1 / 0.015) : Math.round(parseFloat(val) / 0.015) + }, + outputReadabilityData: (val) => { + return (parseFloat(val) * 0.015).toFixed(1) + }, + defaultValue: [13333333, 7], + defaultUnit: 'Hz', + downloadUnit: 'Hz', + unit: { + Hz: 1, + }, + }, + EIS_PPD: { + type: 'number', + showName: 'Points per decades', + componentType: 'input-field', + range: Object.freeze({ min: 1, max: 10 }), + outputRawData: (val) => { + return parseInt(val) + }, + outputReadabilityData: (val) => { + return parseInt(val) + }, + defaultValue: 10, + defaultUnit: 'points', + downloadUnit: null, + unit: { + points: 1, + }, + }, + EIS_SCALE: { + type: 'array', + showName: 'Point spacing', + componentType: 'input-button-toggle', + options: [ + { value: 0, label: 'Logarithm' }, + { value: 1, label: 'Linear' }, + ], + range: ['Logarithm', 'Linear'], + defaultValue: 0, + outputRawData: (val) => { + const scaleArr = ['Logarithm', 'Linear'] + return scaleArr.indexOf(val.toString()) + }, + outputReadabilityData: (idx) => { + const scaleArr = ['Logarithm', 'Linear'] + return scaleArr[parseInt(idx)] + }, + }, + EIS_DELAY: { + type: 'number', + showName: 'DELAY', + componentType: 'input-field', + range: Object.freeze({ min: 0, max: 100 }), + outputRawData: (val) => { + return parseInt(parseFloat(val) * 10) + }, + outputReadabilityData: (val) => { + return parseFloat(val / 10).toFixed(1) + }, + defaultValue: 0, + defaultUnit: 'points', + downloadUnit: null, + unit: { + points: 1, + }, + }, + EIS_AVERAGE_NUM: { + type: 'array', + showName: 'Average', + componentType: 'input-button-toggle', + options: [ + { value: 0, label: '2' }, + { value: 1, label: '4' }, + { value: 2, label: '6' }, + { value: 3, label: '8' }, + ], + range: ['2', '4', '6', '8'], + defaultValue: 0, + outputRawData: (val) => { + const numArr = ['2', '4', '6', '8'] + return numArr.indexOf(val.toString()) + }, + outputReadabilityData: (idx) => { + const numArr = ['2', '4', '6', '8'] + return numArr[parseInt(idx)] + }, + }, + CF_DC_BIAS: { + type: 'number', + showName: 'DC Volt', + componentType: 'input-field', + range: Object.freeze({ min: 2500, max: 50000 }), // UI上能輸入的最大最小值 + outputRawData: (val, scale = 1) => { + return Math.round(parseInt(val) * 12.5 * scale + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return Math.round(parseInt(val - 25000) / 12.5) / scale + }, + defaultValue: 25000, + defaultUnit: 'mV', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + }, + CF_AC_AMP: { + type: 'number', + showName: 'AC Amp', + componentType: 'input-field', + range: Object.freeze({ min: 0, max: 2047 }), + outputRawData: (val, scale = 1) => { + return Math.round((parseInt(val * scale) / 800) * 2047) + }, + outputReadabilityData: (val, scale = 1) => { + return Math.round((parseInt(val) / 2047) * 800) / scale + }, + defaultValue: 25, + defaultUnit: 'mV', + downloadUnit: 'mV', + unit: { + mV: 1, + }, + }, + CF_FREQ: { + type: 'number', + showName: 'Frequency', + componentType: 'input-field', + range: Object.freeze({ min: 1, max: 13333333 }), + outputRawData: (val) => { + return parseFloat(val) < 0.1 ? Math.round(0.1 / 0.015) : Math.round(parseFloat(val) / 0.015) + }, + outputReadabilityData: (val) => { + return (parseFloat(val) * 0.015).toFixed(1) + }, + defaultValue: 13333333, + defaultUnit: 'Hz', + downloadUnit: 'Hz', + unit: { + Hz: 1, + }, + }, + CF_PPD: { + type: 'number', + showName: 'Points per decades', + componentType: 'input-field', + range: Object.freeze({ min: 1, max: 10 }), + outputRawData: (val) => { + return parseInt(val) + }, + outputReadabilityData: (val) => { + return parseInt(val) + }, + defaultValue: 10, + defaultUnit: 'points', + downloadUnit: null, + unit: { + points: 1, + }, + }, + CF_SCALE: { + type: 'array', + showName: 'Point spacing', + componentType: 'input-button-toggle', + options: [ + { value: 0, label: 'Logarithm' }, + { value: 1, label: 'Linear' }, + ], + range: ['Logarithm', 'Linear'], + defaultValue: 0, + outputRawData: (val) => { + const scaleArr = ['Logarithm', 'Linear'] + return scaleArr.indexOf(val.toString()) + }, + outputReadabilityData: (idx) => { + const scaleArr = ['Logarithm', 'Linear'] + return scaleArr[parseInt(idx)] + }, + }, + CF_DELAY: { + type: 'number', + showName: 'DELAY', + componentType: 'input-field', + range: Object.freeze({ min: 0, max: 100 }), + outputRawData: (val) => { + return parseInt(parseFloat(val) * 10) + }, + outputReadabilityData: (val) => { + return parseFloat(val / 10).toFixed(1) + }, + defaultValue: 0, + defaultUnit: 'points', + downloadUnit: null, + unit: { + points: 1, + }, + }, + CF_AVERAGE_NUM: { + type: 'array', + showName: 'Average', + componentType: 'input-button-toggle', + options: [ + { value: 0, label: '2' }, + { value: 1, label: '4' }, + { value: 2, label: '6' }, + { value: 3, label: '8' }, + ], + range: ['2', '4', '6', '8'], + defaultValue: 3, + outputRawData: (val) => { + const numArr = ['2', '4', '6', '8'] + return numArr.indexOf(val.toString()) + }, + outputReadabilityData: (idx) => { + const numArr = ['2', '4', '6', '8'] + return numArr[parseInt(idx)] + }, + }, + CV_E_INITIAL: { + type: 'number', + showName: 'E-Initial', + componentType: 'input-range', + range: Object.freeze({ min: 2500, max: 50000 }), + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 12.5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 12.5) / scale + }, + defaultValue: 25000, + defaultUnit: 'V', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + }, + CV_E1: { + type: 'number', + showName: 'E1', + componentType: 'input-range', + range: Object.freeze({ min: 2500, max: 50000 }), + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 12.5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 12.5) / scale + }, + defaultValue: 25000, + defaultUnit: 'V', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + }, + CV_E2: { + type: 'number', + showName: 'E2', + componentType: 'input-range', + range: Object.freeze({ min: 2500, max: 50000 }), + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 12.5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 12.5) / scale + }, + defaultValue: 25000, + defaultUnit: 'V', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + }, + CV_SCAN_RATE: { + type: 'number', + showName: 'ScanRate', + componentType: 'input-range', + range: Object.freeze({ min: 1, max: 100000 }), + outputRawData: (val) => { + return parseInt(parseFloat(val) * 100) + }, + outputReadabilityData: (val) => { + return parseFloat(val) / 100 + }, + defaultValue: 10000, + defaultUnit: 'mV/s', + downloadUnit: 'mV/s', + unit: { + 'mV/s': 1, + }, + }, + CA_VOLT: { + type: 'number', + showName: 'Volt (v.s. ref)', + componentType: 'input-range', + range: Object.freeze({ min: 2500, max: 50000 }), + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 12.5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 12.5) / scale + }, + defaultValue: 25000, + defaultUnit: 'V', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + }, + VT_MEASURE_VIN_RANGE: { + type: 'array', + showName: 'Vin Range', + componentType: 'input-button-toggle', + options: [ + { value: 0, label: '0~2V' }, + { value: 1, label: '-1~1V' }, + { value: 2, label: '-2~0V' }, + { value: 3, label: 'Auto' }, + ], + range: ['1', '2', '3', 'Auto'], + defaultValue: 0, + outputRawData: (val) => { + const voltageInRangeArr = ['1', '2', '3', 'Auto'] + return voltageInRangeArr.indexOf(val.toString()) + }, + outputReadabilityData: (idx) => { + const voltageInRangeArr = ['1', '2', '3', 'Auto'] + return voltageInRangeArr[parseInt(idx)] + }, + }, + RT_VOLT_SET: { + type: 'number', + showName: 'Volt out', + componentType: 'input-range', + range: Object.freeze({ min: 2500, max: 50000 }), + defaultValue: 37500, + defaultUnit: 'V', + downloadUnit: 'mV', + unit: { + mV: 1, + V: 1e3, + }, + outputRawData: (val, scale = 1) => { + return parseInt(parseFloat(val) * scale * 12.5 + 25000) + }, + outputReadabilityData: (val, scale = 1) => { + return parseInt((parseFloat(val) - 25000) / 12.5) / scale + }, + }, + ADC_VALUE_I: { + type: 'none', + showName: 'Instruction', + componentType: 'dev-mode', + }, + + MODE_OPTIONS: [ + { + id: 7, + description: 'Idle', + }, + { + id: 0, + description: 'Potentiostatic Electrochemical Impedance Spectroscopy', + }, + { + id: 1, + description: 'CV', + }, + { + id: 2, + description: 'Chronoamperometry', + }, + { + id: 3, + description: 'VT', + }, + { + id: 4, + description: 'RT', + }, + { + id: 5, + description: 'Constant Frequency', + }, + { + id: 6, + description: 'Dev Tools', + }, + ], + MODE: { + 0: PotentiostaticEIS, + 1: CyclicVoltammetry, + 2: Chronoamperometry, + 3: VT, + 4: RT, + 5: ConstantFrequency, + 6: DevMode, + 7: Idle, + }, +} + +export default EliteEIS diff --git a/src/data/config-table/index.ts b/src/data/config-table/index.ts new file mode 100644 index 0000000..83cc190 --- /dev/null +++ b/src/data/config-table/index.ts @@ -0,0 +1,148 @@ +import EliteEDC from './EliteEDC/index' +import EliteEIS from './EliteEIS/index' + +// object saving library name mapping table +const libraryNameMappingTable = { + EDC: EliteEDC, + EliteZM15: EliteEDC, + 'Elite_EDC_1.4': null, + 'Elite_EDC_1.5': EliteEDC, + 'Elite_EDC_1.5re': EliteEDC, + 'Elite_EDC_1.5r2': EliteEDC, + 'Elite_BAT_1.0': EliteEDC, + EIS: EliteEIS, + 'Elite_EIS_1.0': EliteEIS, + 'Elite_EIS_1.1': EliteEIS, + 'Elite_EIS_MINI_1.0': EliteEIS, + 'Elite_TRIG_0.1': null, + 'Elite_MEGAFLY_0.1': null, +} + +// object saving serial number mapping table +const serialNumberMappingTable = { + 0: { + 2: { + 1: { + 5: null, // EDC1.4 + 6: EliteEDC, // EDC1.5 + 7: EliteEDC, // EDC1.5re + 8: EliteEDC, // EDC1.5r2 + }, + }, + 3: { + 1: { + 0: EliteEDC, // BAT1.0 + }, + }, + 4: { + 1: { + 0: EliteEIS, // EIS1.0 + 1: EliteEIS, // EIS1.1 + 2: EliteEIS, // EIS1.1mini + }, + }, + 5: { + 1: { + 0: null, // TRIG0.1 + }, + }, + 6: { + 1: { + 0: null, // MEAGFLY0.1 + }, + }, + }, +} + +/** + * return config table by library or serial number (type) + * @param {String | Object} type + * @returns {Object} : config + */ +function getConfig(type) { + if (type === undefined || type === null) return + // if (typeof type === 'number') { + // const deviceList = store.getters.getField('taskContent').deviceListNew + // if (deviceList === undefined) return + // const device = deviceList.find((ele) => ele.memory_board === type) + // if (device === undefined) return + // return libraryNameMappingTable[device.library_name] + // } + + // library name + if (typeof type === 'string') { + return libraryNameMappingTable[type] + } + // serial number + if (typeof type === 'object') { + return serialNumberMappingTable[type[0]][type[1]][type[2]][type[3]] + } +} + +/** + * return mode config table by type and mode + * @param {String | Object} type + * @param {Number} mode + * @returns {Object} : mode-config + */ +function getModeConfig(type, mode) { + return getConfig(type).MODE[mode] +} + +/** + * return parameter config table by type and parameter name + * @param {String | Object} type + * @param {String} parameterName + * @returns {Object} : parameter-config + */ +function getParameterConfig(deviceType, parameterName) { + return getConfig(deviceType)[parameterName] +} + +/** + * return channel config table by type and mode + * @param {String | Object} type + * @param {String} mode + * @param {String | Number} channel + * @returns {Object} : channel-config + */ +function getChannelConfig(type, mode, channel) { + if (channel === undefined) { + return getModeConfig(type, mode).channels + } + return getModeConfig(type, mode).channels[channel] +} + +/** + * return chart config table by type and mode and chartType + * @param {String | Object} type + * @param {String} mode + * @param {String} chartType + * @returns {Object} : chart-config + */ +function getChartConfig(type, mode, chartType = 'default') { + return getModeConfig(type, mode).charts[chartType] +} + +/** + * return mode's parameter list + * @param {String | Object} type + * @param {String} mode + * @returns {Object} : parameter list + */ +function getModeParameter(type, mode) { + return getModeConfig(type, mode).parameter +} + +const configTable = { + getConfig, + getModeConfig, + getChannelConfig, + getParameterConfig, + getChartConfig, + getModeParameter, + EliteEDC, + EliteEIS, +} + +export default configTable diff --git a/src/data/server-api/collection.ts b/src/data/server-api/collection.ts new file mode 100644 index 0000000..a0643a4 --- /dev/null +++ b/src/data/server-api/collection.ts @@ -0,0 +1,29 @@ +import { getAxios } from '@/data/axios' +import { AxiosResponse } from 'axios' + +const axios = getAxios() +const FOLDER_TYPE = 'folder' + +const getCollection = async function ( + parent: number, + offset: number, + limit: number, + order: Array, +): Promise> { + let url = `api/file/collection/get?type=${FOLDER_TYPE}&` + if (parent) url += `parent=${parent}&` + if (offset) url += `offset=${offset}&` + if (limit) url += `limit=${limit}&` + if (order) { + const _order = order?.join('-') + url += `order=${_order}` + } + const result = await axios.get(url) + return result +} + +const meta = { + getCollection, +} + +export default meta diff --git a/src/data/server-api/index.ts b/src/data/server-api/index.ts new file mode 100644 index 0000000..11a1e5b --- /dev/null +++ b/src/data/server-api/index.ts @@ -0,0 +1,11 @@ +import meta from './meta' +import collection from './collection' +import project from './project' + +const api = { + collection, + meta, + project, +} + +export default api diff --git a/src/data/server-api/meta.ts b/src/data/server-api/meta.ts new file mode 100644 index 0000000..5f056ce --- /dev/null +++ b/src/data/server-api/meta.ts @@ -0,0 +1,51 @@ +import { getAxios } from '@/data/axios' +import { AxiosResponse } from 'axios' + +const FOLDER_TYPE = 'folder' + +const axios = getAxios() + +const getMetaWithTypeFolder = async function ( + parent: number, + offset: number, + limit: number, + order: Array, +): Promise> { + let url = `api/file/meta/get?type=${FOLDER_TYPE}&` + if (parent) url += `parent=${parent}&` + if (offset) url += `offset=${offset}&` + if (limit) url += `limit=${limit}&` + if (order) { + const _order = order?.join('-') + url += `order=${_order}` + } + const result = await axios.get(url) + return result +} + +const getMetaByTime = async function (time: string): Promise> { + const url = `api/file/meta/get?time=${time}` + const result = await axios.get(url) + return result +} + +const getMetaGroupByTime = async function (): Promise> { + const url = `api/file/meta/get?group=time` + const result = await axios.get(url) + return result +} + +const getMetaByProject = async function (uuid: string): Promise> { + const url = `api/file/meta/get?type=project&project=${uuid}` + const result = await axios.get(url) + return result +} + +const meta = { + getMetaWithTypeFolder, + getMetaByTime, + getMetaByProject, + getMetaGroupByTime, +} + +export default meta diff --git a/src/data/server-api/project.ts b/src/data/server-api/project.ts new file mode 100644 index 0000000..06b73c2 --- /dev/null +++ b/src/data/server-api/project.ts @@ -0,0 +1,17 @@ +import { getAxios } from '@/data/axios' +import { AxiosResponse } from 'axios' + +const axios = getAxios() + +const getProjectGroup = async function (attrs?: Array): Promise> { + let url = `api/project/report/get?` + if (attrs) url += `attrs=${attrs.join('-')}` + const result = await axios.get(url) + return result +} + +const project = { + getProjectGroup, +} + +export default project diff --git a/src/main.ts b/src/main.ts index 732569f..52f079a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -26,20 +26,6 @@ import { BrushComponent, } from 'echarts/components' -// import { -// TitleComponentOption, -// LegendComponentOption, -// GridComponentOption, -// TooltipComponentOption, -// DataZoomComponentOption, -// MarkLineComponentOption, -// ToolboxComponentOption, -// BrushComponentOption, -// XAXisComponentOption, -// YAXisComponentOption, -// } from 'echarts' - -// use echarts necessary component use([ CanvasRenderer, LineChart, @@ -55,19 +41,7 @@ use([ MarkLineComponent, ]) -// // declare chart types -// declare global { -// type TitleOption = TitleComponentOption -// type LegendOption = LegendComponentOption -// type TooltipOption = TooltipComponentOption -// type GridOption = GridComponentOption -// type DataZoomOption = DataZoomComponentOption -// type MarkLineOption = MarkLineComponentOption -// type ToolboxOption = ToolboxComponentOption -// type BrushOption = BrushComponentOption -// type XAXisOption = XAXisComponentOption -// type YAXisOption = YAXisComponentOption -// } +import serverApi from '@/data/server-api' const app = createApp(App) @@ -78,6 +52,8 @@ app.use(createVuestic({ config: vuesticGlobalConfig })) app.component('EChart', ECharts) +app.provide('server-api', serverApi) + if (import.meta.env.VITE_APP_GTM_ENABLED) { app.use( createGtm({ diff --git a/src/pages/admin/data-analysis/DataAnalysis.vue b/src/pages/admin/data-analysis/DataAnalysis.vue index 5089060..23c878c 100644 --- a/src/pages/admin/data-analysis/DataAnalysis.vue +++ b/src/pages/admin/data-analysis/DataAnalysis.vue @@ -1,83 +1,71 @@ - diff --git a/src/stores/counter.ts b/src/stores/counter.ts new file mode 100644 index 0000000..4459247 --- /dev/null +++ b/src/stores/counter.ts @@ -0,0 +1,14 @@ +import { defineStore } from 'pinia' + +export const useCounterStore = defineStore('counter', { + state: () => { + return { count: 0 } + }, + // could also be defined as + // state: () => ({ count: 0 }) + actions: { + increment() { + this.count++ + }, + }, +}) diff --git a/src/stores/data-analysis/channel.ts b/src/stores/data-analysis/channel.ts new file mode 100644 index 0000000..6622a4e --- /dev/null +++ b/src/stores/data-analysis/channel.ts @@ -0,0 +1,10 @@ +import { defineStore } from 'pinia' + +export const useChannelStore = defineStore('data-analysis-channel', { + state: () => ({ + xAxis: {}, + yAxis: {}, + }), + getters: {}, + actions: {}, +}) diff --git a/src/stores/data-analysis/chart.ts b/src/stores/data-analysis/chart.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/stores/data-analysis/file-view.ts b/src/stores/data-analysis/file-view.ts new file mode 100644 index 0000000..127d551 --- /dev/null +++ b/src/stores/data-analysis/file-view.ts @@ -0,0 +1,22 @@ +import { defineStore } from 'pinia' +import { FileView } from '@/utils/file' + +interface FileViewState { + fileView: FileView + filesSelected: (string | never)[] +} + +export const useFileViewStore = defineStore('data-analysis-file-view', { + state: (): FileViewState => ({ + fileView: new FileView(), + filesSelected: [], + }), + // could also be defined as + // state: () => ({ count: 0 }) + getters: {}, + actions: { + setFilesSelect(fileSelect: string[]) { + this.filesSelected.push(...fileSelect) + }, + }, +}) diff --git a/src/utils/collection.d.ts b/src/utils/collection.d.ts new file mode 100644 index 0000000..43a1d9b --- /dev/null +++ b/src/utils/collection.d.ts @@ -0,0 +1,12 @@ +interface collection { + id: number + name: string + parent: object + controller_id: number + size: number + type: string + description: string + deleted: bool +} + +export { collection } diff --git a/src/utils/file.ts b/src/utils/file.ts new file mode 100644 index 0000000..c16c194 --- /dev/null +++ b/src/utils/file.ts @@ -0,0 +1,393 @@ +import api from '@/data/server-api' + +declare type FolderType = { + file: number + collection: number +} + +class FileView { + children: Array + viewBy: string + offset: number + limit: number + + constructor() { + this.children = [] + this.viewBy = 'time' + this.offset = 0 + this.limit = 20 + } + + init() { + this.children.length = 0 + this.offset = 0 + this.limit = 20 + } + + reset() { + this.children.length = 0 + this.offset = 0 + this.limit = 20 + } + + changeView(viewBy: string) { + this.reset() + this.viewBy = viewBy + } + + async appendChildren(id: number) { + if (this.viewBy === 'folder') { + // append children folder + const folderResult = await this.getCollectionsFromServer(id) + for (const _data of folderResult.rows) { + const folder = new Folder(_data.id, _data.name) + // console.log('folder', folder) + await folder.init() + this.children.push(folder) + } + } else if (this.viewBy == 'time') { + const timeGroup = await this.getTimeGroupFromServer() + for (const time in timeGroup) { + const timeInstance = new Time(time, timeGroup[time]?.date) + await timeInstance.appendChildren() + this.children.push(timeInstance) + } + } else if (this.viewBy == 'project') { + const projectGroup = await this.getProjectGroupFromServer(['id', 'name', 'uuid', 'created_at']) + for (const project of projectGroup) { + const projectInstance = new Project(project.id, project.name, project.uuid, project.created_at) + await projectInstance.appendChildren() + this.children.push(projectInstance) + } + } + // console.log('children', this.children) + } + + async getCollectionsFromServer(id: number, order: string[] = ['id', 'desc']) { + const result = await api.collection.getCollection(id, this.offset, this.limit, order) + return result.data + } + + async getFilesByIdFromServer(id: number, order: string[] = ['id', 'desc']) { + const result = await api.meta.getMetaWithTypeFolder(id, this.offset, this.limit, order) + return result.data + } + + async getTimeGroupFromServer() { + const result = await api.meta.getMetaGroupByTime() + return result.data + } + + async getProjectGroupFromServer(attrs: string[]) { + const result = await api.project.getProjectGroup(attrs) + return result.data + } + + getChildren() { + return this.children + } + + getMetaFile(idType: string) { + for (const child of this.children) { + if (!(child instanceof MetaFile)) { + const result = child.getMetaFile(idType) + if (result) return result + } + } + } +} + +class Time { + id: string + type: string + idType: string + name: string + children: Array